Hello!
ZenCart 1.5.6c
PHP 5.6.40 (I know...)
Quick summary:
- Paypal WPP French translation is breaking Paypal Express confirmation => easy fix below
- Transactions rejected as duplicates by Paypal Express appear successful in ZC => I don't have a fix for that
After successfully upgrading to ZC1.5.6c + utf8mb4 to support emojis, I made a quick Paypal Express live purchase and it failed this way:
- Create Cart
- Proceed to purchase using Paypal Express
- Transaction is a success
- Paypal table is not updated on: PHP Fatal error: 1406: Data too long for column 'payment_type' at row 1 :: INSERT INTO paypal
- User is not sent back to the purchase confirmation page (WARNING: An Error occurred, please refresh the page and try again.)
Indeed the payment_type is using define('MODULE_PAYMENT_PAYPALWPP_EC_TEXT_TYPE', 'Encaissement avec PayPal Expresst'); found in /includes/languages/french/modules/payment/paypalwpp.php and the resulting field was Encaissement avec PayPal Expresst which is then concatenated with (instant) and ends up at 42 characters when the table only allows 40.
I trimmed the translation (and fixed the typo) to PayPal Express (instant), inserted the missing paypal table entry manually and the world was in balance again.
BEFORE:
ZC Order -> OK
Paypal Payment -> OK
Paypal ZC update -> Failed
AFTER:
ZC Order -> OK
Paypal Payment -> OK
Paypal ZC update -> OK (manually)
Then I tried again Paypal Express to validate the fix. This is where it gets a little more complicated.
- Cart was still alive from previous attempt
- Modified the cart (remove/add a different item) but SAME global price
- Validate purchase choosing Paypal
- I reached the successful purchase page WITHOUT CONFIRMING Paypal payment => Basically I never saw the Paypal popup
- ZC thinks the transaction is a success (order+Paypal) but there is no Paypal payment
This is the return from Paypal (selected lines):
ZC Order -> OK (but it shouldn't)Code:Mar-12-2021 15:23:42 (1615559022) before_process - EC-5 resultset: Array ( [TOKEN] => EC-2EX728800F188990X [SUCCESSPAGEREDIRECTREQUESTED] => false [TIMESTAMP] => 2021-03-12T14:23:41Z [ACK] => SuccessWithWarning [VERSION] => 124.0 [BUILD] => 55384336 [L_ERRORCODE0] => 11607 [L_SHORTMESSAGE0] => Duplicate Request [L_LONGMESSAGE0] => A successful transaction has already been completed for this token. [L_SEVERITYCODE0] => Warning [PAYMENTINFO_0_TRANSACTIONTYPE] => cart [PAYMENTINFO_0_PAYMENTTYPE] => instant [PAYMENTINFO_0_ORDERTIME] => 2021-03-12T13:52:11Z [PAYMENTINFO_0_AMT] => 2.50 [PAYMENTINFO_0_FEEAMT] => 0.42 [PAYMENTINFO_0_TAXAMT] => 0.00 [PAYMENTINFO_0_CURRENCYCODE] => EUR [PAYMENTINFO_0_PAYMENTSTATUS] => Completed [PAYMENTINFO_0_PENDINGREASON] => None [PAYMENTINFO_0_REASONCODE] => None [PAYMENTINFO_0_ERRORCODE] => 0 [PAYMENTINFO_0_ACK] => Success [CURL_ERRORS] => )
Paypal Payment -> Failed (SuccessWithWarning)
Paypal ZC update -> OK (but it shouldn't)
So it seems that there was 2 issues:
1/ ZenCart kept the same CART ID even though it had been modified (a left-over from the failed paypal insertion that seems to be preceding the cart validation/deletion)
2/ Paypal gently DENIES the transaction but this send a "SuccessWithWarning" thinking it was really the same transaction and acknowledging the success of the PREVIOUS one
Note that Paypal also offers a setting in the Pro Seller's page to either accept or reject payments that seem to be duplicates.
By default it was on "reject", it has been updated to "accept" but I haven't tested that yet.
Julien


Reply With Quote
