Add ordering strategy for netherlands donation gateways.

This commit is contained in:
Alex Hart
2023-10-24 16:11:06 -03:00
committed by Cody Henthorne
parent 162ca3e21e
commit e12d467627

View File

@@ -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
}