Skip to content

RowSelectionBehavior Implementation #10831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 63 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3ecc18a
api
tianzhao-stripe May 16, 2025
74876c6
lint
tianzhao-stripe May 19, 2025
d4fca0a
callback
tianzhao-stripe May 20, 2025
461973d
validate in config
tianzhao-stripe May 20, 2025
bfd7519
handleImmediateRowActionCallback
tianzhao-stripe May 20, 2025
4468c73
linkRow, gPayRow clicked
tianzhao-stripe May 22, 2025
cfd8170
remember embeddedPaymentElement properly
tianzhao-stripe May 22, 2025
a2efa68
move logic into EmbeddedRowSelectionImmediateActionHandler
tianzhao-stripe May 22, 2025
8e2f16f
move InternalRowSelectionCallback to rowSelectionActionHandler
tianzhao-stripe May 22, 2025
a59028c
import rowSelectionImmediateActionHandler to defaultSheetLauncher
tianzhao-stripe May 22, 2025
1560234
manage screen
tianzhao-stripe May 22, 2025
d1589d1
form and non form rows
tianzhao-stripe May 22, 2025
62728d7
remove paymentMethodID
tianzhao-stripe May 22, 2025
b6253ed
comments about where selection set by user click
tianzhao-stripe May 22, 2025
43792eb
remove comments about where selection set by user click
tianzhao-stripe May 22, 2025
d4ddf92
remove path comments form/non form
tianzhao-stripe May 22, 2025
d08ff83
manage screen user click comments
tianzhao-stripe May 22, 2025
d9e2640
remove import
tianzhao-stripe May 22, 2025
7b112f0
extra space
tianzhao-stripe May 22, 2025
4fa18e4
remove manage import
tianzhao-stripe May 22, 2025
74c6208
pass flag instead of selection
tianzhao-stripe May 26, 2025
7e59a79
remove state from rowImmediateActionHandler
tianzhao-stripe May 28, 2025
ebe5053
clear state after confirm
tianzhao-stripe May 28, 2025
b891b60
unusedimport
tianzhao-stripe May 28, 2025
7a1e291
simplify with coroutines
tianzhao-stripe May 28, 2025
21916a8
more simplification of handleImmediateRowSelectionCallback
tianzhao-stripe May 28, 2025
d52d694
lint
tianzhao-stripe May 28, 2025
fd17458
don't invoke callback when in confirm
tianzhao-stripe May 30, 2025
db24c1c
return failure result and not crash
tianzhao-stripe May 30, 2025
01aeca1
tests
tianzhao-stripe May 30, 2025
4c9ed3f
remove singletons
tianzhao-stripe May 30, 2025
ef734fb
use one callback
tianzhao-stripe May 30, 2025
9630c4b
comments: move clearSelection logic to embeddedSelectionChooser
tianzhao-stripe May 31, 2025
13ea6ef
comments rename form row tests
tianzhao-stripe May 31, 2025
41d2b98
missed check for confirm
tianzhao-stripe Jun 1, 2025
64a2acd
DefaultEmbeddedConfigurationHandlerTest update
tianzhao-stripe Jun 1, 2025
a248440
DefaultPaymentMethodVerticalLayoutInteractorTest update
tianzhao-stripe Jun 1, 2025
82bb928
changelog
tianzhao-stripe Jun 1, 2025
9af8124
integration tests
tianzhao-stripe Jun 2, 2025
eb5940b
analytics tests
tianzhao-stripe Jun 2, 2025
fe2a7c1
remove comment to myself
tianzhao-stripe Jun 3, 2025
ab888f1
fix tests with idle and factor out common code
tianzhao-stripe Jun 3, 2025
be0ef31
Delete EmbeddedRowSelectionImmediateActionHandlerTest.kt
tianzhao-stripe Jun 3, 2025
d762164
internal rowSelectionBehavior classes
tianzhao-stripe Jun 3, 2025
331219b
missing comma
tianzhao-stripe Jun 4, 2025
a1d3d97
fun interface invoke
tianzhao-stripe Jun 5, 2025
eab674b
Update EmbeddedContentHelper.kt
tianzhao-stripe Jun 5, 2025
7175dbf
Update EmbeddedPaymentElementTestRunner.kt
tianzhao-stripe Jun 5, 2025
b0216b0
test use turbine
tianzhao-stripe Jun 5, 2025
66b87e0
extract assert code to functions
tianzhao-stripe Jun 5, 2025
62f61c7
replace espresso onidle with fetchSemanticsNodes(atLeastOneRootRequir…
tianzhao-stripe Jun 5, 2025
47d0e8d
move rowSelectionCalls to testContext
tianzhao-stripe Jun 6, 2025
77a3855
test updates
tianzhao-stripe Jun 6, 2025
0ab7701
merge conflicts
tianzhao-stripe Jun 6, 2025
d59397b
Merge branch 'master' into CustomCTA_V1_Impl
tianzhao-stripe Jun 6, 2025
52a1b5a
Merge branch 'master' into CustomCTA_V1_Impl
tianzhao-stripe Jun 12, 2025
14f13dc
update changelog, move update to paymentSheet
tianzhao-stripe Jun 13, 2025
d5e6fc8
private object default
tianzhao-stripe Jun 13, 2025
f76dea0
updates to rowSelectionTest
tianzhao-stripe Jun 13, 2025
2fce35a
use only assertNextCardRowSelectionItem
tianzhao-stripe Jun 13, 2025
d762eb9
private class immediateAction
tianzhao-stripe Jun 13, 2025
0941ccd
Merge branch 'master' into CustomCTA_V1_Impl
tianzhao-stripe Jun 13, 2025
4ac87d8
fix test
tianzhao-stripe Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### PaymentSheet
* [ADDED][10935](https://github.com/stripe/stripe-android/pull/10935) Add `formInsetValues` method to `PaymentSheet.Appearance.Builder`.
* [ADDED][10831](https://github.com/stripe/stripe-android/pull/10831) Added `RowSelectionBehavior` API to Embedded Payment Element
* [DEPRECATED][10833](https://github.com/stripe/stripe-android/pull/10833) Deprecated PaymentSheet/FlowController constructors, create methods, and Compose remember functions in favor of new Builder pattern APIs.

## 21.17.0 - 2025-06-09
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import com.stripe.android.paymentsheet.verticalmode.TEST_TAG_MANAGE_SCREEN_CHEVR
import com.stripe.android.paymentsheet.verticalmode.TEST_TAG_MANAGE_SCREEN_SAVED_PMS_LIST
import com.stripe.android.paymentsheet.verticalmode.TEST_TAG_SAVED_PAYMENT_METHOD_ROW_BUTTON

@Suppress("TooManyFunctions")
class ManagePage(
private val composeTestRule: ComposeTestRule,
) {
fun waitUntilVisible() {
composeTestRule.waitUntil {
composeTestRule
.onAllNodes(hasTestTag(TEST_TAG_MANAGE_SCREEN_SAVED_PMS_LIST))
.fetchSemanticsNodes()
.fetchSemanticsNodes(atLeastOneRootRequired = false)
.isNotEmpty()
}
}
Expand All @@ -32,6 +33,15 @@ class ManagePage(
.assertDoesNotExist()
}

fun waitUntilNotVisible() {
composeTestRule.waitUntil {
composeTestRule
.onAllNodes(hasTestTag(TEST_TAG_MANAGE_SCREEN_SAVED_PMS_LIST))
.fetchSemanticsNodes()
.isEmpty()
}
}

fun selectPaymentMethod(paymentMethodId: String) {
composeTestRule.onNode(
hasTestTag("${TEST_TAG_SAVED_PAYMENT_METHOD_ROW_BUTTON}_$paymentMethodId")
Expand Down
11 changes: 11 additions & 0 deletions paymentsheet/api/paymentsheet.api
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ public final class com/stripe/android/paymentelement/EmbeddedPaymentElement$Buil
public final fun analyticEventCallback (Lcom/stripe/android/paymentelement/AnalyticEventCallback;)Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$Builder;
public final fun confirmCustomPaymentMethodCallback (Lcom/stripe/android/paymentelement/ConfirmCustomPaymentMethodCallback;)Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$Builder;
public final fun externalPaymentMethodConfirmHandler (Lcom/stripe/android/paymentsheet/ExternalPaymentMethodConfirmHandler;)Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$Builder;
public final fun rowSelectionBehavior (Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$RowSelectionBehavior;)Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$Builder;
}

public final class com/stripe/android/paymentelement/EmbeddedPaymentElement$Configuration : android/os/Parcelable {
Expand Down Expand Up @@ -918,6 +919,16 @@ public abstract interface class com/stripe/android/paymentelement/EmbeddedPaymen
public abstract fun onResult (Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$Result;)V
}

public abstract class com/stripe/android/paymentelement/EmbeddedPaymentElement$RowSelectionBehavior {
public static final field $stable I
public static final field Companion Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$RowSelectionBehavior$Companion;
}

public final class com/stripe/android/paymentelement/EmbeddedPaymentElement$RowSelectionBehavior$Companion {
public final fun default ()Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$RowSelectionBehavior;
public final fun immediateAction (Lkotlin/jvm/functions/Function1;)Lcom/stripe/android/paymentelement/EmbeddedPaymentElement$RowSelectionBehavior;
}

public final class com/stripe/android/paymentelement/EmbeddedPaymentElement$State : android/os/Parcelable {
public static final field $stable I
public static final field CREATOR Landroid/os/Parcelable$Creator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class EmbeddedContentPage(
composeTestRule.waitUntil {
composeTestRule
.onAllNodes(hasTestTag(TEST_TAG_PAYMENT_METHOD_EMBEDDED_LAYOUT))
.fetchSemanticsNodes()
.fetchSemanticsNodes(atLeastOneRootRequired = false)
.isNotEmpty()
}
}
Expand Down Expand Up @@ -65,6 +65,14 @@ internal class EmbeddedContentPage(
}
}

fun clickOnSavedPM(paymentMethodId: String) {
waitUntilVisible()

composeTestRule.onNode(hasTestTag("${TEST_TAG_SAVED_PAYMENT_METHOD_ROW_BUTTON}_$paymentMethodId"))
.performScrollTo()
.performClick()
}

fun clickViewMore() {
waitUntilVisible()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ import kotlin.time.Duration.Companion.seconds
internal class EmbeddedFormPage(
private val composeTestRule: ComposeTestRule,
) {
val cardNumber: SemanticsNodeInteraction = nodeWithLabel("Card number")
val cardNumberText: SemanticsNodeInteraction = nodeWithLabel("Card number")

fun fillOutCardDetails(fillOutCardNumber: Boolean = true) {
fun fillOutCardDetails(
newCardNumber: String = "4242424242424242",
fillOutCardNumber: Boolean = true
) {
waitUntilVisible()
if (fillOutCardNumber) {
replaceText(cardNumber, "4242424242424242")
replaceText(cardNumberText, newCardNumber)
}
fillExpirationDate("12/34")
replaceText("CVC", "123")
Expand Down Expand Up @@ -52,7 +55,7 @@ internal class EmbeddedFormPage(
composeTestRule.waitUntil {
composeTestRule
.onAllNodes(hasTestTag(FORM_ELEMENT_TEST_TAG))
.fetchSemanticsNodes()
.fetchSemanticsNodes(atLeastOneRootRequired = false)
.isNotEmpty()
}
}
Expand Down
Loading
Loading