-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show Instant Debits in payment methods carousel (#8264)
* Show Instant Debits in payment methods carousel * Add InstantDebits requirement tests * Update PaymentMethodMetadata test * Update payment options test * Address code review feedback - Remove `Link.code` check in requirement - Update tests with correct feature flag value * Add toggle for Instant Debits in playground
- Loading branch information
1 parent
cf8b0ce
commit c766796
Showing
11 changed files
with
181 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...android/paymentsheet/example/playground/settings/EnableInstantDebitsSettingsDefinition.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.stripe.android.paymentsheet.example.playground.settings | ||
|
||
import com.stripe.android.core.utils.FeatureFlags | ||
|
||
internal object EnableInstantDebitsSettingsDefinition : BooleanSettingsDefinition( | ||
key = "enableInstantDebits", | ||
displayName = "Enable Instant Debits", | ||
defaultValue = false, | ||
) { | ||
override fun valueUpdated(value: Boolean, playgroundSettings: PlaygroundSettings) { | ||
FeatureFlags.instantDebits.setEnabled(value) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...va/com/stripe/android/lpmfoundations/paymentmethod/definitions/InstantDebitsDefinition.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.stripe.android.lpmfoundations.paymentmethod.definitions | ||
|
||
import com.stripe.android.lpmfoundations.luxe.SupportedPaymentMethod | ||
import com.stripe.android.lpmfoundations.paymentmethod.AddPaymentMethodRequirement | ||
import com.stripe.android.lpmfoundations.paymentmethod.PaymentMethodDefinition | ||
import com.stripe.android.lpmfoundations.paymentmethod.PaymentMethodMetadata | ||
import com.stripe.android.lpmfoundations.paymentmethod.UiDefinitionFactory | ||
import com.stripe.android.model.PaymentMethod | ||
import com.stripe.android.uicore.elements.FormElement | ||
import com.stripe.android.ui.core.R as PaymentsUiCoreR | ||
|
||
internal object InstantDebitsDefinition : PaymentMethodDefinition { | ||
|
||
override val type: PaymentMethod.Type = PaymentMethod.Type.Link | ||
|
||
override val supportedAsSavedPaymentMethod: Boolean = false | ||
|
||
override fun requirementsToBeUsedAsNewPaymentMethod( | ||
hasIntentToSetup: Boolean | ||
): Set<AddPaymentMethodRequirement> = setOf( | ||
AddPaymentMethodRequirement.FinancialConnectionsSdk, | ||
AddPaymentMethodRequirement.InstantDebits, | ||
) | ||
|
||
override fun requiresMandate(metadata: PaymentMethodMetadata): Boolean = true | ||
|
||
override fun uiDefinitionFactory(): UiDefinitionFactory = InstantDebitsUiDefinitionFactory | ||
} | ||
|
||
private object InstantDebitsUiDefinitionFactory : UiDefinitionFactory.Simple { | ||
|
||
override fun createSupportedPaymentMethod(): SupportedPaymentMethod { | ||
return SupportedPaymentMethod( | ||
code = InstantDebitsDefinition.type.code, | ||
displayNameResource = PaymentsUiCoreR.string.stripe_paymentsheet_payment_method_instant_debits, | ||
iconResource = PaymentsUiCoreR.drawable.stripe_ic_paymentsheet_pm_bank, | ||
tintIconOnSelection = true, | ||
lightThemeIconUrl = null, | ||
darkThemeIconUrl = null, | ||
) | ||
} | ||
|
||
// Instant Debits uses its own mechanism, not these form elements. | ||
override fun createFormElements( | ||
metadata: PaymentMethodMetadata, | ||
arguments: UiDefinitionFactory.Arguments, | ||
): List<FormElement> { | ||
return emptyList() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters