예제 #1
0
        protected void Search_Submit(object sender, EventArgs e)
        {
            // Create request object
            GetTransactionDetailsRequestType request = new GetTransactionDetailsRequestType();

            // (Required) Unique identifier of a transaction.
            // Note: The details for some kinds of transactions cannot be retrieved with GetTransactionDetails. You cannot obtain details of bank transfer withdrawals, for example.
            request.TransactionID = transactionId.Value;

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

            wrapper.GetTransactionDetailsRequest = 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 GetTransactionDetails method in service wrapper object
            GetTransactionDetailsResponseType transactionDetails = service.GetTransactionDetails(wrapper);

            // Check for API return status
            processResponse(service, transactionDetails);
        }
예제 #2
0
        public void GetTransactionDetails(Orders order)
        {
            GetTransactionDetailsRequestType detailRequest = new GetTransactionDetailsRequestType();

            detailRequest.TransactionID = order.TransactionID;
            detailRequest.Version       = "2.0";
            GetTransactionDetailsReq request = new GetTransactionDetailsReq();

            request.GetTransactionDetailsRequest = detailRequest;

            GetTransactionDetailsResponseType response = service.GetTransactionDetails(request);

            string sErrors = this.CheckForErrors(response);

            if (sErrors == string.Empty)
            {
                PaymentInfoType payment = response.PaymentTransactionDetails.PaymentInfo;

                order.OrderTotal    = GetAmountValue(payment.GrossAmount);
                order.Tax           = GetAmountValue(payment.TaxAmount);
                IsSubmissionSuccess = true;
            }
            else
            {
                IsSubmissionSuccess = false;
            }
        }
예제 #3
0
        /**
         *
         */
        public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq GetTransactionDetailsReq, string apiUsername)
        {
            setStandardParams(GetTransactionDetailsReq.GetTransactionDetailsRequest);
            string resp = call("GetTransactionDetails", GetTransactionDetailsReq.toXMLString(), apiUsername);

            return(new GetTransactionDetailsResponseType(resp));
        }
예제 #4
0
        public PaymentInfoType GetTransactionStatus(string transactionId, out string error)
        {
            // Create request object
            GetTransactionDetailsRequestType request = new GetTransactionDetailsRequestType();

            // (Required) Unique identifier of a transaction.
            // Note: The details for some kinds of transactions cannot be retrieved with GetTransactionDetails. You cannot obtain details of bank transfer withdrawals, for example.
            request.TransactionID = transactionId;

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

            wrapper.GetTransactionDetailsRequest = 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]

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

            int  numReintento      = 0;
            bool esLlamadaCorrecta = false;
            GetTransactionDetailsResponseType transactionDetails = null;

            do
            {
                numReintento += 1;

                // # API call
                // Invoke the GetTransactionDetails method in service wrapper object
                transactionDetails = service.GetTransactionDetails(wrapper);

                // Check for API return status

                if (!transactionDetails.Ack.Equals(AckCodeType.FAILURE) ||
                    !(transactionDetails.Errors != null && transactionDetails.Errors.Count > 0))
                {
                    esLlamadaCorrecta = true;
                }
            } while (!esLlamadaCorrecta && (numReintento <= 5));


            if (esLlamadaCorrecta)
            {
                error = string.Empty;
                return(transactionDetails.PaymentTransactionDetails.PaymentInfo);
            }
            //Error
            error = transactionDetails.Errors != null || transactionDetails.Errors.Count > 0
                ? transactionDetails.Errors.FirstOrDefault().LongMessage
                : "Imposible obtener el status de la transacción de PayPal.";

            return(null);
        }
        /**
         * AUTO_GENERATED
         */
        public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq getTransactionDetailsReq, string apiUserName)
        {
            setStandardParams(getTransactionDetailsReq.GetTransactionDetailsRequest);
            string      response    = Call("GetTransactionDetails", getTransactionDetailsReq.ToXMLString(), apiUserName);
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(response);
            XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='GetTransactionDetailsResponse']");

            return(new GetTransactionDetailsResponseType(xmlNode));
        }
예제 #6
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            GetTransactionDetailsReq         request     = new GetTransactionDetailsReq();
            GetTransactionDetailsRequestType requestType = new GetTransactionDetailsRequestType();

            requestType.TransactionID            = transactionId.Value;
            request.GetTransactionDetailsRequest = requestType;

            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();

            service.GetTransactionDetails(request);
        }
