Ticket #1001611: Adjust Payment Processor Options for Tenant

This commit is contained in:
Elaine Tan 2012-11-16 17:40:17 +08:00
parent baa32c9952
commit bec8fac40c
18 changed files with 7062 additions and 380 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
package org.compiere.model;
import java.util.Properties;
import org.compiere.util.Env;
/**
*
* @author Elaine
*
*/
public class CalloutBankAcctProcessor extends CalloutEngine
{
/**
* Payment Processor Changed
* @param ctx
* @param WindowNo
* @param mTab
* @param mField
* @param value
* @return null or error message
*/
public String paymentProcessor(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer C_PaymentProcessor_ID = (Integer)value;
if (C_PaymentProcessor_ID == null || C_PaymentProcessor_ID.intValue() == 0)
return "";
MPaymentProcessor pp = new MPaymentProcessor(ctx, C_PaymentProcessor_ID, null);
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptMC, pp.isAcceptMC());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptVisa, pp.isAcceptVisa());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptAMEX, pp.isAcceptAMEX());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptDiners, pp.isAcceptDiners());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptCorporate, pp.isAcceptCorporate());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptDiscover, pp.isAcceptDiscover());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptDirectDeposit, pp.isAcceptDirectDeposit());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptDirectDebit, pp.isAcceptDirectDebit());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptCheck, pp.isAcceptCheck());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_AcceptATM, pp.isAcceptATM());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_MinimumAmt, pp.getMinimumAmt());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_C_Currency_ID, pp.getC_Currency_ID());
mTab.setValue(MBankAccountProcessor.COLUMNNAME_RequireVV, pp.isRequireVV());
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptMC, pp.isAcceptMC() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptVisa, pp.isAcceptVisa() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptAMEX, pp.isAcceptAMEX() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptDiners, pp.isAcceptDiners() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptCorporate, pp.isAcceptCorporate() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptDiscover, pp.isAcceptDiscover() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptDirectDeposit, pp.isAcceptDirectDeposit() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptDirectDebit, pp.isAcceptDirectDebit() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptCheck, pp.isAcceptCheck() ? "Y" : "N");
Env.setContext(ctx, WindowNo, mTab.getTabNo(), MBankAccountProcessor.COLUMNNAME_IsPPAcceptATM, pp.isAcceptATM() ? "Y" : "N");
return null;
}
}

View File

@ -24,6 +24,7 @@ import java.net.URL;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor; import org.compiere.model.MPaymentProcessor;
import org.compiere.model.ModelValidator; import org.compiere.model.ModelValidator;
import org.compiere.model.PaymentInterface; import org.compiere.model.PaymentInterface;
@ -94,17 +95,18 @@ public class Core {
/** /**
* Get payment processor instance * Get payment processor instance
* @param mpp payment processor model * @param mbap payment processor model
* @param mp payment model * @param mp payment model
* @return initialized PaymentProcessor or null * @return initialized PaymentProcessor or null
*/ */
public static PaymentProcessor getPaymentProcessor(MPaymentProcessor mpp, PaymentInterface mp) { public static PaymentProcessor getPaymentProcessor(MBankAccountProcessor mbap, PaymentInterface mp) {
if (s_log.isLoggable(Level.FINE)) if (s_log.isLoggable(Level.FINE))
s_log.fine("create for " + mpp); s_log.fine("create for " + mbap);
MPaymentProcessor mpp = new MPaymentProcessor(mbap.getCtx(), mbap.getC_PaymentProcessor_ID(), mbap.get_TrxName());
String className = mpp.getPayProcessorClass(); String className = mpp.getPayProcessorClass();
if (className == null || className.length() == 0) { if (className == null || className.length() == 0) {
s_log.log(Level.SEVERE, "No PaymentProcessor class name in " + mpp); s_log.log(Level.SEVERE, "No PaymentProcessor class name in " + mbap);
return null; return null;
} }
// //
@ -130,7 +132,7 @@ public class Core {
} }
// Initialize // Initialize
myProcessor.initialize(mpp, mp); myProcessor.initialize(mbap, mp);
// //
return myProcessor; return myProcessor;
} }

View File

@ -41,6 +41,136 @@ public interface I_C_BankAccount_Processor
/** Load Meta Data */ /** Load Meta Data */
/** Column name AcceptAMEX */
public static final String COLUMNNAME_AcceptAMEX = "AcceptAMEX";
/** Set Accept AMEX.
* Accept American Express Card
*/
public void setAcceptAMEX (boolean AcceptAMEX);
/** Get Accept AMEX.
* Accept American Express Card
*/
public boolean isAcceptAMEX();
/** Column name AcceptATM */
public static final String COLUMNNAME_AcceptATM = "AcceptATM";
/** Set Accept ATM.
* Accept Bank ATM Card
*/
public void setAcceptATM (boolean AcceptATM);
/** Get Accept ATM.
* Accept Bank ATM Card
*/
public boolean isAcceptATM();
/** Column name AcceptCheck */
public static final String COLUMNNAME_AcceptCheck = "AcceptCheck";
/** Set Accept Electronic Check.
* Accept ECheck (Electronic Checks)
*/
public void setAcceptCheck (boolean AcceptCheck);
/** Get Accept Electronic Check.
* Accept ECheck (Electronic Checks)
*/
public boolean isAcceptCheck();
/** Column name AcceptCorporate */
public static final String COLUMNNAME_AcceptCorporate = "AcceptCorporate";
/** Set Accept Corporate.
* Accept Corporate Purchase Cards
*/
public void setAcceptCorporate (boolean AcceptCorporate);
/** Get Accept Corporate.
* Accept Corporate Purchase Cards
*/
public boolean isAcceptCorporate();
/** Column name AcceptDiners */
public static final String COLUMNNAME_AcceptDiners = "AcceptDiners";
/** Set Accept Diners.
* Accept Diner's Club
*/
public void setAcceptDiners (boolean AcceptDiners);
/** Get Accept Diners.
* Accept Diner's Club
*/
public boolean isAcceptDiners();
/** Column name AcceptDirectDebit */
public static final String COLUMNNAME_AcceptDirectDebit = "AcceptDirectDebit";
/** Set Accept Direct Debit.
* Accept Direct Debits (vendor initiated)
*/
public void setAcceptDirectDebit (boolean AcceptDirectDebit);
/** Get Accept Direct Debit.
* Accept Direct Debits (vendor initiated)
*/
public boolean isAcceptDirectDebit();
/** Column name AcceptDirectDeposit */
public static final String COLUMNNAME_AcceptDirectDeposit = "AcceptDirectDeposit";
/** Set Accept Direct Deposit.
* Accept Direct Deposit (payee initiated)
*/
public void setAcceptDirectDeposit (boolean AcceptDirectDeposit);
/** Get Accept Direct Deposit.
* Accept Direct Deposit (payee initiated)
*/
public boolean isAcceptDirectDeposit();
/** Column name AcceptDiscover */
public static final String COLUMNNAME_AcceptDiscover = "AcceptDiscover";
/** Set Accept Discover.
* Accept Discover Card
*/
public void setAcceptDiscover (boolean AcceptDiscover);
/** Get Accept Discover.
* Accept Discover Card
*/
public boolean isAcceptDiscover();
/** Column name AcceptMC */
public static final String COLUMNNAME_AcceptMC = "AcceptMC";
/** Set Accept MasterCard.
* Accept Master Card
*/
public void setAcceptMC (boolean AcceptMC);
/** Get Accept MasterCard.
* Accept Master Card
*/
public boolean isAcceptMC();
/** Column name AcceptVisa */
public static final String COLUMNNAME_AcceptVisa = "AcceptVisa";
/** Set Accept Visa.
* Accept Visa Cards
*/
public void setAcceptVisa (boolean AcceptVisa);
/** Get Accept Visa.
* Accept Visa Cards
*/
public boolean isAcceptVisa();
/** Column name AD_Client_ID */ /** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID"; public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
@ -86,6 +216,21 @@ public interface I_C_BankAccount_Processor
/** Get C_BankAccount_Processor_UU */ /** Get C_BankAccount_Processor_UU */
public String getC_BankAccount_Processor_UU(); public String getC_BankAccount_Processor_UU();
/** Column name C_Currency_ID */
public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID";
/** Set Currency.
* The Currency for this record
*/
public void setC_Currency_ID (int C_Currency_ID);
/** Get Currency.
* The Currency for this record
*/
public int getC_Currency_ID();
public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException;
/** Column name C_PaymentProcessor_ID */ /** Column name C_PaymentProcessor_ID */
public static final String COLUMNNAME_C_PaymentProcessor_ID = "C_PaymentProcessor_ID"; public static final String COLUMNNAME_C_PaymentProcessor_ID = "C_PaymentProcessor_ID";
@ -130,6 +275,148 @@ public interface I_C_BankAccount_Processor
*/ */
public boolean isActive(); public boolean isActive();
/** Column name IsPPAcceptAMEX */
public static final String COLUMNNAME_IsPPAcceptAMEX = "IsPPAcceptAMEX";
/** Set Accept AMEX */
public void setIsPPAcceptAMEX (boolean IsPPAcceptAMEX);
/** Get Accept AMEX */
public boolean isPPAcceptAMEX();
/** Column name IsPPAcceptATM */
public static final String COLUMNNAME_IsPPAcceptATM = "IsPPAcceptATM";
/** Set Accept ATM */
public void setIsPPAcceptATM (boolean IsPPAcceptATM);
/** Get Accept ATM */
public boolean isPPAcceptATM();
/** Column name IsPPAcceptCheck */
public static final String COLUMNNAME_IsPPAcceptCheck = "IsPPAcceptCheck";
/** Set Accept Check */
public void setIsPPAcceptCheck (boolean IsPPAcceptCheck);
/** Get Accept Check */
public boolean isPPAcceptCheck();
/** Column name IsPPAcceptCorporate */
public static final String COLUMNNAME_IsPPAcceptCorporate = "IsPPAcceptCorporate";
/** Set Accept Corporate */
public void setIsPPAcceptCorporate (boolean IsPPAcceptCorporate);
/** Get Accept Corporate */
public boolean isPPAcceptCorporate();
/** Column name IsPPAcceptDiners */
public static final String COLUMNNAME_IsPPAcceptDiners = "IsPPAcceptDiners";
/** Set Accept Diners */
public void setIsPPAcceptDiners (boolean IsPPAcceptDiners);
/** Get Accept Diners */
public boolean isPPAcceptDiners();
/** Column name IsPPAcceptDirectDebit */
public static final String COLUMNNAME_IsPPAcceptDirectDebit = "IsPPAcceptDirectDebit";
/** Set Accept Direct Debit */
public void setIsPPAcceptDirectDebit (boolean IsPPAcceptDirectDebit);
/** Get Accept Direct Debit */
public boolean isPPAcceptDirectDebit();
/** Column name IsPPAcceptDirectDeposit */
public static final String COLUMNNAME_IsPPAcceptDirectDeposit = "IsPPAcceptDirectDeposit";
/** Set Accept Direct Deposit */
public void setIsPPAcceptDirectDeposit (boolean IsPPAcceptDirectDeposit);
/** Get Accept Direct Deposit */
public boolean isPPAcceptDirectDeposit();
/** Column name IsPPAcceptDiscover */
public static final String COLUMNNAME_IsPPAcceptDiscover = "IsPPAcceptDiscover";
/** Set Accept Discover */
public void setIsPPAcceptDiscover (boolean IsPPAcceptDiscover);
/** Get Accept Discover */
public boolean isPPAcceptDiscover();
/** Column name IsPPAcceptMC */
public static final String COLUMNNAME_IsPPAcceptMC = "IsPPAcceptMC";
/** Set Accept MasterCard */
public void setIsPPAcceptMC (boolean IsPPAcceptMC);
/** Get Accept MasterCard */
public boolean isPPAcceptMC();
/** Column name IsPPAcceptVisa */
public static final String COLUMNNAME_IsPPAcceptVisa = "IsPPAcceptVisa";
/** Set Accept Visa */
public void setIsPPAcceptVisa (boolean IsPPAcceptVisa);
/** Get Accept Visa */
public boolean isPPAcceptVisa();
/** Column name MinimumAmt */
public static final String COLUMNNAME_MinimumAmt = "MinimumAmt";
/** Set Minimum Amt.
* Minimum Amount in Document Currency
*/
public void setMinimumAmt (BigDecimal MinimumAmt);
/** Get Minimum Amt.
* Minimum Amount in Document Currency
*/
public BigDecimal getMinimumAmt();
/** Column name PartnerID */
public static final String COLUMNNAME_PartnerID = "PartnerID";
/** Set Partner ID.
* Partner ID or Account for the Payment Processor
*/
public void setPartnerID (String PartnerID);
/** Get Partner ID.
* Partner ID or Account for the Payment Processor
*/
public String getPartnerID();
/** Column name Password */
public static final String COLUMNNAME_Password = "Password";
/** Set Password.
* Password of any length (case sensitive)
*/
public void setPassword (String Password);
/** Get Password.
* Password of any length (case sensitive)
*/
public String getPassword();
/** Column name RequireVV */
public static final String COLUMNNAME_RequireVV = "RequireVV";
/** Set Require CreditCard Verification Code.
* Require 3/4 digit Credit Verification Code
*/
public void setRequireVV (boolean RequireVV);
/** Get Require CreditCard Verification Code.
* Require 3/4 digit Credit Verification Code
*/
public boolean isRequireVV();
/** Column name Updated */ /** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated"; public static final String COLUMNNAME_Updated = "Updated";
@ -145,4 +432,30 @@ public interface I_C_BankAccount_Processor
* User who updated this records * User who updated this records
*/ */
public int getUpdatedBy(); public int getUpdatedBy();
/** Column name UserID */
public static final String COLUMNNAME_UserID = "UserID";
/** Set User ID.
* User ID or account number
*/
public void setUserID (String UserID);
/** Get User ID.
* User ID or account number
*/
public String getUserID();
/** Column name VendorID */
public static final String COLUMNNAME_VendorID = "VendorID";
/** Set Vendor ID.
* Vendor ID for the Payment Processor
*/
public void setVendorID (String VendorID);
/** Get Vendor ID.
* Vendor ID for the Payment Processor
*/
public String getVendorID();
} }

