예제 #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 string PayPalTransactionProcessLongRunningAction(string id, int PaypalApi, string RangeDate)
        {
            using (ImsDbContext dbContext = new ImsDbContext())
            {
                dbContext.Configuration.AutoDetectChangesEnabled = false;
                PaypalApi paypalApi = dbContext.PaypalApis.Find(PaypalApi);
                dbContext.Configuration.AutoDetectChangesEnabled = true;
                this.ImsService.PayPalHelper(paypalApi);
                string   dataRange = RangeDate;
                string[] date      = dataRange.Split(new char[] { '-' });

                DateTime startDate = DateTime.Parse(date[0].Trim());
                DateTime endDate   = DateTime.Parse(date[1].Trim());

                IEnumerable <PaymentTransactionSearchResultType> PaypalTransactionSearch = this.ImsService.ApiTransactionSearch(startDate, endDate);
                int total = PaypalTransactionSearch.Count <PaymentTransactionSearchResultType>();


                if (PaypalTransactionSearch.Count() > 0)
                {
                    var lastsearch = PaypalTransactionSearch.Last();
                    var lastdetail = this.ImsService.ApiTransactionDetail(lastsearch);
                    ProcessLastDate = lastdetail.PaymentTransactionDetails.PaymentInfo.PaymentDate;
                }
                else
                {
                    ProcessLastDate = startDate.ToCnDataString();
                }
                int i = 0;
                // List<PayPalTransaction> pptlist = new List<PayPalTransaction>();
                PaypalTransactionSearch.ToList().ForEach(a =>
                {
                    GetTransactionDetailsResponseType PaypalTransactionDetails = this.ImsService.ApiTransactionDetail(a);
                    if (PaypalTransactionDetails.Ack.Equals(AckCodeType.SUCCESS))
                    {
                        i++;
                        int d = Precentage(i, total);

                        lock (syncRoot)
                        {
                            ProcessStatus[id] = d;
                            ProcessTotal      = total;
                            ProcessNumber     = i + 1;
                        }
                        dbContext.Configuration.AutoDetectChangesEnabled = false;
                        bool flag = dbContext.PayPalTransactions.AsNoTracking().Count(j => j.TransactionId == a.TransactionID) == 0;
                        dbContext.Configuration.AutoDetectChangesEnabled = true;
                        if (flag)
                        {
                            var detail = this.ImsService.PayPayTransaction(PaypalTransactionDetails);
                            // pptlist.Add(detail);
                            dbContext.Insert <PayPalTransaction>(detail);
                        }
                    }
                });
                // dbContext.PayPalTransactions.AddRange(pptlist);
                // dbContext.SaveChanges();
            }
            return(id);
        }
예제 #4
0
    public void GetTransactionDetails()
    {
        GetTransactionDetailsSample       sample = new GetTransactionDetailsSample();
        GetTransactionDetailsResponseType responseGetTransactionDetailsResponseType = sample.GetTransactionDetailsAPIOperation();

        Assert.IsNotNull(responseGetTransactionDetailsResponseType);
        Assert.AreEqual(responseGetTransactionDetailsResponseType.Ack.ToString().ToUpper(), "SUCCESS");
        Assert.IsNotNull(responseGetTransactionDetailsResponseType.PaymentTransactionDetails.PayerInfo.PayerID);
    }
예제 #5
0
 /// <summary>
 /// Get a detail information about a transaction.
 /// </summary>
 /// <param name="transactionID">ID of transaction of interest.</param>
 /// <returns>a transaction details code</returns>
 public string getTransactionDetails(string transactionID)
 {
     GetTransactionDetailsRequestType request = new GetTransactionDetailsRequestType();
     request.TransactionID = transactionID;
     request.Version = settings.Version;
     GetTransactionDetailsResponseType response = new GetTransactionDetailsResponseType();
     response = (GetTransactionDetailsResponseType)caller.Call("GetTransactionDetails", request);
     return response.Ack.ToString();
 }