예제 #7
0
        protected void Search_Submit(object sender, EventArgs e)
        {
            // Create request object
            GetTransactionDetailsRequestType request = new GetTransactionDetailsRequestType();
            request.TransactionID = transactionId.Value;            

            // Invoke the API
            GetTransactionDetailsReq wrapper = new GetTransactionDetailsReq();
            wrapper.GetTransactionDetailsRequest = request;            
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
            GetTransactionDetailsResponseType transactionDetails = service.GetTransactionDetails(wrapper);

            // Check for API return status
            processResponse(service, transactionDetails);
        }
예제 #8
0
    public PayPalReturn GetTransactionDetails(string transactionID)
    {
        //PayPal Return Structure
        PayPalReturn rv = new PayPalReturn();

        rv.IsSucess = false;

        //Requests
        //TransactionID = "6XT85330WL909250J"
        GetTransactionDetailsReq request = new GetTransactionDetailsReq();

        request.GetTransactionDetailsRequest = new GetTransactionDetailsRequestType();
        request.GetTransactionDetailsRequest.TransactionID = transactionID;
        request.GetTransactionDetailsRequest.Version       = "51.0";

        //Headers
        CustomSecurityHeaderType headers = new CustomSecurityHeaderType();

        headers.Credentials           = new UserIdPasswordType();
        headers.Credentials.Username  = ConfigurationManager.AppSettings["PayPalAPIUsername"];
        headers.Credentials.Password  = ConfigurationManager.AppSettings["PayPalAPIPassword"];
        headers.Credentials.Signature = ConfigurationManager.AppSettings["PayPalAPISignature"];

        //Client
        PayPalAPISoapBinding client = new PayPalAPISoapBinding();

        client.RequesterCredentials = headers;
        client.Timeout = 15000;
        GetTransactionDetailsResponseType response = client.GetTransactionDetails(request);

        if (response.Ack == AckCodeType.Success || response.Ack == AckCodeType.SuccessWithWarning)
        {
            rv.IsSucess      = true;
            rv.TransactionID = response.PaymentTransactionDetails.PaymentInfo.TransactionID;
            rv.ObjectValue   = response.PaymentTransactionDetails;
        }
        else
        {
            rv.ErrorMessage = response.Errors[0].LongMessage;
        }
        return(rv);
    }
