@Test public void createSourceSynchronous_withAlipaySingleUseParams_passesIntegrationTest() { Stripe stripe = getNonLoggingStripe(mContext); SourceParams alipayParams = SourceParams.createAlipaySingleUseParams( 1000L, "usd", "Example Payer", "abc@def.com", "stripe://start"); try { Source alipaySource = stripe.createSourceSynchronous(alipayParams, FUNCTIONAL_SOURCE_PUBLISHABLE_KEY); assertNotNull(alipaySource); assertNotNull(alipaySource.getId()); assertNotNull(alipaySource.getClientSecret()); assertNotNull(alipaySource.getAmount()); assertEquals(1000L, alipaySource.getAmount().longValue()); assertEquals(Source.ALIPAY, alipaySource.getType()); assertEquals("redirect", alipaySource.getFlow()); assertNotNull(alipaySource.getOwner()); assertEquals("Example Payer", alipaySource.getOwner().getName()); assertEquals("abc@def.com", alipaySource.getOwner().getEmail()); assertEquals("usd", alipaySource.getCurrency()); assertEquals(Source.SINGLE_USE, alipaySource.getUsage()); assertNotNull(alipaySource.getRedirect()); assertEquals("stripe://start", alipaySource.getRedirect().getReturnUrl()); } catch (StripeException stripeEx) { fail("Unexpected error: " + stripeEx.getLocalizedMessage()); } }
@Test public void createSourceSynchronous_withAlipayReusableParams_passesIntegrationTest() { Stripe stripe = getNonLoggingStripe(mContext); SourceParams alipayParams = SourceParams.createAlipayReusableParams( "usd", "Example Payer", "abc@def.com", "stripe://start"); try { Source alipaySource = stripe.createSourceSynchronous(alipayParams, FUNCTIONAL_SOURCE_PUBLISHABLE_KEY); assertNotNull(alipaySource); assertNotNull(alipaySource.getId()); assertNotNull(alipaySource.getClientSecret()); assertEquals(Source.ALIPAY, alipaySource.getType()); assertEquals("redirect", alipaySource.getFlow()); assertNotNull(alipaySource.getOwner()); assertEquals("Example Payer", alipaySource.getOwner().getName()); assertEquals("abc@def.com", alipaySource.getOwner().getEmail()); assertEquals("usd", alipaySource.getCurrency()); assertEquals(Source.REUSABLE, alipaySource.getUsage()); assertNotNull(alipaySource.getRedirect()); assertEquals("stripe://start", alipaySource.getRedirect().getReturnUrl()); } catch (StripeException stripeEx) { fail("Unexpected error: " + stripeEx.getLocalizedMessage()); } }
@Test public void createSourceSynchronous_withP24Params_passesIntegrationTest() { Stripe stripe = getNonLoggingStripe(mContext); SourceParams p24Params = SourceParams.createP24Params( 100, "eur", "Example Payer", "abc@def.com", "stripe://start"); try { Source p24Source = stripe.createSourceSynchronous(p24Params, FUNCTIONAL_SOURCE_PUBLISHABLE_KEY); assertNotNull(p24Source); assertNotNull(p24Source.getId()); assertNotNull(p24Source.getClientSecret()); assertEquals(Source.P24, p24Source.getType()); assertEquals("redirect", p24Source.getFlow()); assertNotNull(p24Source.getOwner()); assertEquals("Example Payer", p24Source.getOwner().getName()); assertEquals("abc@def.com", p24Source.getOwner().getEmail()); assertEquals("eur", p24Source.getCurrency()); assertEquals(Source.SINGLE_USE, p24Source.getUsage()); assertNotNull(p24Source.getRedirect()); assertEquals("stripe://start", p24Source.getRedirect().getReturnUrl()); } catch (StripeException stripeEx) { fail("Unexpected error: " + stripeEx.getLocalizedMessage()); } }