Ticket #1001984: Avoiding Payment profile ID mess

This commit is contained in:
Elaine Tan 2013-04-02 18:46:48 +08:00
parent 2bfa8b0e03
commit db9d8b86df
7 changed files with 369 additions and 224 deletions

View File

@ -0,0 +1,32 @@
-- Mar 25, 2013 6:11:15 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,IsToolbarButton,IsAlwaysUpdateable,IsEncrypted) VALUES (0,'N',0,298,210214,'D','N','N','N',0,'N',10,'N',19,'N',1385,'N','Y','93cbf467-dbe3-4c00-b105-959b405e6106','Y','C_PaymentProcessor_ID','Payment processor for electronic payments','The Payment Processor indicates the processor to be used for electronic payments','Payment Processor','Y',TO_DATE('2013-03-25 18:11:13','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2013-03-25 18:11:13','YYYY-MM-DD HH24:MI:SS'),100,0,'N','N','N')
;
-- Mar 25, 2013 6:11:16 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=210214 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Mar 25, 2013 6:11:21 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
ALTER TABLE C_BP_BankAccount ADD C_PaymentProcessor_ID NUMBER(10) DEFAULT NULL
;
-- Mar 25, 2013 6:11:53 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',226,10,'N','N',210214,'Y',201894,'N','The Payment Processor indicates the processor to be used for electronic payments','D','Payment processor for electronic payments','Payment Processor','bb23275a-069d-4436-8af3-d612e42dd4e6','Y','N',100,0,TO_DATE('2013-03-25 18:11:53','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2013-03-25 18:11:53','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Mar 25, 2013 6:11:54 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201894 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Mar 25, 2013 6:12:32 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
UPDATE AD_Field SET ColumnSpan=2, IsSameLine='Y', IsReadOnly='Y', XPosition=4,Updated=TO_DATE('2013-03-25 18:12:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201894
;
SELECT register_migration_script('201304021807_TICKET-1001984.sql') FROM dual
;

View File

@ -0,0 +1,32 @@
-- Mar 25, 2013 6:11:15 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,IsToolbarButton,IsAlwaysUpdateable,IsEncrypted) VALUES (0,'N',0,298,210214,'D','N','N','N',0,'N',10,'N',19,'N',1385,'N','Y','93cbf467-dbe3-4c00-b105-959b405e6106','Y','C_PaymentProcessor_ID','Payment processor for electronic payments','The Payment Processor indicates the processor to be used for electronic payments','Payment Processor','Y',TO_TIMESTAMP('2013-03-25 18:11:13','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2013-03-25 18:11:13','YYYY-MM-DD HH24:MI:SS'),100,0,'N','N','N')
;
-- Mar 25, 2013 6:11:16 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=210214 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Mar 25, 2013 6:11:21 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
ALTER TABLE C_BP_BankAccount ADD COLUMN C_PaymentProcessor_ID NUMERIC(10) DEFAULT NULL
;
-- Mar 25, 2013 6:11:53 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Description,Name,AD_Field_UU,IsDisplayed,IsFieldOnly,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',226,10,'N','N',210214,'Y',201894,'N','The Payment Processor indicates the processor to be used for electronic payments','D','Payment processor for electronic payments','Payment Processor','bb23275a-069d-4436-8af3-d612e42dd4e6','Y','N',100,0,TO_TIMESTAMP('2013-03-25 18:11:53','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2013-03-25 18:11:53','YYYY-MM-DD HH24:MI:SS'),'Y')
;
-- Mar 25, 2013 6:11:54 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=201894 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Mar 25, 2013 6:12:32 PM SGT
-- Ticket #1001984: Avoiding Payment profile ID mess
UPDATE AD_Field SET ColumnSpan=2, IsSameLine='Y', IsReadOnly='Y', XPosition=4,Updated=TO_TIMESTAMP('2013-03-25 18:12:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=201894
;
SELECT register_migration_script('201304021807_TICKET-1001984.sql') FROM dual
;

View File

@ -36,16 +36,16 @@ public class PaymentUtil {
private static final CLogger logger = CLogger.getCLogger(PaymentUtil.class);
public static MBPBankAccount[] getBankAccounts(MBPartner bpartner,
String creditCardNo) {
public static MBPBankAccount[] getBankAccounts(MBPartner bpartner, String creditCardNo, int C_PaymentProcessor_ID) {
ArrayList<MBPBankAccount> list = new ArrayList<MBPBankAccount>();
String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=? AND CREDITCARDNUMBER=? AND IsActive='Y' order by created";
String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=? AND CreditCardNumber=? AND C_PaymentProcessor_ID = ? AND IsActive='Y' ORDER BY Created";
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sql, bpartner.get_TrxName());
pstmt.setInt(1, bpartner.getC_BPartner_ID());
pstmt.setString(2, creditCardNo);
pstmt.setInt(3, C_PaymentProcessor_ID);
rs = pstmt.executeQuery();
while (rs.next())
list.add(new MBPBankAccount(bpartner.getCtx(), rs, bpartner

View File

@ -41,19 +41,6 @@ public interface I_C_BP_BankAccount
/** Load Meta Data */
/** Column name AccountNo */
public static final String COLUMNNAME_AccountNo = "AccountNo";
/** Set Account No.
* Account Number
*/
public void setAccountNo (String AccountNo);
/** Get Account No.
* Account Number
*/
public String getAccountNo();
/** Column name A_City */
public static final String COLUMNNAME_A_City = "A_City";
@ -80,42 +67,6 @@ public interface I_C_BP_BankAccount
*/
public String getA_Country();
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_User_ID */
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
/** Set User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID);
/** Get User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID();
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException;
/** Column name A_EMail */
public static final String COLUMNNAME_A_EMail = "A_EMail";
@ -207,6 +158,55 @@ public interface I_C_BP_BankAccount
*/
public String getA_Zip();
/** Column name AccountNo */
public static final String COLUMNNAME_AccountNo = "AccountNo";
/** Set Account No.
* Account Number
*/
public void setAccountNo (String AccountNo);
/** Get Account No.
* Account Number
*/
public String getAccountNo();
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name AD_User_ID */
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
/** Set User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID);
/** Get User/Contact.
* User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID();
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException;
/** Column name BankAccountType */
public static final String COLUMNNAME_BankAccountType = "BankAccountType";
@ -248,21 +248,6 @@ public interface I_C_BP_BankAccount
public org.compiere.model.I_C_Bank getC_Bank() throws RuntimeException;
/** Column name C_BPartner_ID */
public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID";
/** Set Business Partner .
* Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID);
/** Get Business Partner .
* Identifies a Business Partner
*/
public int getC_BPartner_ID();
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException;
/** Column name C_BP_BankAccount_ID */
public static final String COLUMNNAME_C_BP_BankAccount_ID = "C_BP_BankAccount_ID";
@ -285,6 +270,36 @@ public interface I_C_BP_BankAccount
/** Get C_BP_BankAccount_UU */
public String getC_BP_BankAccount_UU();
/** Column name C_BPartner_ID */
public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID";
/** Set Business Partner .
* Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID);
/** Get Business Partner .
* Identifies a Business Partner
*/
public int getC_BPartner_ID();
public org.compiere.model.I_C_BPartner getC_BPartner() 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();
public org.compiere.model.I_C_PaymentProcessor getC_PaymentProcessor() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";

View File

@ -546,44 +546,54 @@ public final class MPayment extends X_C_Payment
Trx trx = Trx.get(Trx.createTrxName("ppt-"), true);
MPaymentTransaction m_mPaymentTransaction = createPaymentTransaction(trx.getTrxName());
m_mPaymentTransaction.setIsApproved(approved);
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment))
m_mPaymentTransaction.setIsVoided(approved);
m_mPaymentTransaction.setProcessed(approved);
m_mPaymentTransaction.setC_Payment_ID(getC_Payment_ID());
m_mPaymentTransaction.saveEx();
MOnlineTrxHistory history = new MOnlineTrxHistory(getCtx(), 0, trx.getTrxName());
history.setAD_Table_ID(MPaymentTransaction.Table_ID);
history.setRecord_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
history.setIsError(!approved);
history.setProcessed(approved);
StringBuilder msg = new StringBuilder();
if (approved)
try
{
MPaymentTransaction m_mPaymentTransaction = createPaymentTransaction(trx.getTrxName());
m_mPaymentTransaction.setIsApproved(approved);
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment))
msg.append(getR_VoidMsg() + "\n");
else
m_mPaymentTransaction.setIsVoided(approved);
m_mPaymentTransaction.setProcessed(approved);
m_mPaymentTransaction.setC_Payment_ID(getC_Payment_ID());
m_mPaymentTransaction.saveEx();
MOnlineTrxHistory history = new MOnlineTrxHistory(getCtx(), 0, trx.getTrxName());
history.setAD_Table_ID(MPaymentTransaction.Table_ID);
history.setRecord_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
history.setIsError(!approved);
history.setProcessed(approved);
StringBuilder msg = new StringBuilder();
if (approved)
{
msg.append("Result: " + getR_Result() + "\n");
msg.append("Response Message: " + getR_RespMsg() + "\n");
msg.append("Reference: " + getR_PnRef() + "\n");
msg.append("Authorization Code: " + getR_AuthCode() + "\n");
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment))
msg.append(getR_VoidMsg() + "\n");
else
{
msg.append("Result: " + getR_Result() + "\n");
msg.append("Response Message: " + getR_RespMsg() + "\n");
msg.append("Reference: " + getR_PnRef() + "\n");
msg.append("Authorization Code: " + getR_AuthCode() + "\n");
}
}
else
msg.append("ERROR: " + getErrorMessage() + "\n");
msg.append("Transaction Type: " + getTrxType());
history.setTextMsg(msg.toString());
history.saveEx();
}
else
msg.append("ERROR: " + getErrorMessage() + "\n");
msg.append("Transaction Type: " + getTrxType());
history.setTextMsg(msg.toString());
history.saveEx();
if (trx != null)
catch (Exception e)
{
trx.commit();
trx.close();
log.log(Level.SEVERE, "processOnline", e);
setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNotProcessed") + ": " + e.getMessage());
}
finally
{
if (trx != null)
{
trx.commit();
trx.close();
}
}
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment))
@ -916,7 +926,7 @@ public final class MPayment extends X_C_Payment
*/
public boolean setPaymentProcessor ()
{
return setPaymentProcessor (getTenderType(), getCreditCardType());
return setPaymentProcessor (getTenderType(), getCreditCardType(), getC_PaymentProcessor_ID());
} // setPaymentProcessor
/**
@ -925,7 +935,7 @@ public final class MPayment extends X_C_Payment
* @param CCType CC Type see CC_
* @return true if found
*/
public boolean setPaymentProcessor (String tender, String CCType)
public boolean setPaymentProcessor (String tender, String CCType, int C_PaymentProcessor_ID)
{
m_mBankAccountProcessor = null;
// Get Processor List
@ -945,8 +955,11 @@ public final class MPayment extends X_C_Payment
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
if (bankAccountProcessor.accepts(tender, CCType))
{
m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break;
if (C_PaymentProcessor_ID == 0 || bankAccountProcessor.getC_PaymentProcessor_ID() == C_PaymentProcessor_ID)
{
m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break;
}
}
}
if (m_mBankAccountProcessor != null)

