From 83a07660764c1fdbe340f9ba8dd3f0e686cf442d Mon Sep 17 00:00:00 2001
From: tjclawson-stripe <163896025+tjclawson-stripe@users.noreply.github.com>
Date: Thu, 2 Jan 2025 15:14:49 -0500
Subject: [PATCH] Remove RowStyle from
PaymentMethodVerticalLayoutInteractor.State (#9836)
* Remove RowStyle from PaymentMethodVerticalLayoutInteractor.State
---
paymentsheet/detekt-baseline.xml | 18 ++++++++----------
.../paymentelement/embedded/EmbeddedContent.kt | 5 +++++
.../embedded/EmbeddedContentHelper.kt | 6 ++----
.../PaymentMethodEmbeddedLayoutUI.kt | 5 +++--
.../PaymentMethodVerticalLayoutInteractor.kt | 7 -------
.../embedded/EmbeddedContentScreenshotTest.kt | 14 ++++++++++++--
...aymentMethodVerticalLayoutInteractorTest.kt | 2 --
...akePaymentMethodVerticalLayoutInteractor.kt | 4 ----
.../verticalmode/PaymentMethodLayoutUITest.kt | 10 +---------
9 files changed, 31 insertions(+), 40 deletions(-)
diff --git a/paymentsheet/detekt-baseline.xml b/paymentsheet/detekt-baseline.xml
index a3b9c6c618d..0f02af01e2e 100644
--- a/paymentsheet/detekt-baseline.xml
+++ b/paymentsheet/detekt-baseline.xml
@@ -28,9 +28,10 @@
LongMethod:CustomerSheetScreen.kt$@Composable internal fun SelectPaymentMethod( viewState: CustomerSheetViewState.SelectPaymentMethod, viewActionHandler: (CustomerSheetViewAction) -> Unit, paymentMethodNameProvider: (PaymentMethodCode?) -> ResolvableString, modifier: Modifier = Modifier, )
LongMethod:DefaultConfirmationHandlerTest.kt$DefaultConfirmationHandlerTest$private fun test( someDefinitionAction: ConfirmationDefinition.Action<SomeConfirmationDefinition.LauncherArgs> = ConfirmationDefinition.Action.Fail( cause = IllegalStateException("Failed!"), message = R.string.stripe_something_went_wrong.resolvableString, errorType = ConfirmationHandler.Result.Failed.ErrorType.Internal, ), someDefinitionResult: ConfirmationDefinition.Result = ConfirmationDefinition.Result.Failed( cause = IllegalStateException("Failed!"), message = R.string.stripe_something_went_wrong.resolvableString, type = ConfirmationHandler.Result.Failed.ErrorType.Internal, ), someOtherDefinitionAction: ConfirmationDefinition.Action<SomeOtherConfirmationDefinition.LauncherArgs> = ConfirmationDefinition.Action.Fail( cause = IllegalStateException("Failed!"), message = R.string.stripe_something_went_wrong.resolvableString, errorType = ConfirmationHandler.Result.Failed.ErrorType.Internal, ), someOtherDefinitionResult: ConfirmationDefinition.Result = ConfirmationDefinition.Result.Failed( cause = IllegalStateException("Failed!"), message = R.string.stripe_something_went_wrong.resolvableString, type = ConfirmationHandler.Result.Failed.ErrorType.Internal, ), shouldRegister: Boolean = true, savedStateHandle: SavedStateHandle = SavedStateHandle(), dispatcher: CoroutineDispatcher = UnconfinedTestDispatcher(), scenarioTest: suspend Scenario.() -> Unit )
LongMethod:EditPaymentMethod.kt$@Composable internal fun EditPaymentMethodUi( viewState: EditPaymentMethodViewState, viewActionHandler: (action: EditPaymentMethodViewAction) -> Unit, modifier: Modifier = Modifier )
- LongMethod:EmbeddedContentHelper.kt$DefaultEmbeddedContentHelper$private fun createInteractor( coroutineScope: CoroutineScope, paymentMethodMetadata: PaymentMethodMetadata, rowStyle: Embedded.RowStyle ): PaymentMethodVerticalLayoutInteractor
+ LongMethod:EmbeddedContentHelper.kt$DefaultEmbeddedContentHelper$private fun createInteractor( coroutineScope: CoroutineScope, paymentMethodMetadata: PaymentMethodMetadata, ): PaymentMethodVerticalLayoutInteractor
LongMethod:FormViewModelTest.kt$FormViewModelTest$@Test fun `Verify params are set when element address fields are complete`()
LongMethod:FormViewModelTest.kt$FormViewModelTest$@Test fun `Verify params are set when required address fields are complete`()
+ LongMethod:LinkInlineSignupFields.kt$@Composable internal fun LinkInlineSignupFields( sectionError: Int?, emailController: TextFieldController, phoneNumberController: PhoneNumberController, nameController: TextFieldController, signUpState: SignUpState, enabled: Boolean, isShowingPhoneFirst: Boolean, requiresNameCollection: Boolean, errorMessage: ErrorMessage?, didShowAllFields: Boolean, onShowingAllFields: () -> Unit, modifier: Modifier = Modifier, emailFocusRequester: FocusRequester = remember { FocusRequester() }, phoneFocusRequester: FocusRequester = remember { FocusRequester() }, nameFocusRequester: FocusRequester = remember { FocusRequester() }, )
LongMethod:PaymentMethodMetadataTest.kt$PaymentMethodMetadataTest$@OptIn(ExperimentalCardBrandFilteringApi::class) @Test fun `should create metadata properly with elements session response, payment sheet config, and data specs`()
LongMethod:PaymentMethodVerticalLayoutInteractor.kt$DefaultPaymentMethodVerticalLayoutInteractor.Companion$fun create( viewModel: BaseSheetViewModel, paymentMethodMetadata: PaymentMethodMetadata, customerStateHolder: CustomerStateHolder, bankFormInteractor: BankFormInteractor, ): PaymentMethodVerticalLayoutInteractor
LongMethod:PaymentSheetConfigurationKtx.kt$internal fun PaymentSheet.Appearance.parseAppearance()
@@ -46,6 +47,7 @@
MagicNumber:NewPaymentMethodTabLayoutUI.kt$.5f
MagicNumber:PrimaryButton.kt$PrimaryButton$0.5f
MagicNumber:USBankAccountForm.kt$0.5f
+ MatchingDeclarationName:ErrorText.kt$ErrorTextStyle
MaxLineLength:CardDefinition.kt$internal
MaxLineLength:CustomerRepositoryTest.kt$CustomerRepositoryTest$fun
MaxLineLength:CustomerSheetViewModelTest.kt$CustomerSheetViewModelTest$fun
@@ -58,6 +60,7 @@
MaxLineLength:InjectableActivityScenario.kt$InjectableActivityScenario$delegate ?: throw IllegalStateException("Cannot move to state $newState since the activity hasn't been launched.")
MaxLineLength:InjectableActivityScenario.kt$InjectableActivityScenario$val d = delegate ?: throw IllegalStateException("Cannot run onActivity since the activity hasn't been launched.")
MaxLineLength:IntentConfirmationDefinitionTest.kt$IntentConfirmationDefinitionTest$private inline
+ MaxLineLength:LinkActivityResultTest.kt$LinkActivityResultTest$"link-popup://complete?link_status=complete&pm=eyJpZCI6InBtXzFOSmVFckx1NW8zUDE4WnBtWHBDdElyUiIsIm9iamVjdCI6InBheW1lbnRfbWV0aG9kIiwiYmlsbGluZ19kZXRhaWxzIjp7ImFkZHJlc3MiOnsiY2l0eSI6bnVsbCwiY291bnRyeSI6bnVsbCwibGluZTEiOm51bGwsImxpbmUyIjpudWxsLCJwb3N0YWxfY29kZSI6bnVsbCwic3RhdGUiOm51bGx9LCJlbWFpbCI6bnVsbCwibmFtZSI6bnVsbCwicGhvbmUiOm51bGx9LCJjYXJkIjp7ImJyYW5kIjoidmlzYSIsImNoZWNrcyI6eyJhZGRyZXNzX2xpbmUxX2NoZWNrIjpudWxsLCJhZGRyZXNzX3Bvc3RhbF9jb2RlX2NoZWNrIjpudWxsLCJjdmNfY2hlY2siOm51bGx9LCJjb3VudHJ5IjpudWxsLCJleHBfbW9udGgiOjEyLCJleHBfeWVhciI6MjAzNCwiZnVuZGluZyI6ImNyZWRpdCIsImdlbmVyYXRlZF9mcm9tIjpudWxsLCJsYXN0NCI6IjAwMDAiLCJuZXR3b3JrcyI6eyJhdmFpbGFibGUiOlsidmlzYSJdLCJwcmVmZXJyZWQiOm51bGx9LCJ0aHJlZV9kX3NlY3VyZV91c2FnZSI6eyJzdXBwb3J0ZWQiOnRydWV9LCJ3YWxsZXQiOnsiZHluYW1pY19sYXN0NCI6bnVsbCwibGluayI6e30sInR5cGUiOiJsaW5rIn19LCJjcmVhdGVkIjoxNjg2OTI4MDIxLCJjdXN0b21lciI6bnVsbCwibGl2ZW1vZGUiOmZhbHNlLCJ0eXBlIjoiY2FyZCJ9ICAg"
MaxLineLength:PaymentSheet.kt$PaymentSheet.Address$*
MaxLineLength:PaymentSheet.kt$PaymentSheet.BillingDetails$*
MaxLineLength:PaymentSheet.kt$PaymentSheet.Configuration$*
@@ -69,23 +72,18 @@
MaxLineLength:SupportedPaymentMethod.kt$SupportedPaymentMethod$/** This describes the image in the LPM selector. These can be found internally [here](https://www.figma.com/file/2b9r3CJbyeVAmKi1VHV2h9/Mobile-Payment-Element?node-id=1128%3A0) */
MaxLineLength:USBankAccountFormViewModelTest.kt$USBankAccountFormViewModelTest$fun
MaximumLineLength:CardDefinition.kt$internal
+ SwallowedException:LinkActivityResult.kt$e: Exception
+ TooGenericExceptionCaught:LinkActivityResult.kt$e: Exception
TooManyFunctions:CustomerSheetEventReporter.kt$CustomerSheetEventReporter
TooManyFunctions:DefaultCustomerSheetEventReporter.kt$DefaultCustomerSheetEventReporter : CustomerSheetEventReporter
TooManyFunctions:DefaultEventReporter.kt$DefaultEventReporter : EventReporter
TooManyFunctions:DefaultFlowController.kt$DefaultFlowController : FlowController
+ TooManyFunctions:DefaultLinkEventsReporter.kt$DefaultLinkEventsReporter : LinkEventsReporter
TooManyFunctions:DelegateDrawable.kt$DelegateDrawable : Drawable
TooManyFunctions:EventReporter.kt$EventReporter
+ TooManyFunctions:LinkEventsReporter.kt$LinkEventsReporter
TooManyFunctions:PaymentMethodMetadata.kt$PaymentMethodMetadata : Parcelable
TooManyFunctions:SharedPaymentElementViewModel.kt$SharedPaymentElementViewModelModule
UnusedPrivateClass:PaymentOptionsViewModelTest.kt$PaymentOptionsViewModelTest$MyHostActivity : AppCompatActivity
- LongMethod:LinkInlineSignupFields.kt$@Composable internal fun LinkInlineSignupFields( sectionError: Int?, emailController: TextFieldController, phoneNumberController: PhoneNumberController, nameController: TextFieldController, signUpState: SignUpState, enabled: Boolean, isShowingPhoneFirst: Boolean, requiresNameCollection: Boolean, errorMessage: ErrorMessage?, didShowAllFields: Boolean, onShowingAllFields: () -> Unit, modifier: Modifier = Modifier, emailFocusRequester: FocusRequester = remember { FocusRequester() }, phoneFocusRequester: FocusRequester = remember { FocusRequester() }, nameFocusRequester: FocusRequester = remember { FocusRequester() }, )
- MatchingDeclarationName:ErrorText.kt$ErrorTextStyle
- MaxLineLength:InjectableActivityScenario.kt$InjectableActivityScenario$delegate ?: throw IllegalStateException("Cannot move to state $newState since the activity hasn't been launched.")
- MaxLineLength:InjectableActivityScenario.kt$InjectableActivityScenario$val d = delegate ?: throw IllegalStateException("Cannot run onActivity since the activity hasn't been launched.")
- MaxLineLength:LinkActivityResultTest.kt$LinkActivityResultTest$"link-popup://complete?link_status=complete&pm=eyJpZCI6InBtXzFOSmVFckx1NW8zUDE4WnBtWHBDdElyUiIsIm9iamVjdCI6InBheW1lbnRfbWV0aG9kIiwiYmlsbGluZ19kZXRhaWxzIjp7ImFkZHJlc3MiOnsiY2l0eSI6bnVsbCwiY291bnRyeSI6bnVsbCwibGluZTEiOm51bGwsImxpbmUyIjpudWxsLCJwb3N0YWxfY29kZSI6bnVsbCwic3RhdGUiOm51bGx9LCJlbWFpbCI6bnVsbCwibmFtZSI6bnVsbCwicGhvbmUiOm51bGx9LCJjYXJkIjp7ImJyYW5kIjoidmlzYSIsImNoZWNrcyI6eyJhZGRyZXNzX2xpbmUxX2NoZWNrIjpudWxsLCJhZGRyZXNzX3Bvc3RhbF9jb2RlX2NoZWNrIjpudWxsLCJjdmNfY2hlY2siOm51bGx9LCJjb3VudHJ5IjpudWxsLCJleHBfbW9udGgiOjEyLCJleHBfeWVhciI6MjAzNCwiZnVuZGluZyI6ImNyZWRpdCIsImdlbmVyYXRlZF9mcm9tIjpudWxsLCJsYXN0NCI6IjAwMDAiLCJuZXR3b3JrcyI6eyJhdmFpbGFibGUiOlsidmlzYSJdLCJwcmVmZXJyZWQiOm51bGx9LCJ0aHJlZV9kX3NlY3VyZV91c2FnZSI6eyJzdXBwb3J0ZWQiOnRydWV9LCJ3YWxsZXQiOnsiZHluYW1pY19sYXN0NCI6bnVsbCwibGluayI6e30sInR5cGUiOiJsaW5rIn19LCJjcmVhdGVkIjoxNjg2OTI4MDIxLCJjdXN0b21lciI6bnVsbCwibGl2ZW1vZGUiOmZhbHNlLCJ0eXBlIjoiY2FyZCJ9ICAg"
- SwallowedException:LinkActivityResult.kt$e: Exception
- TooGenericExceptionCaught:LinkActivityResult.kt$e: Exception
- TooManyFunctions:DefaultLinkEventsReporter.kt$DefaultLinkEventsReporter : LinkEventsReporter
- TooManyFunctions:LinkEventsReporter.kt$LinkEventsReporter
diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContent.kt b/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContent.kt
index e7bb1ba59b2..09d323f7305 100644
--- a/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContent.kt
+++ b/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContent.kt
@@ -9,15 +9,19 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import com.stripe.android.core.strings.ResolvableString
+import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
+import com.stripe.android.paymentsheet.PaymentSheet.Appearance.Embedded
import com.stripe.android.paymentsheet.ui.Mandate
import com.stripe.android.paymentsheet.verticalmode.PaymentMethodEmbeddedLayoutUI
import com.stripe.android.paymentsheet.verticalmode.PaymentMethodVerticalLayoutInteractor
import com.stripe.android.uicore.strings.resolve
@Immutable
+@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
internal data class EmbeddedContent(
private val interactor: PaymentMethodVerticalLayoutInteractor,
val mandate: ResolvableString? = null,
+ private val rowStyle: Embedded.RowStyle
) {
@Composable
fun Content() {
@@ -36,6 +40,7 @@ internal data class EmbeddedContent(
PaymentMethodEmbeddedLayoutUI(
interactor = interactor,
modifier = Modifier.padding(bottom = 8.dp),
+ rowStyle = rowStyle
)
}
diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContentHelper.kt b/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContentHelper.kt
index 734181b2bd7..e9f53e4de50 100644
--- a/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContentHelper.kt
+++ b/paymentsheet/src/main/java/com/stripe/android/paymentelement/embedded/EmbeddedContentHelper.kt
@@ -85,8 +85,8 @@ internal class DefaultEmbeddedContentHelper @AssistedInject constructor(
interactor = createInteractor(
coroutineScope = coroutineScope,
paymentMethodMetadata = state.paymentMethodMetadata,
- rowStyle = state.rowStyle
- )
+ ),
+ rowStyle = state.rowStyle
)
}
}
@@ -110,7 +110,6 @@ internal class DefaultEmbeddedContentHelper @AssistedInject constructor(
private fun createInteractor(
coroutineScope: CoroutineScope,
paymentMethodMetadata: PaymentMethodMetadata,
- rowStyle: Embedded.RowStyle
): PaymentMethodVerticalLayoutInteractor {
val paymentMethodIncentiveInteractor = PaymentMethodIncentiveInteractor(
incentive = paymentMethodMetadata.paymentMethodIncentive,
@@ -171,7 +170,6 @@ internal class DefaultEmbeddedContentHelper @AssistedInject constructor(
reportFormShown = eventReporter::onPaymentMethodFormShown,
onUpdatePaymentMethod = savedPaymentMethodMutator::updatePaymentMethod,
isLiveMode = paymentMethodMetadata.stripeIntent.isLiveMode,
- rowStyle = rowStyle
)
}
diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodEmbeddedLayoutUI.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodEmbeddedLayoutUI.kt
index 739289e8ff6..6f57fef23a1 100644
--- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodEmbeddedLayoutUI.kt
+++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodEmbeddedLayoutUI.kt
@@ -29,7 +29,8 @@ internal const val TEST_TAG_PAYMENT_METHOD_EMBEDDED_LAYOUT = "TEST_TAG_PAYMENT_M
@Composable
internal fun PaymentMethodEmbeddedLayoutUI(
interactor: PaymentMethodVerticalLayoutInteractor,
- modifier: Modifier = Modifier
+ modifier: Modifier = Modifier,
+ rowStyle: Embedded.RowStyle
) {
val context = LocalContext.current
val imageLoader = remember {
@@ -62,7 +63,7 @@ internal fun PaymentMethodEmbeddedLayoutUI(
imageLoader = imageLoader,
modifier = modifier
.testTag(TEST_TAG_PAYMENT_METHOD_EMBEDDED_LAYOUT),
- rowStyle = state.rowType
+ rowStyle = rowStyle
)
}
diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt
index adb37aad391..377aeeaa5eb 100644
--- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt
+++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodVerticalLayoutInteractor.kt
@@ -6,12 +6,10 @@ import com.stripe.android.core.strings.resolvableString
import com.stripe.android.lpmfoundations.paymentmethod.PaymentMethodMetadata
import com.stripe.android.model.PaymentMethod
import com.stripe.android.model.PaymentMethodCode
-import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
import com.stripe.android.paymentsheet.CustomerStateHolder
import com.stripe.android.paymentsheet.DisplayableSavedPaymentMethod
import com.stripe.android.paymentsheet.FormHelper
import com.stripe.android.paymentsheet.LinkInlineHandler
-import com.stripe.android.paymentsheet.PaymentSheet.Appearance.Embedded
import com.stripe.android.paymentsheet.R
import com.stripe.android.paymentsheet.analytics.code
import com.stripe.android.paymentsheet.forms.FormFieldValues
@@ -33,7 +31,6 @@ import kotlinx.coroutines.launch
import kotlin.coroutines.CoroutineContext
import com.stripe.android.R as PaymentsCoreR
-@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
internal interface PaymentMethodVerticalLayoutInteractor {
val isLiveMode: Boolean
@@ -49,7 +46,6 @@ internal interface PaymentMethodVerticalLayoutInteractor {
val selection: PaymentSelection?,
val displayedSavedPaymentMethod: DisplayableSavedPaymentMethod?,
val availableSavedPaymentMethodAction: SavedPaymentMethodAction,
- val rowType: Embedded.RowStyle
)
sealed interface ViewAction {
@@ -66,7 +62,6 @@ internal interface PaymentMethodVerticalLayoutInteractor {
}
}
-@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
internal class DefaultPaymentMethodVerticalLayoutInteractor(
paymentMethodMetadata: PaymentMethodMetadata,
processing: StateFlow,
@@ -91,7 +86,6 @@ internal class DefaultPaymentMethodVerticalLayoutInteractor(
private val onUpdatePaymentMethod: (DisplayableSavedPaymentMethod) -> Unit,
override val isLiveMode: Boolean,
dispatcher: CoroutineContext = Dispatchers.Default,
- private val rowStyle: Embedded.RowStyle = Embedded.RowStyle.FloatingButton.default
) : PaymentMethodVerticalLayoutInteractor {
sealed interface FormType {
@@ -223,7 +217,6 @@ internal class DefaultPaymentMethodVerticalLayoutInteractor(
selection = mostRecentSelection,
displayedSavedPaymentMethod = displayedSavedPaymentMethod,
availableSavedPaymentMethodAction = action,
- rowType = rowStyle
)
}
diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentelement/embedded/EmbeddedContentScreenshotTest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentelement/embedded/EmbeddedContentScreenshotTest.kt
index e979e657466..467409d4c97 100644
--- a/paymentsheet/src/test/java/com/stripe/android/paymentelement/embedded/EmbeddedContentScreenshotTest.kt
+++ b/paymentsheet/src/test/java/com/stripe/android/paymentelement/embedded/EmbeddedContentScreenshotTest.kt
@@ -5,11 +5,14 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.stripe.android.core.strings.resolvableString
import com.stripe.android.lpmfoundations.paymentmethod.PaymentMethodMetadataFactory
+import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
+import com.stripe.android.paymentsheet.PaymentSheet
import com.stripe.android.paymentsheet.verticalmode.FakePaymentMethodVerticalLayoutInteractor
import com.stripe.android.screenshottesting.PaparazziRule
import org.junit.Rule
import kotlin.test.Test
+@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
internal class EmbeddedContentScreenshotTest {
@get:Rule
val paparazziRule = PaparazziRule(boxModifier = Modifier.padding(horizontal = 20.dp))
@@ -18,7 +21,10 @@ internal class EmbeddedContentScreenshotTest {
fun displaysVerticalModeList() {
val metadata = PaymentMethodMetadataFactory.create()
val interactor = FakePaymentMethodVerticalLayoutInteractor.create(metadata)
- val content = EmbeddedContent(interactor)
+ val content = EmbeddedContent(
+ interactor = interactor,
+ rowStyle = PaymentSheet.Appearance.Embedded.RowStyle.FloatingButton.default
+ )
paparazziRule.snapshot {
content.Content()
}
@@ -28,7 +34,11 @@ internal class EmbeddedContentScreenshotTest {
fun displaysVerticalModeListWithMandate() {
val metadata = PaymentMethodMetadataFactory.create()
val interactor = FakePaymentMethodVerticalLayoutInteractor.create(metadata)
- val content = EmbeddedContent(interactor, mandate = "Some mandate".resolvableString)
+ val content = EmbeddedContent(
+ interactor = interactor,
+ mandate = "Some mandate".resolvableString,
+ rowStyle = PaymentSheet.Appearance.Embedded.RowStyle.FloatingButton.default
+ )
paparazziRule.snapshot {
content.Content()
}
diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt
index df5da422eb3..8c73e740d5b 100644
--- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt
+++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/DefaultPaymentMethodVerticalLayoutInteractorTest.kt
@@ -12,7 +12,6 @@ import com.stripe.android.model.PaymentMethodCode
import com.stripe.android.model.PaymentMethodCreateParams
import com.stripe.android.model.PaymentMethodFixtures
import com.stripe.android.model.SetupIntentFixtures
-import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
import com.stripe.android.paymentsheet.DisplayableSavedPaymentMethod
import com.stripe.android.paymentsheet.analytics.code
import com.stripe.android.paymentsheet.forms.FormFieldValues
@@ -32,7 +31,6 @@ import org.junit.Test
import com.stripe.android.paymentsheet.R as PaymentSheetR
@Suppress("LargeClass")
-@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
class DefaultPaymentMethodVerticalLayoutInteractorTest {
@Test
diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/FakePaymentMethodVerticalLayoutInteractor.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/FakePaymentMethodVerticalLayoutInteractor.kt
index 064afb6ad62..9eb31a262f1 100644
--- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/FakePaymentMethodVerticalLayoutInteractor.kt
+++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/FakePaymentMethodVerticalLayoutInteractor.kt
@@ -2,14 +2,11 @@ package com.stripe.android.paymentsheet.verticalmode
import com.stripe.android.lpmfoundations.paymentmethod.PaymentMethodMetadata
import com.stripe.android.lpmfoundations.paymentmethod.PaymentMethodMetadataFactory
-import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
-import com.stripe.android.paymentsheet.PaymentSheet.Appearance.Embedded
import com.stripe.android.paymentsheet.ViewActionRecorder
import com.stripe.android.paymentsheet.model.PaymentSelection
import com.stripe.android.uicore.utils.stateFlowOf
import kotlinx.coroutines.flow.StateFlow
-@OptIn(ExperimentalEmbeddedPaymentElementApi::class)
internal class FakePaymentMethodVerticalLayoutInteractor(
initialState: PaymentMethodVerticalLayoutInteractor.State,
initialShowsWalletsHeader: Boolean = false,
@@ -38,7 +35,6 @@ internal class FakePaymentMethodVerticalLayoutInteractor(
displayedSavedPaymentMethod = null,
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.MANAGE_ALL,
- rowType = Embedded.RowStyle.FloatingButton.default
)
return FakePaymentMethodVerticalLayoutInteractor(
initialState = initialState,
diff --git a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodLayoutUITest.kt b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodLayoutUITest.kt
index 9f9b9b20308..f5af0d7ab8e 100644
--- a/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodLayoutUITest.kt
+++ b/paymentsheet/src/test/java/com/stripe/android/paymentsheet/verticalmode/PaymentMethodLayoutUITest.kt
@@ -50,7 +50,6 @@ internal class PaymentMethodLayoutUITest(
displayedSavedPaymentMethod = PaymentMethodFixtures.displayableCard(),
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.MANAGE_ALL,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
assertThat(viewActionRecorder.viewActions).isEmpty()
@@ -70,7 +69,6 @@ internal class PaymentMethodLayoutUITest(
displayedSavedPaymentMethod = PaymentMethodFixtures.displayableCard(),
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.MANAGE_ONE,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
assertThat(viewActionRecorder.viewActions).isEmpty()
@@ -92,7 +90,6 @@ internal class PaymentMethodLayoutUITest(
displayedSavedPaymentMethod = PaymentMethodFixtures.displayableCard(),
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.NONE,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
composeRule.onNodeWithTag(
@@ -121,7 +118,6 @@ internal class PaymentMethodLayoutUITest(
displayedSavedPaymentMethod = null,
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.MANAGE_ALL,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
assertThat(onClickCalled).isFalse()
@@ -141,7 +137,6 @@ internal class PaymentMethodLayoutUITest(
selection = null,
displayedSavedPaymentMethod = savedPaymentMethod,
availableSavedPaymentMethodAction = PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.NONE,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
assertThat(viewActionRecorder.viewActions).isEmpty()
@@ -176,7 +171,6 @@ internal class PaymentMethodLayoutUITest(
displayedSavedPaymentMethod = PaymentMethodFixtures.displayableCard(),
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.MANAGE_ALL,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
assertThat(
@@ -212,7 +206,6 @@ internal class PaymentMethodLayoutUITest(
displayedSavedPaymentMethod = PaymentMethodFixtures.displayableCard(),
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.MANAGE_ALL,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
composeRule.onNodeWithTag(
@@ -259,7 +252,6 @@ internal class PaymentMethodLayoutUITest(
displayedSavedPaymentMethod = null,
availableSavedPaymentMethodAction =
PaymentMethodVerticalLayoutInteractor.SavedPaymentMethodAction.MANAGE_ALL,
- rowType = Embedded.RowStyle.FloatingButton.default
)
) {
assertThat(
@@ -315,7 +307,7 @@ internal class PaymentMethodLayoutUITest(
paymentMethodsTag = TEST_TAG_PAYMENT_METHOD_EMBEDDED_LAYOUT,
allPaymentMethodsChildCount = 4,
layoutUI = { interactor, modifier ->
- PaymentMethodEmbeddedLayoutUI(interactor, modifier)
+ PaymentMethodEmbeddedLayoutUI(interactor, modifier, Embedded.RowStyle.FloatingButton.default)
}
)
)