Esempio n. 1
0
        /// <summary>
        /// Used to cancel a payment already made.
        /// The transaction as a whole is then credited the mobile phone subscription.
        /// It is not possible to reverse only part of a payment.
        /// </summary>
        /// <param name="details">Details about the transaction.</param>
        /// <returns>The reverse payment response.</returns>
        public async Task <ReversePaymentDetails> ReversePaymentAsync(ReversePaymentDetails details)
        {
            var responseMessage = await _client.DeleteAsync($"{RelativeUri.Pay}/{details.TransactionId}");

            await CheckIfFailedRequestAsync(responseMessage);

            return(await responseMessage.DeserializeAsAsync <ReversePaymentDetails>());
        }
Esempio n. 2
0
        /// <summary>
        /// Used to cancel a payment already made.
        /// The transaction as a whole is then credited the mobile phone subscription.
        /// It is not possible to reverse only part of a payment.
        /// </summary>
        /// <param name="details">Details about the transaction.</param>
        /// <exception cref="ArgumentNullException">Thrown if <see cref="ReversePaymentDetails"/> is null.</exception>
        /// <returns>The reverse payment response.</returns>
        public async Task <ReversePaymentDetails> ReversePaymentAsync(ReversePaymentDetails details)
        {
            if (details == null)
            {
                throw new ArgumentNullException(nameof(details));
            }

            return(await _client.DeleteAsync($"{RelativeUri.Pay}/{details.TransactionId}")
                   .ConfigureAwait(false)
                   .ThrowIfErrorResponseAsync()
                   .DeserializeAsync <ReversePaymentDetails>());
        }