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.
Description
Description
Details
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Stop AstroPay failmail related to dLocal test IPNs | wikimedia/fundraising/SmashPig | master | +47 -0 |
Event Timeline
Comment Actions
Change 904622 had a related patch set uploaded (by Jgleeson; author: Jgleeson):
[wikimedia/fundraising/SmashPig@master] Stop AstroPay failmail related to dLocal test IPNs
Comment Actions
To test:
- Pull down https://gerrit.wikimedia.org/r/904622
- From Postman, make a POST request to http://localhost:9006/astropay using the body contents:
{"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.
Comment Actions
Change 904622 merged by jenkins-bot:
[wikimedia/fundraising/SmashPig@master] Stop AstroPay failmail related to dLocal test IPNs