コード例 #1
0
        /// <summary>
        /// Refunds a disbursement of a advanced payment.
        /// </summary>
        /// <param name="advancedPaymentId">Advanced Payment ID.</param>
        /// <param name="disbursementId">Disbursement ID.</param>
        /// <param name="amount">Amount to be refunded.</param>
        /// <param name="requestOptions"><see cref="RequestOptions"/>.</param>
        /// <returns>The refund of the disbursement.</returns>
        /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception>
        /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception>
        public AdvancedPaymentDisbursementRefund Refund(
            long advancedPaymentId,
            long disbursementId,
            decimal?amount,
            RequestOptions requestOptions = null)
        {
            var request = new AdvancedPaymentRefundCreateRequest
            {
                Amount = amount,
            };

            return(Send(
                       $"/v1/advanced_payments/{advancedPaymentId}/disbursements/{disbursementId}/refunds",
                       HttpMethod.POST,
                       request,
                       requestOptions));
        }
コード例 #2
0
        /// <summary>
        /// Refunds async a disbursement of a advanced payment.
        /// </summary>
        /// <param name="advancedPaymentId">Advanced Payment ID.</param>
        /// <param name="disbursementId">Disbursement ID.</param>
        /// <param name="amount">Amount to be refunded.</param>
        /// <param name="requestOptions"><see cref="RequestOptions"/>.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>A task whose the result is the refund of the disbursement.</returns>
        /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception>
        /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception>
        public Task <AdvancedPaymentDisbursementRefund> RefundAsync(
            long advancedPaymentId,
            long disbursementId,
            decimal?amount,
            RequestOptions requestOptions       = null,
            CancellationToken cancellationToken = default)
        {
            var request = new AdvancedPaymentRefundCreateRequest
            {
                Amount = amount,
            };

            return(SendAsync(
                       $"/v1/advanced_payments/{advancedPaymentId}/disbursements/{disbursementId}/refunds",
                       HttpMethod.POST,
                       request,
                       requestOptions,
                       cancellationToken));
        }