PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / LegacySubscriptions / Actions / EnsureSubscriptionHasPaymentMode.php

EnsureSubscriptionHasPaymentMode.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/LegacySubscriptions/Actions/EnsureSubscriptionHasPaymentMode.php

40 lines 973 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Give\LegacySubscriptions\Actions;
6
7 use Give\Subscriptions\ValueObjects\SubscriptionMode;
8
9 /**
10 * When payment mode was introduced it was possible for users to update core before updating Recurring. In this case,
11 * subscriptions could be made which did not have a payment mode. This action ensures that all subscriptions have a
12 * payment mode.
13 *
14 * @since 2.24.0
15 */
16 class EnsureSubscriptionHasPaymentMode
17 {
18 /**
19 * Makes sure the payment mode is set when the legacy recurring system is used.
20 *
21 * @since 2.24.0
22 *
23 * @param int $id
24 * @param array $arguments
25 *
26 * @return void
27 */
28 public function __invoke($id, $arguments)
29 {
30 if (!empty($arguments['payment_mode'])) {
31 return;
32 }
33
34 give()->subscriptions->updatePaymentMode(
35 $id,
36 give_is_test_mode() ? SubscriptionMode::TEST() : SubscriptionMode::LIVE()
37 );
38 }
39 }
40