Skip to content

Commit

Permalink
Add expiration handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Dušan Bobičić committed Oct 1, 2024
1 parent 7adc4b2 commit 5451d8a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Svea.WebPay.SDK;
using Svea.WebPay.SDK.CheckoutApi.Recurring;

namespace Sample.Testshop.Server.Modules.Checkout
{
public static class ChangePaymentMethodHandler
{
public static async Task<ChangePaymentMethodResponse> Handle(string token, ChangepaymentMethodModel request, SveaWebPayClient sveaWebPayClient)
{
var response = await sveaWebPayClient.Checkout.Recurring.ChangePaymentMethodAsync(request, token);
return response;
}
}
}
3 changes: 3 additions & 0 deletions src/Samples/Sample.Testshop/Sample.Testshop.Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Builder;
using Sample.Testshop.Server.Extensions;
using Sample.Testshop.Server.Modules.Checkout;

Expand Down Expand Up @@ -46,6 +47,8 @@
app.MapGet("/api/recurring/{token}", GetRecurringToken.Handle).WithName("Get Recurring Token")
.WithOpenApi(); ;

app.MapPost("/api/recurring/{token}/payment-method", ChangePaymentMethodHandler.Handle).WithName("Change Payment Method").WithOpenApi();

app.MapGet("/api/utils/merchants", GetMerchantsHandler.Handle).WithName("Get Available Merchants").WithOpenApi();

app.MapFallbackToFile("/index.html");
Expand Down

0 comments on commit 5451d8a

Please sign in to comment.