Skip to content

Commit

Permalink
Add merchant id hook
Browse files Browse the repository at this point in the history
  • Loading branch information
simond-stripe committed Dec 19, 2024
1 parent 808631f commit 8671bad
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.stripe.android.connect.EmbeddedComponentManager
import com.stripe.android.connect.PrivateBetaConnectSDK
import com.stripe.android.connect.StripeEmbeddedComponent
import com.stripe.android.connect.StripeEmbeddedComponentListener
import com.stripe.android.connect.analytics.ConnectAnalyticsService
import com.stripe.android.connect.appearance.Appearance
import com.stripe.android.connect.databinding.StripeConnectWebviewBinding
import com.stripe.android.connect.webview.serialization.AccountSessionClaimedMessage
Expand Down Expand Up @@ -85,6 +86,8 @@ internal class StripeConnectWebViewContainerImpl<Listener : StripeEmbeddedCompon
private var viewBinding: StripeConnectWebviewBinding? = null
private val webView get() = viewBinding?.stripeWebView

private var analyticsService: ConnectAnalyticsService? = null

@VisibleForTesting
internal val stripeWebViewClient = StripeConnectWebViewClient()

Expand All @@ -107,6 +110,7 @@ internal class StripeConnectWebViewContainerImpl<Listener : StripeEmbeddedCompon
.also { this.viewBinding = it }
initializeWebView(viewBinding.stripeWebView)
bindViewToController()
analyticsService = ConnectAnalyticsService(view.context, isTestMode = false)
}

@VisibleForTesting
Expand Down Expand Up @@ -288,6 +292,8 @@ internal class StripeConnectWebViewContainerImpl<Listener : StripeEmbeddedCompon
fun accountSessionClaimed(message: String) {
val accountSessionClaimedMessage = ConnectJson.decodeFromString<AccountSessionClaimedMessage>(message)
logger.debug("Account session claimed: $accountSessionClaimedMessage")

analyticsService?.merchantId = accountSessionClaimedMessage.merchantId
}

@JavascriptInterface
Expand Down

0 comments on commit 8671bad

Please sign in to comment.