Page MenuHomePhabricator

Trustly ACH recurring (gravy) that are cancelled on the donors end are breaking the charge job
Closed, ResolvedPublic

Description

Three of these happened 2024-12-20:

invoice_id : 222102261.2
gravy id: 0826a7f9-70ac-4b4b-8ace-dea4d9075d7e

/var/log/process-control/recurring_smashpig_charge/recurring_smashpig_charge-20241220-102101.log
2024-12-20 10:25:14,095 ERROR civicrm.wmf.INFO: Error: 1000009 invoice_id:222102261.2
2024-12-20 10:25:14,096 ERROR WD php: Error: Object of class [error]
2024-12-20 10:25:14,096 ERROR SmashPig\PaymentProviders\Responses\ApprovePaymentResponse could not
2024-12-20 10:25:14,096 ERROR be converted to string in
2024-12-20 10:25:14,096 ERROR CRM_Core_Payment_SmashPigRecurringProcessor->createActivity() (line
2024-12-20 10:25:14,096 ERROR 372 of
2024-12-20 10:25:14,096 ERROR /srv/org.wikimedia.civicrm/drupal/sites/default/civicrm/extensions/org.wikimedia.smashpig/CRM/Core/Payment/SmashPigRecurringProcessor.php).
2024-12-20 10:25:14,097 INFO Error: Object of class SmashPig\PaymentProviders\Responses\ApprovePaymentResponse could not be converted to string in CRM_Core_Payment_SmashPigRecurringProcessor->createActivity() (line 372 of /srv/org.wikimedia.civicrm/drupal/sites/default/civicrm/extensions/org.wikimedia.smashpig/CRM/Core/Payment/SmashPigRecurringProcessor.php).
2024-12-20 10:25:14,097 ERROR Drush command terminated abnormally due to an unrecoverable error. [error]

2 Failed the inital recurring setup, and then when we tried to charge the token we got the error splitToken is not valid
1 Had the inital go through but the donor cancelled it on their end after that we got the error canceled_payment_method

This is due to the ACH flow where we put them all in civi first then figure out if they succeed/fail

Event Timeline

AKanji-WMF moved this task from Triage to DRI Backlog on the Fundraising-Backlog board.

I cancelled the 4 that got stuck in Processing

We had another set today, most of the ones I've seen follow a pattern:

The theory is:

  • Donor put in a transaction and sets up recurring
  • Along the way the payment method was cancelled (either by Trustly or the donor)
  • Civi did not acknowledge the canceled payment method and tries to charge the saved token. This leads to the error "Invalid split token"

I believe the solution would be to:

  • Listen to cancel payment method messages and cancel recurring records. From the logs, gravy has not been sending a cancel payment method message. We only have the payment error response for alerting, we could use this payment error to cancel a recurring row.
  • Given we save ACH transactions before they're settled, we should cancel the recurring record and set contribution to failed/chargeback when ACH the authorization or capture fails.

Change #1113602 had a related patch set uploaded (by Cstone; author: Cstone):

[wikimedia/fundraising/crm@master] WIP: Create getErrorMesageText and test Also fix it to handle ApprovePaymentMethod

https://gerrit.wikimedia.org/r/1113602

Change #1114677 had a related patch set uploaded (by Jgleeson; author: Jgleeson):

[wikimedia/fundraising/crm@master] Add small guard clause to getErrorText() to handle broken input.

https://gerrit.wikimedia.org/r/1114677

Change #1113602 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Create getErrorText and test Also fix it to handle ApprovePaymentMethod

https://gerrit.wikimedia.org/r/1113602

Change #1114677 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Add small guard clause to getErrorText() to handle broken input.

https://gerrit.wikimedia.org/r/1114677

XenoRyet set Final Story Points to 4.