@Test public void createConfirmPaymentIntentWithSourceIdParams_withAllFields_hasExpectedFields() { PaymentIntentParams params = PaymentIntentParams.createConfirmPaymentIntentWithSourceIdParams( TEST_SOURCE_ID, TEST_CLIENT_SECRET, TEST_RETURN_URL); Assert.assertEquals(TEST_CLIENT_SECRET, params.getClientSecret()); Assert.assertEquals(TEST_RETURN_URL, params.getReturnUrl()); Assert.assertEquals(TEST_SOURCE_ID, params.getSourceId()); }
@Ignore public void disabled_confirmPaymentIntent_withSourceId_canSuccessfulConfirm() { String clientSecret = "temporarily put a private key here simulate the backend"; String publicKey = "put a public key that matches the private key here"; String sourceId = "id of the source created on the backend"; try { PaymentIntentParams paymentIntentParams = PaymentIntentParams.createConfirmPaymentIntentWithSourceIdParams( sourceId, clientSecret, null ); PaymentIntent paymentIntent = StripeApiHandler.confirmPaymentIntent( null, ApplicationProvider.getApplicationContext(), paymentIntentParams, publicKey, null, null); assertNotNull(paymentIntent); } catch (AuthenticationException authEx) { fail("Unexpected error: " + authEx.getLocalizedMessage()); } catch (StripeException stripeEx) { fail("Unexpected error when connecting to Stripe API: " + stripeEx.getLocalizedMessage()); } }