Page MenuHomePhabricator

Smashpig recurring job (for Adyen at least) is saving the capture ID as the gateway transaction ID instead of the authorise ID
Open, Needs TriagePublic4 Estimated Story Points

Description

Lots of confusing ID names for this one

From the:

  • Adyen audit failure investigation T306194
  • Adyen audit parser finding lots of missing files T306631
  • fix Adyen audit as much as possible T297856

ID definitions:
Authorise ID - the ID we get back from Adyen on the authorise call. Adyen calls this Payment in the console as well as the PSP Reference
Capture ID - the ID we back from Adyen on the capture call. Adyen calls this Capture in the console
Transaction ID - the ID we store in trxn_id of civicrm_contribution, this shows up in civi when you click on a donation
Gateway Transaction ID - the ID we store in gateway_txn_id in wmf_contribution_extra

Adyen recurring payments charged by the SmashPig charge job are saving the Capture ID to the transaction/gateway transaction ID in civi instead of the Authorise ID. Example below:

Test initial monthly donation from the Adyen console 17.1:
Authorise ID - WT9HTK7MJMK2WN82
Capture ID - HZQ9V7C988NKGK82
Transaction ID - RECURRING ADYEN WT9HTK7MJMK2WN82
Gateway Transaction ID - WT9HTK7MJMK2WN82

Second Charge of that donation 17.2:
Authorise ID - LMBZPNX2PSGLNK82
Capture ID - S5VN2STFWTTFWR82
Transaction ID - RECURRING ADYEN S5VN2STFWTTFWR82
Gateway Transaction ID - S5VN2STFWTTFWR82

This is causing the audit to not be able to find the donations in civi as its using the Psp Reference column in the file that has the Authorise ID in it but the Capture ID is saved in civi. The Capture ID is in the audit file under the column Modification Reference.

I have two bandaid patches here that tell the audit parser to look at the Modification Reference and use that to look up if the donation is already in civi:
https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/SmashPig/+/786373
https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/crm/+/786390

The real fix is to stop the flipping in the recurring processor where it's saving the capture ID instead of the authorise ID. I think its happening on line 95 in the doPayment function of SmashPig.php.

Also backfill the data, if we can look up the Authorise ID from the Capture ID and correct the donations in civi.