From fc2f457add891fc232022e5630c1af77137b8422 Mon Sep 17 00:00:00 2001 From: Khwezi Mngoma Date: Tue, 2 Jun 2026 08:10:30 +0200 Subject: [PATCH] Refactored endpoint --- .../Payments/Endpoints/ConfirmationEndpoint.cs | 2 +- MidrandBooksApi/Properties/launchSettings.json | 2 +- MidrandBooksApi/http/app.http | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 MidrandBooksApi/http/app.http diff --git a/MidrandBooksApi/Payments/Endpoints/ConfirmationEndpoint.cs b/MidrandBooksApi/Payments/Endpoints/ConfirmationEndpoint.cs index f250c5a..f4aa481 100644 --- a/MidrandBooksApi/Payments/Endpoints/ConfirmationEndpoint.cs +++ b/MidrandBooksApi/Payments/Endpoints/ConfirmationEndpoint.cs @@ -12,7 +12,7 @@ public sealed class ConfirmationEndpoint : IEndpoint public void Map(IEndpointRouteBuilder builder) { - builder.MapPost("payments/confirm", async (HttpRequest request, HashService hashService, + builder.MapPost("payments/payfast/confirm", async (HttpRequest request, HashService hashService, IJobOrchestrator jobOrchestrator, CancellationToken cancellationToken) => { using Activity? activity = PaymentActivitySource.StartActivity("ReceivePayfastWebhook", ActivityKind.Server); diff --git a/MidrandBooksApi/Properties/launchSettings.json b/MidrandBooksApi/Properties/launchSettings.json index e2d88db..dd9e1c7 100644 --- a/MidrandBooksApi/Properties/launchSettings.json +++ b/MidrandBooksApi/Properties/launchSettings.json @@ -13,7 +13,7 @@ "https": { "commandName": "Project", "dotnetRunMessages": true, - "launchBrowser": false, + "launchBrowser": false, "applicationUrl": "https://localhost:7196;http://localhost:5159", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/MidrandBooksApi/http/app.http b/MidrandBooksApi/http/app.http new file mode 100644 index 0000000..7297a16 --- /dev/null +++ b/MidrandBooksApi/http/app.http @@ -0,0 +1,8 @@ +## Payfast Payment Confirmation +# This endpoint is used by Payfast to confirm the payment status of a transaction. +# It receives a POST request with the payment details and updates the order status accordingly. + +POST {{baseUrl}}/v1/payments/payfast/confirm +Content-Type: application/x-www-form-urlencoded + +amount={{amount}}&item_name={{item_name}}&m_payment_id={{paymentId}}&signature={{signature}}