View File

@ -237,6 +237,28 @@ public interface I_C_PaymentProcessor
public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException; public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException;
/** Column name C_PaymentProcessor_ID */
public static final String COLUMNNAME_C_PaymentProcessor_ID = "C_PaymentProcessor_ID";
/** Set Payment Processor.
* Payment processor for electronic payments
*/
public void setC_PaymentProcessor_ID (int C_PaymentProcessor_ID);
/** Get Payment Processor.
* Payment processor for electronic payments
*/
public int getC_PaymentProcessor_ID();
/** Column name C_PaymentProcessor_UU */
public static final String COLUMNNAME_C_PaymentProcessor_UU = "C_PaymentProcessor_UU";
/** Set C_PaymentProcessor_UU */
public void setC_PaymentProcessor_UU (String C_PaymentProcessor_UU);
/** Get C_PaymentProcessor_UU */
public String getC_PaymentProcessor_UU();
/** Column name Commission */ /** Column name Commission */
public static final String COLUMNNAME_Commission = "Commission"; public static final String COLUMNNAME_Commission = "Commission";
@ -263,28 +285,6 @@ public interface I_C_PaymentProcessor
*/ */
public BigDecimal getCostPerTrx(); public BigDecimal getCostPerTrx();
/** Column name C_PaymentProcessor_ID */
public static final String COLUMNNAME_C_PaymentProcessor_ID = "C_PaymentProcessor_ID";
/** Set Payment Processor.
* Payment processor for electronic payments
*/
public void setC_PaymentProcessor_ID (int C_PaymentProcessor_ID);
/** Get Payment Processor.
* Payment processor for electronic payments
*/
public int getC_PaymentProcessor_ID();
/** Column name C_PaymentProcessor_UU */
public static final String COLUMNNAME_C_PaymentProcessor_UU = "C_PaymentProcessor_UU";
/** Set C_PaymentProcessor_UU */
public void setC_PaymentProcessor_UU (String C_PaymentProcessor_UU);
/** Get C_PaymentProcessor_UU */
public String getC_PaymentProcessor_UU();
/** Column name Created */ /** Column name Created */
public static final String COLUMNNAME_Created = "Created"; public static final String COLUMNNAME_Created = "Created";
@ -379,32 +379,6 @@ public interface I_C_PaymentProcessor
*/ */
public String getName(); public String getName();
/** Column name PartnerID */
public static final String COLUMNNAME_PartnerID = "PartnerID";
/** Set Partner ID.
* Partner ID or Account for the Payment Processor
*/
public void setPartnerID (String PartnerID);
/** Get Partner ID.
* Partner ID or Account for the Payment Processor
*/
public String getPartnerID();
/** Column name Password */
public static final String COLUMNNAME_Password = "Password";
/** Set Password.
* Password of any length (case sensitive)
*/
public void setPassword (String Password);
/** Get Password.
* Password of any length (case sensitive)
*/
public String getPassword();
/** Column name PayProcessorClass */ /** Column name PayProcessorClass */
public static final String COLUMNNAME_PayProcessorClass = "PayProcessorClass"; public static final String COLUMNNAME_PayProcessorClass = "PayProcessorClass";
@ -511,30 +485,4 @@ public interface I_C_PaymentProcessor
* User who updated this records * User who updated this records
*/ */
public int getUpdatedBy(); public int getUpdatedBy();
/** Column name UserID */
public static final String COLUMNNAME_UserID = "UserID";
/** Set User ID.
* User ID or account number
*/
public void setUserID (String UserID);
/** Get User ID.
* User ID or account number
*/
public String getUserID();
/** Column name VendorID */
public static final String COLUMNNAME_VendorID = "VendorID";
/** Set Vendor ID.
* Vendor ID for the Payment Processor
*/
public void setVendorID (String VendorID);
/** Get Vendor ID.
* Vendor ID for the Payment Processor
*/
public String getVendorID();
} }

View File

