fix zarinpal payment issue , add version 0.17.22.36
parent
5fa2f0ce72
commit
dada0113c4
|
@ -6,8 +6,8 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<AssemblyVersion>0.17.21.35</AssemblyVersion>
|
<AssemblyVersion>0.17.22.36</AssemblyVersion>
|
||||||
<FileVersion>0.17.21.35</FileVersion>
|
<FileVersion>0.17.22.36</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class ZarinaplPaymentVerifyResponseData
|
||||||
public string message { get; set; } = string.Empty;
|
public string message { get; set; } = string.Empty;
|
||||||
public string card_hash { get; set; } = string.Empty;
|
public string card_hash { get; set; } = string.Empty;
|
||||||
public string card_pan { 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 string fee_type { get; set; } = string.Empty;
|
||||||
public int fee { get; set; }
|
public long fee { get; set; }
|
||||||
}
|
}
|
|
@ -11,13 +11,13 @@ public class ZarinpalService : IPaymentService
|
||||||
private readonly IRestApiWrapper _restApiWrapper;
|
private readonly IRestApiWrapper _restApiWrapper;
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
private readonly SiteSettings _siteSettings;
|
private readonly SiteSettings _siteSettings;
|
||||||
public ZarinpalService(IRestApiWrapper restApiWrapper,IOptionsSnapshot<SiteSettings> snapshot,IMediator mediator)
|
public ZarinpalService(IRestApiWrapper restApiWrapper, IOptionsSnapshot<SiteSettings> snapshot, IMediator mediator)
|
||||||
{
|
{
|
||||||
_restApiWrapper = restApiWrapper;
|
_restApiWrapper = restApiWrapper;
|
||||||
_mediator = mediator;
|
_mediator = mediator;
|
||||||
_siteSettings = snapshot.Value;
|
_siteSettings = snapshot.Value;
|
||||||
}
|
}
|
||||||
public async Task<string> GetPaymentLinkAsync(double amount,string factorNumber, Guid orderId, Guid userId, string phoneNumber , string fullName , CancellationToken cancellationToken = default)
|
public async Task<string> GetPaymentLinkAsync(double amount, string factorNumber, Guid orderId, Guid userId, string phoneNumber, string fullName, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var request = new ZarinaplPaymentLinkRequest
|
var request = new ZarinaplPaymentLinkRequest
|
||||||
{
|
{
|
||||||
|
@ -32,15 +32,15 @@ public class ZarinpalService : IPaymentService
|
||||||
throw new AppException($"Exception in get link from zarinpal | {response.data.message}");
|
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,
|
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}";
|
string link = $"https://www.zarinpal.com/pg/StartPay/{response.data.authority}";
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Tuple<string,string>> VerifyPaymentAsync(string authority, CancellationToken cancellationToken = default)
|
public async Task<Tuple<string, string>> VerifyPaymentAsync(string authority, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var payment = await _mediator.Send(new GetPaymentQuery(Authority: authority), cancellationToken);
|
var payment = await _mediator.Send(new GetPaymentQuery(Authority: authority), cancellationToken);
|
||||||
var request = new ZarinaplVerifyPaymentRequest
|
var request = new ZarinaplVerifyPaymentRequest
|
||||||
|
@ -62,8 +62,9 @@ public class ZarinpalService : IPaymentService
|
||||||
payment.TransactionCode, payment.CardPan, payment.Authority, payment.Type, payment.Status,
|
payment.TransactionCode, payment.CardPan, payment.Authority, payment.Type, payment.Status,
|
||||||
payment.OrderId, payment.UserId), cancellationToken);
|
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<string, string>(payment.TransactionCode,payment.FactorNumber);
|
return new Tuple<string, string>(payment.TransactionCode, payment.FactorNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue