Пример #1
0
 /// <remarks/>
 public void DoVoidAsync(DoVoidReq DoVoidReq) {
     this.DoVoidAsync(DoVoidReq, null);
 }
Пример #2
0
 /// <remarks/>
 public void DoVoidAsync(DoVoidReq DoVoidReq, object userState) {
     if ((this.DoVoidOperationCompleted == null)) {
         this.DoVoidOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDoVoidOperationCompleted);
     }
     this.InvokeAsync("DoVoid", new object[] {
                 DoVoidReq}, this.DoVoidOperationCompleted, userState);
 }
        /// <summary>
        /// Voids payment
        /// </summary>
        /// <param name="order">Order</param>
        /// <param name="cancelPaymentResult">Cancel payment result</param>        
        public void Void(Order order, ref CancelPaymentResult cancelPaymentResult)
        {
            InitSettings();

            string transactionID = cancelPaymentResult.AuthorizationTransactionId;
            if (String.IsNullOrEmpty(transactionID))
                transactionID = cancelPaymentResult.CaptureTransactionId;

            DoVoidReq req = new DoVoidReq();
            req.DoVoidRequest = new DoVoidRequestType();
            req.DoVoidRequest.Version = this.APIVersion;
            req.DoVoidRequest.AuthorizationID = transactionID;
            DoVoidResponseType response = service2.DoVoid(req);

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