-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attach Mandate to PaymentOption (#9881)
* Attach Mandate to PaymentOption Co-authored-by: jaynewstrom-stripe <jaynewstrom@stripe.com> * Rename UiDefinitionFactoryHelper to NullUiDefinitionFactoryHelper * Add tests * Add google pay test --------- Co-authored-by: jaynewstrom-stripe <jaynewstrom@stripe.com>
- Loading branch information
1 parent
25f4519
commit 0333f85
Showing
4 changed files
with
169 additions
and
3 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...src/main/java/com/stripe/android/paymentelement/embedded/NullUiDefinitionFactoryHelper.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,44 @@ | ||
package com.stripe.android.paymentelement.embedded | ||
|
||
import com.stripe.android.cards.CardAccountRangeRepository | ||
import com.stripe.android.cards.CardNumber | ||
import com.stripe.android.lpmfoundations.paymentmethod.UiDefinitionFactory | ||
import com.stripe.android.model.AccountRange | ||
import com.stripe.android.networking.StripeRepository | ||
import com.stripe.android.uicore.utils.stateFlowOf | ||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
internal object NullUiDefinitionFactoryHelper { | ||
val nullEmbeddedUiDefinitionFactory = UiDefinitionFactory.Arguments.Factory.Default( | ||
cardAccountRangeRepositoryFactory = NullCardAccountRangeRepositoryFactory, | ||
linkConfigurationCoordinator = null, | ||
onLinkInlineSignupStateChanged = { | ||
throw IllegalStateException("Not possible.") | ||
}, | ||
) | ||
} | ||
|
||
private object NullCardAccountRangeRepositoryFactory : CardAccountRangeRepository.Factory { | ||
override fun create(): CardAccountRangeRepository { | ||
return NullCardAccountRangeRepository | ||
} | ||
|
||
override fun createWithStripeRepository( | ||
stripeRepository: StripeRepository, | ||
publishableKey: String | ||
): CardAccountRangeRepository { | ||
return NullCardAccountRangeRepository | ||
} | ||
|
||
private object NullCardAccountRangeRepository : CardAccountRangeRepository { | ||
override suspend fun getAccountRange(cardNumber: CardNumber.Unvalidated): AccountRange? { | ||
return null | ||
} | ||
|
||
override suspend fun getAccountRanges(cardNumber: CardNumber.Unvalidated): List<AccountRange>? { | ||
return null | ||
} | ||
|
||
override val loading: StateFlow<Boolean> = stateFlowOf(false) | ||
} | ||
} |
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