Exemple #1
0
        /// <inheritdoc />
        public override async Task <IPaymentVerifyResult> VerifyAsync(InvoiceContext context, CancellationToken cancellationToken = default)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var callbackResult = await GetCallbackResult(context, cancellationToken);

            if (!callbackResult.IsSucceed)
            {
                return(PaymentVerifyResult.Failed(callbackResult.Message));
            }

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

            var data = PayIrHelper.CreateVerifyData(account, callbackResult);

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

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

            return(PayIrHelper.CreateVerifyResult(response, _messagesOptions));
        }
Exemple #2
0
        public static Task <IPaymentVerifyResult> ToInterfaceAsync(this PaymentVerifyResult verifyResult)
        {
            if (verifyResult == null)
            {
                throw new ArgumentNullException(nameof(verifyResult));
            }

            return(Task.FromResult <IPaymentVerifyResult>(verifyResult));
        }