예제 #6
0
        public string PaymentTransactionProcessLongRunningAction(string id, int PaypalApi, string RangeDate)
        {
            PaypalApi paypalApi = this.ImsService.GetPaypalApi(PaypalApi);

            this.ImsService.PayPalHelper(paypalApi);

            string dataRange = RangeDate;

            string[] date = dataRange.Split(new char[] { '-' });

            DateTime startDate = DateTime.Parse(date[0].Trim());
            DateTime endDate   = DateTime.Parse(date[1].Trim());

            IEnumerable <PaymentTransactionSearchResultType> PaypalTransactionSearch = this.ImsService.ApiTransactionSearch(startDate, endDate);
            var total = PaypalTransactionSearch.Count <PaymentTransactionSearchResultType>();


            int i = 0;

            foreach (var item in PaypalTransactionSearch)
            {
                GetTransactionDetailsResponseType PaypalTransactionDetails = this.ImsService.ApiTransactionDetail(item);
                if (PaypalTransactionDetails.Ack.Equals(AckCodeType.SUCCESS))
                {
                    i++;
                    int d = Precentage(i, total);

                    lock (syncRoot)
                    {
                        ProcessStatus[id] = d;
                    }


                    /*TransactionDetailRequest request = new TransactionDetailRequest
                     * {
                     *  TransactionID = item.TransactionID
                     * };*/

                    PaymentTransactionRequest request = new PaymentTransactionRequest
                    {
                        TransactionID = item.TransactionID
                    };
                    if (this.ImsService.GetPaymentTransactionList(request).Count() == 0)
                    {
                        var detail = this.ImsService.PaymentTransaction(PaypalTransactionDetails);

                        using (var dbContext = new ImsDbContext())
                        {
                            dbContext.Insert <Evisou.Ims.Contract.Model.PayPal.PaymentTransactionType>(detail);
                        }
                    }
                }
            }

            return(id);
        }
예제 #7
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);
        }
예제 #8
0
        public override ApiInfo GetStatus(Order order, IDictionary <string, string> settings)
        {
            ApiInfo apiInfo = null;

            try {
                order.MustNotBeNull("order");
                settings.MustNotBeNull("settings");
                settings.MustContainKey("x_login", "settings");
                settings.MustContainKey("transactionKey", "settings");

                GetTransactionDetailsResponseType result = GetAuthorizeNetServiceClient(settings).GetTransactionDetails(new MerchantAuthenticationType {
                    name = settings["x_login"], transactionKey = settings["transactionKey"]
                }, order.TransactionInformation.TransactionId);

                if (result.resultCode == MessageTypeEnum.Ok)
                {
                    PaymentState paymentState = PaymentState.Initialized;
                    switch (result.transaction.transactionStatus)
                    {
                    case "authorizedPendingCapture":
                        paymentState = PaymentState.Authorized;
                        break;

                    case "capturedPendingSettlement":
                    case "settledSuccessfully":
                        paymentState = PaymentState.Captured;
                        break;

                    case "voided":
                        paymentState = PaymentState.Cancelled;
                        break;

                    case "refundSettledSuccessfully":
                    case "refundPendingSettlement":
                        paymentState = PaymentState.Refunded;
                        break;
                    }

                    apiInfo = new ApiInfo(result.transaction.transId, paymentState);
                }
                else
                {
                    LoggingService.Instance.Warn <AuthorizeNet>("Authorize.net(" + order.OrderNumber + ") - Error making API request - error code: " + result.messages[0].code + " | description: " + result.messages[0].text);
                }
            } catch (Exception exp) {
                LoggingService.Instance.Error <AuthorizeNet>("Authorize.net(" + order.OrderNumber + ") - Get status", exp);
            }

            return(apiInfo);
        }
예제 #9
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);
        }
예제 #10
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);
    }
        private IGatewayResponse SendGetTransactionDetailsRequest(AuthorizeDotNetRequest request)
        {
            var result = string.Empty;
            IGatewayResponse gatewayResponse;

            var authentication = new MerchantAuthenticationType();

            authentication.name           = request.KeyValues[AuthorizeDotNetApi.ApiLogin];
            authentication.transactionKey = request.KeyValues[AuthorizeDotNetApi.TransactionKey];

            string id = request.KeyValues[AuthorizeDotNetApi.TransactionId];

            using (var webService = new RevStack.AuthorizeDotNet.net.authorize.api.Service())
            {
                webService.Url = request.PostUrl;
                GetTransactionDetailsResponseType response = webService.GetTransactionDetails(authentication, id, null);
                char del = request.KeyValues[AuthorizeDotNetApi.DelimitCharacter].ToCharArray()[0];
                gatewayResponse = new Model.Gateway.Payment(response.transaction);
            }

            return(gatewayResponse);
        }
