} // End of the GetEndPoint method /// <summary> /// Get a svea country code /// </summary> /// <param name="countryCodeString">A country code in two letters</param> /// <returns>A svea country code</returns> public static Webpay.Integration.CSharp.Util.Constant.CountryCode GetSveaCountryCode(string countryCodeString) { // Create the country code to return (SE is standard) Webpay.Integration.CSharp.Util.Constant.CountryCode countryCode = Webpay.Integration.CSharp.Util.Constant.CountryCode.SE; // Check if we should set another country code if (countryCodeString.ToLower() == "dk") { countryCode = Webpay.Integration.CSharp.Util.Constant.CountryCode.DK; } else if (countryCodeString.ToLower() == "fi") { countryCode = Webpay.Integration.CSharp.Util.Constant.CountryCode.FI; } else if (countryCodeString.ToLower() == "no") { countryCode = Webpay.Integration.CSharp.Util.Constant.CountryCode.NO; } // Return the country code return(countryCode); } // End of the GetSveaCountryCode method
} // End of the GetPassword method /// <summary> /// Get the client number for svea web pay /// </summary> /// <param name="type"> eg. HOSTED, INVOICE or PAYMENTPLAN</param> /// <param name="country">country code</param> /// <returns>The client number as an int</returns> public int GetClientNumber(Webpay.Integration.CSharp.Util.Constant.PaymentType type, Webpay.Integration.CSharp.Util.Constant.CountryCode country) { // Get the webshop settings KeyStringList webshopSettings = WebshopSetting.GetAllFromCache(); switch (country) { case Webpay.Integration.CSharp.Util.Constant.CountryCode.SE: if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.INVOICE) { return(Convert.ToInt32(webshopSettings.Get("SVEA-SE-INVOICE-CLIENT-NUMBER"))); } if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.PAYMENTPLAN) { return(59999); } break; case Webpay.Integration.CSharp.Util.Constant.CountryCode.NO: if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.INVOICE) { return(Convert.ToInt32(webshopSettings.Get("SVEA-NO-INVOICE-CLIENT-NUMBER"))); } if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.PAYMENTPLAN) { return(32503); } break; case Webpay.Integration.CSharp.Util.Constant.CountryCode.FI: if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.INVOICE) { return(Convert.ToInt32(webshopSettings.Get("SVEA-FI-INVOICE-CLIENT-NUMBER"))); } if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.PAYMENTPLAN) { return(27136); } break; case Webpay.Integration.CSharp.Util.Constant.CountryCode.DK: if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.INVOICE) { return(Convert.ToInt32(webshopSettings.Get("SVEA-DK-INVOICE-CLIENT-NUMBER"))); } if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.PAYMENTPLAN) { return(64008); } break; } return(0); } // End of the GetClientNumber method
} // End of the GetUsername method /// <summary> /// Get the password for svea web pay /// </summary> /// <param name="type"> eg. HOSTED, INVOICE or PAYMENTPLAN</param> /// <param name="country">country code</param> /// <returns>The password as a string</returns> public string GetPassword(Webpay.Integration.CSharp.Util.Constant.PaymentType type, Webpay.Integration.CSharp.Util.Constant.CountryCode country) { // Get the webshop settings KeyStringList webshopSettings = WebshopSetting.GetAllFromCache(); if (type == Webpay.Integration.CSharp.Util.Constant.PaymentType.INVOICE || type == Webpay.Integration.CSharp.Util.Constant.PaymentType.PAYMENTPLAN) { switch (country) { case Webpay.Integration.CSharp.Util.Constant.CountryCode.SE: return(webshopSettings.Get("SVEA-SE-PASSWORD")); case Webpay.Integration.CSharp.Util.Constant.CountryCode.NO: return(webshopSettings.Get("SVEA-NO-PASSWORD")); case Webpay.Integration.CSharp.Util.Constant.CountryCode.FI: return(webshopSettings.Get("SVEA-FI-PASSWORD")); case Webpay.Integration.CSharp.Util.Constant.CountryCode.DK: return(webshopSettings.Get("SVEA-DK-PASSWORD")); } } return(""); } // End of the GetPassword method
} // End of the GetMerchantId method /// <summary> /// Get the secret word for svea web pay /// </summary> /// <param name="type"> eg. HOSTED, INVOICE or PAYMENTPLAN</param> /// <param name="country">country code</param> /// <returns>The secret word as a string</returns> public string GetSecretWord(Webpay.Integration.CSharp.Util.Constant.PaymentType type, Webpay.Integration.CSharp.Util.Constant.CountryCode country) { // Get the webshop settings KeyStringList webshopSettings = WebshopSetting.GetAllFromCache(); // Return the secret word return(type == Webpay.Integration.CSharp.Util.Constant.PaymentType.HOSTED ? webshopSettings.Get("SVEA-SECRET-WORD") : ""); } // End of the GetSecretWord method
} // End of the GetClientNumber method /// <summary> /// Get the merchant id for svea web pay /// </summary> /// <param name="type"> eg. HOSTED, INVOICE or PAYMENTPLAN</param> /// <param name="country">country code</param> /// <returns>The merchant id as a string</returns> public string GetMerchantId(Webpay.Integration.CSharp.Util.Constant.PaymentType type, Webpay.Integration.CSharp.Util.Constant.CountryCode country) { // Get the company settings KeyStringList webshopSettings = WebshopSetting.GetAllFromCache(); // Return the merchant id return(type == Webpay.Integration.CSharp.Util.Constant.PaymentType.HOSTED ? webshopSettings.Get("SVEA-MERCHANT-ID") : ""); } // End of the GetMerchantId method