public async void TestCreateHydratedCard() { CardsavrSession.InstanceConfig config = this.session.getConfig(); CardsavrHelper helper = new CardsavrHelper(); helper.SetAppSettings(config.cardsavr_server, config.app_name, config.app_key, CardsavrSession.rejectUnauthorized); await helper.LoginAndCreateSession(config.app_username, config.app_password, "{\"key\": \"my_trace\"}"); PropertyBag cd = new PropertyBag() { { "my_fi", new PropertyBag() { { "token", "123" } } } }; string cuid = $"{CardsavrSession.e2e_identifier}_{CardsavrSession.random.Next(10000)}_0"; ClientLogin login = await helper.CreateCard(config.app_username, new Cardholder() { custom_data = cd, cuid = cuid }, new Card() { pan = "4111111111111111", cvv = "111", expiration_month = "01", expiration_year = "25" }, new Address() { first_name = "Strivve", last_name = "User", email = "*****@*****.**", is_primary = true, phone_number = "5555555555", address1 = "1234 1st ave", city = "Seattle", subnational = "WA", postal_code = "98006", country = "USA" } ); await helper.CloseSession(config.app_username); Assert.NotNull(login.cardholder.grant); Assert.Equal(login.cardholder.cuid, cuid); Assert.True(login.card.id > 0); log.Info("CARDSAVRHELPERTESTS cuid: " + login.cardholder.cuid + ", grant: " + login.grant + ", card_id: " + login.card.id); //login can now be used as a redirect to a url that can log in and process jobs }
public async Task <ClientLogin> TestCreateHydratedCard() { try { CardsavrHelper helper = new CardsavrHelper(); helper.SetAppSettings("https://api.<SERVERR>.cardsavr.io/", "<INTEGRATOR NAME>", "<INTEGRATOR KEY>", false); ClientSession auth = await helper.LoginAndCreateSession("<USERNAME>", "<PASSWORD>", "{\"key\": \"my_trace\"}"); PropertyBag cd = new PropertyBag() { { "my_fi", new PropertyBag() { { "token", "123" } } } }; ClientLogin login = await helper.CreateCard("testing_user", new Cardholder() { email = "*****@*****.**", custom_data = cd, cuid = "12345" }, new Card() { pan = "4111111111111111", cvv = "111", expiration_month = "01", expiration_year = "25" }, new Address() { first_name = "Strivve", last_name = "User", is_primary = true, phone_number = "5555555555", address1 = "1234 1st ave", city = "Seattle", subnational = "WA", postal_code = "98006", country = "USA" } ); await helper.CloseSession("AdvAppUser"); Console.WriteLine("CARDSAVRHELPERTESTS cuid: " + login.cardholder.cuid + ", grant: " + login.grant + ", card_id: " + login.card.id); return(login); } catch (Exception e) { Console.Write(e); } return(null); }