예제 #12
0
        private void processResponse(PayPalAPIInterfaceServiceService service, GetTransactionDetailsResponseType response)
        {
            HttpContext CurrContext = HttpContext.Current;

            CurrContext.Items.Add("Response_apiName", "GetTransactionDetails");
            CurrContext.Items.Add("Response_redirectURL", null);
            CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
            CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());

            Dictionary <string, string> keyResponseParameters = new Dictionary <string, string>();

            keyResponseParameters.Add("Correlation Id", response.CorrelationID);
            keyResponseParameters.Add("API Result", response.Ack.ToString());

            if (response.Ack.Equals(AckCodeType.FAILURE) ||
                (response.Errors != null && response.Errors.Count > 0))
            {
                CurrContext.Items.Add("Response_error", response.Errors);
            }
            else
            {
                CurrContext.Items.Add("Response_error", null);
                PaymentTransactionType transactionDetails = response.PaymentTransactionDetails;
                keyResponseParameters.Add("Payment receiver", transactionDetails.ReceiverInfo.Receiver);
                keyResponseParameters.Add("Payer", transactionDetails.PayerInfo.Payer);
                keyResponseParameters.Add("Payment date", transactionDetails.PaymentInfo.PaymentDate);
                keyResponseParameters.Add("Payment status", transactionDetails.PaymentInfo.PaymentStatus.ToString());
                keyResponseParameters.Add("Gross amount",
                                          transactionDetails.PaymentInfo.GrossAmount.value + transactionDetails.PaymentInfo.GrossAmount.currencyID.ToString());

                if (transactionDetails.PaymentInfo.SettleAmount != null)
                {
                    keyResponseParameters.Add("Settlement amount",
                                              transactionDetails.PaymentInfo.SettleAmount.value + transactionDetails.PaymentInfo.SettleAmount.currencyID.ToString());
                }
            }
            CurrContext.Items.Add("Response_keyResponseObject", keyResponseParameters);
            Server.Transfer("../APIResponse.aspx");
        }