@ -14,8 +14,16 @@
package org.compiere.model; package org.compiere.model;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
/** /**
* Bank Account Payment Processor * Bank Account Payment Processor
@ -29,6 +37,92 @@ public class MBankAccountProcessor extends X_C_BankAccount_Processor {
*/ */
private static final long serialVersionUID = -9082774421123292838L; private static final long serialVersionUID = -9082774421123292838L;
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MBankAccountProcessor.class);
public static MBankAccountProcessor[] find (Properties ctx,
String tender, String CCType,
int AD_Client_ID, int AD_Org_ID, int C_Currency_ID, BigDecimal Amt, String trxName)
{
return find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Amt, trxName);
}
/**
* Get Bank Account Processor
* @param ctx context
* @param tender optional Tender see TENDER_
* @param CCType optional CC Type see CC_
* @param AD_Client_ID Client
* @param C_Currency_ID Currency (ignored)
* @param Amt Amount (ignored)
* @param trxName transaction
* @return Array of BankAccount[0] & PaymentProcessor[1] or null
*/
public static MBankAccountProcessor[] find (Properties ctx,
String tender, String CCType,
int AD_Client_ID, int C_Currency_ID, BigDecimal Amt, String trxName)
{
ArrayList<MBankAccountProcessor> list = new ArrayList<MBankAccountProcessor>();
StringBuffer sql = new StringBuffer("SELECT bap.* "
+ "FROM C_BankAccount_Processor bap, C_PaymentProcessor pp, C_BankAccount ba "
+ "WHERE pp.C_PaymentProcessor_ID = bap.C_PaymentProcessor_ID"
+ " AND ba.C_BankAccount_ID = bap.C_BankAccount_ID"
+ " AND ba.AD_Client_ID=? AND pp.IsActive='Y'" // #1
+ " AND ba.IsActive='Y' AND bap.IsActive='Y' "
+ " AND (bap.C_Currency_ID IS NULL OR bap.C_Currency_ID=?)" // #2
+ " AND (bap.MinimumAmt IS NULL OR bap.MinimumAmt = 0 OR bap.MinimumAmt <= ?)"); // #3
if (MPayment.TENDERTYPE_DirectDeposit.equals(tender))
sql.append(" AND bap.AcceptDirectDeposit='Y'");
else if (MPayment.TENDERTYPE_DirectDebit.equals(tender))
sql.append(" AND bap.AcceptDirectDebit='Y'");
else if (MPayment.TENDERTYPE_Check.equals(tender))
sql.append(" AND bap.AcceptCheck='Y'");
// CreditCards
else if (MPayment.CREDITCARDTYPE_ATM.equals(CCType))
sql.append(" AND bap.AcceptATM='Y'");
else if (MPayment.CREDITCARDTYPE_Amex.equals(CCType))
sql.append(" AND bap.AcceptAMEX='Y'");
else if (MPayment.CREDITCARDTYPE_Visa.equals(CCType))
sql.append(" AND bap.AcceptVISA='Y'");
else if (MPayment.CREDITCARDTYPE_MasterCard.equals(CCType))
sql.append(" AND bap.AcceptMC='Y'");
else if (MPayment.CREDITCARDTYPE_Diners.equals(CCType))
sql.append(" AND bap.AcceptDiners='Y'");
else if (MPayment.CREDITCARDTYPE_Discover.equals(CCType))
sql.append(" AND bap.AcceptDiscover='Y'");
else if (MPayment.CREDITCARDTYPE_PurchaseCard.equals(CCType))
sql.append(" AND bap.AcceptCORPORATE='Y'");
sql.append(" ORDER BY ba.IsDefault DESC ");
//
try
{
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), trxName);
pstmt.setInt(1, AD_Client_ID);
pstmt.setInt(2, C_Currency_ID);
pstmt.setBigDecimal(3, Amt);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MBankAccountProcessor (ctx, rs, trxName));
rs.close();
pstmt.close();
}
catch (SQLException e)
{
s_log.log(Level.SEVERE, "find - " + sql, e);
return null;
}
//
if (list.size() == 0)
s_log.warning("find - not found - AD_Client_ID=" + AD_Client_ID
+ ", C_Currency_ID=" + C_Currency_ID + ", Amt=" + Amt);
else
s_log.fine("find - #" + list.size() + " - AD_Client_ID=" + AD_Client_ID
+ ", C_Currency_ID=" + C_Currency_ID + ", Amt=" + Amt);
MBankAccountProcessor[] retValue = new MBankAccountProcessor[list.size()];
list.toArray(retValue);
return retValue;
} // find
public static MBankAccountProcessor get(Properties ctx, int C_BankAccount_ID, int C_PaymentProcessor_ID, String trxName) public static MBankAccountProcessor get(Properties ctx, int C_BankAccount_ID, int C_PaymentProcessor_ID, String trxName)
{ {
final String whereClause = MBankAccountProcessor.COLUMNNAME_C_BankAccount_ID + "=? AND " + MBankAccountProcessor.COLUMNNAME_C_PaymentProcessor_ID + "=?"; final String whereClause = MBankAccountProcessor.COLUMNNAME_C_BankAccount_ID + "=? AND " + MBankAccountProcessor.COLUMNNAME_C_PaymentProcessor_ID + "=?";
@ -57,6 +151,29 @@ public class MBankAccountProcessor extends X_C_BankAccount_Processor {
setC_PaymentProcessor_ID(C_PaymentProcessor_ID); // FK setC_PaymentProcessor_ID(C_PaymentProcessor_ID); // FK
} }
/**
* Does Payment Processor accepts tender / CC
* @param TenderType tender type
* @param CreditCardType credit card type
* @return true if acceptes
*/
public boolean accepts (String TenderType, String CreditCardType)
{
if ((MPayment.TENDERTYPE_DirectDeposit.equals(TenderType) && isAcceptDirectDeposit())
|| (MPayment.TENDERTYPE_DirectDebit.equals(TenderType) && isAcceptDirectDebit())
|| (MPayment.TENDERTYPE_Check.equals(TenderType) && isAcceptCheck())
//
|| (MPayment.CREDITCARDTYPE_ATM.equals(CreditCardType) && isAcceptATM())
|| (MPayment.CREDITCARDTYPE_Amex.equals(CreditCardType) && isAcceptAMEX())
|| (MPayment.CREDITCARDTYPE_PurchaseCard.equals(CreditCardType) && isAcceptCorporate())
|| (MPayment.CREDITCARDTYPE_Diners.equals(CreditCardType) && isAcceptDiners())
|| (MPayment.CREDITCARDTYPE_Discover.equals(CreditCardType) && isAcceptDiscover())
|| (MPayment.CREDITCARDTYPE_MasterCard.equals(CreditCardType) && isAcceptMC())
|| (MPayment.CREDITCARDTYPE_Visa.equals(CreditCardType) && isAcceptVisa()))
return true;
return false;
} // accepts
public String toString() public String toString()
{ {
StringBuilder sb = new StringBuilder("MBankAccountProcessor[") StringBuilder sb = new StringBuilder("MBankAccountProcessor[")
@ -65,4 +182,40 @@ public class MBankAccountProcessor extends X_C_BankAccount_Processor {
.append("]"); .append("]");
return sb.toString (); return sb.toString ();
} }
public String getHostAddress()
{
MPaymentProcessor pp = new MPaymentProcessor(getCtx(), getC_PaymentProcessor_ID(), get_TrxName());
return pp.getHostAddress();
}
public int getHostPort()
{
MPaymentProcessor pp = new MPaymentProcessor(getCtx(), getC_PaymentProcessor_ID(), get_TrxName());
return pp.getHostPort();
}
public String getProxyAddress()
{
MPaymentProcessor pp = new MPaymentProcessor(getCtx(), getC_PaymentProcessor_ID(), get_TrxName());
return pp.getProxyAddress();
}
public int getProxyPort()
{
MPaymentProcessor pp = new MPaymentProcessor(getCtx(), getC_PaymentProcessor_ID(), get_TrxName());
return pp.getProxyPort();
}
public String getProxyLogon()
{
MPaymentProcessor pp = new MPaymentProcessor(getCtx(), getC_PaymentProcessor_ID(), get_TrxName());
return pp.getProxyLogon();
}
public String getProxyPassword()
{
MPaymentProcessor pp = new MPaymentProcessor(getCtx(), getC_PaymentProcessor_ID(), get_TrxName());
return pp.getProxyPassword();
}
} }

View File