View File

@ -121,7 +121,7 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
public boolean setPaymentProcessor ()
{
return setPaymentProcessor (getTenderType(), getCreditCardType());
return setPaymentProcessor (getTenderType(), getCreditCardType(), getC_PaymentProcessor_ID());
}
/** Temporary Bank Account Processors */
@ -129,7 +129,7 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
/** Temporary Bank Account Processor */
private MBankAccountProcessor m_mBankAccountProcessor = null;
public boolean setPaymentProcessor (String tender, String CCType)
public boolean setPaymentProcessor (String tender, String CCType, int C_PaymentProcessor_ID)
{
m_mBankAccountProcessor = null;
// Get Processor List
@ -149,8 +149,11 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
MBankAccountProcessor bankAccountProcessor = m_mBankAccountProcessors[i];
if (bankAccountProcessor.accepts(tender, CCType))
{
m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break;
if (C_PaymentProcessor_ID == 0 || bankAccountProcessor.getC_PaymentProcessor_ID() == C_PaymentProcessor_ID)
{
m_mBankAccountProcessor = m_mBankAccountProcessors[i];
break;
}
}
}
if (m_mBankAccountProcessor != null)
@ -320,28 +323,39 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
{
Trx trx = Trx.get(Trx.createTrxName("ppt-"), true);
MPaymentTransaction m_mPaymentTransaction = copyFrom(this, new Timestamp(System.currentTimeMillis()), TRXTYPE_Void, getR_PnRef(), trx.getTrxName());
m_mPaymentTransaction.setIsApproved(false);
m_mPaymentTransaction.setIsVoided(false);
m_mPaymentTransaction.setIsDelayedCapture(false);
boolean ok = m_mPaymentTransaction.processOnline(get_TrxName());
m_mPaymentTransaction.setRef_PaymentTransaction_ID(getC_PaymentTransaction_ID());
m_mPaymentTransaction.saveEx();
if (trx != null)
boolean ok = false;
try
{
trx.commit();
trx.close();
MPaymentTransaction m_mPaymentTransaction = copyFrom(this, new Timestamp(System.currentTimeMillis()), TRXTYPE_Void, getR_PnRef(), trx.getTrxName());
m_mPaymentTransaction.setIsApproved(false);
m_mPaymentTransaction.setIsVoided(false);
m_mPaymentTransaction.setIsDelayedCapture(false);
ok = m_mPaymentTransaction.processOnline(get_TrxName());
m_mPaymentTransaction.setRef_PaymentTransaction_ID(getC_PaymentTransaction_ID());
m_mPaymentTransaction.saveEx();
if (ok)
{
setIsVoided(true);
setR_VoidMsg(m_mPaymentTransaction.getR_VoidMsg());
setRef_PaymentTransaction_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
}
else
setErrorMessage(m_mPaymentTransaction.getErrorMessage());
}
if (ok)
catch (Exception e)
{
setIsVoided(true);
setR_VoidMsg(m_mPaymentTransaction.getR_VoidMsg());
setRef_PaymentTransaction_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
log.log(Level.SEVERE, "voidOnlineAuthorizationPaymentTransaction", e);
setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNotProcessed") + ": " + e.getMessage());
}
finally
{
if (trx != null)
{
trx.commit();
trx.close();
}
}
else
setErrorMessage(m_mPaymentTransaction.getErrorMessage());
return ok;
}
@ -355,33 +369,44 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
{
Trx trx = Trx.get(Trx.createTrxName("ppt-"), true);
MPaymentTransaction m_mPaymentTransaction = copyFrom(this, new Timestamp(System.currentTimeMillis()), TRXTYPE_DelayedCapture, getR_PnRef(), trx.getTrxName());
m_mPaymentTransaction.setIsApproved(false);
m_mPaymentTransaction.setIsVoided(false);
m_mPaymentTransaction.setIsDelayedCapture(false);
if (C_Invoice_ID != 0)
m_mPaymentTransaction.setC_Invoice_ID(C_Invoice_ID);
boolean ok = m_mPaymentTransaction.processOnline(get_TrxName());
m_mPaymentTransaction.setRef_PaymentTransaction_ID(getC_PaymentTransaction_ID());
m_mPaymentTransaction.saveEx();
if (trx != null)
{
trx.commit();
trx.close();
}
if (ok)
boolean ok = false;
try
{
MPaymentTransaction m_mPaymentTransaction = copyFrom(this, new Timestamp(System.currentTimeMillis()), TRXTYPE_DelayedCapture, getR_PnRef(), trx.getTrxName());
m_mPaymentTransaction.setIsApproved(false);
m_mPaymentTransaction.setIsVoided(false);
m_mPaymentTransaction.setIsDelayedCapture(false);
if (C_Invoice_ID != 0)
setC_Invoice_ID(C_Invoice_ID);
setIsDelayedCapture(true);
setRef_PaymentTransaction_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
m_mPaymentTransaction.setC_Invoice_ID(C_Invoice_ID);
ok = m_mPaymentTransaction.processOnline(get_TrxName());
m_mPaymentTransaction.setRef_PaymentTransaction_ID(getC_PaymentTransaction_ID());
m_mPaymentTransaction.saveEx();
if (ok)
{
if (C_Invoice_ID != 0)
setC_Invoice_ID(C_Invoice_ID);
setIsDelayedCapture(true);
setRef_PaymentTransaction_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
}
else
setErrorMessage(m_mPaymentTransaction.getErrorMessage());
}
catch (Exception e)
{
log.log(Level.SEVERE, "delayCaptureOnlineAuthorizationPaymentTransaction", e);
setErrorMessage(Msg.getMsg(Env.getCtx(), "PaymentNotProcessed") + ": " + e.getMessage());
}
finally
{
if (trx != null)
{
trx.commit();
trx.close();
}
}
else
setErrorMessage(m_mPaymentTransaction.getErrorMessage());
return ok;
}

