Beispiel #1
0
 /// <remarks/>
 public void RefundTransactionAsync(RefundTransactionReq RefundTransactionReq) {
     this.RefundTransactionAsync(RefundTransactionReq, null);
 }
Beispiel #2
0
 /// <remarks/>
 public void RefundTransactionAsync(RefundTransactionReq RefundTransactionReq, object userState) {
     if ((this.RefundTransactionOperationCompleted == null)) {
         this.RefundTransactionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRefundTransactionOperationCompleted);
     }
     this.InvokeAsync("RefundTransaction", new object[] {
                 RefundTransactionReq}, this.RefundTransactionOperationCompleted, userState);
 }
        /// <summary>
        /// Refunds payment
        /// </summary>
        /// <param name="order">Order</param>
        /// <param name="cancelPaymentResult">Cancel payment result</param>        
        public void Refund(Order order, ref CancelPaymentResult cancelPaymentResult)
        {
            InitSettings();

            string transactionID = cancelPaymentResult.CaptureTransactionId;

            RefundTransactionReq req = new RefundTransactionReq();
            req.RefundTransactionRequest = new RefundTransactionRequestType();
            //NOTE: Specify amount in partial refund
            req.RefundTransactionRequest.RefundType = RefundType.Full;
            req.RefundTransactionRequest.RefundTypeSpecified = true;
            req.RefundTransactionRequest.Version = this.APIVersion;
            req.RefundTransactionRequest.TransactionID = transactionID;
            RefundTransactionResponseType response = service1.RefundTransaction(req);

            string error = string.Empty;
            bool Success = PaypalHelper.CheckSuccess(response, out error);
            if (Success)
            {
                cancelPaymentResult.PaymentStatus = PaymentStatusEnum.Refunded;
                //cancelPaymentResult.RefundTransactionID = response.RefundTransactionID;
            }
            else
            {
                cancelPaymentResult.Error = error;
            }
        }