@ -500,8 +500,7 @@ public final class MPayment extends X_C_Payment
try try
{ {
MPaymentProcessor paymentProcessor = new MPaymentProcessor(m_mBankAccountProcessor.getCtx(), m_mBankAccountProcessor.getC_PaymentProcessor_ID(), m_mBankAccountProcessor.get_TrxName()); PaymentProcessor pp = PaymentProcessor.create(m_mBankAccountProcessor, this);
PaymentProcessor pp = PaymentProcessor.create(paymentProcessor, this);
if (pp == null) if (pp == null)
setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNoProcessor")); setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNoProcessor"));
else else
@ -897,11 +896,11 @@ public final class MPayment extends X_C_Payment
m_mBankAccountProcessor = null; m_mBankAccountProcessor = null;
// Get Processor List // Get Processor List
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find (getCtx(), tender, CCType, getAD_Client_ID(), m_mBankAccountProcessors = MBankAccountProcessor.find(getCtx(), tender, CCType, getAD_Client_ID(),
getC_Currency_ID(), getPayAmt(), get_TrxName()); getC_Currency_ID(), getPayAmt(), get_TrxName());
// Relax Amount // Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find (getCtx(), tender, CCType, getAD_Client_ID(), m_mBankAccountProcessors = MBankAccountProcessor.find(getCtx(), tender, CCType, getAD_Client_ID(),
getC_Currency_ID(), Env.ZERO, get_TrxName()); getC_Currency_ID(), Env.ZERO, get_TrxName());
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return false; return false;
@ -910,8 +909,7 @@ public final class MPayment extends X_C_Payment
for (int i = 0; i < m_mBankAccountProcessors.length; i++) for (int i = 0; i < m_mBankAccountProcessors.length; i++)
{ {
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i]; MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
MPaymentProcessor paymentProcessor = new MPaymentProcessor(bankAccountProcessor.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), bankAccountProcessor.get_TrxName()); if (bankAccountProcessor.accepts(tender, CCType))
if (paymentProcessor.accepts (tender, CCType))
{ {
m_mBankAccountProcessor = m_mBankAccountProcessors[i]; m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break; break;
@ -947,25 +945,24 @@ public final class MPayment extends X_C_Payment
try try
{ {
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find (getCtx (), null, null, m_mBankAccountProcessors = MBankAccountProcessor.find(getCtx (), null, null,
getAD_Client_ID (), getC_Currency_ID (), amt, get_TrxName()); getAD_Client_ID (), getC_Currency_ID (), amt, get_TrxName());
// //
HashMap<String,ValueNamePair> map = new HashMap<String,ValueNamePair>(); // to eliminate duplicates HashMap<String,ValueNamePair> map = new HashMap<String,ValueNamePair>(); // to eliminate duplicates
for (int i = 0; i < m_mBankAccountProcessors.length; i++) for (int i = 0; i < m_mBankAccountProcessors.length; i++)
{ {
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i]; MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
MPaymentProcessor paymentProcessor = new MPaymentProcessor(bankAccountProcessor.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), bankAccountProcessor.get_TrxName()); if (bankAccountProcessor.isAcceptAMEX())
if (paymentProcessor.isAcceptAMEX ())
map.put (CREDITCARDTYPE_Amex, getCreditCardPair (CREDITCARDTYPE_Amex)); map.put (CREDITCARDTYPE_Amex, getCreditCardPair (CREDITCARDTYPE_Amex));
if (paymentProcessor.isAcceptDiners ()) if (bankAccountProcessor.isAcceptDiners())
map.put (CREDITCARDTYPE_Diners, getCreditCardPair (CREDITCARDTYPE_Diners)); map.put (CREDITCARDTYPE_Diners, getCreditCardPair (CREDITCARDTYPE_Diners));
if (paymentProcessor.isAcceptDiscover ()) if (bankAccountProcessor.isAcceptDiscover())
map.put (CREDITCARDTYPE_Discover, getCreditCardPair (CREDITCARDTYPE_Discover)); map.put (CREDITCARDTYPE_Discover, getCreditCardPair (CREDITCARDTYPE_Discover));
if (paymentProcessor.isAcceptMC ()) if (bankAccountProcessor.isAcceptMC())
map.put (CREDITCARDTYPE_MasterCard, getCreditCardPair (CREDITCARDTYPE_MasterCard)); map.put (CREDITCARDTYPE_MasterCard, getCreditCardPair (CREDITCARDTYPE_MasterCard));
if (paymentProcessor.isAcceptCorporate ()) if (bankAccountProcessor.isAcceptCorporate())
map.put (CREDITCARDTYPE_PurchaseCard, getCreditCardPair (CREDITCARDTYPE_PurchaseCard)); map.put (CREDITCARDTYPE_PurchaseCard, getCreditCardPair (CREDITCARDTYPE_PurchaseCard));
if (paymentProcessor.isAcceptVisa ()) if (bankAccountProcessor.isAcceptVisa())
map.put (CREDITCARDTYPE_Visa, getCreditCardPair (CREDITCARDTYPE_Visa)); map.put (CREDITCARDTYPE_Visa, getCreditCardPair (CREDITCARDTYPE_Visa));
} // for all payment processors } // for all payment processors
// //

View File

@ -16,16 +16,9 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -42,94 +35,6 @@ public class MPaymentProcessor extends X_C_PaymentProcessor
*/ */
private static final long serialVersionUID = 8514876566904723695L; private static final long serialVersionUID = 8514876566904723695L;
public static MBankAccountProcessor[] find (Properties ctx,
String tender, String CCType,
int AD_Client_ID, int AD_Org_ID, int C_Currency_ID, BigDecimal Amt, String trxName)
{
return find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Amt, trxName);
}
/**
* Get Bank Account Processor
* @param ctx context
* @param tender optional Tender see TENDER_
* @param CCType optional CC Type see CC_
* @param AD_Client_ID Client
* @param C_Currency_ID Currency (ignored)
* @param Amt Amount (ignored)
* @param trxName transaction
* @return Array of BankAccount[0] & PaymentProcessor[1] or null
*/
public static MBankAccountProcessor[] find (Properties ctx,
String tender, String CCType,
int AD_Client_ID, int C_Currency_ID, BigDecimal Amt, String trxName)
{
ArrayList<MBankAccountProcessor> list = new ArrayList<MBankAccountProcessor>();
StringBuffer sql = new StringBuffer("SELECT bap.* "
+ "FROM C_BankAccount_Processor bap, C_PaymentProcessor pp, C_BankAccount ba "
+ "WHERE pp.C_PaymentProcessor_ID = bap.C_PaymentProcessor_ID"
+ " AND ba.C_BankAccount_ID = bap.C_BankAccount_ID"
+ " AND ba.AD_Client_ID=? AND pp.IsActive='Y'" // #1
+ " AND ba.IsActive='Y' AND bap.IsActive='Y' "
+ " AND (pp.C_Currency_ID IS NULL OR pp.C_Currency_ID=?)" // #2
+ " AND (pp.MinimumAmt IS NULL OR pp.MinimumAmt = 0 OR pp.MinimumAmt <= ?)"); // #3
if (MPayment.TENDERTYPE_DirectDeposit.equals(tender))
sql.append(" AND pp.AcceptDirectDeposit='Y'");
else if (MPayment.TENDERTYPE_DirectDebit.equals(tender))
sql.append(" AND pp.AcceptDirectDebit='Y'");
else if (MPayment.TENDERTYPE_Check.equals(tender))
sql.append(" AND pp.AcceptCheck='Y'");
// CreditCards
else if (MPayment.CREDITCARDTYPE_ATM.equals(CCType))
sql.append(" AND pp.AcceptATM='Y'");
else if (MPayment.CREDITCARDTYPE_Amex.equals(CCType))
sql.append(" AND pp.AcceptAMEX='Y'");
else if (MPayment.CREDITCARDTYPE_Visa.equals(CCType))
sql.append(" AND pp.AcceptVISA='Y'");
else if (MPayment.CREDITCARDTYPE_MasterCard.equals(CCType))
sql.append(" AND pp.AcceptMC='Y'");
else if (MPayment.CREDITCARDTYPE_Diners.equals(CCType))
sql.append(" AND pp.AcceptDiners='Y'");
else if (MPayment.CREDITCARDTYPE_Discover.equals(CCType))
sql.append(" AND pp.AcceptDiscover='Y'");
else if (MPayment.CREDITCARDTYPE_PurchaseCard.equals(CCType))
sql.append(" AND pp.AcceptCORPORATE='Y'");
sql.append(" ORDER BY ba.IsDefault DESC ");
//
try
{
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), trxName);
pstmt.setInt(1, AD_Client_ID);
pstmt.setInt(2, C_Currency_ID);
pstmt.setBigDecimal(3, Amt);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MBankAccountProcessor (ctx, rs, trxName));
rs.close();
pstmt.close();
}
catch (SQLException e)
{
s_log.log(Level.SEVERE, "find - " + sql, e);
return null;
}
//
if (list.size() == 0)
s_log.warning("find - not found - AD_Client_ID=" + AD_Client_ID
+ ", C_Currency_ID=" + C_Currency_ID + ", Amt=" + Amt);
else
s_log.fine("find - #" + list.size() + " - AD_Client_ID=" + AD_Client_ID
+ ", C_Currency_ID=" + C_Currency_ID + ", Amt=" + Amt);
MBankAccountProcessor[] retValue = new MBankAccountProcessor[list.size()];
list.toArray(retValue);
return retValue;
} // find
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MPaymentProcessor.class);
/************************************************************************** /**************************************************************************
* Payment Processor Model * Payment Processor Model
* @param ctx context * @param ctx context
@ -186,29 +91,6 @@ public class MPaymentProcessor extends X_C_PaymentProcessor
return sb.toString (); return sb.toString ();
} // toString } // toString
/**
* Does Payment Processor accepts tender / CC
* @param TenderType tender type
* @param CreditCardType credit card type
* @return true if acceptes
*/
public boolean accepts (String TenderType, String CreditCardType)
{
if ((MPayment.TENDERTYPE_DirectDeposit.equals(TenderType) && isAcceptDirectDeposit())
|| (MPayment.TENDERTYPE_DirectDebit.equals(TenderType) && isAcceptDirectDebit())
|| (MPayment.TENDERTYPE_Check.equals(TenderType) && isAcceptCheck())
//
|| (MPayment.CREDITCARDTYPE_ATM.equals(CreditCardType) && isAcceptATM())
|| (MPayment.CREDITCARDTYPE_Amex.equals(CreditCardType) && isAcceptAMEX())
|| (MPayment.CREDITCARDTYPE_PurchaseCard.equals(CreditCardType) && isAcceptCorporate())
|| (MPayment.CREDITCARDTYPE_Diners.equals(CreditCardType) && isAcceptDiners())
|| (MPayment.CREDITCARDTYPE_Discover.equals(CreditCardType) && isAcceptDiscover())
|| (MPayment.CREDITCARDTYPE_MasterCard.equals(CreditCardType) && isAcceptMC())
|| (MPayment.CREDITCARDTYPE_Visa.equals(CreditCardType) && isAcceptVisa()))
return true;
return false;
} // accepts
/** /**
* @deprecated Use C_BankAccount.C_PaymentProcessor_ID * @deprecated Use C_BankAccount.C_PaymentProcessor_ID
*/ */

View File

