feat: let production select Mercado Pago and acknowledge simulated notifications
The production compose hard-coded the fake payment adapter; it now takes PAYMENT_ADAPTER and the MP_* settings from the stack's environment, so the sandbox can run with test credentials. A signed notification about a payment Mercado Pago does not have, such as the panel's "Simular notificação", is acknowledged instead of answering 500 and being retried; any other lookup failure still raises. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -134,7 +134,15 @@ class MercadoPagoPayment:
|
||||
payment_id = str((query or {}).get('data.id') or (data.get('data') or {}).get('id') or '')
|
||||
if not payment_id.isdigit():
|
||||
return None
|
||||
payment = self.lookup(payment_id)
|
||||
try:
|
||||
payment = self.lookup(payment_id)
|
||||
except httpx.HTTPStatusError as error:
|
||||
# Signed by Mercado Pago but about no payment of ours, such as the
|
||||
# panel's "Simular notificação". Anything else is raised so that a
|
||||
# real notification is retried.
|
||||
if error.response.status_code == 404:
|
||||
return None
|
||||
raise
|
||||
return event_from_payment(payment, notification_id=str(data.get('id', '')))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user