Ejemplo n.º 1
0
 public static ZarinpalPaymentVerifyRequest ToZarinpalRequest(
     this PaymentVerifyRequest request,
     string authority) => new ZarinpalPaymentVerifyRequest
 {
     Amount     = request.Amount,
     Authority  = authority,
     MerchantId = request.MerchantId
 };
Ejemplo n.º 2
0
        static PaymentVerifyResult getVerifyResult(IServiceProvider services, string authority)
        {
            using IServiceScope scope = services.CreateScope();
            IServiceProvider provider = scope.ServiceProvider;

            IZarinpalGateway zarinpal = provider.GetRequiredService <IZarinpalGateway>();
            var request = new PaymentVerifyRequest {
                Amount = 30000
            };

            //zarinpal.EnableSandboxMode();
            zarinpal.SetAuthority(authority);

            var result = zarinpal.VerifyPaymentAsync(request).Result;

            return(result);
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public async Task <PaymentVerifyResult> VerifyPaymentAsync(PaymentVerifyRequest request)
        {
            request.CheckArgumentIsNull("[PaymentVerifyRequest] cannot be null.");

            var response = await _client.bpVerifyRequestAsync(
                terminalId : TerminalId,
                userName : Username,
                userPassword : Password,
                orderId : request.OrderId,
                saleOrderId : request.TrackingNumber,
                saleReferenceId : request.ReferenceId);

            var mellatResult = [email protected]();

            return(await Task.FromResult(
                       mellatResult.ToPaymentVerifyResult()
                       ));
        }
Ejemplo n.º 4
0
        public async Task <PaymentVerifyResult> VerifyPaymentAsync(
            PaymentVerifyRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (string.IsNullOrWhiteSpace(request.MerchantId))
            {
                request.MerchantId = this.MerchantId;
            }

            var zarinpalRequest = request.ToZarinpalRequest(Authority);

            var result = await _httpClient
                         .PostAsync <ZarinpalPaymentVerifyRequest, ZarinpalPaymentVerifyResult>(
                zarinpalRequest,
                ZarinpalApiHelper
                .GetVerifyRequestUrl(SandboxMode, false)
                );

            return(await Task.FromResult(result.ToResult()));
        }