예제 #13
0
        public OrderResponse PlacePayPalOrder(ref OBE_Order oOrder, string cardNumber, int year)
        {
            OrderResponse oValue = new OrderResponse();

            try
            {
                OBE_VerificationPayPal oVerificationPayPal = new OBE_VerificationPayPal();
                GetVerificationObject(ref oVerificationPayPal);
                DoDirectPaymentResponseType       oDPayment      = new DoDirectPaymentResponseType();
                GetTransactionDetailsResponseType oDTransDetails = new GetTransactionDetailsResponseType();
                PayPalAPI.PayPalAPI oPayPalAPI = new PayPalAPI.PayPalAPI(oVerificationPayPal.User, oVerificationPayPal.Password, oVerificationPayPal.Signature, oVerificationPayPal.Enviroment);


                try
                {
                    if (HttpContext.Current.Session["Language"] != null && HttpContext.Current.Session["Language"].ToString() == "FR")
                    {
                        if (HttpContext.Current.Session["WarrantyCheckout"] == null)
                        {
                            oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString().Replace(",", "."), ".", oOrder.CreditCard.NameOnCard, oOrder.BillingCustomer.Address.Address1, oOrder.BillingCustomer.Address.Address2, oOrder.BillingCustomer.Address.City, oOrder.BillingCustomer.Address.ProvState, oOrder.BillingCustomer.Address.POCode, oOrder.BillingCustomer.Address.Country, oOrder.CreditCard.CardType.ToString(),
                                                                   cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);
                        }

                        //made up address as we don't require it for warrantyCheckout process.
                        else
                        {
                            //oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString().Replace(",", "."), ".", oOrder.CreditCard.NameOnCard, "123 main st.", "123 main st.",
                            //HttpContext.Current.Session["city"].ToString(), "ON", "L8W1P1", "Canada", oOrder.CreditCard.CardType.ToString(),
                            //cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);

                            oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString().Replace(",", "."), ".", oOrder.CreditCard.NameOnCard, oOrder.BillingCustomer.Address.Address1, oOrder.BillingCustomer.Address.Address2,
                                                                   oOrder.BillingCustomer.Address.City, oOrder.BillingCustomer.Address.ProvState, oOrder.BillingCustomer.Address.POCode, oOrder.BillingCustomer.Address.Country, oOrder.CreditCard.CardType.ToString(),
                                                                   cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);
                        }
                    }
                    else
                    {
                        if (HttpContext.Current.Session["WarrantyCheckout"] == null)
                        {
                            oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString(), ".", oOrder.CreditCard.NameOnCard, oOrder.BillingCustomer.Address.Address1, oOrder.BillingCustomer.Address.Address2, oOrder.BillingCustomer.Address.City, oOrder.BillingCustomer.Address.ProvState, oOrder.BillingCustomer.Address.POCode, oOrder.BillingCustomer.Address.Country, oOrder.CreditCard.CardType.ToString(),
                                                                   cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);
                        }

                        //made up address as we don't require it for warrantyCheckout process.
                        else
                        {
                            //oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString(), ".", oOrder.CreditCard.NameOnCard, "123 main st.", "123 main st.",
                            //HttpContext.Current.Session["city"].ToString(), "ON", "L8W1P1", "Canada", oOrder.CreditCard.CardType.ToString(),
                            //cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);


                            oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString(), ".", oOrder.CreditCard.NameOnCard, oOrder.BillingCustomer.Address.Address1, oOrder.BillingCustomer.Address.Address2,
                                                                   oOrder.BillingCustomer.Address.City, oOrder.BillingCustomer.Address.ProvState, oOrder.BillingCustomer.Address.POCode, oOrder.BillingCustomer.Address.Country, oOrder.CreditCard.CardType.ToString(),
                                                                   cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);



                            HttpContext.Current.Session["WarrantyCheckout"] = null;
                        }
                    }
                    try
                    {
                        if ((oDPayment.TransactionID != null) && !string.IsNullOrEmpty(oDPayment.TransactionID))
                        {
                            oDTransDetails = oPayPalAPI.GetTransactionDetails(oDPayment.TransactionID);
                        }

                        //AddPayPalTransaction(oOrder, oDPayment, com.paypal.soap.api.PaymentActionCodeType.Sale, oVerificationPayPal, false, oDTransDetails);
                    }
                    catch (Exception ex)
                    {
                    }

                    oValue = GetPayPalReceipt(oDPayment);

                    if (oValue.ResponseCode == 0 | oValue.ResponseCode == RETURNCODE.RET_CODE_SUCCESS)
                    {
                        oValue.ResponseCode = RETURNCODE.RET_CODE_SUCCESS;
                    }
                    else
                    {
                        if (HttpContext.Current.Session["Language"] != null && HttpContext.Current.Session["Language"].ToString() == "FR")
                        {
                            oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString().Replace(",", "."), ".", oOrder.CreditCard.NameOnCard, oVerificationPayPal.Address1, oVerificationPayPal.Address2, oVerificationPayPal.City, oVerificationPayPal.Prov, oVerificationPayPal.POCode, oVerificationPayPal.Country, oOrder.CreditCard.CardType.ToString(),
                                                                   cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);
                        }
                        else
                        {
                            oDPayment = oPayPalAPI.DoDirectPayment(Math.Round(((decimal)oOrder.Subtotal + oOrder.GST.Amount + oOrder.PST.Amount + (decimal)oOrder.ShippingCost), 2).ToString(), ".", oOrder.CreditCard.NameOnCard, oVerificationPayPal.Address1, oVerificationPayPal.Address2, oVerificationPayPal.City, oVerificationPayPal.Prov, oVerificationPayPal.POCode, oVerificationPayPal.Country, oOrder.CreditCard.CardType.ToString(),
                                                                   cardNumber, oOrder.CreditCard.CVV, Int32.Parse(oOrder.CreditCard.ExpiryMonth), year, com.paypal.soap.api.PaymentActionCodeType.Authorization, oVerificationPayPal.Currency);
                        }
                        try
                        {
                            if ((oDPayment.TransactionID != null) && !string.IsNullOrEmpty(oDPayment.TransactionID))
                            {
                                oDTransDetails = oPayPalAPI.GetTransactionDetails(oDPayment.TransactionID);
                            }

                            //AddPayPalTransaction(oOrder, oDPayment, com.paypal.soap.api.PaymentActionCodeType.Sale, oVerificationPayPal, true, oDTransDetails);
                        }
                        catch (Exception ex)
                        {
                        }


                        oValue = GetPayPalReceipt(oDPayment);

                        if (oValue.ResponseCode == 0 | oValue.ResponseCode == RETURNCODE.RET_CODE_SUCCESS)
                        {
                            oValue.ResponseCode = RETURNCODE.RET_CODE_SUCCESS;
                        }
                        else
                        {
                            oValue.ResponseCode = RETURNCODE.RET_CODE_UNKNOWN_ERROR;
                        }
                    }
                }
                catch (Exception ex)
                {
                    if ((oDPayment.TransactionID != null) && !string.IsNullOrEmpty(oDPayment.TransactionID))
                    {
                        oDTransDetails = oPayPalAPI.GetTransactionDetails(oDPayment.TransactionID);
                    }

                    //AddPayPalTransaction(oOrder, oDPayment, com.paypal.soap.api.PaymentActionCodeType.Sale, oVerificationPayPal, false, oDTransDetails);

                    oValue.ResponseCode = RETURNCODE.RET_CODE_UNKNOWN_ERROR;
                    oValue.Message      = "Unknown Verisign Error";
                }
            }
            catch (Exception ex)
            {
                oValue.ResponseCode = RETURNCODE.RET_CODE_DB_UNKNOWN_ERROR;
                oValue.Message      = "Unknown Verisign DB Error";
            }

            if (HttpContext.Current.Session["Language"] != null && HttpContext.Current.Session["Language"].ToString() == "FR")
            {
                if (oValue.Message.ToString() == "This transaction cannot be processed. Please enter a valid credit card number and type.")
                {
                    oValue.Message = "Cette transaction ne peut pas être traitée. Veuillez saisir un numéro et un type de carte de crédit valides.";
                }
            }


            return(oValue);
        }
예제 #14
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);
    }
예제 #15
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);
        }