Пример #1
0
 /// <remarks/>
 public System.IAsyncResult BeginDoVoid(DoVoidReq DoVoidReq, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("DoVoid", new object[] {
                 DoVoidReq}, callback, asyncState);
 }
Пример #2
0
    public static bool VoidPendingCharge(string transactionId, out string errorMessages)
    {
        PayPalServices.UserIdPasswordType user = new PayPalServices.UserIdPasswordType();
        user.Username = APIUsername;
        user.Password = APIPassword;
        user.Signature = APISignature;

        PayPalServices.PayPalAPIAASoapBinding PPInterface = new PayPalServices.PayPalAPIAASoapBinding();
        PPInterface.RequesterCredentials = new PayPalServices.CustomSecurityHeaderType();
        PPInterface.RequesterCredentials.Credentials = user;
        PPInterface.RequestEncoding = System.Text.Encoding.UTF8;
        PPInterface.Url = APIUrl;

        PayPalServices.DoVoidReq voidReq = new PayPalServices.DoVoidReq();
        voidReq.DoVoidRequest = new PayPalServices.DoVoidRequestType();
        voidReq.DoVoidRequest.Version = APIVersion;
        voidReq.DoVoidRequest.AuthorizationID = transactionId;

        PayPalServices.DoVoidResponseType response = PPInterface.DoVoid(voidReq);
        if(response.Ack == PayPalServices.AckCodeType.Success)
        {
           errorMessages = string.Empty;
           return true;
        }
        string errorsMessages = "Status: " + response.Ack.ToString() + " <br/>";
        foreach (PayPalServices.ErrorType error in response.Errors)
        {
            errorsMessages += error.ErrorCode + " - " + error.LongMessage + " " + error.ShortMessage + "<br/>";
        }

        errorMessages = errorsMessages;
        return false;
    }