示例#1
0
        /// <inheritdoc />
        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 = await AsanPardakhtHelper.CreateRequestData(invoice, account, _crypto)
                       .ConfigureAwaitFalse();

            var responseMessage = await _httpClient
                                  .PostXmlAsync(_gatewayOptions.ApiUrl, data, cancellationToken)
                                  .ConfigureAwaitFalse();

            var response = await responseMessage.Content.ReadAsStringAsync().ConfigureAwaitFalse();

            return(AsanPardakhtHelper.CreateRequestResult(
                       response,
                       account,
                       _httpContextAccessor.HttpContext,
                       _gatewayOptions,
                       _messageOptions));
        }