예제 #9
0
    // # GetTransactionDetails API Operation
    // The GetTransactionDetails API operation obtains information about a specific transaction.
    public GetTransactionDetailsResponseType GetTransactionDetailsAPIOperation()
    {
        // Create the GetTransactionDetailsResponseType object
        GetTransactionDetailsResponseType responseGetTransactionDetailsResponseType = new GetTransactionDetailsResponseType();

        try
        {
            // Create the GetTransactionDetailsReq object
            GetTransactionDetailsReq         getTransactionDetails        = new GetTransactionDetailsReq();
            GetTransactionDetailsRequestType getTransactionDetailsRequest = new GetTransactionDetailsRequestType();

            // Unique identifier of a transaction.
            // `Note:
            // The details for some kinds of transactions cannot be retrieved with
            // GetTransactionDetails. You cannot obtain details of bank transfer
            // withdrawals, for example.`
            getTransactionDetailsRequest.TransactionID         = "5AT5731435011481X";
            getTransactionDetails.GetTransactionDetailsRequest = getTransactionDetailsRequest;

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

            // # API call
            // Invoke the GetTransactionDetails method in service wrapper object
            responseGetTransactionDetailsResponseType = service.GetTransactionDetails(getTransactionDetails);

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

                // # Success values
                if (responseGetTransactionDetailsResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
                {
                    // Unique PayPal Customer Account identification number
                    logger.Info("Payer ID : " + responseGetTransactionDetailsResponseType.PaymentTransactionDetails.PayerInfo.PayerID + "\n");
                    Console.WriteLine("Payer ID : " + responseGetTransactionDetailsResponseType.PaymentTransactionDetails.PayerInfo.PayerID + "\n");
                }
                // # Error Values
                else
                {
                    List <ErrorType> errorMessages = responseGetTransactionDetailsResponseType.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(responseGetTransactionDetailsResponseType);
    }
예제 #10
0
 /// <remarks/>
 public void GetTransactionDetailsAsync(GetTransactionDetailsReq GetTransactionDetailsReq, object userState) {
     if ((this.GetTransactionDetailsOperationCompleted == null)) {
         this.GetTransactionDetailsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetTransactionDetailsOperationCompleted);
     }
     this.InvokeAsync("GetTransactionDetails", new object[] {
                 GetTransactionDetailsReq}, this.GetTransactionDetailsOperationCompleted, userState);
 }
예제 #11
0
 /// <remarks/>
 public void GetTransactionDetailsAsync(GetTransactionDetailsReq GetTransactionDetailsReq) {
     this.GetTransactionDetailsAsync(GetTransactionDetailsReq, null);
 }
예제 #12
0
 public GetTransactionDetailsResponseType GetTransactionDetails(GetTransactionDetailsReq GetTransactionDetailsReq)
 {
     return(GetTransactionDetails(GetTransactionDetailsReq, null));
 }
예제 #13
0
        public string GetTransactionDetail(string transactionID, string delimiter)
        {
            string sReturn = "";
            GetTransactionDetailsRequestType detailRequest = new GetTransactionDetailsRequestType();

            detailRequest.TransactionID = transactionID;
            detailRequest.Version       = PayPalServiceUtility.PayPalAPIVersionNumber;
            GetTransactionDetailsReq request = new GetTransactionDetailsReq();

            request.GetTransactionDetailsRequest = detailRequest;

            GetTransactionDetailsResponseType response = service.GetTransactionDetails(request);

            sReturn = response.Ack.ToString() + "\n";

            string sErrors = this.CheckErrors(response);

            if (sErrors == string.Empty)
            {
                //build out the response
                StringBuilder sb = new StringBuilder();
                sb.Append("************** Payment Information ******************" + delimiter);

                //payment info
                PaymentInfoType payment = response.PaymentTransactionDetails.PaymentInfo;
                sb.Append("ReceiptID: " + payment.ReceiptID + delimiter);
                sb.Append("TransactionID: " + payment.TransactionID + delimiter);
                sb.Append("PaymentDate: " + payment.PaymentDate + delimiter);
                sb.Append("GrossAmount: " + GetAmountValue(payment.GrossAmount) + delimiter);
                sb.Append("SettleAmount: " + GetAmountValue(payment.SettleAmount) + delimiter);
                sb.Append("FeeAmount: " + GetAmountValue(payment.FeeAmount) + delimiter);
                sb.Append("TaxAmount: " + GetAmountValue(payment.TaxAmount) + delimiter);
                sb.Append("PaymentStatus: " + payment.PaymentStatus + delimiter);
                sb.Append("PaymentType: " + payment.PaymentType + delimiter);
                sb.Append("TransactionType: " + payment.TransactionType + delimiter);
                sb.Append(delimiter);
                //sReturn+=response.PaymentTransactionDetails.PaymentInfo.ToString();
                sb.Append("************** Buyer Information ******************" + delimiter);

                //receiver info
                ReceiverInfoType receiver = response.PaymentTransactionDetails.ReceiverInfo;
                sb.Append("Business: " + receiver.Business + delimiter);
                sb.Append("Receiver: " + receiver.Receiver + delimiter);
                sb.Append("ReceiverID: " + receiver.ReceiverID + delimiter);

                /*
                 * --- Uncomment this to report Auction and Subscription info
                 * sb.Append("************** Auction Information ******************"+delimiter);
                 *
                 * AuctionInfoType auction=new AuctionInfoType();
                 * sb.Append("BuyerID: "+auction.BuyerID+delimiter);
                 * sb.Append("ClosingDate: "+auction.ClosingDate+delimiter);
                 * sb.Append("ClosingDateSpecified: "+auction.ClosingDateSpecified+delimiter);
                 * sb.Append("multiItem: "+auction.multiItem+delimiter);
                 *
                 * sb.Append("************** Subscription Information ******************"+delimiter);
                 *
                 * SubscriptionInfoType sub=new SubscriptionInfoType();
                 *
                 * sb.Append("EffectiveDate: "+sub.EffectiveDate+delimiter);
                 * sb.Append("EffectiveDateSpecified: "+sub.EffectiveDateSpecified+delimiter);
                 * sb.Append("Password: "******"reattempt: "+sub.reattempt+delimiter);
                 * sb.Append("Recurrences: "+sub.Recurrences+delimiter);
                 * sb.Append("recurring: "+sub.recurring+delimiter);
                 * sb.Append("RetryTime: "+sub.RetryTime+delimiter);
                 * sb.Append("RetryTimeSpecified: "+sub.RetryTimeSpecified+delimiter);
                 * sb.Append("SubscriptionDate: "+sub.SubscriptionDate+delimiter);
                 * sb.Append("SubscriptionDateSpecified: "+sub.SubscriptionDateSpecified+delimiter);
                 * sb.Append("SubscriptionID: "+sub.SubscriptionID+delimiter);
                 * sb.Append("Terms: "+sub.Terms+delimiter);
                 * sb.Append("Username: "+sub.Username+delimiter);
                 */
                sReturn = sb.ToString();
            }
            else
            {
                sReturn = sErrors;
            }
            return(sReturn);
        }