/// <remarks/> public void DoVoidAsync(DoVoidReq DoVoidReq) { this.DoVoidAsync(DoVoidReq, null); }
/// <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 a payment /// </summary> /// <param name="voidPaymentRequest">Request</param> /// <returns>Result</returns> public VoidPaymentResult Void(VoidPaymentRequest voidPaymentRequest) { var result = new VoidPaymentResult(); string transactionId = voidPaymentRequest.Order.AuthorizationTransactionId; if (String.IsNullOrEmpty(transactionId)) transactionId = voidPaymentRequest.Order.CaptureTransactionId; var req = new DoVoidReq(); req.DoVoidRequest = new DoVoidRequestType(); req.DoVoidRequest.Version = GetApiVersion(); req.DoVoidRequest.AuthorizationID = transactionId; using (var service2 = new PayPalAPIAASoapBinding()) { if (!_paypalDirectPaymentSettings.UseSandbox) service2.Url = "https://api-3t.paypal.com/2.0/"; else service2.Url = "https://api-3t.sandbox.paypal.com/2.0/"; service2.RequesterCredentials = new CustomSecurityHeaderType(); service2.RequesterCredentials.Credentials = new UserIdPasswordType(); service2.RequesterCredentials.Credentials.Username = _paypalDirectPaymentSettings.ApiAccountName; service2.RequesterCredentials.Credentials.Password = _paypalDirectPaymentSettings.ApiAccountPassword; service2.RequesterCredentials.Credentials.Signature = _paypalDirectPaymentSettings.Signature; service2.RequesterCredentials.Credentials.Subject = ""; DoVoidResponseType response = service2.DoVoid(req); string error = ""; bool success = PaypalHelper.CheckSuccess(response, out error); if (success) { result.NewPaymentStatus = PaymentStatus.Voided; //result.VoidTransactionID = response.RefundTransactionID; } else { result.AddError(error); } } return result; }