(20250225)

This commit is contained in:
2025-02-25 17:53:33 +05:30
parent b66843faf1
commit 7aea7e0270
3 changed files with 9 additions and 1 deletions
@@ -206,7 +206,8 @@ async def request_payment(
return ResponseModel( return ResponseModel(
status_code = StatusCodes.OK if response.success else StatusCodes.FAILED, status_code = StatusCodes.OK if response.success else StatusCodes.FAILED,
http_code = HttpCodes.SUCCESS if response.success else HttpCodes.INTERNAL_SERVER_ERROR, http_code = HttpCodes.SUCCESS if response.success else HttpCodes.INTERNAL_SERVER_ERROR,
message = response.message message = response.message,
data = {"paymentId": str(response.paymentId)}
) )
@@ -198,6 +198,7 @@ class SafaricomMPesaExpressPaymentsController(PaymentsController):
payment_request = payment_request, payment_request = payment_request,
tags = ["Payment", "Safaricom", "M-Pesa Express", "Kenya"] tags = ["Payment", "Safaricom", "M-Pesa Express", "Kenya"]
) )
result.paymentId = payment_id
# Initialize the third-party client: # Initialize the third-party client:
client_auth = MPesaExpressAuthorization( client_auth = MPesaExpressAuthorization(
@@ -263,6 +263,11 @@ class PGPaymentRequestData(BaseModel):
class PaymentRequestOneResult(BaseModel): class PaymentRequestOneResult(BaseModel):
paymentId: ObjectId | None = Field(
description = "the id of this payment's record",
default = None
)
success: bool = Field( success: bool = Field(
description = "whether, or not, the payment was successfully requested", description = "whether, or not, the payment was successfully requested",
default = False default = False
@@ -280,6 +285,7 @@ class PaymentRequestOneResult(BaseModel):
class Config: class Config:
extra = "forbid" extra = "forbid"
arbitrary_types_allowed = True
# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------