Skip to Content
0
Former Member
Aug 02, 2016 at 03:50 PM

Why does cart restoration strategy clear payment transactions?

118 Views

I was wondering why does the default commerce cart restoraiton strategy remove all payment transactions whenever the cart is restored? Is there a special intent for that? I am running into a situation, where it would be useful to store payment transaction and was wondering if there is any risk customising this piece of code.

 cartModel.setCalculated(Boolean.FALSE);
 if (!cartModel.getPaymentTransactions().isEmpty())
 {
     // clear payment transactions
     clearPaymentTransactionsOnCart(cartModel);
     // reset guid since its used as a merchantId for payment subscriptions and is a base id for generating PaymentTransaction.code
     cartModel.setGuid(getGuidKeyGenerator().generate().toString());
 }