mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Add ordering strategy for netherlands donation gateways.
This commit is contained in:
committed by
Cody Henthorne
parent
162ca3e21e
commit
e12d467627
@@ -7,6 +7,7 @@ package org.thoughtcrime.securesms.components.settings.app.subscription.donate.g
|
||||
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil
|
||||
import org.signal.core.util.orNull
|
||||
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppDonations
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
|
||||
sealed interface GatewayOrderStrategy {
|
||||
@@ -24,7 +25,6 @@ sealed interface GatewayOrderStrategy {
|
||||
}
|
||||
|
||||
private object NorthAmerica : GatewayOrderStrategy {
|
||||
|
||||
override val orderedGateways: Set<GatewayResponse.Gateway> = setOf(
|
||||
GatewayResponse.Gateway.GOOGLE_PAY,
|
||||
GatewayResponse.Gateway.PAYPAL,
|
||||
@@ -34,6 +34,16 @@ sealed interface GatewayOrderStrategy {
|
||||
)
|
||||
}
|
||||
|
||||
private object Netherlands : GatewayOrderStrategy {
|
||||
override val orderedGateways: Set<GatewayResponse.Gateway> = setOf(
|
||||
GatewayResponse.Gateway.IDEAL,
|
||||
GatewayResponse.Gateway.PAYPAL,
|
||||
GatewayResponse.Gateway.GOOGLE_PAY,
|
||||
GatewayResponse.Gateway.CREDIT_CARD,
|
||||
GatewayResponse.Gateway.SEPA_DEBIT
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getStrategy(): GatewayOrderStrategy {
|
||||
val self = Recipient.self()
|
||||
@@ -41,6 +51,8 @@ sealed interface GatewayOrderStrategy {
|
||||
|
||||
return if (PhoneNumberUtil.getInstance().parse(e164, "").countryCode == 1) {
|
||||
NorthAmerica
|
||||
} else if (InAppDonations.isIDEALAvailable()) {
|
||||
Netherlands
|
||||
} else {
|
||||
Default
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user