Пример #1
0
        /// <summary>
        /// Cancels a pending advanced payment.
        /// </summary>
        /// <param name="id">Advanced payment id.</param>
        /// <param name="requestOptions"><see cref="RequestOptions"/>.</param>
        /// <returns>The cancelled advanced payment.</returns>
        /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception>
        /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception>
        public AdvancedPayment Cancel(
            long id,
            RequestOptions requestOptions = null)
        {
            var request = new AdvancedPaymentCancelRequest();

            return(Send(
                       $"/v1/advanced_payments/{id}",
                       HttpMethod.PUT,
                       request,
                       requestOptions));
        }
Пример #2
0
        /// <summary>
        /// Cancels a pending advanced payment async.
        /// </summary>
        /// <param name="id">Advanced payment id.</param>
        /// <param name="requestOptions"><see cref="RequestOptions"/>.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>A task whose the result is the cancelled advanced payment.</returns>
        /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception>
        /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception>
        public Task <AdvancedPayment> CancelAsync(
            long id,
            RequestOptions requestOptions       = null,
            CancellationToken cancellationToken = default)
        {
            var request = new AdvancedPaymentCancelRequest();

            return(SendAsync(
                       $"/v1/advanced_payments/{id}",
                       HttpMethod.PUT,
                       request,
                       requestOptions,
                       cancellationToken));
        }