예제 #1
0
        protected void SubmitRefundButton_Click(object sender, EventArgs e)
        {
            //GET THE REFUND AMOUNT
            string originalRefundAmount = string.Format("{0:F2}", _Payment.Amount);


            decimal refundAmount = AlwaysConvert.ToDecimal(RefundAmount.Text);

            // AC8-2854, AC8-3117: IF amount is not changed by merchant then
            // to avoid rounding issues, restore the original amount upto 4 decimal digits
            if (originalRefundAmount == RefundAmount.Text)
            {
                refundAmount = _Payment.Amount;
            }

            if (refundAmount > 0 && _Payment.PaymentStatus == PaymentStatus.Captured)
            {
                RefundTransactionRequest refundRequest = new RefundTransactionRequest(_Payment, Request.UserHostAddress);
                if (CreditCardFields.Visible)
                {
                    SetRequestForCreditCard(refundRequest);
                }
                else if (CheckFields.Visible)
                {
                    SetRequestForCheck(refundRequest);
                }
                refundRequest.Amount = refundAmount;
                PaymentEngine.DoRefund(refundRequest);
                //_Payment.Refund(refundRequest);
                if (!string.IsNullOrEmpty(CustomerNote.Text))
                {
                    OrderNote note = new OrderNote(_Order.Id, AbleContext.Current.UserId, DateTime.UtcNow, CustomerNote.Text, NoteType.Public);
                    note.Save();
                }
            }
            Response.Redirect("Default.aspx?OrderNumber=" + _Order.OrderNumber.ToString());
        }
예제 #2
0
        /// <summary>
        /// Refunds this payment
        /// </summary>
        /// <param name="remoteIp">Remote IP of the user initiating the request</param>
        public virtual void Refund(string remoteIp)
        {
            RefundTransactionRequest request = new RefundTransactionRequest(this, remoteIp);

            PaymentEngine.DoRefund(request);
        }