When doing credit card authorization for orders, if you do a regular credit card order using Authorize only, and quickly do a second order, the wrong payment information will be written into the Salesforce order.
In the file:
cartridges/int_cybs_sfra_base/cartridge/scripts/hooks/payment/processor/payments_credit.js
At line 264, we read/copy the value of session.privacy.encryptedDataGP
gPayToken: session.privacy.encryptedDataGP
Then two things happen. The session value is set to blank ('') on line 267:
session.privacy.encryptedDataGP = '';
and we test the value we read on line 264 on line 284:
if (card.gPayToken === null) {
Notice the difference ? We're setting it to blank, but testing against null. If we re-enter this code, the test on line 284 fails (blank is not null, so a different value is written to the paymentInstrument.paymentTransaction.custom.paymentDetails part of the order.
Other places in the code that read the session.privacy.encryptedDataGP value test it as:
if (empty(session.privacy.encryptedDataGP))
Howdy,
When doing credit card authorization for orders, if you do a regular credit card order using Authorize only, and quickly do a second order, the wrong payment information will be written into the Salesforce order.
In the file: cartridges/int_cybs_sfra_base/cartridge/scripts/hooks/payment/processor/payments_credit.js
At line 264, we read/copy the value of
session.privacy.encryptedDataGP
Then two things happen. The
session
value is set to blank (''
) on line 267:and we test the value we read on line 264 on line 284:
Notice the difference ? We're setting it to blank, but testing against null. If we re-enter this code, the test on line 284 fails (blank is not null, so a different value is written to the
paymentInstrument.paymentTransaction.custom.paymentDetails
part of the order.Other places in the code that read the
session.privacy.encryptedDataGP
value test it as:if (empty(session.privacy.encryptedDataGP))
I think the correct fix is to update line 284 https://github.com/CyberSource/cybersource-plugins-rest-salesforceb2ccommerce/blob/85de8efb3f900445c830c7a826a028725de28b3c/cartridges/int_cybs_sfra_base/cartridge/scripts/hooks/payment/processor/payments_credit.js#L284 to test if the
card.gPayToken
isempty
and NOT test if it isnull