Add blocked regions from global config for donations payments.

This commit is contained in:
Alex Hart
2022-11-10 10:17:13 -04:00
committed by GitHub
parent 8f56c1baa5
commit c69b91c4db
3 changed files with 59 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.components.settings.app.subscription
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.LocaleFeatureFlags
import org.thoughtcrime.securesms.util.PlayServicesUtil
/**
@@ -17,14 +18,14 @@ object InAppDonations {
* - Able to use PayPal and is in a region where it is able to be accepted.
*/
fun hasAtLeastOnePaymentMethodAvailable(): Boolean {
return isCreditCardAvailable() || isPayPalAvailable() || isPlayServicesAvailable()
return isCreditCardAvailable() || isPayPalAvailable() || isGooglePayAvailable()
}
/**
* Whether the user is in a region that supports credit cards, based off local phone number.
*/
fun isCreditCardAvailable(): Boolean {
return FeatureFlags.creditCardPayments()
return FeatureFlags.creditCardPayments() && !LocaleFeatureFlags.isCreditCardDisabled()
}
/**
@@ -34,6 +35,13 @@ object InAppDonations {
return false
}
/**
* Whether the user is in a region that supports GooglePay, based off local phone number.
*/
private fun isGooglePayAvailable(): Boolean {
return isPlayServicesAvailable() && !LocaleFeatureFlags.isGooglePayDisabled()
}
/**
* Whether Play Services is available. This will *not* tell you whether a user has Google Pay set up, but is
* enough information to determine whether we can display Google Pay as an option.