public void Login(bool isTestMode, params MerchantConfigValue[] MerchantConfigValues) { MerchantId = MerchantConfigValues.Where(r => r.Key.Equals("MerchantId")).FirstOrDefault().Value; PublicKey = MerchantConfigValues.Where(r => r.Key.Equals("PublicKey")).FirstOrDefault().Value; PrivateKey = MerchantConfigValues.Where(r => r.Key.Equals("PrivateKey")).FirstOrDefault().Value; if (isTestMode) { Environment = Braintree.Environment.SANDBOX; } else { Environment = Braintree.Environment.PRODUCTION; } }
public PaymentFormHandler(IReferenceDataService referenceDataService, IPolicies policyApi, IBicyclePolicies bicyclePolicyApi, IEmailService emailService) : base(referenceDataService, policyApi, bicyclePolicyApi) { _emailService = emailService; Environment environment = GetBraintreeMode(ConfigurationManager.AppSettings["Braintree.Environment"]); if (environment == null) { throw new ArgumentException("Cannot determine Braintree Environment from value: " + ConfigurationManager.AppSettings["Braintree.Environment"]); } _brainTreeGateway = new BraintreeGateway { Environment = environment, PublicKey = _publicKey, PrivateKey = _privateKey, MerchantId = _merchantId }; }
public Configuration(Environment environment, string merchantId, string publicKey, string privateKey) : this() { if (environment == null) { throw new ConfigurationException("Configuration.environment needs to be set"); } else if (string.IsNullOrEmpty(merchantId)) { throw new ConfigurationException("Configuration.merchantId needs to be set"); } else if (string.IsNullOrEmpty(publicKey)) { throw new ConfigurationException("Configuration.publicKey needs to be set"); } else if (string.IsNullOrEmpty(privateKey)) { throw new ConfigurationException("Configuration.privateKey needs to be set"); } Environment = environment; MerchantId = merchantId; PublicKey = publicKey; PrivateKey = privateKey; }