Skip to content
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

Enable new LPMs #5042

Merged
merged 49 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
6ad41de
Change how mapping from field field values works. The form field va…
michelleb-stripe Apr 8, 2022
ab667a0
Rename newCard to newLpm taking in any new PaymentSelection
michelleb-stripe Apr 8, 2022
c4bf754
This will prepoulate the fields in the LPMs, the last selected paymen…
michelleb-stripe Apr 8, 2022
488447e
Merge branch 'master' into michelleb/payment-method-params
michelleb-stripe Apr 8, 2022
61c31c5
Merge branch 'michelleb/payment-method-params' into michelleb/pre-pop…
michelleb-stripe Apr 8, 2022
faf3303
Set the initial value of all fields
michelleb-stripe Apr 10, 2022
df8a847
Fix au_becs_debit account number identifier path
michelleb-stripe Apr 10, 2022
b1d9d30
Merge
michelleb-stripe Apr 10, 2022
b7a3d45
Add passing of merchant country based on currency
michelleb-stripe Apr 10, 2022
6e9efa9
Merge branch 'michelleb/pre-populate-fields' into michelleb/playgroun…
michelleb-stripe Apr 10, 2022
8a962cc
Add initial values for SignUpScreen
michelleb-stripe Apr 10, 2022
8b9006d
Update tests with initialValues.
michelleb-stripe Apr 10, 2022
9f69fa9
Fix tests
michelleb-stripe Apr 10, 2022
64dcd66
Merge with master
michelleb-stripe Apr 10, 2022
8d4a4e0
Merge branch 'michelleb/payment-method-params' into michelleb/pre-pop…
michelleb-stripe Apr 10, 2022
090e93b
Cleanup
michelleb-stripe Apr 10, 2022
8ccbd02
Merge branch 'michelleb/pre-populate-fields' into michelleb/playgroun…
michelleb-stripe Apr 10, 2022
2730a66
Merge remote-tracking branch 'origin/master' into michelleb/payment-m…
michelleb-stripe Apr 18, 2022
628e005
Merge branch 'master' into michelleb/payment-method-params
michelleb-stripe Apr 19, 2022
d6c6438
Ran localize script, made a couple of tweaks to make it work.
michelleb-stripe Apr 20, 2022
b918a48
Ran localize script, made a couple of tweaks to make it work.
michelleb-stripe Apr 20, 2022
16cfde6
Merge branch 'master' into michelleb/payment-method-params
michelleb-stripe Apr 20, 2022
3552b22
Merge with origin/master
michelleb-stripe Apr 25, 2022
e5411d1
wrong branch
michelleb-stripe Apr 25, 2022
f2dcfc6
PaymentSheet set default values on form (#4909)
michelleb-stripe Apr 25, 2022
9d5231d
Merge with master
michelleb-stripe Apr 25, 2022
ced2201
All validated.
michelleb-stripe Apr 25, 2022
9905eb3
Merge with master
michelleb-stripe Apr 25, 2022
cf3e021
cleanup
michelleb-stripe Apr 25, 2022
2d13bee
Merge with master
michelleb-stripe Apr 27, 2022
150e061
Merge with master
michelleb-stripe Apr 27, 2022
899cc6e
Fix merge
michelleb-stripe Apr 27, 2022
eb74b88
apiDump
michelleb-stripe Apr 27, 2022
ac801f8
Merge with master.
michelleb-stripe May 19, 2022
b543f75
Add AU BECS to the playground, send the requested merchant country to…
michelleb-stripe May 19, 2022
4f6d974
Update the changelog.
michelleb-stripe May 19, 2022
152e269
Cleanup
michelleb-stripe May 19, 2022
4e8f653
Merge remote-tracking branch 'origin/master' into michelleb/enable-au…
michelleb-stripe May 20, 2022
38d06b9
Remove the paypal tests for now.
michelleb-stripe May 20, 2022
b0a2167
Make the paymentConfiguration update-able after initialization of the…
michelleb-stripe May 20, 2022
60d45f0
Cleanup
michelleb-stripe May 20, 2022
ef89b60
Merge branch 'michelleb/set-pubkey-after-paysment-sheet-init' into mi…
michelleb-stripe May 20, 2022
074f554
Need to clear the new user if the currency changes because the curren…
michelleb-stripe May 20, 2022
1a3752a
Undo unnecessary change.
michelleb-stripe May 20, 2022
0c4c075
Cleanup
michelleb-stripe May 20, 2022
281af28
Merge branch 'michelleb/set-pubkey-after-paysment-sheet-init' into mi…
michelleb-stripe May 20, 2022
20a3e3e
Cleanup
michelleb-stripe May 20, 2022
856c6b3
merge with master.
michelleb-stripe May 21, 2022
fa6c448
Fix AU BECS field population.
michelleb-stripe May 21, 2022
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## x.x.x - xxxx-xx-xx

### PaymentSheet
- [FIXED] the format of the country dropdown in PaymentSheet for all languages.
- [FIXED] Fixed the format of the country dropdown in PaymentSheet for all languages.
- [ADDED] Added Affirm and AU BECS Direct Debit.


## 20.3.0 - 2022-05-16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ class TestHardCodedLpms {
)
}

