Skip to content

Commit

Permalink
Fix mandate text disappearing
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswoo-stripe committed Oct 27, 2023
1 parent a5b1121 commit 81f43a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ internal sealed class PaymentSelection : Parcelable {
override val paymentMethodOptionsParams: PaymentMethodOptionsParams? = null,
) : New() {

override fun mandateText(
context: Context,
merchantName: String,
isSaveForFutureUseSelected: Boolean,
): String? {
return screenState.mandateText
}

@Parcelize
data class Input(
val name: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ class PaymentSelectionTest {
)
}

@Test
fun `Displays the correct mandate for US Bank Account`() {
val paymentSelection = PaymentSelection.Saved(
paymentMethod = PaymentMethodFactory.usBankAccount(),
)

val result = paymentSelection.mandateText(
context = context,
merchantName = "Merchant",
isSaveForFutureUseSelected = false,
)

assertThat(result).isEqualTo(
"By continuing, you agree to authorize payments pursuant to " +
"<a href=\"https://stripe.com/ach-payments/authorization\">these terms</a>."
)
}

@Test
fun `Doesn't display a mandate for a saved payment method that isn't US bank account`() =
runAllConfigurations { isSaveForFutureUseSelected ->
Expand Down

0 comments on commit 81f43a4

Please sign in to comment.