Page MenuHomePhabricator

Stop AstroPay failmail related to dLocal test IPNs
Closed, ResolvedPublic

Description

The Astropay Listener is receiving a steady flow of new-style IPNs from dLocal servers. This was an accident on the dLocal side, but unfortunately, these failed requests are retried multiple times an hour for the next seven days if they do not receive a HTTP 200 response. Let's quiet these down by detecting the affected IPNs and serving them a 200 response. This code is temporary and will need to be removed once the failmails quiet down.

Event Timeline

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

[wikimedia/fundraising/SmashPig@master] Stop AstroPay failmail related to dLocal test IPNs

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

To test:

{"id":"R-648-d5f8928d-20c7-4726-ba22-22859b063efb","amount":100_00,"status":"REJECTED","status_detail":"The_payment_was_rejected_","status_code":"300","currency":"INR","country":"IN","payment_method_id":"UI","payment_method_type":"BANK_TRANSFER","payment_method_flow":"REDIRECT","payer":{"name":"mpbnetgQ_eonocGVo","user_reference":"","email":"pqqdg73bwuf1-autest@dlocal_com","phone":"9908234561","document":"110800934215","address":{"city":"Kathoowas","zip_code":"301704","street":"Kathoowas","empty":false}},"order_id":"dLocalTest-21a06c99-0567-47a9-a105-3ab52c26dedb","description":"Wikimedia_Foundation","notification_url":"https://payments-listener_wikimedia_org/astropay","callback_url":"https://payments_wikimedia_org/index_php?title":"Special:AstropayGatewayResult","created_date":"2023-03-29T02:58:59.000 0000"}

Note: the invalid JSON body is taken verbatim from the logs. It uses '_' as a separator in the amount parameter. e.g. "amount":100_00, but the code fix doesn't care about this as it doesn't decode the JSON. Instead, it pattern matches and extracts the "id" parameter, which is used to compare against the known affected payment IDs.

Change 904622 merged by jenkins-bot:

[wikimedia/fundraising/SmashPig@master] Stop AstroPay failmail related to dLocal test IPNs

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

XenoRyet set Final Story Points to 2.