From d9236975064f4a971a47f41bed432a1e8a7dfe4c Mon Sep 17 00:00:00 2001 From: khushal Date: Tue, 17 Dec 2024 14:07:46 +0530 Subject: [PATCH] (20241217) Capturing IP Addrs for payment events (callback) now. --- api/blueprints/finstitutions/payments/callback.py | 1 + models/core/payment.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/api/blueprints/finstitutions/payments/callback.py b/api/blueprints/finstitutions/payments/callback.py index 439e511..600956a 100644 --- a/api/blueprints/finstitutions/payments/callback.py +++ b/api/blueprints/finstitutions/payments/callback.py @@ -214,6 +214,7 @@ async def safaricom_m_pesa_express_callback( paymentStatus = relevant_code["status"], message = relevant_code["message"], initByPG = True, + ipAddr = inbound_headers["Remote-IP"], httpCode = None, headers = inbound_headers, payload = inbound_data diff --git a/models/core/payment.py b/models/core/payment.py index 4610e9c..21b07a4 100644 --- a/models/core/payment.py +++ b/models/core/payment.py @@ -168,6 +168,12 @@ class PaymentEvent(BaseModel): frozen = True ) + ipAddr: str | None = Field( + description = "if initiated by the payment gateway, what ip addr did this request come from", + frozen = True, + default = None + ) + httpCode: int | None = Field( description = "the http code generated by the event", frozen = True,