@ -126,11 +126,11 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
m_mBankAccountProcessor = null; m_mBankAccountProcessor = null;
// Get Processor List // Get Processor List
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find (getCtx(), tender, CCType, getAD_Client_ID(), m_mBankAccountProcessors = MBankAccountProcessor.find(getCtx(), tender, CCType, getAD_Client_ID(),
getC_Currency_ID(), getPayAmt(), get_TrxName()); getC_Currency_ID(), getPayAmt(), get_TrxName());
// Relax Amount // Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find (getCtx(), tender, CCType, getAD_Client_ID(), m_mBankAccountProcessors = MBankAccountProcessor.find(getCtx(), tender, CCType, getAD_Client_ID(),
getC_Currency_ID(), Env.ZERO, get_TrxName()); getC_Currency_ID(), Env.ZERO, get_TrxName());
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return false; return false;
@ -139,8 +139,7 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
for (int i = 0; i < m_mBankAccountProcessors.length; i++) for (int i = 0; i < m_mBankAccountProcessors.length; i++)
{ {
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i]; MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
MPaymentProcessor paymentProcessor = new MPaymentProcessor(bankAccountProcessor.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), bankAccountProcessor.get_TrxName()); if (bankAccountProcessor.accepts(tender, CCType))
if (paymentProcessor.accepts (tender, CCType))
{ {
m_mBankAccountProcessor = m_mBankAccountProcessors[i]; m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break; break;
@ -208,8 +207,7 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
try try
{ {
MPaymentProcessor paymentProcessor = new MPaymentProcessor(m_mBankAccountProcessor.getCtx(), m_mBankAccountProcessor.getC_PaymentProcessor_ID(), m_mBankAccountProcessor.get_TrxName()); PaymentProcessor pp = PaymentProcessor.create(m_mBankAccountProcessor, this);
PaymentProcessor pp = PaymentProcessor.create(paymentProcessor, this);
if (pp == null) if (pp == null)
setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNoProcessor")); setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNoProcessor"));
else else

View File

@ -68,9 +68,9 @@ public abstract class PaymentProcessor
* @param mpp * @param mpp
* @param mp * @param mp
*/ */
public void initialize(MPaymentProcessor mpp, PaymentInterface mp) public void initialize(MBankAccountProcessor mbap, PaymentInterface mp)
{ {
p_mpp = mpp; p_mbap = mbap;
p_mp = mp; p_mp = mp;
} }
@ -80,14 +80,14 @@ public abstract class PaymentProcessor
* @param mp payment model * @param mp payment model
* @return initialized PaymentProcessor or null * @return initialized PaymentProcessor or null
*/ */
public static PaymentProcessor create (MPaymentProcessor mpp, PaymentInterface mp) public static PaymentProcessor create (MBankAccountProcessor mbap, PaymentInterface mp)
{ {
return Core.getPaymentProcessor(mpp, mp); return Core.getPaymentProcessor(mbap, mp);
} // create } // create
/*************************************************************************/ /*************************************************************************/
protected MPaymentProcessor p_mpp = null; protected MBankAccountProcessor p_mbap = null;
protected PaymentInterface p_mp = null; protected PaymentInterface p_mp = null;
// //
private int m_timeout = 30; private int m_timeout = 30;

View File

@ -17,8 +17,10 @@
/** Generated Model - DO NOT CHANGE */ /** Generated Model - DO NOT CHANGE */
package org.compiere.model; package org.compiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.Properties; import java.util.Properties;
import org.compiere.util.Env;
/** Generated Model for C_BankAccount_Processor /** Generated Model for C_BankAccount_Processor
* @author iDempiere (generated) * @author iDempiere (generated)
@ -29,7 +31,7 @@ public class X_C_BankAccount_Processor extends PO implements I_C_BankAccount_Pro
/** /**
* *
*/ */
private static final long serialVersionUID = 20121031L; private static final long serialVersionUID = 20121116L;
/** Standard Constructor */ /** Standard Constructor */
public X_C_BankAccount_Processor (Properties ctx, int C_BankAccount_Processor_ID, String trxName) public X_C_BankAccount_Processor (Properties ctx, int C_BankAccount_Processor_ID, String trxName)
@ -37,8 +39,32 @@ public class X_C_BankAccount_Processor extends PO implements I_C_BankAccount_Pro
super (ctx, C_BankAccount_Processor_ID, trxName); super (ctx, C_BankAccount_Processor_ID, trxName);
/** if (C_BankAccount_Processor_ID == 0) /** if (C_BankAccount_Processor_ID == 0)
{ {
setAcceptAMEX (false);
// N
setAcceptATM (false);
// N
setAcceptCheck (false);
// N
setAcceptCorporate (false);
// N
setAcceptDiners (false);
// N
setAcceptDirectDebit (false);
// N
setAcceptDirectDeposit (false);
// N
setAcceptDiscover (false);
// N
setAcceptMC (false);
// N
setAcceptVisa (false);
// N
setC_BankAccount_ID (0); setC_BankAccount_ID (0);
setC_PaymentProcessor_ID (0); setC_PaymentProcessor_ID (0);
setPassword (null);
setRequireVV (false);
// N
setUserID (null);
} */ } */
} }
@ -70,6 +96,246 @@ public class X_C_BankAccount_Processor extends PO implements I_C_BankAccount_Pro
return sb.toString(); return sb.toString();
} }
/** Set Accept AMEX.
@param AcceptAMEX
Accept American Express Card
*/
public void setAcceptAMEX (boolean AcceptAMEX)
{
set_Value (COLUMNNAME_AcceptAMEX, Boolean.valueOf(AcceptAMEX));
}
/** Get Accept AMEX.
@return Accept American Express Card
*/
public boolean isAcceptAMEX ()
{
Object oo = get_Value(COLUMNNAME_AcceptAMEX);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept ATM.
@param AcceptATM
Accept Bank ATM Card
*/
public void setAcceptATM (boolean AcceptATM)
{
set_Value (COLUMNNAME_AcceptATM, Boolean.valueOf(AcceptATM));
}
/** Get Accept ATM.
@return Accept Bank ATM Card
*/
public boolean isAcceptATM ()
{
Object oo = get_Value(COLUMNNAME_AcceptATM);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Electronic Check.
@param AcceptCheck
Accept ECheck (Electronic Checks)
*/
public void setAcceptCheck (boolean AcceptCheck)
{
set_Value (COLUMNNAME_AcceptCheck, Boolean.valueOf(AcceptCheck));
}
/** Get Accept Electronic Check.
@return Accept ECheck (Electronic Checks)
*/
public boolean isAcceptCheck ()
{
Object oo = get_Value(COLUMNNAME_AcceptCheck);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Corporate.
@param AcceptCorporate
Accept Corporate Purchase Cards
*/
public void setAcceptCorporate (boolean AcceptCorporate)
{
set_Value (COLUMNNAME_AcceptCorporate, Boolean.valueOf(AcceptCorporate));
}
/** Get Accept Corporate.
@return Accept Corporate Purchase Cards
*/
public boolean isAcceptCorporate ()
{
Object oo = get_Value(COLUMNNAME_AcceptCorporate);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Diners.
@param AcceptDiners
Accept Diner's Club
*/
public void setAcceptDiners (boolean AcceptDiners)
{
set_Value (COLUMNNAME_AcceptDiners, Boolean.valueOf(AcceptDiners));
}
/** Get Accept Diners.
@return Accept Diner's Club
*/
public boolean isAcceptDiners ()
{
Object oo = get_Value(COLUMNNAME_AcceptDiners);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Direct Debit.
@param AcceptDirectDebit
Accept Direct Debits (vendor initiated)
*/
public void setAcceptDirectDebit (boolean AcceptDirectDebit)
{
set_Value (COLUMNNAME_AcceptDirectDebit, Boolean.valueOf(AcceptDirectDebit));
}
/** Get Accept Direct Debit.
@return Accept Direct Debits (vendor initiated)
*/
public boolean isAcceptDirectDebit ()
{
Object oo = get_Value(COLUMNNAME_AcceptDirectDebit);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Direct Deposit.
@param AcceptDirectDeposit
Accept Direct Deposit (payee initiated)
*/
public void setAcceptDirectDeposit (boolean AcceptDirectDeposit)
{
set_Value (COLUMNNAME_AcceptDirectDeposit, Boolean.valueOf(AcceptDirectDeposit));
}
/** Get Accept Direct Deposit.
@return Accept Direct Deposit (payee initiated)
*/
public boolean isAcceptDirectDeposit ()
{
Object oo = get_Value(COLUMNNAME_AcceptDirectDeposit);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Discover.
@param AcceptDiscover
Accept Discover Card
*/
public void setAcceptDiscover (boolean AcceptDiscover)
{
set_Value (COLUMNNAME_AcceptDiscover, Boolean.valueOf(AcceptDiscover));
}
/** Get Accept Discover.
@return Accept Discover Card
*/
public boolean isAcceptDiscover ()
{
Object oo = get_Value(COLUMNNAME_AcceptDiscover);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept MasterCard.
@param AcceptMC
Accept Master Card
*/
public void setAcceptMC (boolean AcceptMC)
{
set_Value (COLUMNNAME_AcceptMC, Boolean.valueOf(AcceptMC));
}
/** Get Accept MasterCard.
@return Accept Master Card
*/
public boolean isAcceptMC ()
{
Object oo = get_Value(COLUMNNAME_AcceptMC);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Visa.
@param AcceptVisa
Accept Visa Cards
*/
public void setAcceptVisa (boolean AcceptVisa)
{
set_Value (COLUMNNAME_AcceptVisa, Boolean.valueOf(AcceptVisa));
}
/** Get Accept Visa.
@return Accept Visa Cards
*/
public boolean isAcceptVisa ()
{
Object oo = get_Value(COLUMNNAME_AcceptVisa);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
public org.compiere.model.I_C_BankAccount getC_BankAccount() throws RuntimeException public org.compiere.model.I_C_BankAccount getC_BankAccount() throws RuntimeException
{ {
return (org.compiere.model.I_C_BankAccount)MTable.get(getCtx(), org.compiere.model.I_C_BankAccount.Table_Name) return (org.compiere.model.I_C_BankAccount)MTable.get(getCtx(), org.compiere.model.I_C_BankAccount.Table_Name)
@ -112,6 +378,34 @@ public class X_C_BankAccount_Processor extends PO implements I_C_BankAccount_Pro
return (String)get_Value(COLUMNNAME_C_BankAccount_Processor_UU); return (String)get_Value(COLUMNNAME_C_BankAccount_Processor_UU);
} }
public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException
{
return (org.compiere.model.I_C_Currency)MTable.get(getCtx(), org.compiere.model.I_C_Currency.Table_Name)
.getPO(getC_Currency_ID(), get_TrxName()); }
/** Set Currency.
@param C_Currency_ID
The Currency for this record
*/
public void setC_Currency_ID (int C_Currency_ID)
{
if (C_Currency_ID < 1)
set_Value (COLUMNNAME_C_Currency_ID, null);
else
set_Value (COLUMNNAME_C_Currency_ID, Integer.valueOf(C_Currency_ID));
}
/** Get Currency.
@return The Currency for this record
*/
public int getC_Currency_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Currency_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_PaymentProcessor getC_PaymentProcessor() throws RuntimeException public org.compiere.model.I_C_PaymentProcessor getC_PaymentProcessor() throws RuntimeException
{ {
return (org.compiere.model.I_C_PaymentProcessor)MTable.get(getCtx(), org.compiere.model.I_C_PaymentProcessor.Table_Name) return (org.compiere.model.I_C_PaymentProcessor)MTable.get(getCtx(), org.compiere.model.I_C_PaymentProcessor.Table_Name)
@ -139,4 +433,316 @@ public class X_C_BankAccount_Processor extends PO implements I_C_BankAccount_Pro
return 0; return 0;
return ii.intValue(); return ii.intValue();
} }
/** Set Accept AMEX.
@param IsPPAcceptAMEX Accept AMEX */
public void setIsPPAcceptAMEX (boolean IsPPAcceptAMEX)
{
throw new IllegalArgumentException ("IsPPAcceptAMEX is virtual column"); }
/** Get Accept AMEX.
@return Accept AMEX */
public boolean isPPAcceptAMEX ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptAMEX);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept ATM.
@param IsPPAcceptATM Accept ATM */
public void setIsPPAcceptATM (boolean IsPPAcceptATM)
{
throw new IllegalArgumentException ("IsPPAcceptATM is virtual column"); }
/** Get Accept ATM.
@return Accept ATM */
public boolean isPPAcceptATM ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptATM);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Check.
@param IsPPAcceptCheck Accept Check */
public void setIsPPAcceptCheck (boolean IsPPAcceptCheck)
{
throw new IllegalArgumentException ("IsPPAcceptCheck is virtual column"); }
/** Get Accept Check.
@return Accept Check */
public boolean isPPAcceptCheck ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptCheck);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Corporate.
@param IsPPAcceptCorporate Accept Corporate */
public void setIsPPAcceptCorporate (boolean IsPPAcceptCorporate)
{
throw new IllegalArgumentException ("IsPPAcceptCorporate is virtual column"); }
/** Get Accept Corporate.
@return Accept Corporate */
public boolean isPPAcceptCorporate ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptCorporate);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Diners.
@param IsPPAcceptDiners Accept Diners */
public void setIsPPAcceptDiners (boolean IsPPAcceptDiners)
{
throw new IllegalArgumentException ("IsPPAcceptDiners is virtual column"); }
/** Get Accept Diners.
@return Accept Diners */
public boolean isPPAcceptDiners ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptDiners);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Direct Debit.
@param IsPPAcceptDirectDebit Accept Direct Debit */
public void setIsPPAcceptDirectDebit (boolean IsPPAcceptDirectDebit)
{
throw new IllegalArgumentException ("IsPPAcceptDirectDebit is virtual column"); }
/** Get Accept Direct Debit.
@return Accept Direct Debit */
public boolean isPPAcceptDirectDebit ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptDirectDebit);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Direct Deposit.
@param IsPPAcceptDirectDeposit Accept Direct Deposit */
public void setIsPPAcceptDirectDeposit (boolean IsPPAcceptDirectDeposit)
{
throw new IllegalArgumentException ("IsPPAcceptDirectDeposit is virtual column"); }
/** Get Accept Direct Deposit.
@return Accept Direct Deposit */
public boolean isPPAcceptDirectDeposit ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptDirectDeposit);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Discover.
@param IsPPAcceptDiscover Accept Discover */
public void setIsPPAcceptDiscover (boolean IsPPAcceptDiscover)
{
throw new IllegalArgumentException ("IsPPAcceptDiscover is virtual column"); }
/** Get Accept Discover.
@return Accept Discover */
public boolean isPPAcceptDiscover ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptDiscover);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept MasterCard.
@param IsPPAcceptMC Accept MasterCard */
public void setIsPPAcceptMC (boolean IsPPAcceptMC)
{
throw new IllegalArgumentException ("IsPPAcceptMC is virtual column"); }
/** Get Accept MasterCard.
@return Accept MasterCard */
public boolean isPPAcceptMC ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptMC);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Accept Visa.
@param IsPPAcceptVisa Accept Visa */
public void setIsPPAcceptVisa (boolean IsPPAcceptVisa)
{
throw new IllegalArgumentException ("IsPPAcceptVisa is virtual column"); }
/** Get Accept Visa.
@return Accept Visa */
public boolean isPPAcceptVisa ()
{
Object oo = get_Value(COLUMNNAME_IsPPAcceptVisa);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Minimum Amt.
@param MinimumAmt
Minimum Amount in Document Currency
*/
public void setMinimumAmt (BigDecimal MinimumAmt)
{
set_Value (COLUMNNAME_MinimumAmt, MinimumAmt);
}
/** Get Minimum Amt.
@return Minimum Amount in Document Currency
*/
public BigDecimal getMinimumAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_MinimumAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Partner ID.
@param PartnerID
Partner ID or Account for the Payment Processor
*/
public void setPartnerID (String PartnerID)
{
set_Value (COLUMNNAME_PartnerID, PartnerID);
}
/** Get Partner ID.
@return Partner ID or Account for the Payment Processor
*/
public String getPartnerID ()
{
return (String)get_Value(COLUMNNAME_PartnerID);
}
/** Set Password.
@param Password
Password of any length (case sensitive)
*/
public void setPassword (String Password)
{
set_Value (COLUMNNAME_Password, Password);
}
/** Get Password.
@return Password of any length (case sensitive)
*/
public String getPassword ()
{
return (String)get_Value(COLUMNNAME_Password);
}
/** Set Require CreditCard Verification Code.
@param RequireVV
Require 3/4 digit Credit Verification Code
*/
public void setRequireVV (boolean RequireVV)
{
set_Value (COLUMNNAME_RequireVV, Boolean.valueOf(RequireVV));
}
/** Get Require CreditCard Verification Code.
@return Require 3/4 digit Credit Verification Code
*/
public boolean isRequireVV ()
{
Object oo = get_Value(COLUMNNAME_RequireVV);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set User ID.
@param UserID
User ID or account number
*/
public void setUserID (String UserID)
{
set_Value (COLUMNNAME_UserID, UserID);
}
/** Get User ID.
@return User ID or account number
*/
public String getUserID ()
{
return (String)get_Value(COLUMNNAME_UserID);
}
/** Set Vendor ID.
@param VendorID
Vendor ID for the Payment Processor
*/
public void setVendorID (String VendorID)
{
set_Value (COLUMNNAME_VendorID, VendorID);
}
/** Get Vendor ID.
@return Vendor ID for the Payment Processor
*/
public String getVendorID ()
{
return (String)get_Value(COLUMNNAME_VendorID);
}
} }

View File

@ -32,7 +32,7 @@ public class X_C_PaymentProcessor extends PO implements I_C_PaymentProcessor, I_
/** /**
* *
*/ */
private static final long serialVersionUID = 20121031L; private static final long serialVersionUID = 20121116L;
/** Standard Constructor */ /** Standard Constructor */
public X_C_PaymentProcessor (Properties ctx, int C_PaymentProcessor_ID, String trxName) public X_C_PaymentProcessor (Properties ctx, int C_PaymentProcessor_ID, String trxName)
@ -50,15 +50,13 @@ public class X_C_PaymentProcessor extends PO implements I_C_PaymentProcessor, I_
setAcceptDiscover (false); setAcceptDiscover (false);
setAcceptMC (false); setAcceptMC (false);
setAcceptVisa (false); setAcceptVisa (false);
setC_PaymentProcessor_ID (0);
setCommission (Env.ZERO); setCommission (Env.ZERO);
setCostPerTrx (Env.ZERO); setCostPerTrx (Env.ZERO);
setC_PaymentProcessor_ID (0);
setHostAddress (null); setHostAddress (null);
setHostPort (0); setHostPort (0);
setName (null); setName (null);
setPassword (null);
setRequireVV (false); setRequireVV (false);
setUserID (null);
} */ } */
} }
@ -414,6 +412,43 @@ public class X_C_PaymentProcessor extends PO implements I_C_PaymentProcessor, I_
return ii.intValue(); return ii.intValue();
} }
/** Set Payment Processor.
@param C_PaymentProcessor_ID
Payment processor for electronic payments
*/
public void setC_PaymentProcessor_ID (int C_PaymentProcessor_ID)
{
if (C_PaymentProcessor_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_PaymentProcessor_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_PaymentProcessor_ID, Integer.valueOf(C_PaymentProcessor_ID));
}
/** Get Payment Processor.
@return Payment processor for electronic payments
*/
public int getC_PaymentProcessor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_PaymentProcessor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_PaymentProcessor_UU.
@param C_PaymentProcessor_UU C_PaymentProcessor_UU */
public void setC_PaymentProcessor_UU (String C_PaymentProcessor_UU)
{
set_Value (COLUMNNAME_C_PaymentProcessor_UU, C_PaymentProcessor_UU);
}
/** Get C_PaymentProcessor_UU.
@return C_PaymentProcessor_UU */
public String getC_PaymentProcessor_UU ()
{
return (String)get_Value(COLUMNNAME_C_PaymentProcessor_UU);
}
/** Set Commission %. /** Set Commission %.
@param Commission @param Commission
Commission stated as a percentage Commission stated as a percentage
@ -454,43 +489,6 @@ public class X_C_PaymentProcessor extends PO implements I_C_PaymentProcessor, I_
return bd; return bd;
} }
/** Set Payment Processor.
@param C_PaymentProcessor_ID
Payment processor for electronic payments
*/
public void setC_PaymentProcessor_ID (int C_PaymentProcessor_ID)
{
if (C_PaymentProcessor_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_PaymentProcessor_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_PaymentProcessor_ID, Integer.valueOf(C_PaymentProcessor_ID));
}
/** Get Payment Processor.
@return Payment processor for electronic payments
*/
public int getC_PaymentProcessor_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_PaymentProcessor_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_PaymentProcessor_UU.
@param C_PaymentProcessor_UU C_PaymentProcessor_UU */
public void setC_PaymentProcessor_UU (String C_PaymentProcessor_UU)
{
set_Value (COLUMNNAME_C_PaymentProcessor_UU, C_PaymentProcessor_UU);
}
/** Get C_PaymentProcessor_UU.
@return C_PaymentProcessor_UU */
public String getC_PaymentProcessor_UU ()
{
return (String)get_Value(COLUMNNAME_C_PaymentProcessor_UU);
}
/** Set Description. /** Set Description.
@param Description @param Description
Optional short description of the record Optional short description of the record
@ -590,40 +588,6 @@ public class X_C_PaymentProcessor extends PO implements I_C_PaymentProcessor, I_
return new KeyNamePair(get_ID(), getName()); return new KeyNamePair(get_ID(), getName());
} }
/** Set Partner ID.
@param PartnerID
Partner ID or Account for the Payment Processor
*/
public void setPartnerID (String PartnerID)
{
set_Value (COLUMNNAME_PartnerID, PartnerID);
}
/** Get Partner ID.
@return Partner ID or Account for the Payment Processor
*/
public String getPartnerID ()
{
return (String)get_Value(COLUMNNAME_PartnerID);
}
/** Set Password.
@param Password
Password of any length (case sensitive)
*/
public void setPassword (String Password)
{
set_Value (COLUMNNAME_Password, Password);
}
/** Get Password.
@return Password of any length (case sensitive)
*/
public String getPassword ()
{
return (String)get_Value(COLUMNNAME_Password);
}
/** Set Payment Processor Class. /** Set Payment Processor Class.
@param PayProcessorClass @param PayProcessorClass
Payment Processor Java Class Payment Processor Java Class
@ -767,38 +731,4 @@ public class X_C_PaymentProcessor extends PO implements I_C_PaymentProcessor, I_
{ {
return (String)get_Value(COLUMNNAME_TrxType); return (String)get_Value(COLUMNNAME_TrxType);
} }
/** Set User ID.
@param UserID
User ID or account number
*/
public void setUserID (String UserID)
{
set_Value (COLUMNNAME_UserID, UserID);
}
/** Get User ID.
@return User ID or account number
*/
public String getUserID ()
{
return (String)get_Value(COLUMNNAME_UserID);
}
/** Set Vendor ID.
@param VendorID
Vendor ID for the Payment Processor
*/
public void setVendorID (String VendorID)
{
set_Value (COLUMNNAME_VendorID, VendorID);
}
/** Get Vendor ID.
@return Vendor ID for the Payment Processor
*/
public String getVendorID ()
{
return (String)get_Value(COLUMNNAME_VendorID);
}
} }

