@NonNull public static SourceParams createSepaDebitParams( @NonNull String name, @NonNull String iban, @Nullable String addressLine1, @NonNull String city, @NonNull String postalCode, @NonNull @Size(2) String country) { return createSepaDebitParams(name, iban, null, addressLine1, city, postalCode, country); }
@Test public void createSepaDebitParams_toParamMap_createsExpectedMap() { final SourceParams params = SourceParams.createSepaDebitParams( "Jai Testa", "ibaniban", "sepaholder@stripe.com", "44 Fourth Street", "Test City", "90210", "EI"); Map<String, Object> expectedMap = new HashMap<>(); expectedMap.put("type", Source.SEPA_DEBIT); expectedMap.put("currency", Source.EURO); final Map<String, Object> addressMap = new HashMap<>(); addressMap.put("line1", "44 Fourth Street"); addressMap.put("city", "Test City"); addressMap.put("postal_code", "90210"); addressMap.put("country", "EI"); expectedMap.put("owner", new HashMap<String, Object>() {{ put("name", "Jai Testa"); put("email", "sepaholder@stripe.com"); put("address", addressMap); }}); expectedMap.put(Source.SEPA_DEBIT, new HashMap<String, Object>() {{ put("iban", "ibaniban"); }}); assertEquals(Source.SEPA_DEBIT, params.getType()); Map<String, Object> actualMap = params.toParamMap(); JsonTestUtils.assertMapEquals(expectedMap, actualMap); }
@Test public void createSepaDebitParams_hasExpectedFields() { final SourceParams params = SourceParams.createSepaDebitParams( "Jai Testa", "ibaniban", "sepaholder@stripe.com", "44 Fourth Street", "Test City", "90210", "EI"); assertEquals(Source.SEPA_DEBIT, params.getType()); assertEquals(Source.EURO, params.getCurrency()); assertNotNull(params.getOwner()); assertEquals("Jai Testa", params.getOwner().get("name")); Map<String, Object> addressMap = getMapFromOwner(params, "address"); assertEquals("44 Fourth Street", addressMap.get("line1")); assertEquals("Test City", addressMap.get("city")); assertEquals("90210", addressMap.get("postal_code")); assertEquals("EI", addressMap.get("country")); Map<String, Object> apiMap = params.getApiParameterMap(); assertEquals("ibaniban", apiMap.get("iban")); }
@Test public void createSourceSynchronous_withSepaDebitParamsWithMinimalValues_passesIntegrationTest() { Stripe stripe = getNonLoggingStripe(mContext); String validIban = "DE89370400440532013000"; SourceParams params = SourceParams.createSepaDebitParams( "Sepa Account Holder", validIban, null, null, null, null, null); Map<String, String> metamap = new HashMap<String, String>() {{ put("water source", "well"); put("type", "brackish"); put("value", "100000"); }}; params.setMetaData(metamap); try { Source sepaDebitSource = stripe.createSourceSynchronous(params, FUNCTIONAL_SOURCE_PUBLISHABLE_KEY); assertNotNull(sepaDebitSource); assertNotNull(sepaDebitSource.getClientSecret()); assertNotNull(sepaDebitSource.getId()); assertEquals(Source.SEPA_DEBIT, sepaDebitSource.getType()); JsonTestUtils.assertMapEquals(metamap ,sepaDebitSource.getMetaData()); } catch (StripeException stripeEx) { fail("Unexpected error: " + stripeEx.getLocalizedMessage()); } }
Stripe stripe = getNonLoggingStripe(mContext); String validIban = "DE89370400440532013000"; SourceParams params = SourceParams.createSepaDebitParams( "Sepa Account Holder", validIban,
Stripe stripe = getNonLoggingStripe(mContext); String validIban = "DE89370400440532013000"; SourceParams params = SourceParams.createSepaDebitParams( "Sepa Account Holder", validIban,
Stripe stripe = getNonLoggingStripe(mContext); String validIban = "DE89370400440532013000"; SourceParams params = SourceParams.createSepaDebitParams( "Sepa Account Holder", validIban,