From 53bb8c0074a89a5e3588a1f5b26b2491d474958d Mon Sep 17 00:00:00 2001 From: Michael Shafrir <45020849+mshafrir-stripe@users.noreply.github.com> Date: Thu, 4 Jun 2020 14:02:18 -0400 Subject: [PATCH] Use CustomerSession.stripeAccountId in AddPaymentMethodActivity (#2542) This property must be used to correctly create a PaymentMethod as the connected account, when specified. MOBILE-266 --- stripe/src/main/java/com/stripe/android/CustomerSession.kt | 2 +- .../com/stripe/android/view/AddPaymentMethodActivity.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stripe/src/main/java/com/stripe/android/CustomerSession.kt b/stripe/src/main/java/com/stripe/android/CustomerSession.kt index 3ffcad2b023..98e4601b30e 100644 --- a/stripe/src/main/java/com/stripe/android/CustomerSession.kt +++ b/stripe/src/main/java/com/stripe/android/CustomerSession.kt @@ -30,7 +30,7 @@ class CustomerSession @VisibleForTesting internal constructor( context: Context, stripeRepository: StripeRepository, publishableKey: String, - stripeAccountId: String?, + internal val stripeAccountId: String?, private val workDispatcher: CoroutineDispatcher = createCoroutineDispatcher(), private val operationIdFactory: OperationIdFactory = StripeOperationIdFactory(), private val timeSupplier: TimeSupplier = { Calendar.getInstance().timeInMillis }, diff --git a/stripe/src/main/java/com/stripe/android/view/AddPaymentMethodActivity.kt b/stripe/src/main/java/com/stripe/android/view/AddPaymentMethodActivity.kt index 5c15099b324..681e196e959 100644 --- a/stripe/src/main/java/com/stripe/android/view/AddPaymentMethodActivity.kt +++ b/stripe/src/main/java/com/stripe/android/view/AddPaymentMethodActivity.kt @@ -39,7 +39,11 @@ class AddPaymentMethodActivity : StripeActivity() { private val stripe: Stripe by lazy { val paymentConfiguration = args.paymentConfiguration ?: PaymentConfiguration.getInstance(this) - Stripe(applicationContext, paymentConfiguration.publishableKey) + Stripe( + applicationContext, + publishableKey = paymentConfiguration.publishableKey, + stripeAccountId = customerSession.stripeAccountId + ) } private val paymentMethodType: PaymentMethod.Type by lazy {