Ejemplo n.º 1
0
        /// <summary>
        /// Payment refund
        /// </summary>
        public async Task <Payment> RefundAsync()
        {
            var refund = new Refund
            {
                PaymentId = this.Id
            };
            await refund.SaveAsync();

            if (refund.Id.HasValue)
            {
                this.Status = PaymentStatus.refunded;
            }

            return(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Payment refund
        /// </summary>
        public Payment Refund()
        {
            Refund refund = new Refund();

            refund.manualSetPaymentId((decimal)this.Id);
            refund.Save();

            if (refund.Id.HasValue)
            {
                this.Status = PaymentStatus.refunded;
            }
            else
            {
                //this.DelegateErrors(refund.Errors);
            }
            return(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Payment refund
        /// </summary>
        public Payment Refund()
        {
            var refund = new Refund
            {
                PaymentId = this.Id
            };

            refund.Save();

            if (refund.Id.HasValue)
            {
                this.Status = PaymentStatus.refunded;
            }
            else
            {
                //this.DelegateErrors(refund.Errors);
            }
            return(this);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Partial payment refund
        /// </summary>
        public Payment Refund(decimal?amount, MPRequestOptions requestOptions)
        {
            Refund refund = new Refund();

            refund.manualSetPaymentId((decimal)Id);
            refund.Amount = amount;
            refund.Save(requestOptions);

            if (refund.Id.HasValue)
            {
                var payment = Payment.FindById(Id, WITHOUT_CACHE, requestOptions);
                Status       = payment.Status;
                StatusDetail = payment.StatusDetail;
                TransactionAmountRefunded = payment.TransactionAmountRefunded;
                Refunds = payment.Refunds;
            }
            else
            {
                _errors = refund.Errors;
            }

            return(this);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Partial payment refund
        /// </summary>
        public Payment Refund(decimal?amount, MPRequestOptions requestOptions)
        {
            Refund refund = new Refund();

            refund.manualSetPaymentId((decimal)_id);
            refund.Amount = amount;
            refund.Save(requestOptions);

            if (refund.Id.HasValue)
            {
                Thread.Sleep(500);
                var payment = Payment.FindById(_id, WITHOUT_CACHE, requestOptions);
                _status        = payment.Status;
                _status_detail = payment.StatusDetail;
                _transaction_amount_refunded = payment.TransactionAmountRefunded;
                _refunds = payment.Refunds;
            }
            else
            {
                _errors = refund.Errors;
            }

            return(this);
        }