← All changes
|
includes/gateways/stripe/includes/admin/admin-helpers.php
+13
-2
4.15.1
→
4.17.0
View file →
| @@ -40,8 +40,9 @@ | ||
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * This function is used to check whether a payment method supported by Stripe with Give is active or not. |
| 43 | 43 | * |
| 44 | + * @since 4.16.9 Also check the `gateways_v3` option so modern Stripe gateways are recognized. | |
| 44 | 45 | * @since 2.5.5 |
| 45 | 46 | * |
| 46 | 47 | * @return bool |
| 47 | 48 | */ |
| @@ -46,11 +47,21 @@ | ||
| 46 | 47 | * @return bool |
| 47 | 48 | */ |
| 48 | 49 | function give_stripe_is_any_payment_method_active() |
| 49 | 50 | { |
| 50 | - $settings = give_get_settings(); | |
| 51 | - $gateways = $settings['gateways'] ?? []; | |
| 51 | + $settings = give_get_settings(); | |
| 52 | 52 | $stripePaymentMethods = give_stripe_supported_payment_methods(); |
| 53 | + | |
| 54 | + /* | |
| 55 | + * The modern Stripe gateways (e.g. Stripe Payment Element) are stored in the | |
| 56 | + * `gateways_v3` option, while the legacy gateways live in the `gateways` | |
| 57 | + * setting. Both must be checked, so a site using only a modern Stripe gateway | |
| 58 | + * is still reported as having an active Stripe payment method. | |
| 59 | + */ | |
| 60 | + $gateways = array_merge( | |
| 61 | + (array) ($settings['gateways'] ?? []), | |
| 62 | + (array) give_get_option('gateways_v3', []) | |
| 63 | + ); | |
| 53 | 64 | |
| 54 | 65 | $active = false; |
| 55 | 66 | foreach (array_keys($gateways) as $gateway) { |
| 56 | 67 | // Return true, if even single payment method is active. |