Disable SEPA Debit for gifts.

This commit is contained in:
Alex Hart
2023-10-11 15:49:41 -03:00
committed by Cody Henthorne
parent bf37c09ba0
commit 65d26d753d

View File

@@ -28,7 +28,7 @@ object InAppDonations {
PaymentSourceType.PayPal -> isPayPalAvailableForDonateToSignalType(donateToSignalType) PaymentSourceType.PayPal -> isPayPalAvailableForDonateToSignalType(donateToSignalType)
PaymentSourceType.Stripe.CreditCard -> isCreditCardAvailable() PaymentSourceType.Stripe.CreditCard -> isCreditCardAvailable()
PaymentSourceType.Stripe.GooglePay -> isGooglePayAvailable() PaymentSourceType.Stripe.GooglePay -> isGooglePayAvailable()
PaymentSourceType.Stripe.SEPADebit -> isSEPADebitAvailable() PaymentSourceType.Stripe.SEPADebit -> isSEPADebitAvailableForDonateToSignalType(donateToSignalType)
PaymentSourceType.Unknown -> false PaymentSourceType.Unknown -> false
} }
} }
@@ -67,4 +67,12 @@ object InAppDonations {
fun isSEPADebitAvailable(): Boolean { fun isSEPADebitAvailable(): Boolean {
return FeatureFlags.sepaDebitDonations() return FeatureFlags.sepaDebitDonations()
} }
/**
* Whether the user is in a region which supports SEPA Debit transfers, based off local phone number
* and donation type.
*/
fun isSEPADebitAvailableForDonateToSignalType(donateToSignalType: DonateToSignalType): Boolean {
return donateToSignalType != DonateToSignalType.GIFT && FeatureFlags.sepaDebitDonations()
}
} }