Beispiel #1
0
        public DoVoidResponseType DoVoid(string authorizationId, string note)
        {
            DoVoidRequestType pp_request = new DoVoidRequestType();

            pp_request.AuthorizationID = authorizationId;
            pp_request.Note            = note;
            return((DoVoidResponseType)caller.Call("DoVoid", pp_request));
        }
Beispiel #2
0
        public DoVoidResponseType DoVoid(string authorizationId, string note)
        {
            var pp_request = new DoVoidRequestType
            {
                AuthorizationID = authorizationId,
                Note            = note
            };

            return((DoVoidResponseType)caller.Call("DoVoid", pp_request));
        }
Beispiel #3
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            DoVoidRequestType request =
                new DoVoidRequestType();

            // (Required) Original authorization ID specifying the authorization to void or, to void an order, the order ID.
            // Important: If you are voiding a transaction that has been reauthorized, use the ID from the original authorization, and not the reauthorization.
            request.AuthorizationID = authorizationId.Value;
            // (Optional) Informational note about this void that is displayed to the buyer in email and in their transaction history.
            if (note.Value != string.Empty)
            {
                request.Note = note.Value;
            }

            // Invoke the API
            DoVoidReq wrapper = new DoVoidReq();

            wrapper.DoVoidRequest = request;

            // Configuration map containing signature credentials and other required configuration.
            // For a full list of configuration parameters refer in wiki page
            // [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
            Dictionary <string, string> configurationMap = Configuration.GetAcctAndConfig();

            // Create the PayPalAPIInterfaceServiceService service object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);

            // # API call
            // Invoke the DoVoid method in service wrapper object
            DoVoidResponseType doVoidResponse =
                service.DoVoid(wrapper);


            // Check for API return status
            setKeyResponseObjects(service, doVoidResponse);
        }
Beispiel #4
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            DoVoidRequestType request =
                new DoVoidRequestType();

            request.AuthorizationID = authorizationId.Value;
            if (note.Value != "")
            {
                request.Note = note.Value;
            }

            // Invoke the API
            DoVoidReq wrapper = new DoVoidReq();

            wrapper.DoVoidRequest = request;
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
            DoVoidResponseType doVoidResponse        =
                service.DoVoid(wrapper);


            // Check for API return status
            setKeyResponseObjects(service, doVoidResponse);
        }
Beispiel #5
0
        public override string VoidOrder(int OrderNumber)
        {
            String result = String.Empty;

            DB.ExecuteSQL("update orders set VoidTXCommand=NULL, VoidTXResult=NULL where OrderNumber=" + OrderNumber.ToString());
            String TransID = String.Empty;

            using (var con = new SqlConnection(DB.GetDBConn()))
            {
                con.Open();
                using (var rs = DB.GetRS("select * from orders   with (NOLOCK)  where OrderNumber=" + OrderNumber.ToString(), con))
                {
                    if (rs.Read())
                    {
                        // If you are voiding a transaction that has been reauthorized,
                        // use the ID from the original authorization, and not the reauthorization.
                        TransID = Regex.Match(DB.RSField(rs, "AuthorizationPNREF"), "(?<=AUTH=)[0-9A-Z]+", RegexOptions.Compiled).ToString();
                    }
                }
            }

            if (TransID.Length == 0 || TransID == "0")
            {
                result = "Invalid or Empty Transaction ID";
            }
            else
            {
                try
                {
                    DoVoidReq          VoidReq         = new DoVoidReq();
                    DoVoidRequestType  VoidRequestType = new DoVoidRequestType();
                    DoVoidResponseType VoidResponse;

                    VoidRequestType.AuthorizationID = TransID;
                    VoidRequestType.Version         = API_VER;

                    VoidReq.DoVoidRequest = VoidRequestType;

                    VoidResponse = (DoVoidResponseType)IPayPal.DoVoid(VoidReq);


                    //if (LogToErrorTable)
                    //{
                    //    PayPalController.Log(XmlCommon.SerializeObject(VoidReq, VoidReq.GetType()), "DoVoid Request");
                    //    PayPalController.Log(XmlCommon.SerializeObject(VoidResponse, VoidResponse.GetType()), "DoVoid Response");
                    //}

                    DB.ExecuteSQL("update orders set VoidTXCommand=" + DB.SQuote(XmlCommon.SerializeObject(VoidReq, VoidReq.GetType()))
                                  + ", VoidTXResult=" + DB.SQuote(XmlCommon.SerializeObject(VoidResponse, VoidResponse.GetType())) + " where OrderNumber=" + OrderNumber.ToString());

                    if (VoidResponse != null && VoidResponse.Ack.ToString().StartsWith("success", StringComparison.InvariantCultureIgnoreCase))
                    {
                        result = AppLogic.ro_OK;
                    }
                    else
                    {
                        if (VoidResponse.Errors != null)
                        {
                            bool first = true;
                            for (int ix = 0; ix < VoidResponse.Errors.Length; ix++)
                            {
                                if (!first)
                                {
                                    result += ", ";
                                }
                                result += "Error: [" + VoidResponse.Errors[ix].ErrorCode + "] " + VoidResponse.Errors[ix].LongMessage;
                                first   = false;
                            }
                        }
                    }
                }
                catch
                {
                    result = "NO RESPONSE FROM GATEWAY!";
                }
            }
            return(result);
        }