View File

@ -30,7 +30,7 @@ public class X_C_BP_BankAccount extends PO implements I_C_BP_BankAccount, I_Pers
/**
*
*/
private static final long serialVersionUID = 20121031L;
private static final long serialVersionUID = 20130325L;
/** Standard Constructor */
public X_C_BP_BankAccount (Properties ctx, int C_BP_BankAccount_ID, String trxName)
@ -39,8 +39,8 @@ public class X_C_BP_BankAccount extends PO implements I_C_BP_BankAccount, I_Pers
/** if (C_BP_BankAccount_ID == 0)
{
setA_Name (null);
setC_BPartner_ID (0);
setC_BP_BankAccount_ID (0);
setC_BPartner_ID (0);
setIsACH (false);
} */
}
@ -73,23 +73,6 @@ public class X_C_BP_BankAccount extends PO implements I_C_BP_BankAccount, I_Pers
return sb.toString();
}
/** Set Account No.
@param AccountNo
Account Number
*/
public void setAccountNo (String AccountNo)
{
set_Value (COLUMNNAME_AccountNo, AccountNo);
}
/** Get Account No.
@return Account Number
*/
public String getAccountNo ()
{
return (String)get_Value(COLUMNNAME_AccountNo);
}
/** Set Account City.
@param A_City
City or the Credit Card or Account Holder
@ -124,34 +107,6 @@ public class X_C_BP_BankAccount extends PO implements I_C_BP_BankAccount, I_Pers
return (String)get_Value(COLUMNNAME_A_Country);
}
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
{
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Account EMail.
@param A_EMail
Email Address
@ -279,6 +234,51 @@ public class X_C_BP_BankAccount extends PO implements I_C_BP_BankAccount, I_Pers
return (String)get_Value(COLUMNNAME_A_Zip);
}
/** Set Account No.
@param AccountNo
Account Number
*/
public void setAccountNo (String AccountNo)
{
set_Value (COLUMNNAME_AccountNo, AccountNo);
}
/** Get Account No.
@return Account Number
*/
public String getAccountNo ()
{
return (String)get_Value(COLUMNNAME_AccountNo);
}
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
{
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name)
.getPO(getAD_User_ID(), get_TrxName()); }
/** Set User/Contact.
@param AD_User_ID
User within the system - Internal or Business Partner Contact
*/
public void setAD_User_ID (int AD_User_ID)
{
if (AD_User_ID < 1)
set_Value (COLUMNNAME_AD_User_ID, null);
else
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
}
/** Get User/Contact.
@return User within the system - Internal or Business Partner Contact
*/
public int getAD_User_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** BankAccountType AD_Reference_ID=216 */
public static final int BANKACCOUNTTYPE_AD_Reference_ID=216;
/** Checking = C */
@ -363,34 +363,6 @@ public class X_C_BP_BankAccount extends PO implements I_C_BP_BankAccount, I_Pers
return ii.intValue();
}
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException
{
return (org.compiere.model.I_C_BPartner)MTable.get(getCtx(), org.compiere.model.I_C_BPartner.Table_Name)
.getPO(getC_BPartner_ID(), get_TrxName()); }
/** Set Business Partner .
@param C_BPartner_ID
Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BPartner_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get Business Partner .
@return Identifies a Business Partner
*/
public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Partner Bank Account.
@param C_BP_BankAccount_ID
Bank Account of the Business Partner
@ -428,6 +400,62 @@ public class X_C_BP_BankAccount extends PO implements I_C_BP_BankAccount, I_Pers
return (String)get_Value(COLUMNNAME_C_BP_BankAccount_UU);
}
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException
{
return (org.compiere.model.I_C_BPartner)MTable.get(getCtx(), org.compiere.model.I_C_BPartner.Table_Name)
.getPO(getC_BPartner_ID(), get_TrxName()); }
/** Set Business Partner .
@param C_BPartner_ID
Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_ValueNoCheck (COLUMNNAME_C_BPartner_ID, null);
else
set_ValueNoCheck (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get Business Partner .
@return Identifies a Business Partner
*/
public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
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)
.getPO(getC_PaymentProcessor_ID(), get_TrxName()); }
/** 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_Value (COLUMNNAME_C_PaymentProcessor_ID, null);
else
set_Value (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 Exp. Month.
@param CreditCardExpMM
Expiry Month