public bool NotificationMessageIsAuthenticated(PaymentMethod paymentMethod) { var currentRequest = System.Web.HttpContext.Current.Request; if (!currentRequest.IsSecureConnection) { LoggingService.Log <PaymentResultValidator>("Adyen uses basic auth for sending payment notification. Request validated as insecure. Has your application been configured for SSL?"); } string authHeader = currentRequest.Headers["Authorization"]; string userName = paymentMethod.DynamicProperty <string>().NotificationUsername; string password = paymentMethod.DynamicProperty <string>().NotificationPassword; if (authHeader == null) { return(false); } else { string encodedAuth = authHeader.Split(' ')[1]; string decodedAuth = Encoding.UTF8.GetString(Convert.FromBase64String(encodedAuth)); var requestUser = decodedAuth.Split(':')[0]; var requestPassword = decodedAuth.Split(':')[1]; if (!userName.Equals(requestUser) || !password.Equals(requestPassword)) { return(false); } } return(true); }
public SecureTradingTransactionUpdateXmlResponse UpdateSettleMentStatus(string transactionId, SecureTradingSettlementStatus settleStatus, PaymentMethod paymentMethod) { string webServiceAlias = paymentMethod.DynamicProperty <string>().WebServiceAlias; string sitereference = paymentMethod.DynamicProperty <string>().Sitereference; string xmlToSend = string.Format(@"<?xml version=""1.0"" encoding=""utf-8""?> <requestblock version=""3.67""> <alias>{0}</alias> <request type=""TRANSACTIONUPDATE""> <filter> <sitereference>{1}</sitereference> <transactionreference>{2}</transactionreference> </filter> <updates> <settlement> <settlestatus>{3}</settlestatus> </settlement> </updates> </request> </requestblock>" , webServiceAlias, sitereference, transactionId, (int)settleStatus); return(new SecureTradingTransactionUpdateXmlResponse(CreateRequest(xmlToSend, paymentMethod))); }
protected virtual bool ProcessOperation(string operation, string transactionId, out string message, PaymentMethod paymentMethod) { // Configuration values string merchantId = paymentMethod.DynamicProperty <string>().MerchantId; string password = paymentMethod.DynamicProperty <string>().Password; bool result; NetaxeptClient client = GetClient(paymentMethod); try { var response = client.Process(merchantId, password, new ProcessRequest { Operation = operation, TransactionId = transactionId }); message = response.ResponseText; result = response.ResponseCode.Equals("OK"); } catch (Exception ex) { message = ex.Message; result = false; } return(result); }
public SecureTradingRefundXmlResponse Refund(string transactionId, string orderReference, PaymentMethod paymentMethod) { string webServiceAlias = paymentMethod.DynamicProperty <string>().WebServiceAlias; string sitereference = paymentMethod.DynamicProperty <string>().Sitereference; string xmlToSend = string.Format(@" <requestblock version=""3.67""> <alias>{0}</alias> <request type=""REFUND""> <merchant> <orderreference>{1}</orderreference> </merchant> <operation> <sitereference>{2}</sitereference> <parenttransactionreference>{3}</parenttransactionreference> </operation> </request> </requestblock>" , webServiceAlias, orderReference, sitereference, transactionId); return(new SecureTradingRefundXmlResponse(CreateRequest(xmlToSend, paymentMethod))); }
private void RedirectCustomerToRemotePaymentPage(string transactionId, PaymentMethod paymentMethod) { // Configuration value string merchantId = paymentMethod.DynamicProperty <string>().MerchantId; bool testMode = paymentMethod.DynamicProperty <bool>().TestMode; string idData = string.Format("?merchantId={0}&transactionId={1}", merchantId, transactionId); string redirectUrl = (testMode) ? string.Format("{0}{1}", BASE_REDIRECT_URL_TEST, idData) : string.Format("{0}{1}", BASE_REDIRECT_URL_LIVE, idData); HttpContext.Current.Response.Redirect(redirectUrl); }
public ButtonEncrypter(PaymentMethod paymentMethod) { var selfCertificatePath = HostingEnvironment.MapPath(paymentMethod.DynamicProperty <string>().PrivateCertificatePath); var publicPayPalCertificatePath = HostingEnvironment.MapPath(paymentMethod.DynamicProperty <string>().PublicPayPalCertificatePath); CheckFileExists(selfCertificatePath); CheckFileExists(publicPayPalCertificatePath); _signerCert = new X509Certificate2(selfCertificatePath, paymentMethod.DynamicProperty <string>().PrivateCertificatePassword, X509KeyStorageFlags.MachineKeySet); _recipientCert = new X509Certificate2(publicPayPalCertificatePath); }
private Dictionary <string, string> GetDefaultPostValues(PaymentMethod paymentMethod) { string merchant = paymentMethod.DynamicProperty <string>().Merchant.ToString(); string apiKey = paymentMethod.DynamicProperty <string>().ApiKey.ToString(); var postValues = new Dictionary <string, string>(); postValues.Add("protocol", PROTOCOL); postValues.Add("merchant", merchant); postValues.Add("apikey", apiKey); return(postValues); }
private void SetupWebServiceCredentials(PaymentMethod paymentMethod) { if (PaymentClient.ClientCredentials == null || RecurringClient.ClientCredentials == null) { throw new InvalidOperationException("Could not set user credentials for the web service access."); } PaymentClient.ClientCredentials.UserName.UserName = paymentMethod.DynamicProperty <string>().WebServiceUsername; PaymentClient.ClientCredentials.UserName.Password = HttpUtility.UrlDecode(paymentMethod.DynamicProperty <string>().WebServicePassword); RecurringClient.ClientCredentials.UserName.UserName = paymentMethod.DynamicProperty <string>().WebServiceUsername; RecurringClient.ClientCredentials.UserName.Password = HttpUtility.UrlDecode(paymentMethod.DynamicProperty <string>().WebServicePassword); }
private string CreateRequest(string xmlToSend, PaymentMethod paymentMethod) { string webServiceAlias = paymentMethod.DynamicProperty <string>().WebServiceAlias; string webServicePassword = paymentMethod.DynamicProperty <string>().WebServicePassword; string serviceUrl = "https://webservices.securetrading.net:443/xml/"; return(new XmlHttpPost( serviceUrl, xmlToSend, webServiceAlias, webServicePassword) .Request()); }
private NVPCallerServices GetPayPalNVPCaller(PaymentMethod paymentMethod) { // var callerServices = new com.paypal.sdk.services.CallerServices(); var caller = new NVPCallerServices(); IAPIProfile profile = ProfileFactory.createSignatureAPIProfile(); profile.Environment = paymentMethod.DynamicProperty <bool>().Sandbox ? "sandbox" : "live"; profile.APIPassword = paymentMethod.DynamicProperty <string>().ApiPassword; profile.APISignature = paymentMethod.DynamicProperty <string>().ApiSignature; profile.APIUsername = paymentMethod.DynamicProperty <string>().ApiUsername; caller.APIProfile = profile; return(caller); }
private BraintreeGateway GetBraintreeGateway(PaymentMethod paymentMethod) { bool testMode = paymentMethod.DynamicProperty <bool>().TestMode; string merchantId = paymentMethod.DynamicProperty <string>().MerchantId; string publicKey = paymentMethod.DynamicProperty <string>().PublicKey; string privateKey = paymentMethod.DynamicProperty <string>().PrivateKey; return(new BraintreeGateway { Configuration = new global::Braintree.Configuration( testMode ? Environment.SANDBOX : Environment.PRODUCTION, merchantId, publicKey, privateKey) }); }
protected virtual PxOrderSoapClient GetPxOrderSoapClient(PaymentMethod paymentMethod) { var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport) { CloseTimeout = TimeSpan.FromMinutes(1), OpenTimeout = TimeSpan.FromMinutes(1), ReceiveTimeout = TimeSpan.FromMinutes(10), SendTimeout = TimeSpan.FromMinutes(10), AllowCookies = false, BypassProxyOnLocal = false, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, MaxBufferSize = 65536, MaxBufferPoolSize = 524288, MaxReceivedMessageSize = 65536, MessageEncoding = WSMessageEncoding.Text, TextEncoding = Encoding.UTF8, TransferMode = TransferMode.Buffered, UseDefaultWebProxy = true }; Uri uri = paymentMethod.DynamicProperty <bool>().TestMode ? new Uri("https://test-external.payex.com/pxorder/pxorder.asmx", UriKind.Absolute) : new Uri("https://external.payex.com/pxorder/pxorder.asmx", UriKind.Absolute); var endpointAddress = new EndpointAddress(uri); Client = new PxOrderSoapClient(binding, endpointAddress); return(Client); }
protected NetaxeptClient GetClient(PaymentMethod paymentMethod) { var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport) { CloseTimeout = TimeSpan.FromMinutes(1), OpenTimeout = TimeSpan.FromMinutes(1), ReceiveTimeout = TimeSpan.FromMinutes(10), SendTimeout = TimeSpan.FromMinutes(10), AllowCookies = false, BypassProxyOnLocal = false, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, MaxBufferSize = 65536, MaxBufferPoolSize = 524288, MaxReceivedMessageSize = 65536, MessageEncoding = WSMessageEncoding.Text, TextEncoding = Encoding.UTF8, TransferMode = TransferMode.Buffered, UseDefaultWebProxy = true }; bool testMode = paymentMethod.DynamicProperty <bool>().TestMode; string uri = (testMode) ? TEST_ENDPOINT : LIVE_ENDPOINT; var endpointAddress = new EndpointAddress(uri); return(new NetaxeptClient(binding, endpointAddress)); }
/// <summary> /// Determines if the API operation was successful /// </summary> /// <param name="message">The XML response string.</param> /// <param name="paymentMethod">The payment method.</param> /// <returns>The call status</returns> private bool ValidateApiCall(string message, PaymentMethod paymentMethod) { string md5Secret = paymentMethod.DynamicProperty <string>().Md5secret; string md5ResponseString = ""; string md5Check = ""; var responseElement = XDocument.Parse(message).Element("response"); if (responseElement == null) { return(false); } // Concat all elements for MD5 check to // validate the returned response. // Make sure to exclude to sent MD5 value. md5ResponseString = responseElement.Descendants() .Where(x => x.Name.ToString() != "md5check") .Select(x => x.Value) .Aggregate((a, b) => a + b); md5Check = responseElement.Element("md5check").Value; string status = responseElement.Element("qpstat").Value; string md5CheckResponse = QuickpayMd5Computer.GetMd5KeyFromResponseValueString(md5ResponseString, md5Secret); return(status.Equals("000") && !String.IsNullOrEmpty(md5Check) && !String.IsNullOrEmpty(md5CheckResponse) && md5Check.Equals(md5CheckResponse)); }
/// <summary> /// Gets the list of parameters used for the encryption signature. /// </summary> /// <param name="request">The request context.</param> /// <param name="securityKey">The security key.</param> /// <param name="paymentMethod">The payment method</param> /// <returns></returns> protected virtual IList <string> GetSignatureParameterList(HttpRequest request, string securityKey, PaymentMethod paymentMethod) { string vendor = paymentMethod.DynamicProperty <string>().Vendor; IList <string> list = new List <string>(); list.Add(GetHttpRequestValueUrlDecoded(request, "VPSTxId")); list.Add(GetHttpRequestValueUrlDecoded(request, "VendorTxCode")); list.Add(GetHttpRequestValueUrlDecoded(request, "Status")); list.Add(GetHttpRequestValueUrlDecoded(request, "TxAuthNo")); list.Add(vendor.ToLower()); list.Add(GetHttpRequestValueUrlDecoded(request, "AVSCV2")); list.Add(securityKey); list.Add(GetHttpRequestValueUrlDecoded(request, "AddressResult")); list.Add(GetHttpRequestValueUrlDecoded(request, "PostCodeResult")); list.Add(GetHttpRequestValueUrlDecoded(request, "CV2Result")); list.Add(GetHttpRequestValueUrlDecoded(request, "GiftAid")); list.Add(GetHttpRequestValueUrlDecoded(request, "3DSecureStatus")); list.Add(GetHttpRequestValueUrlDecoded(request, "CAVV")); list.Add(GetHttpRequestValueUrlDecoded(request, "AddressStatus")); list.Add(GetHttpRequestValueUrlDecoded(request, "PayerStatus")); list.Add(GetHttpRequestValueUrlDecoded(request, "CardType")); list.Add(GetHttpRequestValueUrlDecoded(request, "Last4Digits")); return(list); }
/// <summary> /// Get the URL for which an appropiate action needs to be sent. /// </summary> /// <param name="strType"></param> /// <param name="paymentMethod"></param> /// <returns></returns> /// <remarks>System urls are the same, but the way we figure out which one to use is different.</remarks> protected override string GetSystemURL(string strType, PaymentMethod paymentMethod) { bool testMode = paymentMethod.DynamicProperty <bool>().TestMode; var requestType = strType.ToLower(); if (testMode) { switch (requestType) { case "abort": return("https://test.sagepay.com/gateway/service/abort.vsp"); case "authorise": return("https://test.sagepay.com/gateway/service/authorise.vsp"); case "cancel": return("https://test.sagepay.com/gateway/service/cancel.vsp"); case "purchase": return("https://test.sagepay.com/gateway/service/vspserver-register.vsp"); case "refund": return("https://test.sagepay.com/gateway/service/refund.vsp"); case "release": return("https://test.sagepay.com/gateway/service/release.vsp"); case "repeat": return("https://test.sagepay.com/gateway/service/repeat.vsp"); case "void": return("https://test.sagepay.com/gateway/service/void.vsp"); case "3dcallback": return("https://test.sagepay.com/gateway/service/direct3dcallback.vsp"); case "showpost": return("https://test.sagepay.com/showpost/showpost.asp"); } } else { switch (requestType) { case "abort": return("https://live.sagepay.com/gateway/service/abort.vsp"); case "authorise": return("https://live.sagepay.com/gateway/service/authorise.vsp"); case "cancel": return("https://live.sagepay.com/gateway/service/cancel.vsp"); case "purchase": return("https://live.sagepay.com/gateway/service/vspserver-register.vsp"); case "refund": return("https://live.sagepay.com/gateway/service/refund.vsp"); case "release": return("https://live.sagepay.com/gateway/service/release.vsp"); case "repeat": return("https://live.sagepay.com/gateway/service/repeat.vsp"); case "void": return("https://live.sagepay.com/gateway/service/void.vsp"); case "3dcallback": return("https://live.sagepay.com/gateway/service/direct3dcallback.vsp"); case "showpost": return("https://test.sagepay.com/showpost/showpost.asp"); } } throw new InvalidOperationException(string.Format("Could not figure out request: {0}. Testmode: {1}", strType, testMode)); }
private string GetRecurringServiceUrl(PaymentMethod paymentMethod) { if (paymentMethod.DynamicProperty <bool>().Live) { return("https://pal-live.adyen.com/pal/servlet/soap/Recurring"); } return("https://pal-test.adyen.com/pal/servlet/soap/Recurring"); }
/// <summary> /// Adds a custom field to the parameters list /// </summary> /// <remarks>Adding AuthRequestParameter allows to return it in the redirect to payment processor. Hence we can distinquish an auth request in process paymentrequest. /// Allows for implementing notifications at a later point. /// </remarks> private void AddCustomFieldsForAuthRequest(IDictionary <string, string> dictionary, PaymentMethod paymentMethod) { bool instantCapture = paymentMethod.DynamicProperty <bool>().InstantCapture; string authValue = instantCapture ? SecureTradingConstants.InstantCapture : SecureTradingConstants.Authorize; dictionary.Add(SecureTradingConstants.AuthRequestParameter, authValue); }
private string GetServiceUrl(PaymentMethod paymentMethod) { GlobalCollectSecurityCheck securityCheck; if (!Enum.TryParse(paymentMethod.DynamicProperty <string>().SecurityCheck, out securityCheck)) { throw new ConfigurationErrorsException( "Could not parse SecurityCheck value from payment method. Please check that your payment {0} has one of the following values set in the field 'SecurityCheck': {1} or {2}." .FormatWith(paymentMethod.Name, GlobalCollectSecurityCheck.IpCheck.ToString(), GlobalCollectSecurityCheck.ClientAuthentication.ToString())); } if (paymentMethod.DynamicProperty <bool>().Live) { // Live switch (securityCheck) { case GlobalCollectSecurityCheck.IpCheck: return(GlobalCollectConstants.LiveApiServiceUsingIpRestriction); case GlobalCollectSecurityCheck.ClientAuthentication: return(GlobalCollectConstants.LiveApiServiceUsingClientAuthentication); default: throw new Exception("Invalid security value: " + securityCheck); } } // Debug switch (securityCheck) { case GlobalCollectSecurityCheck.IpCheck: return(GlobalCollectConstants.TestApiServiceUsingIpRestriction); case GlobalCollectSecurityCheck.ClientAuthentication: return(GlobalCollectConstants.TestApiServiceUsingClientAuthentication); default: throw new Exception("Invalid security value: " + securityCheck); } }
private string GetPostUrl(PaymentMethod paymentMethod) { bool testMode = paymentMethod.DynamicProperty <bool>().TestMode; if (testMode) { return("https://select-test.worldpay.com/wcc/itransaction"); } return("https://select.worldpay.com/wcc/itransaction"); }
/// <summary> /// Gets the Epay error. /// </summary> /// <param name="errorNumber">The error number.</param> /// <param name="paymentMethod">The payment method. Needed to get configuration data</param> /// <returns></returns> protected virtual string GetEpayError(int errorNumber, PaymentMethod paymentMethod) { string errorMessage = null; int errorCode = 0; if (!Client.getEpayError(int.Parse(paymentMethod.DynamicProperty <string>().MerchantNumber), Language, errorNumber, paymentMethod.DynamicProperty <string>().Pwd, ref errorMessage, ref errorCode)) { errorMessage = string.Format("Tried to lookup the error code: {0} but failed with code: {1}", errorNumber, errorCode); } return(errorMessage); }
protected string CalculateMerchantSignature(IDictionary <string, string> dict, PaymentMethod paymentMethod) { string signature; if (paymentMethod.DynamicProperty <string>().SigningAlgorithm == "SHA256") { var signingString = BuildSigningStringForSHA256(dict); var calculator = new HmacCalculatorSHA256(HttpUtility.UrlDecode(paymentMethod.DynamicProperty <string>().HmacSharedSecret)); signature = calculator.Execute(signingString); } else { var signingString = BuildSigningString(dict); var calculator = new HmacCalculator(HttpUtility.UrlDecode(paymentMethod.DynamicProperty <string>().HmacSharedSecret)); signature = calculator.Execute(signingString); } return(signature); }
public SecureTradingTransactionQueryXmlResponse TransactionQuery(string transactionId, PaymentMethod paymentMethod) { string webServiceAlias = paymentMethod.DynamicProperty <string>().WebServiceAlias; string sitereference = paymentMethod.DynamicProperty <string>().Sitereference; string xmlToSend = string.Format(@"<?xml version=""1.0"" encoding=""utf-8""?> <requestblock version=""3.67""> <alias>{0}</alias> <request type=""TRANSACTIONQUERY""> <filter> <sitereference>{1}</sitereference> <transactionreference>{2}</transactionreference> </filter> </request> </requestblock>" , webServiceAlias, sitereference, transactionId); return(new SecureTradingTransactionQueryXmlResponse(CreateRequest(xmlToSend, paymentMethod))); }
public string BuildRequest(string transactionId, PaymentMethod paymentMethod) { string accountId = paymentMethod.DynamicProperty <string>().AccountId; string siteId = paymentMethod.DynamicProperty <string>().SiteId; string siteSecurityCode = paymentMethod.DynamicProperty <string>().SiteSecurityCode; var requestBuilder = new StringBuilder(); requestBuilder.AppendFormat("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); requestBuilder.AppendFormat("<status>"); requestBuilder.AppendFormat(" <merchant>"); requestBuilder.AppendFormat(" <account>{0}</account>", accountId); requestBuilder.AppendFormat(" <site_id>{0}</site_id>", siteId); requestBuilder.AppendFormat(" <site_secure_code>{0}</site_secure_code>", siteSecurityCode); requestBuilder.AppendFormat(" </merchant>"); requestBuilder.AppendFormat(" <transaction>"); requestBuilder.AppendFormat(" <id>{0}</id>", transactionId); requestBuilder.AppendFormat(" </transaction>"); requestBuilder.AppendFormat("</status>"); return(requestBuilder.ToString()); }
public virtual void SettlePayment(PaymentMethod paymentMethod, int paymentProductId, long orderId) { var request = new SetPayment() { Meta = { MerchantId = paymentMethod.DynamicProperty <int>().MerchantId }, Payment = { PaymentProductId = paymentProductId, OrderId = orderId } }; SendTextAndCheckResponseForErrors(GetServiceUrl(paymentMethod), request.ToString()); }
protected virtual IDictionary <string, string> GetParameters(PaymentRequest paymentRequest) { PaymentMethod paymentMethod = paymentRequest.PaymentMethod; Payment payment = paymentRequest.Payment; var dict = new Dictionary <string, string>(); bool testMode = paymentMethod.DynamicProperty <bool>().TestMode; bool instantCapture = paymentMethod.DynamicProperty <bool>().InstantCapture; string callback = paymentMethod.DynamicProperty <string>().Callback; string instId = paymentMethod.DynamicProperty <string>().InstId; string key = paymentMethod.DynamicProperty <string>().Key; string signature = paymentMethod.DynamicProperty <string>().Signature; // All required fields var amount = paymentRequest.Payment.Amount.ToString("0.00", CultureInfo.InvariantCulture); var currency = paymentRequest.Amount.CurrencyIsoCode; dict.Add("testMode", (testMode ? 100 : 0).ToString()); // Specifies the authorisation mode used. The values are "A" for a full auth, or "E" for a pre-auth. if (instantCapture) { dict.Add("authMode", "A"); } else { dict.Add("authMode", "E"); } var hash = Md5Computer.GetHash(payment.Amount, payment.ReferenceId, payment.PurchaseOrder.BillingCurrency.ISOCode, key); var cartId = paymentRequest.Payment.ReferenceId; var callbackUrl = _callbackUrl.GetCallbackUrl(callback, paymentRequest.Payment); dict.Add("MC_hash", hash); dict.Add("instId", instId); dict.Add("cartId", cartId); dict.Add("amount", amount); dict.Add("currency", currency); // instId:amount:currency:cartId:MC_callback IList <string> signatureList = new List <string>(); signatureList.Add(instId); signatureList.Add(amount); signatureList.Add(currency); signatureList.Add(cartId); signatureList.Add(callbackUrl); var signatureHash = Md5Computer.GetSignatureHash(signatureList, signature); dict.Add("signature", signatureHash); dict.Add("MC_callback", callbackUrl); return(dict); }
public virtual void RefundPayment(PaymentMethod paymentMethod, long orderId, string merchantReference, long amount) { var request = new DoRefund() { Meta = { MerchantId = paymentMethod.DynamicProperty <int>().MerchantId }, Payment = { OrderId = orderId, MerchantReference = merchantReference, Amount = amount } }; SendTextAndCheckResponseForErrors(GetServiceUrl(paymentMethod), request.ToString()); }
public XmlElement Request(string xmlRequestString, PaymentMethod paymentMethod) { bool testMode = paymentMethod.DynamicProperty <bool>().TestMode; string apiURl = testMode ? "https://testapi.multisafepay.com/ewx/" : "https://api.multisafepay.com/ewx/"; var httpWebRequest = (HttpWebRequest)WebRequest.Create(apiURl); httpWebRequest.Method = "POST"; httpWebRequest.ContentLength = Encoding.UTF8.GetByteCount(xmlRequestString); httpWebRequest.ContentType = "application/x-www-form-urlencoded"; var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()); streamWriter.Write(xmlRequestString); streamWriter.Close(); var httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); Stream responseStream = httpWebResponse.GetResponseStream(); if (responseStream == null) { throw new NullReferenceException("The HTTP response stream from MultiSafepay is empty."); } var streamReader = new StreamReader(responseStream); string xmlstring = streamReader.ReadToEnd(); var xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xmlstring); XmlElement xmlElement = xmlDocument.DocumentElement; if (xmlElement == null) { throw new NullReferenceException("XML response from MultiSafepay is empty, expected XML document."); } if (xmlElement.Attributes == null) { throw new NullReferenceException("XML response from MultiSafepay didn't contain any attributes, expected a 'result' attribute on the root element."); } return(xmlElement); }
public virtual IEnumerable <IPaymentProduct> GetPaymentProducts(PaymentMethod paymentMethod, string languageCode, string countryCode, string currencyCode) { languageCode = _languageCodeMapper.Convert(languageCode); var getPaymentProducts = new GetPaymentProducts { Meta = { MerchantId = paymentMethod.DynamicProperty <int>().MerchantId }, General = { LanguageCode = languageCode, CountryCode = countryCode, CurrencyCode = currencyCode } }; var responseText = SendTextAndCheckResponseForErrors(GetServiceUrl(paymentMethod), getPaymentProducts.ToString()); var response = new GetPaymentProducts(); response.FromModifiedXml(new ModifiedXmlDocument(responseText), string.Empty); return(new List <IPaymentProduct>(response.Response.PaymentProducts)); }
public string PostUrl(PaymentMethod paymentMethod) { // For dynamics, we have to call the extension method as a normal method. AdyenPaymentFlowSelection flowSelection = EnumExtensions.ParseFlowSelectionThrowExceptionOnFailure(paymentMethod.DynamicProperty <string>().FlowSelection); if (paymentMethod.DynamicProperty <bool>().Live) { switch (flowSelection) { case AdyenPaymentFlowSelection.OnePage: return("https://live.adyen.com/hpp/pay.shtml"); case AdyenPaymentFlowSelection.MultiplePage: return("https://live.adyen.com/hpp/select.shtml"); case AdyenPaymentFlowSelection.DirectoryLookup: return("https://live.adyen.com/hpp/directory.shtml"); case AdyenPaymentFlowSelection.SkipSelect: return("https://live.adyen.com/hpp/details.shtml"); default: throw new InvalidOperationException("Invalid FlowSelection"); } } switch (flowSelection) { case AdyenPaymentFlowSelection.OnePage: return("https://test.adyen.com/hpp/pay.shtml"); case AdyenPaymentFlowSelection.MultiplePage: return("https://test.adyen.com/hpp/select.shtml"); case AdyenPaymentFlowSelection.DirectoryLookup: return("https://test.adyen.com/hpp/directory.shtml"); case AdyenPaymentFlowSelection.SkipSelect: return("https://test.adyen.com/hpp/details.shtml"); default: throw new InvalidOperationException("Invalid FlowSelection"); } }