From dada0113c47a58239a4ba075a888d5ecef807d95 Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Tue, 2 Apr 2024 11:14:00 +0330 Subject: [PATCH] fix zarinpal payment issue , add version 0.17.22.36 --- .version | 2 +- NetinaShop.Api/NetinaShop.Api.csproj | 4 ++-- .../Zarinpal/ZarinaplPaymentVerifyResponse.cs | 4 ++-- .../Services/ZarinpalService.cs | 15 ++++++++------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.version b/.version index fcfb70d..a262af0 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.17.21.35 \ No newline at end of file +0.17.22.36 \ No newline at end of file diff --git a/NetinaShop.Api/NetinaShop.Api.csproj b/NetinaShop.Api/NetinaShop.Api.csproj index 761fc2b..9062acc 100644 --- a/NetinaShop.Api/NetinaShop.Api.csproj +++ b/NetinaShop.Api/NetinaShop.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 0.17.21.35 - 0.17.21.35 + 0.17.22.36 + 0.17.22.36 diff --git a/NetinaShop.Infrastructure/Models/RestApi/Zarinpal/ZarinaplPaymentVerifyResponse.cs b/NetinaShop.Infrastructure/Models/RestApi/Zarinpal/ZarinaplPaymentVerifyResponse.cs index 925bf98..bbf2852 100644 --- a/NetinaShop.Infrastructure/Models/RestApi/Zarinpal/ZarinaplPaymentVerifyResponse.cs +++ b/NetinaShop.Infrastructure/Models/RestApi/Zarinpal/ZarinaplPaymentVerifyResponse.cs @@ -14,7 +14,7 @@ public class ZarinaplPaymentVerifyResponseData public string message { get; set; } = string.Empty; public string card_hash { get; set; } = string.Empty; public string card_pan { get; set; } = string.Empty; - public int ref_id { get; set; } + public long ref_id { get; set; } public string fee_type { get; set; } = string.Empty; - public int fee { get; set; } + public long fee { get; set; } } \ No newline at end of file diff --git a/NetinaShop.Infrastructure/Services/ZarinpalService.cs b/NetinaShop.Infrastructure/Services/ZarinpalService.cs index 6147b07..6d85482 100644 --- a/NetinaShop.Infrastructure/Services/ZarinpalService.cs +++ b/NetinaShop.Infrastructure/Services/ZarinpalService.cs @@ -11,13 +11,13 @@ public class ZarinpalService : IPaymentService private readonly IRestApiWrapper _restApiWrapper; private readonly IMediator _mediator; private readonly SiteSettings _siteSettings; - public ZarinpalService(IRestApiWrapper restApiWrapper,IOptionsSnapshot snapshot,IMediator mediator) + public ZarinpalService(IRestApiWrapper restApiWrapper, IOptionsSnapshot snapshot, IMediator mediator) { _restApiWrapper = restApiWrapper; _mediator = mediator; _siteSettings = snapshot.Value; } - public async Task GetPaymentLinkAsync(double amount,string factorNumber, Guid orderId, Guid userId, string phoneNumber , string fullName , CancellationToken cancellationToken = default) + public async Task GetPaymentLinkAsync(double amount, string factorNumber, Guid orderId, Guid userId, string phoneNumber, string fullName, CancellationToken cancellationToken = default) { var request = new ZarinaplPaymentLinkRequest { @@ -32,15 +32,15 @@ public class ZarinpalService : IPaymentService throw new AppException($"Exception in get link from zarinpal | {response.data.message}"); - var createPaymentResult = await _mediator.Send(new CreateOrUpdatePaymentCommand(null,factorNumber, amount, + var createPaymentResult = await _mediator.Send(new CreateOrUpdatePaymentCommand(null, factorNumber, amount, request.description, string.Empty, string.Empty, - response.data.authority, PaymentType.Online,PaymentStatus.InPaymentGateway, orderId, userId), cancellationToken); + response.data.authority, PaymentType.Online, PaymentStatus.InPaymentGateway, orderId, userId), cancellationToken); string link = $"https://www.zarinpal.com/pg/StartPay/{response.data.authority}"; return link; } - public async Task> VerifyPaymentAsync(string authority, CancellationToken cancellationToken = default) + public async Task> VerifyPaymentAsync(string authority, CancellationToken cancellationToken = default) { var payment = await _mediator.Send(new GetPaymentQuery(Authority: authority), cancellationToken); var request = new ZarinaplVerifyPaymentRequest @@ -62,8 +62,9 @@ public class ZarinpalService : IPaymentService payment.TransactionCode, payment.CardPan, payment.Authority, payment.Type, payment.Status, payment.OrderId, payment.UserId), cancellationToken); - await _mediator.Send(new SubmitOrderPaymentCommand(payment.OrderId, OrderPaymentMethod.OnlinePayment, true),cancellationToken); + await _mediator.Send(new SubmitOrderPaymentCommand(payment.OrderId, OrderPaymentMethod.OnlinePayment, true), + cancellationToken); - return new Tuple(payment.TransactionCode,payment.FactorNumber); + return new Tuple(payment.TransactionCode, payment.FactorNumber); } } \ No newline at end of file