public void Init() { var billTo = new Address() { Organization = "Proworks", Address1 = "777 NE 2nd St.", Locality = "Corvallis", Region = "OR", PostalCode = "97330", CountryCode = "US", Email = "*****@*****.**", Phone = "555-555-5555" }; // create an invoice var invoiceService = new InvoiceService(); _invoice = invoiceService.CreateInvoice(Core.Constants.DefaultKeys.InvoiceStatus.Unpaid); var extendedData = new ExtendedDataCollection(); // this is typically added automatically in the checkout workflow extendedData.SetValue(Core.Constants.ExtendedDataKeys.CurrencyCode, "USD"); var processorSettings = new ChaseProcessorSettings { MerchantId = ConfigurationManager.AppSettings["merchantId"], Bin = ConfigurationManager.AppSettings["bin"], Username = ConfigurationManager.AppSettings["username"], Password = ConfigurationManager.AppSettings["password"] }; Provider.GatewayProviderSettings.ExtendedData.SaveProcessorSettings(processorSettings); if (Provider.PaymentMethods.Any()) return; var resource = new GatewayResource("CreditCard", "Credit Card"); _payment = Provider.CreatePaymentMethod(resource, "Credit Card", "Credit Card"); }
/// <summary> /// Saves the processor settings to an extended data collection /// </summary> /// <param name="extendedData">The <see cref="ExtendedDataCollection"/></param> /// <param name="processorSettings">The <see cref="ChaseProcessorSettings"/> to be serialized and saved</param> public static void SaveProcessorSettings(this ExtendedDataCollection extendedData, ChaseProcessorSettings processorSettings) { var settingsJson = JsonConvert.SerializeObject(processorSettings); extendedData.SetValue(Constants.ExtendedDataKeys.ProcessorSettings, settingsJson); }
public void TestFixtureSetup() { SqlSyntaxProviderTestHelper.EstablishSqlSyntax(); var cacheProvider = new Mock<IRuntimeCacheProvider>(); GatewayProviderService = new GatewayProviderService(); var providers = GatewayProviderService.GetAllGatewayProviders() .Where(x => x.GatewayProviderType == GatewayProviderType.Payment); GatewayProviderSettings = providers.FirstOrDefault(x => x.Key == new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74")); if (GatewayProviderSettings != null) { GatewayProviderService.Delete(GatewayProviderSettings); } var petaPoco = new PetaPocoUnitOfWorkProvider(); var merchantId = ConfigurationManager.AppSettings["merchantId"]; var bin = ConfigurationManager.AppSettings["bin"]; var username = ConfigurationManager.AppSettings["username"]; var password = ConfigurationManager.AppSettings["password"]; var sql = new Sql(); var dto = new GatewayProviderSettingsDto() { Key = new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74"), Name = "Chase", Description = "Chase", ExtendedData = "<extendedData />", EncryptExtendedData = false, ProviderTfKey = Constants.TypeFieldKeys.GatewayProvider.PaymentProviderKey, CreateDate = DateTime.Now, UpdateDate = DateTime.Now }; petaPoco.GetUnitOfWork().Database.Insert(dto); GatewayProviderSettings = GatewayProviderService.GetGatewayProviderByKey(new Guid("D584F356-454B-4D14-BE44-13D9D25D6A74")); var providerSettings = new ChaseProcessorSettings() { MerchantId = merchantId, Bin = bin, Username = username, Password = password }; GatewayProviderSettings.ExtendedData.SaveProcessorSettings(providerSettings); Provider = new ChasePaymentGatewayProvider(GatewayProviderService, GatewayProviderSettings, cacheProvider.Object); //TestCustomer = MerchelloContext.Current.Services.CustomerService.CreateCustomerWithKey( // Guid.NewGuid().ToString(), // "debug", // "debug", // "*****@*****.**"); }
public ChasePaymentProcessor(ChaseProcessorSettings settings) { _settings = settings; }