This commit is contained in:
@@ -54,13 +54,13 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LiteCharms.Features" Version="1.102.0" />
|
||||
<PackageReference Include="LiteCharms.Features" Version="1.115.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- UI -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ANM.Blazored.Toast" Version="0.1.1" />
|
||||
<PackageReference Include="LiteCharms.Features.MidrandBooks" Version="1.102.0" />
|
||||
<PackageReference Include="LiteCharms.Features.MidrandBooks" Version="1.115.0" />
|
||||
|
||||
<!-- Global Usings -->
|
||||
<Using Include="Blazored.Toast.Services" />
|
||||
|
||||
@@ -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); ;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,9 @@ builder.Services.AddQuartzSchedulerClient(MidrandShopSchedulerName, builder.Conf
|
||||
builder.Services.AddEmailServices(builder.Configuration);
|
||||
builder.Services.AddEmailServiceBus();
|
||||
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddShopServices();
|
||||
builder.Services.AddPayfastServices(builder.Configuration);
|
||||
builder.Services.AddHashServices(builder.Configuration);
|
||||
builder.Services.AddMidrandShopDatabase(builder.Configuration);
|
||||
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
{
|
||||
"LiteCharmsSettings": {
|
||||
"PayfastSettings": {
|
||||
"CheckoutUrl": "https://sandbox.payfast.co.za/eng/process",
|
||||
"ValidHosts": [
|
||||
"www.payfast.co.za",
|
||||
"sandbox.payfast.co.za",
|
||||
"w1w.payfast.co.za",
|
||||
"w2w.payfast.co.za",
|
||||
"ips.payfast.co.za",
|
||||
"api.payfast.co.za",
|
||||
"payment.payfast.io"
|
||||
]
|
||||
},
|
||||
"LiteCharmsSettings": {
|
||||
"Authority": "https://sts.security.khongisa.co.za",
|
||||
"Audience": "midrandbooks-api"
|
||||
},
|
||||
"ValidPayfastHosts": [
|
||||
"www.payfast.co.za",
|
||||
"sandbox.payfast.co.za",
|
||||
"w1w.payfast.co.za",
|
||||
"w2w.payfast.co.za",
|
||||
"ips.payfast.co.za",
|
||||
"api.payfast.co.za",
|
||||
"payment.payfast.io"
|
||||
],
|
||||
"HasherSettings": {
|
||||
"MinHashLength": 11
|
||||
},
|
||||
@@ -22,7 +25,6 @@
|
||||
"CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za"
|
||||
},
|
||||
"Monitoring": {
|
||||
"ApiKey": "",
|
||||
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
||||
"ServiceName": "MidrandBooks.DEV"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user