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:
@@ -107,6 +107,33 @@ public partial class Checkout
|
||||
}
|
||||
|
||||
private async Task ProcessPayment()
|
||||
=> await StartGatewayPayment(gatewayProvider: null);
|
||||
|
||||
private async Task ProcessTwentyCardPayment()
|
||||
{
|
||||
if (!CanProceedToPayment || _selectedPackage == null)
|
||||
{
|
||||
Snackbar.Add("لطفاً پکیج را انتخاب کنید.", Severity.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
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 StartGatewayPayment(gatewayProvider: "20card");
|
||||
}
|
||||
|
||||
private async Task StartGatewayPayment(string? gatewayProvider)
|
||||
{
|
||||
if (_isProcessingPayment) return;
|
||||
|
||||
@@ -120,11 +147,15 @@ public partial class Checkout
|
||||
|
||||
try
|
||||
{
|
||||
var response = await PackageClient.CustomerPurchasePackageAsync(new CustomerPurchasePackageRequest
|
||||
var request = new CustomerPurchasePackageRequest
|
||||
{
|
||||
PackageId = _selectedPackage.Id,
|
||||
PurchaseMethod = PurchaseMethodEnum.PurchaseMethodGateway
|
||||
});
|
||||
};
|
||||
if (!string.IsNullOrWhiteSpace(gatewayProvider))
|
||||
request.GatewayProvider = gatewayProvider;
|
||||
|
||||
var response = await PackageClient.CustomerPurchasePackageAsync(request);
|
||||
|
||||
if (!response.Success)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user