Merge e579d7ef4fa5

This commit is contained in:
Heng Sin Low 2012-12-13 09:22:29 +08:00
commit e7d535adb0
2 changed files with 30 additions and 15 deletions

View File

@ -512,7 +512,7 @@ public final class MPayment extends X_C_Payment
// setErrorMessage(Msg.getMsg(getCtx(), msg));
// } else {
// Process if validation succeeds
approved = pp.processCC ();
approved = pp.processCC();
if (approved)
setErrorMessage(null);
@ -534,6 +534,9 @@ public final class MPayment extends X_C_Payment
if (approved)
{
setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
setDateTrx(new Timestamp(System.currentTimeMillis()));
setDateAcct(new Timestamp(System.currentTimeMillis()));
setProcessed(true); // prevent editing of payment details once approved
@ -730,6 +733,23 @@ public final class MPayment extends X_C_Payment
}
}
}
if (isProcessed())
{
if (getCreditCardNumber() != null)
{
String encrpytedCCNo = PaymentUtil.encrpytCreditCard(getCreditCardNumber());
if (!encrpytedCCNo.equals(getCreditCardNumber()))
setCreditCardNumber(encrpytedCCNo);
}
if (getCreditCardVV() != null)
{
String encrpytedCvv = PaymentUtil.encrpytCvv(getCreditCardVV());
if (!encrpytedCvv.equals(getCreditCardVV()))
setCreditCardVV(encrpytedCvv);
}
}
return true;
} // beforeSave
@ -2852,13 +2872,6 @@ public final class MPayment extends X_C_Payment
}
}
// clear out the cc data when a Void happens since at that point we won't need the card information any longer
if (getTenderType().equals(TENDERTYPE_CreditCard))
{
setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
}
if (getC_Invoice_ID() != 0)
{
MInvoice inv = new MInvoice(getCtx(), getC_Invoice_ID(), get_TrxName());

View File

@ -75,7 +75,12 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
protected boolean beforeSave(boolean newRecord)
{
if (getCreditCardVV() != null)
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
{
String encrpytedCvv = PaymentUtil.encrpytCvv(getCreditCardVV());
if (!encrpytedCvv.equals(getCreditCardVV()))
setCreditCardVV(encrpytedCvv);
}
return true;
}
@ -226,7 +231,9 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
// setErrorMessage(Msg.getMsg(getCtx(), msg));
// } else {
// Process if validation succeeds
approved = pp.processCC ();
approved = pp.processCC();
setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
setIsApproved(approved);
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment))
@ -319,8 +326,6 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
m_mPaymentTransaction.setIsDelayedCapture(false);
boolean ok = m_mPaymentTransaction.processOnline(get_TrxName());
m_mPaymentTransaction.setRef_PaymentTransaction_ID(getC_PaymentTransaction_ID());
// m_mPaymentTransaction.setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
// m_mPaymentTransaction.setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
m_mPaymentTransaction.saveEx();
if (trx != null)
@ -334,9 +339,6 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
setIsVoided(true);
setR_VoidMsg(m_mPaymentTransaction.getR_VoidMsg());
setRef_PaymentTransaction_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
// setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
// setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
}
else
setErrorMessage(m_mPaymentTransaction.getErrorMessage());