Beispiel #6
0
    //#DoVoid API Operation
    //#Void an order or an authorization.
    public DoVoidResponseType DoVoidAPIOperation()
    {
        // Create the DoVoidResponseType object
        DoVoidResponseType responseDoVoidResponseType = new DoVoidResponseType();

        try
        {
            // Create the DoVoidReq object
            DoVoidReq doVoid = new DoVoidReq();

            // DoVoidRequest which takes mandatory params:
            //
            // * `Authorization ID` - Original authorization ID specifying the
            // authorization to void or, to void an order, the order ID.
            // `Important:
            // If you are voiding a transaction that has been reauthorized, use the
            // ID from the original authorization, and not the reauthorization.`
            DoVoidRequestType doVoidRequest = new DoVoidRequestType("9B2288061E685550E");
            doVoid.DoVoidRequest = doVoidRequest;

            // Create the service wrapper object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();

            // # API call
            // Invoke the DoVoid method in service wrapper object
            responseDoVoidResponseType = service.DoVoid(doVoid);

            if (responseDoVoidResponseType != null)
            {
                // Response envelope acknowledgement
                string acknowledgement = "DoVoid API Operation - ";
                acknowledgement += responseDoVoidResponseType.Ack.ToString();
                logger.Info(acknowledgement + "\n");
                Console.WriteLine(acknowledgement + "\n");

                // # Success values
                if (responseDoVoidResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
                {
                    // Authorization identification number you specified in the request
                    logger.Info("Authorization ID : " + responseDoVoidResponseType.AuthorizationID + "\n");
                    Console.WriteLine("Authorization ID : " + responseDoVoidResponseType.AuthorizationID + "\n");
                }
                // # Error Values
                else
                {
                    List <ErrorType> errorMessages = responseDoVoidResponseType.Errors;
                    foreach (ErrorType error in errorMessages)
                    {
                        logger.Debug("API Error Message : " + error.LongMessage);
                        Console.WriteLine("API Error Message : " + error.LongMessage + "\n");
                    }
                }
            }
        }
        // # Exception log
        catch (System.Exception ex)
        {
            // Log the exception message
            logger.Debug("Error Message : " + ex.Message);
            Console.WriteLine("Error Message : " + ex.Message);
        }
        return(responseDoVoidResponseType);
    }
Beispiel #7
0
 public DoVoidResponseType DoVoid(string authorizationId, string note)
 {
     DoVoidRequestType pp_request = new DoVoidRequestType();
     pp_request.AuthorizationID = authorizationId;            
     pp_request.Note = note;
     return (DoVoidResponseType)caller.Call("DoVoid", pp_request);
 }