← All changes
|
app/Modules/PaymentMethods/StripeGateway/SubscriptionsManager.php
+9
-5
1.5.4
→
1.6.5
View file →
| @@ -76,17 +76,21 @@ | ||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Check rate limit for SetupIntent creation to prevent card testing fraud. |
| 80 | - * | |
| 81 | - * Rate limit: 3 attempts per day per customer (for subscription card updates) | |
| 82 | - * | |
| 80 | + * | |
| 81 | + * Rate limit: 5 attempts per day per customer by default (for subscription | |
| 82 | + * card updates), overridable via the | |
| 83 | + * fluent_cart/stripe/setup_intent_rate_limit_customer_daily filter. The SAME | |
| 84 | + * filter default feeds getRemainingRateLimit(), so enforcement and the | |
| 85 | + * displayed remaining count share one contract. | |
| 86 | + * | |
| 83 | 87 | * @param string $customerId Stripe customer ID |
| 84 | 88 | * @return bool|\WP_Error Returns true if allowed, WP_Error if rate limited |
| 85 | 89 | */ |
| 86 | 90 | protected static function checkRateLimit($customerId) |
| 87 | 91 | { |
| 88 | - $customerDailyLimit = apply_filters('fluent_cart/stripe/setup_intent_rate_limit_customer_daily', 3, $customerId); | |
| 92 | + $customerDailyLimit = apply_filters('fluent_cart/stripe/setup_intent_rate_limit_customer_daily', 5, $customerId); | |
| 89 | 93 | |
| 90 | 94 | $customerDailyKey = 'fct_stripe_setup_intent_rate_daily_' . md5($customerId); |
| 91 | 95 | $customerDailyAttempts = get_transient($customerDailyKey) ?: 0; |
| 92 | 96 | |
| @@ -100,9 +104,9 @@ | ||
| 100 | 104 | } |
| 101 | 105 | |
| 102 | 106 | public function getRemainingRateLimit($customerId) |
| 103 | 107 | { |
| 104 | - $customerDailyLimit = apply_filters('fluent_cart/stripe/setup_intent_rate_limit_customer_daily', 3, $customerId); | |
| 108 | + $customerDailyLimit = apply_filters('fluent_cart/stripe/setup_intent_rate_limit_customer_daily', 5, $customerId); | |
| 105 | 109 | $customerDailyKey = 'fct_stripe_setup_intent_rate_daily_' . md5($customerId); |
| 106 | 110 | $customerDailyAttempts = get_transient($customerDailyKey) ?: 0; |
| 107 | 111 | return $customerDailyLimit - $customerDailyAttempts; |
| 108 | 112 | } |