protected PayPalServiceWrapperBase(PayPalServiceType serviceType) { var factory = ObjectFactory.GetInstance <IServiceEndPointFactory>(); ConnectionInfo = factory.Create(serviceType); _Profile = ProfileProvider.CreateProfile( ); }
public static bool Validate(string email, string firstName, string lastName, User user) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; if (HaveEmail(email)) { throw new ValidationException("На данную электропочту PayPal уже зарегестирован на Д2 пользователь"); } try { if (profile == null) { profile = CreateProfile(); } var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) { return(false); } if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { DataService.PerThread.PayPalVerificationSet.AddObject(new PayPalVerification() { Email = email, FirstName = firstName, LastName = lastName, VerificationDate = DateTime.Now, User = user }); DataService.PerThread.SaveChanges(); return(true); } return(false); }
public static bool Validate(string email, string firstName, string lastName, User user) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; if (HaveEmail(email)) throw new ValidationException("На данную электропочту PayPal уже зарегестирован на Д2 пользователь"); try { if (profile == null) profile = CreateProfile(); var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) return false; if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { DataService.PerThread.PayPalVerificationSet.AddObject(new PayPalVerification() { Email = email, FirstName = firstName, LastName = lastName, VerificationDate = DateTime.Now, User = user }); DataService.PerThread.SaveChanges(); return true; } return false; }
public static bool ValidateTest(string email, string firstName, string lastName) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; try { if (profile == null) { profile = CreateProfile(); } var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) { return(false); } if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { return(true); } return(false); }
public static bool ValidateTest(string email, string firstName, string lastName) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; try { if (profile == null) profile = CreateProfile(); var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) return false; if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { return true; } return false; }
private static BaseAPIProfile CreateProfile() { BaseAPIProfile profile = null; byte[] bCert = null; string filePath = string.Empty; FileStream fs = null; try { if (ConfigurationManager.AppSettings["API_AUTHENTICATION_MODE"] == "3TOKEN") { ////Three token profile = new BaseAPIProfile(); profile.APIProfileType = ProfileType.ThreeToken; profile.ApplicationID = ConfigurationManager.AppSettings["APPLICATION-ID"]; profile.APIUsername = ConfigurationManager.AppSettings["API_USERNAME"]; profile.APIPassword = ConfigurationManager.AppSettings["API_PASSWORD"]; profile.APISignature = ConfigurationManager.AppSettings["API_SIGNATURE"]; profile.DeviceIpAddress = ConfigurationManager.AppSettings["ipAddress"]; profile.Environment = ConfigurationManager.AppSettings["ENDPOINT"]; profile.RequestDataformat = ConfigurationManager.AppSettings["API_REQUESTFORMAT"]; profile.ResponseDataformat = ConfigurationManager.AppSettings["API_RESPONSEFORMAT"]; profile.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); } else { ////Certificate profile = new BaseAPIProfile(); profile.APIProfileType = ProfileType.Certificate; profile.APIUsername = ConfigurationManager.AppSettings["API_USERNAME"]; profile.APIPassword = ConfigurationManager.AppSettings["API_PASSWORD"]; profile.ApplicationID = ConfigurationManager.AppSettings["APPLICATION-ID"]; profile.RequestDataformat = ConfigurationManager.AppSettings["API_REQUESTFORMAT"]; profile.ResponseDataformat = ConfigurationManager.AppSettings["API_RESPONSEFORMAT"]; profile.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); ///loading the certificate file into profile. filePath = ConstHelper.AppPath + ConfigurationManager.AppSettings["CERTIFICATE"].ToString(); fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); bCert = new byte[fs.Length]; fs.Read(bCert, 0, int.Parse(fs.Length.ToString())); fs.Close(); profile.Certificate = bCert; profile.PrivateKeyPassword = ConfigurationManager.AppSettings["PRIVATE_KEY_PASSWORD"]; profile.APISignature = ""; profile.Environment = ConfigurationManager.AppSettings["ENDPOINT"]; } } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } return(profile); }
public string SetPreapproval(fbuser fbuser, bool Live_Trial, int Tx_Key, decimal amount) { string strReturn = ""; PreapprovalRequest preapprovalRequest = null; BaseAPIProfile profile2 = new BaseAPIProfile(); profile2.APIProfileType = ProfileType.ThreeToken; if (Live_Trial)//true = Live , false = trial { profile2.Environment = ConfigurationManager.AppSettings.Get("Live_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID_Live").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername_Live").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword_Live").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature_Live").ToString(); } else { profile2.Environment = ConfigurationManager.AppSettings.Get("Trial_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature").ToString(); } profile2.RequestDataformat = "SOAP11"; profile2.ResponseDataformat = "SOAP11"; profile2.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); try { decimal amountfee1 = (amount * Convert.ToDecimal(0.029)) + Convert.ToDecimal(0.3); decimal amountblueikon = (amount * Convert.ToDecimal(0.1)); decimal amountfee2 = (amountblueikon * Convert.ToDecimal(0.029)) + Convert.ToDecimal(0.3); amount = amount + amountblueikon + amountfee1 + amountfee2; amount = decimal.Round(amount, 2); string url = ConfigurationManager.AppSettings.Get("App_URL").ToString() ; string returnURL = "http://www.blueikons.com/Order_Confirmation.aspx?Tx_key=" + Tx_Key.ToString(); string cancelURL = url; preapprovalRequest = new PreapprovalRequest(); preapprovalRequest.cancelUrl = cancelURL; preapprovalRequest.returnUrl = returnURL; //preapprovalRequest.senderEmail = senderEmail.Value; preapprovalRequest.requestEnvelope = new RequestEnvelope(); preapprovalRequest.requestEnvelope.errorLanguage = "en-US"; preapprovalRequest.maxNumberOfPayments = 2; preapprovalRequest.maxTotalAmountOfAllPayments = amount; preapprovalRequest.maxTotalAmountOfAllPaymentsSpecified = true; preapprovalRequest.currencyCode = "USD"; preapprovalRequest.startingDate = DateTime.Today; preapprovalRequest.endingDate = DateTime.Today.AddMonths(1); preapprovalRequest.endingDateSpecified = true; preapprovalRequest.clientDetails = new ClientDetailsType(); //preapprovalRequest.clientDetails = ClientInfoUtil.getMyAppDetails(); preapprovalRequest.memo = "BlueIkons"; preapprovalRequest.maxNumberOfPayments = 2; preapprovalRequest.displayMaxTotalAmount = true; preapprovalRequest.displayMaxTotalAmountSpecified = true; preapprovalRequest.feesPayer = "SENDER"; AdapativePayments ap = new AdapativePayments(); ap.APIProfile = profile2; PreapprovalResponse PResponse = ap.preapproval(preapprovalRequest); if (ap.isSuccess.ToUpper() == "FAILURE") { //HttpContext.Current.Session[Constants.SessionConstants.FAULT] = ap.LastError; //HttpContext.Current.Response.Redirect("APIError.aspx", false); } else { // Session[Constants.SessionConstants.PREAPPROVALKEY] = PResponse.preapprovalKey; //this.Response.Redirect(ConfigurationManager.AppSettings["PAYPAL_REDIRECT_URL"] + "_ap-preapproval&preapprovalkey=" + PResponse.preapprovalKey, false); BlueIkons_DB.SPs.UpdateTransactionPakey(Tx_Key, PResponse.preapprovalKey).Execute(); if (Live_Trial)//true = Live , false = trial { //HttpContext.Current.Response.Redirect("https://paypal.com/webapps/adaptivepayment/flow/pay?paykey=" + PResponse.preapprovalKey, false); } else{ //HttpContext.Current.Response.Redirect("https://www.sandbox.paypal.com/webscr?cmd=" + "_ap-payment&paykey=" + PResponse.preapprovalKey, false); } strReturn = PResponse.preapprovalKey; } } catch (FATALException FATALEx) { // Session[Constants.SessionConstants.FATALEXCEPTION] = FATALEx; // this.Response.Redirect(Constants.ASPXPages.APIERROR + "?" + Constants.QueryStringConstants.TYPE + "=FATAL", false); } catch (Exception ex) { //FATALException FATALEx = new FATALException("Error occurred in PreApproval Page.", ex); //Session[Constants.SessionConstants.FATALEXCEPTION] = FATALEx; //this.Response.Redirect("APIError.aspx?type=FATAL", false); } return strReturn; }
public Boolean ParallelPayment(bool Live_Trial, gift giftinfo, string receiveremail) { Boolean txcompleted = false; BaseAPIProfile profile2 = new BaseAPIProfile(); int Tx_Key = giftinfo.txkey; Site sitetemp = new Site(); Transactions txinfo = sitetemp.Gettx(giftinfo.txkey); ////Three token profile2.APIProfileType = ProfileType.ThreeToken; string blueikonemail = ""; if (Live_Trial)//true = Live , false = trial { profile2.Environment = ConfigurationManager.AppSettings.Get("Live_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID_Live").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername_Live").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword_Live").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature_Live").ToString(); blueikonemail = ConfigurationManager.AppSettings.Get("My_Email_Live").ToString(); } else { profile2.Environment = ConfigurationManager.AppSettings.Get("Trial_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature").ToString(); blueikonemail = ConfigurationManager.AppSettings.Get("My_Email_Trial").ToString(); } /*profile2.RequestDataformat = "SOAP11"; profile2.ResponseDataformat = "SOAP11"; */ profile2.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); string url = ConfigurationManager.AppSettings.Get("Callback").ToString() + "/"; string returnURL = url + "Order_Confirmation.aspx?Tx_key=" + Tx_Key.ToString(); string cancelURL = url + "Order_Confirmation.aspx?Tx_key=0"; PayRequest payRequest = null; payRequest = new PayRequest(); payRequest.cancelUrl = cancelURL; payRequest.returnUrl = returnURL; payRequest.reverseAllParallelPaymentsOnError = true; //payRequest.senderEmail = email.Value; //payRequest.clientDetails = new ClientDetailsType(); //payRequest.clientDetails = ClientInfoUtil.getMyAppDetails(); payRequest.feesPayer = "SENDER";//feesPayer.Value; payRequest.memo = "BlueIkons";// memo.Value; payRequest.actionType = "PAY"; payRequest.currencyCode = "USD"; //currencyCode.Items[currencyCode.SelectedIndex].Value; payRequest.requestEnvelope = new RequestEnvelope(); payRequest.requestEnvelope.errorLanguage = "en_US";//ClientInfoUtil.getMyAppRequestEnvelope(); payRequest.preapprovalKey = txinfo.pakey; payRequest.receiverList = new Receiver[2]; payRequest.receiverList[0] = new Receiver(); payRequest.receiverList[0].amount = decimal.Round(giftinfo.amount,2);//amount_0.Value); payRequest.receiverList[0].email = receiveremail;//receiveremail_0.Value; decimal blueikonamount = (giftinfo.amount * Convert.ToDecimal(.1)); if (receiveremail != blueikonemail) { payRequest.receiverList[1] = new Receiver(); payRequest.receiverList[1].amount = decimal.Round(blueikonamount, 2); payRequest.receiverList[1].email = blueikonemail; } else { payRequest.receiverList[0].amount += decimal.Round(blueikonamount, 2); } //Eventomatic_DB.SPs.UpdateTransactionTicketAmountEmail(Tx_Key, strEmail1).Execute(); profile2.ResponseDataformat = "SOAP11"; profile2.RequestDataformat = "SOAP11"; AdapativePayments ap = new AdapativePayments(); ap.APIProfile = profile2; PayResponse PResponse = ap.pay(payRequest); if (ap.isSuccess.ToUpper() == "FAILURE") { //HttpContext.Current.Session[Constants.SessionConstants.FAULT] = ap.LastError; for (int i = 0; i <= ap.LastError.ErrorDetails.Length - 1; i++) { FaultDetailFaultMessageError ETtemp = (FaultDetailFaultMessageError)ap.LastError.ErrorDetails.GetValue(i); //decimal OverallTotal = decimal.Round(dcAmount1, 2) + decimal.Round(dcAmount2, 2); //Eventomatic_DB.SPs.UpdateCCErrors(ETtemp.message.ToString(), Tx_Key, 2, OverallTotal.ToString()).Execute(); } //HttpContext.Current.Response.Redirect("APIError.aspx", false); } else { //Payment went through BlueIkons_DB.SPs.UpdateTransaction(Tx_Key, 0, 0, 0, 3, PResponse.responseEnvelope.correlationId, receiveremail).Execute(); txcompleted = true; } return txcompleted; }
public Boolean PreapprovalActive(string pakey, bool Live_Trial, int txkey) { Boolean isactive = false; PreapprovalDetailsRequest preapprovalRequest = null; BaseAPIProfile profile2 = new BaseAPIProfile(); profile2.APIProfileType = ProfileType.ThreeToken; if (Live_Trial)//true = Live , false = trial { profile2.Environment = ConfigurationManager.AppSettings.Get("Live_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID_Live").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername_Live").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword_Live").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature_Live").ToString(); } else { profile2.Environment = ConfigurationManager.AppSettings.Get("Trial_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature").ToString(); } profile2.RequestDataformat = "SOAP11"; profile2.ResponseDataformat = "SOAP11"; profile2.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); try { preapprovalRequest = new PreapprovalDetailsRequest(); //preapprovalRequest.senderEmail = senderEmail.Value; preapprovalRequest.requestEnvelope = new RequestEnvelope(); preapprovalRequest.requestEnvelope.errorLanguage = "en-US"; preapprovalRequest.preapprovalKey = pakey; AdapativePayments ap = new AdapativePayments(); ap.APIProfile = profile2; PreapprovalDetailsResponse PResponse = ap.preapprovalDetails(preapprovalRequest); if (ap.isSuccess.ToUpper() == "FAILURE") { //HttpContext.Current.Session[Constants.SessionConstants.FAULT] = ap.LastError; //HttpContext.Current.Response.Redirect("APIError.aspx", false); } else { if (PResponse.status == "ACTIVE") { isactive = true; } else if ((PResponse.status == "CANCELED") || (PResponse.status == "DEACTIVED")) { BlueIkons_DB.SPs.UpdateTransactionExpired(txkey).Execute(); } } } catch (FATALException FATALEx) { // Session[Constants.SessionConstants.FATALEXCEPTION] = FATALEx; // this.Response.Redirect(Constants.ASPXPages.APIERROR + "?" + Constants.QueryStringConstants.TYPE + "=FATAL", false); } catch (Exception ex) { //FATALException FATALEx = new FATALException("Error occurred in PreApproval Page.", ex); //Session[Constants.SessionConstants.FATALEXCEPTION] = FATALEx; //this.Response.Redirect("APIError.aspx?type=FATAL", false); } return isactive; }
public static BaseAPIProfile CreateProfile() { BaseAPIProfile profile = null; var factory = ObjectFactory.GetInstance <IServiceEndPointFactory>(); var connectionInfo = factory.Create(PayPalServiceType.Permissions); try { if (CurrentValues.Instance.PayPalApiAuthenticationMode == PayPalProfileType.ThreeToken.ToString()) { profile = new BaseAPIProfile { APIProfileType = ConvertToServerEnum(PayPalProfileType.ThreeToken), ApplicationID = CurrentValues.Instance.PayPalPpApplicationId, APIUsername = CurrentValues.Instance.PayPalApiUsername, APIPassword = CurrentValues.Instance.PayPalApiPassword, APISignature = CurrentValues.Instance.PayPalApiSignature, Environment = connectionInfo.ServiceEndPoint, RequestDataformat = CurrentValues.Instance.PayPalApiRequestFormat.Value, ResponseDataformat = CurrentValues.Instance.PayPalApiResponseFormat.Value, IsTrustAllCertificates = CurrentValues.Instance.PayPalTrustAll }; } else { // ////Certificate // profile = new BaseAPIProfile(); // profile.APIProfileType = ProfileType.Certificate; // profile.APIUsername = config.API_USERNAME; // profile.APIPassword = config.API_PASSWORD; // profile.ApplicationID = config.APPLICATION-ID; // profile.RequestDataformat = config.API_REQUESTFORMAT; // profile.ResponseDataformat = config.API_RESPONSEFORMAT; // // profile.IsTrustAllCertificates = Convert.ToBoolean(config.TrustAll); // ///loading the certificate file into profile. // filePath = HttpContext.Current.Server.MapPath(config.CERTIFICATE.ToString()); // fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); // bCert = new byte[fs.Length]; // fs.Read(bCert, 0, int.Parse(fs.Length.ToString())); // fs.Close(); // // profile.Certificate = bCert; // profile.PrivateKeyPassword = config.PRIVATE_KEY_PASSWORD; // profile.APISignature = ""; // profile.Environment = config.ENDPOINT; throw new CerteficateConfigIsNotSupported(); } } catch (FATALException) { throw; } catch (Exception) { throw; } return(profile); }
private static BaseAPIProfile CreateProfile() { BaseAPIProfile profile = null; byte[] bCert = null; string filePath = string.Empty; FileStream fs = null; try { if (ConfigurationManager.AppSettings["API_AUTHENTICATION_MODE"] == "3TOKEN") { ////Three token profile = new BaseAPIProfile(); profile.APIProfileType = ProfileType.ThreeToken; profile.ApplicationID = ConfigurationManager.AppSettings["APPLICATION-ID"]; profile.APIUsername = ConfigurationManager.AppSettings["API_USERNAME"]; profile.APIPassword = ConfigurationManager.AppSettings["API_PASSWORD"]; profile.APISignature = ConfigurationManager.AppSettings["API_SIGNATURE"]; profile.DeviceIpAddress = ConfigurationManager.AppSettings["ipAddress"]; profile.Environment = ConfigurationManager.AppSettings["ENDPOINT"]; profile.RequestDataformat = ConfigurationManager.AppSettings["API_REQUESTFORMAT"]; profile.ResponseDataformat = ConfigurationManager.AppSettings["API_RESPONSEFORMAT"]; profile.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); } else { ////Certificate profile = new BaseAPIProfile(); profile.APIProfileType = ProfileType.Certificate; profile.APIUsername = ConfigurationManager.AppSettings["API_USERNAME"]; profile.APIPassword = ConfigurationManager.AppSettings["API_PASSWORD"]; profile.ApplicationID = ConfigurationManager.AppSettings["APPLICATION-ID"]; profile.RequestDataformat = ConfigurationManager.AppSettings["API_REQUESTFORMAT"]; profile.ResponseDataformat = ConfigurationManager.AppSettings["API_RESPONSEFORMAT"]; profile.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); ///loading the certificate file into profile. filePath = ConstHelper.AppPath + ConfigurationManager.AppSettings["CERTIFICATE"].ToString(); fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); bCert = new byte[fs.Length]; fs.Read(bCert, 0, int.Parse(fs.Length.ToString())); fs.Close(); profile.Certificate = bCert; profile.PrivateKeyPassword = ConfigurationManager.AppSettings["PRIVATE_KEY_PASSWORD"]; profile.APISignature = ""; profile.Environment = ConfigurationManager.AppSettings["ENDPOINT"]; } } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } return profile; }