Exemple #1
0
        /// <summary>
        /// Allows specific line items / adjutsments to be refunded.
        /// </summary>
        /// <param name="adjustments">The list of adjustments to refund.</param>
        /// <param name="options">The options for the refund invoice.</param>
        /// <returns>new Invoice object</returns>
        public Invoice Refund(IEnumerable <Adjustment> adjustments, RefundOptions options)
        {
            var refunds = new RefundList(adjustments, options);
            var invoice = new Invoice();

            var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Post,
                                                            memberUrl() + "/refund",
                                                            refunds.WriteXml,
                                                            invoice.ReadXml);

            if (HttpStatusCode.Created == statusCode || HttpStatusCode.OK == statusCode)
            {
                return(invoice);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        public Invoice Refund(IEnumerable <Adjustment> adjustments, bool prorate = false, int quantity = 0, RefundMethod method = RefundMethod.CreditFirst)
        {
            var refunds = new RefundList(adjustments, prorate, quantity, method);
            var invoice = new Invoice();

            var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Post,
                                                            memberUrl() + "/refund",
                                                            refunds.WriteXml,
                                                            invoice.ReadXml);

            if (HttpStatusCode.Created == statusCode || HttpStatusCode.OK == statusCode)
            {
                return(invoice);
            }
            else
            {
                return(null);
            }
        }
        public Invoice Refund(IEnumerable <Adjustment> adjustments, bool prorate = false, int quantity = 0)
        {
            var refunds = new RefundList(adjustments, prorate, quantity);
            var invoice = new Invoice();

            var response = Client.Instance.PerformRequest(Client.HttpRequestMethod.Post,
                                                          UrlPrefix + InvoiceNumber + "/refund",
                                                          refunds.WriteXml,
                                                          invoice.ReadXml);

            if (HttpStatusCode.Created == response || HttpStatusCode.OK == response)
            {
                return(invoice);
            }
            else
            {
                return(null);
            }
        }