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

Remove local feature flag for Instant Debits #8418

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.compose.ui.test.isEnabled
import androidx.compose.ui.test.onNodeWithText
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.stripe.android.BasePlaygroundTest
import com.stripe.android.core.utils.FeatureFlags
import com.stripe.android.model.PaymentMethod
import com.stripe.android.paymentsheet.example.playground.settings.AutomaticPaymentMethodsSettingsDefinition
import com.stripe.android.paymentsheet.example.playground.settings.Country
Expand All @@ -15,16 +14,13 @@ import com.stripe.android.paymentsheet.example.playground.settings.Currency
import com.stripe.android.paymentsheet.example.playground.settings.CurrencySettingsDefinition
import com.stripe.android.paymentsheet.example.playground.settings.DefaultBillingAddress
import com.stripe.android.paymentsheet.example.playground.settings.DefaultBillingAddressSettingsDefinition
import com.stripe.android.paymentsheet.example.playground.settings.EnableInstantDebitsSettingsDefinition
import com.stripe.android.paymentsheet.example.playground.settings.LinkSettingsDefinition
import com.stripe.android.paymentsheet.example.playground.settings.SupportedPaymentMethodsSettingsDefinition
import com.stripe.android.paymentsheet.ui.PAYMENT_SHEET_PRIMARY_BUTTON_TEST_TAG
import com.stripe.android.test.core.AuthorizeAction
import com.stripe.android.test.core.TestParameters
import com.stripe.android.test.core.ui.ComposeButton
import com.stripe.android.testing.FeatureFlagTestRule
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

Expand All @@ -43,15 +39,8 @@ internal class TestInstantDebits : BasePlaygroundTest() {
PaymentMethod.Type.Card,
PaymentMethod.Type.Link
).joinToString(",")
settings[EnableInstantDebitsSettingsDefinition] = true
}

@get:Rule
val instantDebitsFeatureRule = FeatureFlagTestRule(
featureFlag = FeatureFlags.instantDebits,
isEnabled = true,
)

@Test
@Ignore
fun testInstantDebitsSuccess() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ internal class PlaygroundSettings private constructor(
CustomerSettingsDefinition,
CheckoutModeSettingsDefinition,
LinkSettingsDefinition,
EnableInstantDebitsSettingsDefinition,
CountrySettingsDefinition,
CurrencySettingsDefinition,
GooglePaySettingsDefinition,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.stripe.android.lpmfoundations.paymentmethod

import com.stripe.android.core.utils.FeatureFlags
import com.stripe.android.model.PaymentIntent
import com.stripe.android.model.PaymentMethod.Type.USBankAccount

Expand Down Expand Up @@ -64,8 +63,7 @@ internal enum class AddPaymentMethodRequirement {
val noUsBankAccount = USBankAccount.code !in paymentMethodTypes
val supportsBankAccounts = "bank_account" in metadata.stripeIntent.linkFundingSources
val isDeferred = metadata.stripeIntent.clientSecret == null
val isEnabled = FeatureFlags.instantDebits.isEnabled
return noUsBankAccount && supportsBankAccounts && !isDeferred && isEnabled
return noUsBankAccount && supportsBankAccounts && !isDeferred
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We no longer need a feature flag, as the bank_account funding source is now only included if the request comes from a supported client version (or from an explicitly-enabled merchant account).

}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
package com.stripe.android.lpmfoundations.paymentmethod

import com.google.common.truth.Truth.assertThat
import com.stripe.android.core.utils.FeatureFlags
import com.stripe.android.lpmfoundations.paymentmethod.AddPaymentMethodRequirement.InstantDebits
import com.stripe.android.model.Address
import com.stripe.android.model.PaymentIntent
import com.stripe.android.model.PaymentIntentFixtures
import com.stripe.android.model.SetupIntentFixtures
import com.stripe.android.model.StripeIntent
import com.stripe.android.testing.FeatureFlagTestRule
import com.stripe.android.testing.PaymentIntentFactory
import org.junit.Rule
import org.junit.Test

internal class AddPaymentMethodRequirementTest {

@get:Rule
val instantDebitsFeatureRule = FeatureFlagTestRule(
featureFlag = FeatureFlags.instantDebits,
isEnabled = false,
)

@Test
fun testUnsupportedReturnsFalse() {
val metadata = PaymentMethodMetadataFactory.create()
Expand Down Expand Up @@ -171,30 +162,15 @@ internal class AddPaymentMethodRequirementTest {

@Test
fun testInstantDebitsReturnsTrue() {
instantDebitsFeatureRule.setEnabled(true)

val metadata = PaymentMethodMetadataFactory.create(
stripeIntent = createValidInstantDebitsPaymentIntent(),
)

assertThat(InstantDebits.isMetBy(metadata)).isTrue()
}

@Test
fun testInstantDebitsReturnsFalseIfFeatureNotEnabled() {
instantDebitsFeatureRule.setEnabled(false)

val metadata = PaymentMethodMetadataFactory.create(
stripeIntent = createValidInstantDebitsPaymentIntent(),
)

assertThat(InstantDebits.isMetBy(metadata)).isFalse()
}

@Test
fun testInstantDebitsReturnsFalseIfDeferredIntent() {
instantDebitsFeatureRule.setEnabled(true)

val metadata = PaymentMethodMetadataFactory.create(
stripeIntent = createValidInstantDebitsPaymentIntent().copy(
clientSecret = null,
Expand All @@ -206,8 +182,6 @@ internal class AddPaymentMethodRequirementTest {

@Test
fun testInstantDebitsReturnsFalseIfShowingUsBankAccount() {
instantDebitsFeatureRule.setEnabled(true)

val metadata = PaymentMethodMetadataFactory.create(
stripeIntent = createValidInstantDebitsPaymentIntent().copy(
paymentMethodTypes = listOf("card", "link", "us_bank_account"),
Expand All @@ -219,8 +193,6 @@ internal class AddPaymentMethodRequirementTest {

@Test
fun testInstantDebitsReturnsFalseIfOnlyCardFundingSource() {
instantDebitsFeatureRule.setEnabled(true)

val metadata = PaymentMethodMetadataFactory.create(
stripeIntent = createValidInstantDebitsPaymentIntent().copy(
linkFundingSources = listOf("card"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import androidx.annotation.RestrictTo
import com.stripe.android.core.BuildConfig

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Suppress("unused")
object FeatureFlags {
val instantDebits = FeatureFlag()
// Add any feature flags here
}

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
Expand Down