Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1039f6f2d5 | |||
| 765eee2060 | |||
| ee250a18f0 | |||
| 5972f8906b | |||
| b90c6381a0 | |||
| c65398bdf6 | |||
| 2958ca8c00 | |||
| e546b3e7ff |
@@ -54,13 +54,13 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="LiteCharms.Features" Version="1.102.0" />
|
<PackageReference Include="LiteCharms.Features" Version="1.115.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- UI -->
|
<!-- UI -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ANM.Blazored.Toast" Version="0.1.1" />
|
<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 -->
|
<!-- Global Usings -->
|
||||||
<Using Include="Blazored.Toast.Services" />
|
<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); ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -25,10 +25,6 @@ public sealed class PayfastConfirmationEndpoint : IEndpoint
|
|||||||
|
|
||||||
string? remoteIp = request.HttpContext.Connection.RemoteIpAddress?.ToString();
|
string? remoteIp = request.HttpContext.Connection.RemoteIpAddress?.ToString();
|
||||||
|
|
||||||
var ipValidation = await payfastService.ValidateReferrerIpAsync(remoteIp!, !hostEnvironment.IsProduction(), cancellationToken);
|
|
||||||
|
|
||||||
if (ipValidation.IsFailed || !ipValidation.Value) return Results.Unauthorized();
|
|
||||||
|
|
||||||
var formCollection = await request.ReadFormAsync(cancellationToken);
|
var formCollection = await request.ReadFormAsync(cancellationToken);
|
||||||
|
|
||||||
if (!formCollection.TryGetValue("signature", out var signatureValues) || string.IsNullOrWhiteSpace(signatureValues.ToString()))
|
if (!formCollection.TryGetValue("signature", out var signatureValues) || string.IsNullOrWhiteSpace(signatureValues.ToString()))
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ builder.Services.AddQuartzSchedulerClient(MidrandShopSchedulerName, builder.Conf
|
|||||||
builder.Services.AddEmailServices(builder.Configuration);
|
builder.Services.AddEmailServices(builder.Configuration);
|
||||||
builder.Services.AddEmailServiceBus();
|
builder.Services.AddEmailServiceBus();
|
||||||
|
|
||||||
|
builder.Services.AddHttpClient();
|
||||||
builder.Services.AddShopServices();
|
builder.Services.AddShopServices();
|
||||||
|
builder.Services.AddPayfastServices(builder.Configuration);
|
||||||
builder.Services.AddHashServices(builder.Configuration);
|
builder.Services.AddHashServices(builder.Configuration);
|
||||||
builder.Services.AddMidrandShopDatabase(builder.Configuration);
|
builder.Services.AddMidrandShopDatabase(builder.Configuration);
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
{
|
{
|
||||||
|
"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": {
|
"LiteCharmsSettings": {
|
||||||
"Authority": "https://sts.security.khongisa.co.za",
|
"Authority": "https://sts.security.khongisa.co.za",
|
||||||
"Audience": "midrandbooks-api"
|
"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": {
|
"HasherSettings": {
|
||||||
"MinHashLength": 11
|
"MinHashLength": 11
|
||||||
},
|
},
|
||||||
@@ -22,7 +25,6 @@
|
|||||||
"CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za"
|
"CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za"
|
||||||
},
|
},
|
||||||
"Monitoring": {
|
"Monitoring": {
|
||||||
"ApiKey": "",
|
|
||||||
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
|
||||||
"ServiceName": "MidrandBooks.DEV"
|
"ServiceName": "MidrandBooks.DEV"
|
||||||
},
|
},
|
||||||
|
|||||||
+21
-10
@@ -19,13 +19,12 @@ data:
|
|||||||
BookshopS3Settings__Region: "garage"
|
BookshopS3Settings__Region: "garage"
|
||||||
BookshopS3Settings__BucketName: "bookshop"
|
BookshopS3Settings__BucketName: "bookshop"
|
||||||
BookshopS3Settings__CdnBaseUrl: "https://bookshop.cdn.khongisa.co.za"
|
BookshopS3Settings__CdnBaseUrl: "https://bookshop.cdn.khongisa.co.za"
|
||||||
ValidPayfastHosts__0: "www.payfast.co.za"
|
PayfastSettings__CheckoutUrl: "https://sandbox.payfast.co.za/eng/process"
|
||||||
ValidPayfastHosts__1: "sandbox.payfast.co.za"
|
PayfastSettings__ValidHosts__0: "www.payfast.co.za"
|
||||||
ValidPayfastHosts__2: "w1w.payfast.co.za"
|
PayfastSettings__ValidHosts__1: "sandbox.payfast.co.za"
|
||||||
ValidPayfastHosts__3: "w2w.payfast.co.za"
|
PayfastSettings__ValidHosts__2: "ips.payfast.co.za"
|
||||||
ValidPayfastHosts__4: "ips.payfast.co.za"
|
PayfastSettings__ValidHosts__3: "api.payfast.co.za"
|
||||||
ValidPayfastHosts__5: "api.payfast.co.za"
|
PayfastSettings__ValidHosts__4: "payment.payfast.io"
|
||||||
ValidPayfastHosts__6: "payment.payfast.io"
|
|
||||||
LiteCharmsSettings__Authority: "https://sts.security.khongisa.co.za"
|
LiteCharmsSettings__Authority: "https://sts.security.khongisa.co.za"
|
||||||
LiteCharmsSettings__Audience: "midrandbooks-api"
|
LiteCharmsSettings__Audience: "midrandbooks-api"
|
||||||
---
|
---
|
||||||
@@ -40,11 +39,13 @@ data:
|
|||||||
connection-string-quartz: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPXNjaGVkdWxlci1kZXY7VXNlcm5hbWU9c2NoZWR1bGVyLWRldi11c2VyO1Bhc3N3b3JkPWtWVm1vV0tKM3h6Z1FYO1BlcnNpc3QgU2VjdXJpdHkgSW5mbz1UcnVl
|
connection-string-quartz: SG9zdD0xOTIuMTY4LjEuMTcwO0RhdGFiYXNlPXNjaGVkdWxlci1kZXY7VXNlcm5hbWU9c2NoZWR1bGVyLWRldi11c2VyO1Bhc3N3b3JkPWtWVm1vV0tKM3h6Z1FYO1BlcnNpc3QgU2VjdXJpdHkgSW5mbz1UcnVl
|
||||||
aspire-apikey: bWMzRzYzSzJqNVpPRXNpMEFqTW9qTFRYbTFLRVpGY3R6SUlqU3dEaVRHdXQ4cUdTa1B1V3d4R1AxUmJzY0pVbw==
|
aspire-apikey: bWMzRzYzSzJqNVpPRXNpMEFqTW9qTFRYbTFLRVpGY3R6SUlqU3dEaVRHdXQ4cUdTa1B1V3d4R1AxUmJzY0pVbw==
|
||||||
hasher-salt: VEdsbmFIUWdRMmhoY20xekxDQk5hV1J5WVc1a1FtOXZhM01nYldGclpTQnNiM1J6SUc5bUlHMXZibVY1SUdGdVpDQmhjbVVnWVNCemRXTmpaWE56Wm5Wc0lIWnBjbUZzSUhOMGIzSjVJR2x1SUZOdmRYUm9JRUZtY21sallRPT0=
|
hasher-salt: VEdsbmFIUWdRMmhoY20xekxDQk5hV1J5WVc1a1FtOXZhM01nYldGclpTQnNiM1J6SUc5bUlHMXZibVY1SUdGdVpDQmhjbVVnWVNCemRXTmpaWE56Wm5Wc0lIWnBjbUZzSUhOMGIzSjVJR2x1SUZOdmRYUm9JRUZtY21sallRPT0=
|
||||||
hasher-payfastpassphrase: OUdBSVIwdFdwaFgwcU8=
|
|
||||||
bookshop-s3-accesskey: R0s1MTRkMmNlOGRjNjkyMzdhMDVjMDFlZWY=
|
bookshop-s3-accesskey: R0s1MTRkMmNlOGRjNjkyMzdhMDVjMDFlZWY=
|
||||||
bookshop-s3-secretkey: ZWFhZmVkYTFhZWQ0MDllY2ZlNjA3MTRlY2RhNTQ5YjgyYmRmNWEzZGFmOWYxOGRkNjFmNjZiNDk3M2E2NDgyZQ==
|
bookshop-s3-secretkey: ZWFhZmVkYTFhZWQ0MDllY2ZlNjA3MTRlY2RhNTQ5YjgyYmRmNWEzZGFmOWYxOGRkNjFmNjZiNDk3M2E2NDgyZQ==
|
||||||
litecharms-clientid: bWlkcmFuZGJvb2tzLWFwaQ==
|
litecharms-clientid: bWlkcmFuZGJvb2tzLWFwaQ==
|
||||||
litecharms-clientsecret: c2VjcmV0X2YzZjA0YWNhYTMzNmVlOTEzZDRjNjdlYmQwOTE1ZWFlYzQ0NzdmYTkwOTdlYTJhYzkyZGE4ZDc0NjgzZTAyNTU=
|
litecharms-clientsecret: c2VjcmV0X2YzZjA0YWNhYTMzNmVlOTEzZDRjNjdlYmQwOTE1ZWFlYzQ0NzdmYTkwOTdlYTJhYzkyZGE4ZDc0NjgzZTAyNTU=
|
||||||
|
payfast-passphrase: OUdBSVIwdFdwaFgwcU8=
|
||||||
|
payfast-merchantid: MTAwNDkzMDc=
|
||||||
|
payfast-merchantkey: anU2bmF2bjBqY2JmMA==
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
@@ -122,11 +123,21 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: midrandbooksapi-secrets
|
name: midrandbooksapi-secrets
|
||||||
key: hasher-salt
|
key: hasher-salt
|
||||||
- name: HasherSettings__PayfastPassphrase
|
- name: PayfastSettings__Passphrase
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: midrandbooksapi-secrets
|
name: midrandbooksapi-secrets
|
||||||
key: hasher-payfastpassphrase
|
key: payfast-passphrase
|
||||||
|
- name: PayfastSettings__MerchantId
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: midrandbooksapi-secrets
|
||||||
|
key: payfast-merchantid
|
||||||
|
- name: PayfastSettings__MerchantKey
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: midrandbooksapi-secrets
|
||||||
|
key: payfast-merchantkey
|
||||||
- name: ConnectionStrings__PostgresScheduler
|
- name: ConnectionStrings__PostgresScheduler
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
|||||||
Reference in New Issue
Block a user