IDEMPIERE-60 - Bizidium must not save credit card number

This commit is contained in:
Elaine Tan 2012-12-12 15:41:01 +08:00
parent a5adac4806
commit 3607328a7b
2 changed files with 30 additions and 15 deletions

View File

@ -534,6 +534,9 @@ public final class MPayment extends X_C_Payment
if (approved) if (approved)
{ {
setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
setDateTrx(new Timestamp(System.currentTimeMillis())); setDateTrx(new Timestamp(System.currentTimeMillis()));
setDateAcct(new Timestamp(System.currentTimeMillis())); setDateAcct(new Timestamp(System.currentTimeMillis()));
setProcessed(true); // prevent editing of payment details once approved setProcessed(true); // prevent editing of payment details once approved
@ -731,6 +734,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; return true;
} // beforeSave } // 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) if (getC_Invoice_ID() != 0)
{ {
MInvoice inv = new MInvoice(getCtx(), getC_Invoice_ID(), get_TrxName()); 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) protected boolean beforeSave(boolean newRecord)
{ {
if (getCreditCardVV() != null) if (getCreditCardVV() != null)
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV())); {
String encrpytedCvv = PaymentUtil.encrpytCvv(getCreditCardVV());
if (!encrpytedCvv.equals(getCreditCardVV()))
setCreditCardVV(encrpytedCvv);
}
return true; return true;
} }
@ -227,6 +232,8 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
// } else { // } else {
// Process if validation succeeds // Process if validation succeeds
approved = pp.processCC(); approved = pp.processCC();
setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
setIsApproved(approved); setIsApproved(approved);
if(getTrxType().equals(TRXTYPE_Void) || getTrxType().equals(TRXTYPE_CreditPayment)) 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); m_mPaymentTransaction.setIsDelayedCapture(false);
boolean ok = m_mPaymentTransaction.processOnline(get_TrxName()); boolean ok = m_mPaymentTransaction.processOnline(get_TrxName());
m_mPaymentTransaction.setRef_PaymentTransaction_ID(getC_PaymentTransaction_ID()); m_mPaymentTransaction.setRef_PaymentTransaction_ID(getC_PaymentTransaction_ID());
// m_mPaymentTransaction.setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
// m_mPaymentTransaction.setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
m_mPaymentTransaction.saveEx(); m_mPaymentTransaction.saveEx();
if (trx != null) if (trx != null)
@ -334,9 +339,6 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
setIsVoided(true); setIsVoided(true);
setR_VoidMsg(m_mPaymentTransaction.getR_VoidMsg()); setR_VoidMsg(m_mPaymentTransaction.getR_VoidMsg());
setRef_PaymentTransaction_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID()); setRef_PaymentTransaction_ID(m_mPaymentTransaction.getC_PaymentTransaction_ID());
// setCreditCardNumber(PaymentUtil.encrpytCreditCard(getCreditCardNumber()));
// setCreditCardVV(PaymentUtil.encrpytCvv(getCreditCardVV()));
} }
else else
setErrorMessage(m_mPaymentTransaction.getErrorMessage()); setErrorMessage(m_mPaymentTransaction.getErrorMessage());