Fundraising/Data and flow/Pending transaction resolver

From Wikitech

Overview

Pending Transaction Resolver Activity diagram

The pending transaction resolver (PTR) is a job that takes care of donations which were left authorized but not captured at payments-wiki. This may be because the fraud score was high enough that we didn't immediately capture the donation, or because the donor didn't make it back from a processor's hosted page to payments-wiki.

Payments-wiki sends information about donation attempts to a 'pending' table, generally before redirecting donors to a hosted payment page. When a donation attempt definitively succeeds (payment captured) or fails (authorization rejected) we delete entries from this table. The rest of these attempts stay in the table until the PTR deals with them.

The PTR examines pending table entries one by one, first getting the latest status and examining the fraud scores. When fraud scores are below the review threshold, the PTR simply tries to capture the donation. Otherwise the PTR checks to see if the name and email in the pending row match an existing donor with no refunds (there is no time limit on donations or refunds). If they match, the PTR tries to capture the donation. In either case, the PTR will NOT try to capture a donation when the name and email match anyone with a successful donation in the past day.

Adyen

The Adyen resolver runs every 30 minutes with the job adyen_pending_resolver.yaml

The job calls cvapi PendingTable.consume version=4 gateway=adyen

Ingenico

The Ingenico resolver runs every 30 minutes with the job ingenico_pending_resolve.yaml

The job calls cvapi PendingTable.consume version=4 gateway=ingenico

Diagrams

Our diagrams on gitlab https://gitlab.wikimedia.org/repos/fundraising-tech/fr-tech-diagrams/-/tree/main/pending_transaction_resolver

Testing

drush cvapi PendingTable.consume version=4 gateway=adyen batch=1

This will run the resolver once locally.