View File

@ -191,22 +191,22 @@ public class PP_Optimal extends PaymentProcessor
public boolean processCC () public boolean processCC ()
throws IllegalArgumentException throws IllegalArgumentException
{ {
log.fine(p_mpp.getHostAddress() + ":" + p_mpp.getHostPort() + ", Timeout=" + getTimeout() log.fine(p_mbap.getHostAddress() + ":" + p_mbap.getHostPort() + ", Timeout=" + getTimeout()
+ "; Proxy=" + p_mpp.getProxyAddress() + ":" + p_mpp.getProxyPort() + " " + p_mpp.getProxyLogon() + " " + p_mpp.getProxyPassword()); + "; Proxy=" + p_mbap.getProxyAddress() + ":" + p_mbap.getProxyPort() + " " + p_mbap.getProxyLogon() + " " + p_mbap.getProxyPassword());
setEncoded(true); setEncoded(true);
String urlString = p_mpp.getHostAddress(); String urlString = p_mbap.getHostAddress();
// "https://realtime.firepay.com/servlet/DPServlet"; // "https://realtime.firepay.com/servlet/DPServlet";
// "https://realtime.test.firepay.com/servlet/DPServlet"; // "https://realtime.test.firepay.com/servlet/DPServlet";
if (p_mpp.getHostPort() != 0) if (p_mbap.getHostPort() != 0)
urlString += ":" + p_mpp.getHostPort(); urlString += ":" + p_mbap.getHostPort();
/** General Parameters */ /** General Parameters */
StringBuffer param = new StringBuffer(200); StringBuffer param = new StringBuffer(200);
// Merchant username and password. // Merchant username and password.
param.append(createPair(MERCHANT_ID, p_mpp.getUserID(), 80)) param.append(createPair(MERCHANT_ID, p_mbap.getUserID(), 80))
.append(AMP).append(createPair(MERCHANT_PWD, p_mpp.getPassword(), 20)) .append(AMP).append(createPair(MERCHANT_PWD, p_mbap.getPassword(), 20))
.append(AMP).append(createPair(ACCOUNT_ID, p_mpp.getPartnerID(), 10)); .append(AMP).append(createPair(ACCOUNT_ID, p_mbap.getPartnerID(), 10));
// param.append(AMP).append(createPair(MERCHANT_DATA, "comment", 255)); // param.append(AMP).append(createPair(MERCHANT_DATA, "comment", 255));
/** Cipher supported : SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5 /** Cipher supported : SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5

View File

@ -83,8 +83,8 @@ public final class PP_PayFlowPro extends PaymentProcessor
*/ */
public boolean processCC () throws IllegalArgumentException public boolean processCC () throws IllegalArgumentException
{ {
log.fine(p_mpp.getHostAddress() + " " + p_mpp.getHostPort() + ", Timeout=" + getTimeout() log.fine(p_mbap.getHostAddress() + " " + p_mbap.getHostPort() + ", Timeout=" + getTimeout()
+ "; Proxy=" + p_mpp.getProxyAddress() + " " + p_mpp.getProxyPort() + " " + p_mpp.getProxyLogon() + " " + p_mpp.getProxyPassword()); + "; Proxy=" + p_mbap.getProxyAddress() + " " + p_mbap.getProxyPort() + " " + p_mbap.getProxyLogon() + " " + p_mbap.getProxyPassword());
// //
StringBuffer param = new StringBuffer(); StringBuffer param = new StringBuffer();
// Transaction Type // Transaction Type
@ -151,15 +151,15 @@ public final class PP_PayFlowPro extends PaymentProcessor
StringBuffer param = new StringBuffer(parameter); StringBuffer param = new StringBuffer(parameter);
// Usr/Pwd // Usr/Pwd
param param
.append("&PARTNER=").append(p_mpp.getPartnerID()) .append("&PARTNER=").append(p_mbap.getPartnerID())
.append("&VENDOR=").append(p_mpp.getVendorID()) .append("&VENDOR=").append(p_mbap.getVendorID())
.append("&USER=").append(p_mpp.getUserID()) .append("&USER=").append(p_mbap.getUserID())
.append("&PWD=").append(p_mpp.getPassword()); .append("&PWD=").append(p_mbap.getPassword());
log.fine("-> " + param.toString()); log.fine("-> " + param.toString());
// Call the PayFlowPro client. // Call the PayFlowPro client.
int rc = m_pp.CreateContext (p_mpp.getHostAddress(), p_mpp.getHostPort(), getTimeout(), int rc = m_pp.CreateContext (p_mbap.getHostAddress(), p_mbap.getHostPort(), getTimeout(),
p_mpp.getProxyAddress(), p_mpp.getProxyPort(), p_mpp.getProxyLogon(), p_mpp.getProxyPassword()); p_mbap.getProxyAddress(), p_mbap.getProxyPort(), p_mbap.getProxyLogon(), p_mbap.getProxyPassword());
String response = m_pp.SubmitTransaction(param.toString()); String response = m_pp.SubmitTransaction(param.toString());
m_pp.DestroyContext(); m_pp.DestroyContext();
// //

View File

@ -79,14 +79,14 @@ public final class PP_PayFlowPro4 extends PaymentProcessor
*/ */
public boolean processCC () throws IllegalArgumentException public boolean processCC () throws IllegalArgumentException
{ {
log.fine(p_mpp.getHostAddress() + " " + p_mpp.getHostPort() + ", Timeout=" + getTimeout() log.fine(p_mbap.getHostAddress() + " " + p_mbap.getHostPort() + ", Timeout=" + getTimeout()
+ "; Proxy=" + p_mpp.getProxyAddress() + " " + p_mpp.getProxyPort() + " " + p_mpp.getProxyLogon() + " " + p_mpp.getProxyPassword()); + "; Proxy=" + p_mbap.getProxyAddress() + " " + p_mbap.getProxyPort() + " " + p_mbap.getProxyLogon() + " " + p_mbap.getProxyPassword());
if ( p_mpp.getC_Currency_ID() != 0 && p_mpp.getC_Currency_ID() != p_mp.getC_Currency_ID() ) if ( p_mbap.getC_Currency_ID() != 0 && p_mbap.getC_Currency_ID() != p_mp.getC_Currency_ID() )
throw new IllegalArgumentException("Payment currency not supported by processor."); throw new IllegalArgumentException("Payment currency not supported by processor.");
if ( p_mpp.getMinimumAmt().compareTo(p_mp.getPayAmt()) > 0) if ( p_mbap.getMinimumAmt().compareTo(p_mp.getPayAmt()) > 0)
throw new IllegalArgumentException("Payment amount is less than minimum accepted."); throw new IllegalArgumentException("Payment amount is less than minimum accepted.");
if ( p_mpp.isRequireVV() && Util.isEmpty(p_mp.getCreditCardVV(), true) ) if ( p_mbap.isRequireVV() && Util.isEmpty(p_mp.getCreditCardVV(), true) )
throw new IllegalArgumentException("Credit card verification code required."); throw new IllegalArgumentException("Credit card verification code required.");
@ -169,22 +169,22 @@ public final class PP_PayFlowPro4 extends PaymentProcessor
StringBuffer param = new StringBuffer(parameter); StringBuffer param = new StringBuffer(parameter);
// Usr/Pwd // Usr/Pwd
param param
.append("&PARTNER=").append(p_mpp.getPartnerID()) .append("&PARTNER=").append(p_mbap.getPartnerID())
.append("&VENDOR=").append(p_mpp.getVendorID()) .append("&VENDOR=").append(p_mbap.getVendorID())
.append("&USER=").append(p_mpp.getUserID()) .append("&USER=").append(p_mbap.getUserID())
.append("&PWD=").append(p_mpp.getPassword()); .append("&PWD=").append(p_mbap.getPassword());
// PCI DSS don't log private data // PCI DSS don't log private data
// log.fine("-> " + param.toString()); // log.fine("-> " + param.toString());
SDKProperties.setHostAddress(p_mpp.getHostAddress()); SDKProperties.setHostAddress(p_mbap.getHostAddress());
SDKProperties.setHostPort(p_mpp.getHostPort()); SDKProperties.setHostPort(p_mbap.getHostPort());
SDKProperties.setTimeOut(getTimeout()); SDKProperties.setTimeOut(getTimeout());
SDKProperties.setProxyAddress(p_mpp.getProxyAddress()); SDKProperties.setProxyAddress(p_mbap.getProxyAddress());
SDKProperties.setProxyPort(p_mpp.getProxyPort()); SDKProperties.setProxyPort(p_mbap.getProxyPort());
SDKProperties.setProxyLogin(p_mpp.getProxyLogon()); SDKProperties.setProxyLogin(p_mbap.getProxyLogon());
SDKProperties.setProxyPassword(p_mpp.getProxyPassword()); SDKProperties.setProxyPassword(p_mbap.getProxyPassword());
//Logging is by default off. To turn logging on uncomment the following lines: //Logging is by default off. To turn logging on uncomment the following lines:
//SDKProperties.setLogFileName("payflow_java.log"); //SDKProperties.setLogFileName("payflow_java.log");

View File

@ -24,7 +24,6 @@ import org.compiere.model.MOrderLine;
import org.compiere.model.MOrderTax; import org.compiere.model.MOrderTax;
import org.compiere.model.MPOS; import org.compiere.model.MPOS;
import org.compiere.model.MPayment; import org.compiere.model.MPayment;
import org.compiere.model.MPaymentProcessor;
import org.compiere.model.MProduct; import org.compiere.model.MProduct;
import org.compiere.process.DocAction; import org.compiere.process.DocAction;
import org.compiere.util.DB; import org.compiere.util.DB;
@ -397,25 +396,24 @@ public class PosOrderModel extends MOrder {
{ {
try try
{ {
MBankAccountProcessor[] m_mBankAccountProcessors = MPaymentProcessor.find (getCtx (), null, null, MBankAccountProcessor[] m_mBankAccountProcessors = MBankAccountProcessor.find(getCtx (), null, null,
getAD_Client_ID (), getAD_Org_ID(), getC_Currency_ID (), amt, get_TrxName()); getAD_Client_ID (), getAD_Org_ID(), getC_Currency_ID (), amt, get_TrxName());
// //
HashMap<String,ValueNamePair> map = new HashMap<String,ValueNamePair>(); // to eliminate duplicates HashMap<String,ValueNamePair> map = new HashMap<String,ValueNamePair>(); // to eliminate duplicates
for (int i = 0; i < m_mBankAccountProcessors.length; i++) for (int i = 0; i < m_mBankAccountProcessors.length; i++)
{ {
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i]; MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
MPaymentProcessor paymentProcessor = new MPaymentProcessor(bankAccountProcessor.getCtx(), bankAccountProcessor.getC_PaymentProcessor_ID(), bankAccountProcessor.get_TrxName()); if (bankAccountProcessor.isAcceptAMEX())
if (paymentProcessor.isAcceptAMEX ())
map.put (MPayment.CREDITCARDTYPE_Amex, getCreditCardPair (MPayment.CREDITCARDTYPE_Amex)); map.put (MPayment.CREDITCARDTYPE_Amex, getCreditCardPair (MPayment.CREDITCARDTYPE_Amex));
if (paymentProcessor.isAcceptDiners ()) if (bankAccountProcessor.isAcceptDiners())
map.put (MPayment.CREDITCARDTYPE_Diners, getCreditCardPair (MPayment.CREDITCARDTYPE_Diners)); map.put (MPayment.CREDITCARDTYPE_Diners, getCreditCardPair (MPayment.CREDITCARDTYPE_Diners));
if (paymentProcessor.isAcceptDiscover ()) if (bankAccountProcessor.isAcceptDiscover())
map.put (MPayment.CREDITCARDTYPE_Discover, getCreditCardPair (MPayment.CREDITCARDTYPE_Discover)); map.put (MPayment.CREDITCARDTYPE_Discover, getCreditCardPair (MPayment.CREDITCARDTYPE_Discover));
if (paymentProcessor.isAcceptMC ()) if (bankAccountProcessor.isAcceptMC())
map.put (MPayment.CREDITCARDTYPE_MasterCard, getCreditCardPair (MPayment.CREDITCARDTYPE_MasterCard)); map.put (MPayment.CREDITCARDTYPE_MasterCard, getCreditCardPair (MPayment.CREDITCARDTYPE_MasterCard));
if (paymentProcessor.isAcceptCorporate ()) if (bankAccountProcessor.isAcceptCorporate())
map.put (MPayment.CREDITCARDTYPE_PurchaseCard, getCreditCardPair (MPayment.CREDITCARDTYPE_PurchaseCard)); map.put (MPayment.CREDITCARDTYPE_PurchaseCard, getCreditCardPair (MPayment.CREDITCARDTYPE_PurchaseCard));
if (paymentProcessor.isAcceptVisa ()) if (bankAccountProcessor.isAcceptVisa())
map.put (MPayment.CREDITCARDTYPE_Visa, getCreditCardPair (MPayment.CREDITCARDTYPE_Visa)); map.put (MPayment.CREDITCARDTYPE_Visa, getCreditCardPair (MPayment.CREDITCARDTYPE_Visa));
} // for all payment processors } // for all payment processors
// //

View File

@ -25,7 +25,6 @@ import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MBankAccountProcessor; import org.compiere.model.MBankAccountProcessor;
import org.compiere.model.MPaymentProcessor;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -237,10 +236,10 @@ public abstract class PaymentForm implements IPaymentForm {
protected boolean isBankAccountProcessorExist(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName) protected boolean isBankAccountProcessorExist(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName)
{ {
MBankAccountProcessor[] m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName); MBankAccountProcessor[] m_mBankAccountProcessors = MBankAccountProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName);
// Relax Amount // Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName); m_mBankAccountProcessors = MBankAccountProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName);
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return false; return false;
return true; return true;
@ -248,10 +247,10 @@ public abstract class PaymentForm implements IPaymentForm {
protected MBankAccountProcessor getBankAccountProcessor(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName) protected MBankAccountProcessor getBankAccountProcessor(Properties ctx, String tender, String CCType, int AD_Client_ID, int C_Currency_ID, BigDecimal PayAmt, String trxName)
{ {
MBankAccountProcessor[] m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName); MBankAccountProcessor[] m_mBankAccountProcessors = MBankAccountProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, PayAmt, trxName);
// Relax Amount // Relax Amount
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
m_mBankAccountProcessors = MPaymentProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName); m_mBankAccountProcessors = MBankAccountProcessor.find(ctx, tender, CCType, AD_Client_ID, C_Currency_ID, Env.ZERO, trxName);
if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0) if (m_mBankAccountProcessors == null || m_mBankAccountProcessors.length == 0)
return null; return null;
@ -260,8 +259,7 @@ public abstract class PaymentForm implements IPaymentForm {
for (int i = 0; i < m_mBankAccountProcessors.length; i++) for (int i = 0; i < m_mBankAccountProcessors.length; i++)
{ {
MBankAccountProcessor bap = m_mBankAccountProcessors[i]; MBankAccountProcessor bap = m_mBankAccountProcessors[i];
MPaymentProcessor paymentProcessor = new MPaymentProcessor(bap.getCtx(), bap.getC_PaymentProcessor_ID(), bap.get_TrxName()); if (bap.accepts(tender, CCType))
if (paymentProcessor.accepts (tender, CCType))
{ {
m_mBankAccountProcessor = m_mBankAccountProcessors[i]; m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break; break;