コード例 #1
0
ファイル: ZibalGateway.cs プロジェクト: mehregan9000/Parbad
        public override async Task <IPaymentVerifyResult> VerifyAsync(InvoiceContext context, CancellationToken cancellationToken = default)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var account = await GetAccountAsync(context.Payment).ConfigureAwaitFalse();

            var data = ZibalHelper.CreateVerifyData(context.Transactions, account);

            var responseMessage = await _httpClient
                                  .PostJsonAsync(_gatewayOptions.VerifyURl, data, DefaultSerializerSettings, cancellationToken)
                                  .ConfigureAwaitFalse();

            return(await ZibalHelper.CreateVerifyResult(responseMessage, _options.Messages));
        }
コード例 #2
0
ファイル: ZibalGateway.cs プロジェクト: mehregan9000/Parbad
        public override async Task <IPaymentRequestResult> RequestAsync(Invoice invoice, CancellationToken cancellationToken = default)
        {
            if (invoice == null)
            {
                throw new ArgumentNullException(nameof(invoice));
            }

            var account = await GetAccountAsync(invoice).ConfigureAwaitFalse();

            var data = ZibalHelper.CreateRequestData(invoice, account);

            var responseMessage = await _httpClient
                                  .PostJsonAsync(_gatewayOptions.RequestURl, data, DefaultSerializerSettings, cancellationToken)
                                  .ConfigureAwaitFalse();

            return(await ZibalHelper.CreateRequestResult(responseMessage, _httpContextAccessor.HttpContext, account, _gatewayOptions, _options.Messages));
        }