This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
using LiteCharms.Features.Abstractions;
|
||||
using LiteCharms.Features.Api;
|
||||
using LiteCharms.Features.Extensions;
|
||||
using LiteCharms.Features.MidrandBooks.Customers;
|
||||
using LiteCharms.Features.MidrandBooks.Payments;
|
||||
using LiteCharms.Features.MidrandBooks.Payments.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Products;
|
||||
using static LiteCharms.Features.Extensions.Api;
|
||||
|
||||
namespace MidrandBooksApi.Payments.Payfast;
|
||||
|
||||
[ApiVersionTarget(1)]
|
||||
public sealed class PayfastCheckoutEndpoint : IEndpoint
|
||||
{
|
||||
private static readonly ActivitySource PaymentActivitySource = new("MidrandBooksApi.Payments");
|
||||
|
||||
public void Map(IEndpointRouteBuilder builder)
|
||||
{
|
||||
builder.MapPost("payments/payfast/checkout", ([FromBody, Required] Cart shoppingCart, ProductService productService,
|
||||
PaymentService paymentService, PayfastService payfastService, CustomerService customerService, IJobOrchestrator jobOrchestrator,
|
||||
CancellationToken cancellationToken = default) =>
|
||||
{
|
||||
using Activity? activity = PaymentActivitySource.StartActivity("GeneratePayfastCheckoutUrl", ActivityKind.Server);
|
||||
|
||||
activity?.SetTag("messaging.system", "midrandbooks-api");
|
||||
activity?.SetTag("messaging.destination.name", "payments/payfast/checkout");
|
||||
|
||||
// do work
|
||||
|
||||
var checkoutUrl = string.Empty;
|
||||
|
||||
activity?.SetStatus(ActivityStatusCode.Ok);
|
||||
|
||||
return Results.Ok(checkoutUrl);
|
||||
})
|
||||
.RequireAuthorization()
|
||||
.WithDescription("Payfact checkout processor back-channel.")
|
||||
.WithName(typeof(PayfastCheckoutEndpoint).ToEndpointName())
|
||||
.MapToApiVersion(new ApiVersion(1))
|
||||
.Produces<string>(StatusCodes.Status200OK)
|
||||
.Produces(StatusCodes.Status400BadRequest)
|
||||
.Produces(StatusCodes.Status401Unauthorized)
|
||||
.WithTags(Api.Payments); ;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user