@Ignore("Ignored until ready to release")
// @Test
@Test
fun testAffirm() {
testDriver.confirmNewOrGuestComplete(
newUser.copy(
Expand All @@ -178,14 +177,16 @@ class TestHardCodedLpms {
)
}

@Ignore("Cannot be tested requires AU-based merchant")
@Test
fun testAuBecsDD() {
testDriver.confirmNewOrGuestComplete(
newUser.copy(
paymentMethod = SupportedPaymentMethod.AuBecsDebit,
authorizationAction = AuthorizeAction.Authorize,
currency = Currency.USD,
shipping = Shipping.On
authorizationAction = null,
currency = Currency.AUD,
shipping = Shipping.On,
delayed = DelayedPMs.On,
automatic = Automatic.Off,
)
)
}
Expand All @@ -201,13 +202,14 @@ class TestHardCodedLpms {
)
}

@Ignore("Cannot be tested requires EU-based merchant")
@Test
fun testPayPal() {
testDriver.confirmNewOrGuestComplete(
newUser.copy(
paymentMethod = SupportedPaymentMethod.PayPal,
authorizationAction = AuthorizeAction.Authorize,
currency = Currency.USD
currency = Currency.EUR,
automatic = Automatic.Off
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ class TestMultiStepFieldsReloaded {
)
}

@Ignore("Ignored until ready to release")
// @Test
@Test
fun testAffirm() {
testDriver.confirmCustom(
newUser.copy(
Expand All @@ -170,7 +169,7 @@ class TestMultiStepFieldsReloaded {
)
}

@Ignore("Cannot be tested requires AU-based merchant")
@Test
fun testAuBecsDD() {
testDriver.confirmCustom(
newUser.copy(
Expand All @@ -190,7 +189,7 @@ class TestMultiStepFieldsReloaded {
)
}

@Ignore("Cannot be tested requires EU-based merchant")
@Test
fun testPayPal() {
testDriver.confirmCustom(
newUser.copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import androidx.test.espresso.Espresso
import com.stripe.android.test.core.ui.Selectors
import com.stripe.android.ui.core.elements.AddressSpec
import com.stripe.android.ui.core.elements.AuBankAccountNumberSpec
import com.stripe.android.ui.core.elements.DropdownSpec
import com.stripe.android.ui.core.elements.BsbSpec
import com.stripe.android.ui.core.elements.CardBillingSpec
import com.stripe.android.ui.core.elements.CardDetailsSectionSpec
import com.stripe.android.ui.core.elements.CountrySpec
import com.stripe.android.ui.core.elements.DropdownSpec
import com.stripe.android.ui.core.elements.EmailSpec
import com.stripe.android.ui.core.elements.IbanSpec
import com.stripe.android.ui.core.elements.KlarnaCountrySpec
Expand Down Expand Up @@ -89,12 +90,18 @@ class FieldPopulator(
val state: String = "CA",
val cardNumber: String = "4242424242424242",
val cardExpiration: String = "1230",
val cardCvc: String = "321"
val cardCvc: String = "321",
val auBecsBsbNumber: String = "000000",
val auBecsAccountNumber: String = "000123456"
)

private fun verifyPlatformLpmFields(values: Values = Values()) {
formSpec.items.forEach {
when (it) {
is BsbSpec -> {
selectors.getAuBsb()
.assertContentDescriptionEquals(values.auBecsBsbNumber)
}
is CardDetailsSectionSpec -> {
selectors.getCardNumber()
.assertContentDescriptionEquals(values.cardNumber)
Expand Down Expand Up @@ -135,7 +142,10 @@ class FieldPopulator(
}
is CountrySpec -> {}
is SimpleTextSpec -> {}
AuBankAccountNumberSpec -> {}
AuBankAccountNumberSpec -> {
selectors.getAuAccountNumber()
.assertContentDescriptionEquals(values.state)
}
is DropdownSpec -> {}
IbanSpec -> {}
is KlarnaCountrySpec -> {}
Expand All @@ -156,6 +166,11 @@ class FieldPopulator(
private fun populatePlatformLpmFields(values: Values = Values()) {
formSpec.items.forEach {
when (it) {
is BsbSpec -> {
selectors.getAuBsb().apply {
performTextInput(values.auBecsBsbNumber)
}
}
is CardDetailsSectionSpec -> {
selectors.getCardNumber().performTextInput(values.cardNumber)
selectors.composeTestRule.waitForIdle()
Expand Down Expand Up @@ -204,7 +219,12 @@ class FieldPopulator(
}
is CountrySpec -> {}
is SimpleTextSpec -> {}
AuBankAccountNumberSpec -> {}
is AuBankAccountNumberSpec -> {
selectors.getAuAccountNumber().apply {
performTextInput(values.auBecsAccountNumber)
}

}
is DropdownSpec -> {}
IbanSpec -> {}
is KlarnaCountrySpec -> {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class PlaygroundTestDriver(
// Could consider setting these preferences instead of clicking
// if it is faster (possibly 1-2s)
selectors.customer.click()
selectors.automatic.click()
selectors.currency.click()
selectors.checkout.click()
selectors.delayed.click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ enum class IntentType {
*/
enum class Currency {
USD,
EUR
EUR,
AUD
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Selectors(
val currency = when (testParameters.currency) {
Currency.EUR -> EspressoLabelIdButton(R.string.currency_eur)
Currency.USD -> EspressoLabelIdButton(R.string.currency_usd)
Currency.AUD -> EspressoLabelIdButton(R.string.currency_aud)
}

val checkout = when (testParameters.intentType) {
Expand Down Expand Up @@ -241,6 +242,14 @@ class Selectors(
getResourceString(R.string.address_label_zip_code)
)

fun getAuBsb() = composeTestRule.onNodeWithText(
getResourceString(com.stripe.android.ui.core.R.string.becs_widget_bsb)
)

fun getAuAccountNumber() = composeTestRule.onNodeWithText(
getResourceString(R.string.becs_widget_account_number)
)

fun getGoogleDividerText() = composeTestRule.onNodeWithText(
"Or pay",
substring = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ data class CheckoutRequest(
val mode: String,
val set_shipping_address: Boolean,
val automatic_payment_methods: Boolean,
val use_link: Boolean
val use_link: Boolean,

// when used with the glitch backend: mature-buttery-bumper, which skyler has access to
// this will use a different merchant based on the country code
val merchant_country_code: String? = when (currency.uppercase()) {
"AUD" -> "AU"
"EUR" -> "GB"
else -> null
}
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@

<RadioButton
android:id="@+id/currency_aud_button"
android:text="AUD"
android:text="@string/currency_aud"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
Expand Down
1 change: 1 addition & 0 deletions paymentsheet-example/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<string name="confirm">confirm</string>
<string name="currency_usd">USD</string>
<string name="currency_eur">EUR</string>
<string name="currency_aud">AUD</string>
<string name="show_sheet">Show Sheet</string>
<string name="appearance_playground">"Appearance Customization"</string>
</resources>
2 changes: 1 addition & 1 deletion paymentsheet/api/paymentsheet.api
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ public final class com/stripe/android/paymentsheet/injection/PaymentSheetCommonM
public static fun create (Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/injection/PaymentSheetCommonModule_Companion_ProvidePublishableKeyFactory;
public synthetic fun get ()Ljava/lang/Object;
public fun get ()Lkotlin/jvm/functions/Function0;
public static fun providePublishableKey (Ldagger/Lazy;)Lkotlin/jvm/functions/Function0;
public static fun providePublishableKey (Landroid/content/Context;)Lkotlin/jvm/functions/Function0;
}

public final class com/stripe/android/paymentsheet/injection/PaymentSheetCommonModule_Companion_ProvideStripeAccountIdFactory : dagger/internal/Factory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ internal abstract class PaymentSheetCommonModule {

@Provides
@Named(PUBLISHABLE_KEY)
fun providePublishableKey(paymentConfiguration: Lazy<PaymentConfiguration>): () -> String =
{ paymentConfiguration.get().publishableKey }
fun providePublishableKey(appContext: Context): () -> String =
{ PaymentConfiguration.getInstance(appContext).publishableKey }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so that if the currency changes after PaymentSheet is created, that the publishable key returned from the reload is updated in the PaymentSheet Configuration.


@Provides
@Named(STRIPE_ACCOUNT_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ sealed class SupportedPaymentMethod(
PayPal,
AfterpayClearpay,
USBankAccount,
// Affirm // TODO: uncomment once we are ready to go live
// AuBecsDebit // TODO: uncomment once we are ready to go live
Affirm,
AuBecsDebit
)
}

Expand Down