feat(payment): integrate TwentyCard payment option and enhance checkout flow
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 5m6s
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 5m6s
- Added a new payment method for TwentyCard in the checkout process, allowing users to select it alongside direct payment options. - Implemented the logic for processing TwentyCard payments, including user feedback and dialog interactions for payment confirmation. - Updated the appsettings files to include configuration for the new payment method. - Enhanced the user interface in the PackagePurchaseDialog to reflect the new payment option and its requirements. These changes improve the payment flexibility in the checkout process, providing users with additional options for completing their transactions.
This commit is contained in:
@@ -421,7 +421,10 @@ public partial class Index
|
||||
switch (purchase.Method)
|
||||
{
|
||||
case Shared.PackagePurchaseDialog.PaymentMethodType.DirectPayment:
|
||||
await ProcessDirectPayment(purchase.Package.Id);
|
||||
await ProcessDirectPayment(purchase.Package.Id, gatewayProvider: null);
|
||||
break;
|
||||
case Shared.PackagePurchaseDialog.PaymentMethodType.TwentyCard:
|
||||
await ProcessTwentyCardPayment(purchase.Package.Id);
|
||||
break;
|
||||
case Shared.PackagePurchaseDialog.PaymentMethodType.DayaLoan:
|
||||
await ProcessDayaLoanPayment();
|
||||
@@ -430,7 +433,25 @@ public partial class Index
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ProcessDirectPayment(long packageId)
|
||||
private async Task ProcessTwentyCardPayment(long packageId)
|
||||
{
|
||||
var options = new DialogOptions
|
||||
{
|
||||
MaxWidth = MaxWidth.Small,
|
||||
FullWidth = true,
|
||||
CloseOnEscapeKey = true,
|
||||
BackdropClick = true
|
||||
};
|
||||
|
||||
var dialog = await DialogService.ShowAsync<Shared.TwentyCardCreditDialog>(
|
||||
string.Empty, options);
|
||||
var result = await dialog.Result;
|
||||
if (result.Canceled) return;
|
||||
|
||||
await ProcessDirectPayment(packageId, gatewayProvider: "20card");
|
||||
}
|
||||
|
||||
private async Task ProcessDirectPayment(long packageId, string? gatewayProvider = null)
|
||||
{
|
||||
if (_isProcessingPayment) return;
|
||||
|
||||
@@ -439,11 +460,15 @@ public partial class Index
|
||||
|
||||
try
|
||||
{
|
||||
var response = await PackageContract.CustomerPurchasePackageAsync(new CustomerPurchasePackageRequest
|
||||
var request = new CustomerPurchasePackageRequest
|
||||
{
|
||||
PackageId = packageId,
|
||||
PurchaseMethod = PurchaseMethodEnum.PurchaseMethodGateway
|
||||
});
|
||||
};
|
||||
if (!string.IsNullOrWhiteSpace(gatewayProvider))
|
||||
request.GatewayProvider = gatewayProvider;
|
||||
|
||||
var response = await PackageContract.CustomerPurchasePackageAsync(request);
|
||||
|
||||
if (!response.Success)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user