|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Gateway |
|
4
|
|
|
* |
|
5
|
|
|
* @author Pronamic <[email protected]> |
|
6
|
|
|
* @copyright 2005-2021 Pronamic |
|
7
|
|
|
* @license GPL-3.0-or-later |
|
8
|
|
|
* @package Pronamic\WordPress\Pay\Extensions\MemberPress |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Pronamic\WordPress\Pay\Extensions\MemberPress\Gateways; |
|
12
|
|
|
|
|
13
|
|
|
use MeprBaseRealGateway; |
|
|
|
|
|
|
14
|
|
|
use MeprEmailFactory; |
|
|
|
|
|
|
15
|
|
|
use MeprOptions; |
|
|
|
|
|
|
16
|
|
|
use MeprProduct; |
|
|
|
|
|
|
17
|
|
|
use MeprSubscription; |
|
|
|
|
|
|
18
|
|
|
use MeprTransaction; |
|
|
|
|
|
|
19
|
|
|
use MeprTransactionsHelper; |
|
|
|
|
|
|
20
|
|
|
use MeprUser; |
|
|
|
|
|
|
21
|
|
|
use MeprUtils; |
|
|
|
|
|
|
22
|
|
|
use MeprView; |
|
|
|
|
|
|
23
|
|
|
use Pronamic\WordPress\Pay\Core\PaymentMethods; |
|
24
|
|
|
use Pronamic\WordPress\Pay\Core\Util as Core_Util; |
|
25
|
|
|
use Pronamic\WordPress\Pay\Payments\Payment; |
|
26
|
|
|
use Pronamic\WordPress\Pay\Plugin; |
|
27
|
|
|
use Pronamic\WordPress\Pay\Extensions\MemberPress\MemberPress; |
|
28
|
|
|
use Pronamic\WordPress\Pay\Extensions\MemberPress\Pronamic; |
|
29
|
|
|
use Pronamic\WordPress\Pay\Subscriptions\SubscriptionStatus; |
|
30
|
|
|
use ReflectionClass; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* WordPress pay MemberPress gateway |
|
34
|
|
|
* |
|
35
|
|
|
* @author Remco Tolsma |
|
36
|
|
|
* @version 3.1.0 |
|
37
|
|
|
* @since 1.0.0 |
|
38
|
|
|
*/ |
|
39
|
|
|
class Gateway extends MeprBaseRealGateway { |
|
40
|
|
|
/** |
|
41
|
|
|
* Payment method. |
|
42
|
|
|
* |
|
43
|
|
|
* @var string|null |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $payment_method; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Class alias. |
|
49
|
|
|
* |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $class_alias; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Key. |
|
56
|
|
|
* |
|
57
|
|
|
* The key property is not defined in the MemberPress library, |
|
58
|
|
|
* but it is a MemberPress property. |
|
59
|
|
|
* |
|
60
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php |
|
61
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L12 |
|
62
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/helpers/MeprOptionsHelper.php#L192 |
|
63
|
|
|
* @var string |
|
64
|
|
|
*/ |
|
65
|
|
|
public $key; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Constructs and initialize gateway. |
|
69
|
|
|
* |
|
70
|
|
|
* @param string $class_alias Class alias. |
|
71
|
|
|
* @param string|null $payment_method Payment method. |
|
72
|
|
|
*/ |
|
73
|
|
|
public function __construct( $class_alias = 'MeprPronamicGateway', $payment_method = null ) { |
|
74
|
|
|
$this->class_alias = $class_alias; |
|
75
|
|
|
|
|
76
|
|
|
$this->payment_method = $payment_method; |
|
77
|
|
|
|
|
78
|
|
|
// Set the name of this gateway. |
|
79
|
|
|
// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L12-13. |
|
80
|
|
|
$this->name = __( 'Pronamic', 'pronamic_ideal' ); |
|
|
|
|
|
|
81
|
|
|
|
|
82
|
|
|
if ( ! empty( $this->payment_method ) ) { |
|
83
|
|
|
$this->name = sprintf( |
|
84
|
|
|
/* translators: %s: payment method name */ |
|
85
|
|
|
__( 'Pronamic - %s', 'pronamic_ideal' ), |
|
86
|
|
|
PaymentMethods::get_name( $this->payment_method ) |
|
87
|
|
|
); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
// Set the default settings. |
|
91
|
|
|
// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L72-73. |
|
92
|
|
|
$this->set_defaults(); |
|
93
|
|
|
|
|
94
|
|
|
// Set the capabilities of this gateway. |
|
95
|
|
|
// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L36-37. |
|
96
|
|
|
$this->capabilities = array(); |
|
|
|
|
|
|
97
|
|
|
|
|
98
|
|
|
// Setup the notification actions for this gateway. |
|
99
|
|
|
$this->notifiers = array(); |
|
|
|
|
|
|
100
|
|
|
|
|
101
|
|
|
// Support single-page checkout. |
|
102
|
|
|
$this->has_spc_form = true; |
|
|
|
|
|
|
103
|
|
|
|
|
104
|
|
|
// Key. |
|
105
|
|
|
$key = 'pronamic_pay'; |
|
106
|
|
|
|
|
107
|
|
|
if ( null !== $this->payment_method ) { |
|
108
|
|
|
$key = sprintf( 'pronamic_pay_%s', $this->payment_method ); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
$this->key = $key; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Load the specified settings. |
|
116
|
|
|
* |
|
117
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L73-L74 |
|
118
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprGatewayFactory.php#L18 |
|
119
|
|
|
* @param mixed $settings MemberPress gateway settings array. |
|
120
|
|
|
* @return void |
|
121
|
|
|
*/ |
|
122
|
|
|
public function load( $settings ) { |
|
123
|
|
|
$this->settings = (object) $settings; |
|
|
|
|
|
|
124
|
|
|
|
|
125
|
|
|
$this->set_defaults(); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* Get icon function (this is not a MemberPress function). |
|
130
|
|
|
* |
|
131
|
|
|
* @since 1.0.2 |
|
132
|
|
|
* @return string|null |
|
133
|
|
|
*/ |
|
134
|
|
|
protected function get_icon() { |
|
135
|
|
|
return PaymentMethods::get_icon_url( $this->payment_method ); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* Set the default settings. |
|
140
|
|
|
* |
|
141
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L76-L77 |
|
142
|
|
|
* @return void |
|
143
|
|
|
*/ |
|
144
|
|
|
protected function set_defaults() { |
|
145
|
|
|
if ( ! isset( $this->settings ) ) { |
|
146
|
|
|
$this->settings = array(); |
|
|
|
|
|
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
$this->settings = (object) array_merge( |
|
150
|
|
|
array( |
|
151
|
|
|
'gateway' => $this->class_alias, |
|
152
|
|
|
'id' => $this->generate_id(), |
|
153
|
|
|
'label' => '', |
|
154
|
|
|
'use_label' => true, |
|
155
|
|
|
'icon' => $this->get_icon(), |
|
156
|
|
|
'use_icon' => true, |
|
157
|
|
|
'desc' => '', |
|
158
|
|
|
'use_desc' => true, |
|
159
|
|
|
'config_id' => '', |
|
160
|
|
|
'email' => '', |
|
161
|
|
|
'sandbox' => false, |
|
162
|
|
|
'debug' => false, |
|
163
|
|
|
), |
|
164
|
|
|
(array) $this->settings |
|
165
|
|
|
); |
|
166
|
|
|
|
|
167
|
|
|
$this->id = $this->settings->id; |
|
|
|
|
|
|
168
|
|
|
$this->label = $this->settings->label; |
|
|
|
|
|
|
169
|
|
|
$this->use_label = $this->settings->use_label; |
|
|
|
|
|
|
170
|
|
|
$this->icon = $this->settings->icon; |
|
|
|
|
|
|
171
|
|
|
$this->use_icon = $this->settings->use_icon; |
|
|
|
|
|
|
172
|
|
|
$this->desc = $this->settings->desc; |
|
|
|
|
|
|
173
|
|
|
$this->use_desc = $this->settings->use_desc; |
|
|
|
|
|
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* Process payment. |
|
178
|
|
|
* |
|
179
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L149-L152 |
|
180
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L520-L585 |
|
181
|
|
|
* @param MeprTransaction $transaction MemberPress transaction object. |
|
182
|
|
|
* @return void |
|
183
|
|
|
*/ |
|
184
|
|
|
public function process_payment( $transaction ) { |
|
185
|
|
|
// Gateway. |
|
186
|
|
|
$config_id = $this->get_config_id(); |
|
187
|
|
|
|
|
188
|
|
|
$gateway = Plugin::get_gateway( $config_id ); |
|
|
|
|
|
|
189
|
|
|
|
|
190
|
|
|
if ( null === $gateway ) { |
|
|
|
|
|
|
191
|
|
|
return; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
// Create Pronamic payment. |
|
195
|
|
|
$payment = Pronamic::get_payment( $transaction ); |
|
196
|
|
|
|
|
197
|
|
|
$payment->config_id = $config_id; |
|
198
|
|
|
|
|
199
|
|
|
$payment->set_payment_method( $this->payment_method ); |
|
200
|
|
|
|
|
201
|
|
|
$payment = Plugin::start_payment( $payment ); |
|
202
|
|
|
|
|
203
|
|
|
$gateway->redirect( $payment ); |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
/** |
|
207
|
|
|
* Get payment method. |
|
208
|
|
|
* |
|
209
|
|
|
* @return string|null |
|
210
|
|
|
*/ |
|
211
|
|
|
public function get_payment_method() { |
|
212
|
|
|
return $this->payment_method; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* Record subscription payment. |
|
217
|
|
|
* |
|
218
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L170-L175 |
|
219
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L587-L714 |
|
220
|
|
|
* @return void |
|
221
|
|
|
*/ |
|
222
|
|
|
public function record_subscription_payment() { |
|
223
|
|
|
|
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* Record payment failure. |
|
228
|
|
|
* |
|
229
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L177-L178 |
|
230
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L833-L910 |
|
231
|
|
|
* @return void |
|
232
|
|
|
*/ |
|
233
|
|
|
public function record_payment_failure() { |
|
234
|
|
|
|
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* Record payment. |
|
239
|
|
|
* |
|
240
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L154-L159 |
|
241
|
|
|
* @return void |
|
242
|
|
|
*/ |
|
243
|
|
|
public function record_payment() { |
|
244
|
|
|
|
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* Process refund. |
|
249
|
|
|
* |
|
250
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L161-L163 |
|
251
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
252
|
|
|
* @return void |
|
253
|
|
|
*/ |
|
254
|
|
|
public function process_refund( MeprTransaction $txn ) { |
|
255
|
|
|
|
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* Record refund. |
|
260
|
|
|
* |
|
261
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L165-L168 |
|
262
|
|
|
* @return void |
|
263
|
|
|
*/ |
|
264
|
|
|
public function record_refund() { |
|
265
|
|
|
|
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* Process trial payment. |
|
270
|
|
|
* |
|
271
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L180-L187 |
|
272
|
|
|
* @param MeprTransaction $transaction MemberPress transaction object. |
|
273
|
|
|
* @return void |
|
274
|
|
|
*/ |
|
275
|
|
|
public function process_trial_payment( $transaction ) { |
|
276
|
|
|
$this->process_payment( $transaction ); |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
/** |
|
280
|
|
|
* Record trial payment. |
|
281
|
|
|
* |
|
282
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L189-L191 |
|
283
|
|
|
* @param MeprTransaction $transaction MemberPress transaction object. |
|
284
|
|
|
* @return void |
|
285
|
|
|
*/ |
|
286
|
|
|
public function record_trial_payment( $transaction ) { |
|
287
|
|
|
|
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
/** |
|
291
|
|
|
* Process create subscription. |
|
292
|
|
|
* |
|
293
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L193-L197 |
|
294
|
|
|
* @param MeprTransaction $transaction MemberPress transaction object. |
|
295
|
|
|
* @return void |
|
296
|
|
|
*/ |
|
297
|
|
|
public function process_create_subscription( $transaction ) { |
|
298
|
|
|
$subscription = $transaction->subscription(); |
|
299
|
|
|
|
|
300
|
|
|
/** |
|
301
|
|
|
* In the `process_create_subscription` function, every MemberPress |
|
302
|
|
|
* transaction will be linked to a MemberPress subscription, but |
|
303
|
|
|
* just to be sure we check this. |
|
304
|
|
|
* |
|
305
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L312 |
|
306
|
|
|
*/ |
|
307
|
|
|
if ( false !== $subscription ) { |
|
308
|
|
|
/** |
|
309
|
|
|
* The MemberPress transaction total does not contain the |
|
310
|
|
|
* prorated or trial amount. |
|
311
|
|
|
* |
|
312
|
|
|
* We stole this code from the `MeprArtificialGateway` also |
|
313
|
|
|
* known as the 'Offline Payment' gateway. |
|
314
|
|
|
* |
|
315
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprArtificialGateway.php#L217 |
|
316
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L306-L311 |
|
317
|
|
|
*/ |
|
318
|
|
|
if ( $subscription->trial ) { |
|
319
|
|
|
$transaction->set_subtotal( MeprUtils::format_float( $subscription->trial_amount ) ); |
|
320
|
|
|
|
|
321
|
|
|
$transaction->store(); |
|
322
|
|
|
} |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
$this->process_payment( $transaction ); |
|
326
|
|
|
} |
|
327
|
|
|
|
|
328
|
|
|
/** |
|
329
|
|
|
* Record create subscription. |
|
330
|
|
|
* |
|
331
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L199-L204 |
|
332
|
|
|
* @return void |
|
333
|
|
|
*/ |
|
334
|
|
|
public function record_create_subscription() { |
|
335
|
|
|
|
|
336
|
|
|
} |
|
337
|
|
|
|
|
338
|
|
|
/** |
|
339
|
|
|
* Process update subscription. |
|
340
|
|
|
* |
|
341
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L206 |
|
342
|
|
|
* @param int $sub_id Subscription ID. |
|
343
|
|
|
* @return void |
|
344
|
|
|
*/ |
|
345
|
|
|
public function process_update_subscription( $sub_id ) { |
|
346
|
|
|
|
|
347
|
|
|
} |
|
348
|
|
|
|
|
349
|
|
|
/** |
|
350
|
|
|
* Record update subscription. |
|
351
|
|
|
* |
|
352
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L208-L212 |
|
353
|
|
|
* @return void |
|
354
|
|
|
*/ |
|
355
|
|
|
public function record_update_subscription() { |
|
356
|
|
|
|
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
/** |
|
360
|
|
|
* Process suspend subscription. |
|
361
|
|
|
* |
|
362
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/controllers/MeprAccountCtrl.php#L339-L360 |
|
363
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L214-L216 |
|
364
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L1429-L1459 |
|
365
|
|
|
* @param int $subscription_id Subscription id. |
|
366
|
|
|
* @return void |
|
367
|
|
|
*/ |
|
368
|
|
|
public function process_suspend_subscription( $subscription_id ) { |
|
369
|
|
|
$memberpress_subscription = MemberPress::get_subscription_by_id( $subscription_id ); |
|
370
|
|
|
|
|
371
|
|
|
if ( null === $memberpress_subscription ) { |
|
372
|
|
|
return; |
|
373
|
|
|
} |
|
374
|
|
|
|
|
375
|
|
|
/** |
|
376
|
|
|
* If the MemberPress subscription is already suspended we bail out. |
|
377
|
|
|
*/ |
|
378
|
|
|
if ( MeprSubscription::$suspended_str === $memberpress_subscription->status ) { |
|
379
|
|
|
return; |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
$pronamic_subscription = \get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $memberpress_subscription->id ); |
|
383
|
|
|
|
|
384
|
|
|
if ( ! $pronamic_subscription ) { |
|
385
|
|
|
return; |
|
386
|
|
|
} |
|
387
|
|
|
|
|
388
|
|
|
$memberpress_subscription->status = MeprSubscription::$suspended_str; |
|
389
|
|
|
|
|
390
|
|
|
$memberpress_subscription->store(); |
|
391
|
|
|
|
|
392
|
|
|
// Send suspended subscription notices. |
|
393
|
|
|
MeprUtils::send_suspended_sub_notices( $memberpress_subscription ); |
|
394
|
|
|
|
|
395
|
|
|
$note = sprintf( |
|
396
|
|
|
/* translators: %s: extension name */ |
|
397
|
|
|
__( '%s subscription on hold.', 'pronamic_ideal' ), |
|
398
|
|
|
__( 'MemberPress', 'pronamic_ideal' ) |
|
399
|
|
|
); |
|
400
|
|
|
|
|
401
|
|
|
$pronamic_subscription->add_note( $note ); |
|
402
|
|
|
|
|
403
|
|
|
// The status of canceled or completed subscriptions will not be changed automatically. |
|
404
|
|
|
if ( ! in_array( $pronamic_subscription->get_status(), array( SubscriptionStatus::CANCELLED, SubscriptionStatus::COMPLETED ), true ) ) { |
|
405
|
|
|
$pronamic_subscription->set_status( SubscriptionStatus::ON_HOLD ); |
|
406
|
|
|
|
|
407
|
|
|
$pronamic_subscription->save(); |
|
408
|
|
|
} |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
/** |
|
412
|
|
|
* Record suspend subscription. |
|
413
|
|
|
* |
|
414
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L218-L221 |
|
415
|
|
|
* @return void |
|
416
|
|
|
*/ |
|
417
|
|
|
public function record_suspend_subscription() { |
|
418
|
|
|
|
|
419
|
|
|
} |
|
420
|
|
|
|
|
421
|
|
|
/** |
|
422
|
|
|
* Process resume subscription. |
|
423
|
|
|
* |
|
424
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/controllers/MeprAccountCtrl.php#L362-L383 |
|
425
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L223-L225 |
|
426
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L1489-L1550 |
|
427
|
|
|
* @param int $subscription_id Subscription id. |
|
428
|
|
|
* @return void |
|
429
|
|
|
*/ |
|
430
|
|
|
public function process_resume_subscription( $subscription_id ) { |
|
431
|
|
|
$memberpress_subscription = MemberPress::get_subscription_by_id( $subscription_id ); |
|
432
|
|
|
|
|
433
|
|
|
if ( null === $memberpress_subscription ) { |
|
434
|
|
|
return; |
|
435
|
|
|
} |
|
436
|
|
|
|
|
437
|
|
|
/** |
|
438
|
|
|
* If the MemberPress subscription is already active we bail out. |
|
439
|
|
|
*/ |
|
440
|
|
|
if ( MeprSubscription::$active_str === $memberpress_subscription->status ) { |
|
441
|
|
|
return; |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
$pronamic_subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $memberpress_subscription->id ); |
|
445
|
|
|
|
|
446
|
|
|
if ( ! $pronamic_subscription ) { |
|
447
|
|
|
return; |
|
448
|
|
|
} |
|
449
|
|
|
|
|
450
|
|
|
$memberpress_subscription->status = MeprSubscription::$active_str; |
|
451
|
|
|
|
|
452
|
|
|
$memberpress_subscription->store(); |
|
453
|
|
|
|
|
454
|
|
|
/** |
|
455
|
|
|
* If the Pronamic subscription requires a follow-up payment start this. |
|
456
|
|
|
* |
|
457
|
|
|
* @todo |
|
458
|
|
|
*/ |
|
459
|
|
|
|
|
460
|
|
|
// Send resumed subscription notices. |
|
461
|
|
|
MeprUtils::send_resumed_sub_notices( $memberpress_subscription ); |
|
462
|
|
|
|
|
463
|
|
|
// Add note. |
|
464
|
|
|
$note = sprintf( |
|
465
|
|
|
/* translators: %s: extension name */ |
|
466
|
|
|
__( '%s subscription reactivated.', 'pronamic_ideal' ), |
|
467
|
|
|
__( 'MemberPress', 'pronamic_ideal' ) |
|
468
|
|
|
); |
|
469
|
|
|
|
|
470
|
|
|
$pronamic_subscription->add_note( $note ); |
|
471
|
|
|
|
|
472
|
|
|
// The status of canceled or completed subscriptions will not be changed automatically. |
|
473
|
|
|
if ( ! in_array( $pronamic_subscription->get_status(), array( SubscriptionStatus::CANCELLED, SubscriptionStatus::COMPLETED ), true ) ) { |
|
474
|
|
|
$pronamic_subscription->set_status( SubscriptionStatus::ACTIVE ); |
|
475
|
|
|
|
|
476
|
|
|
$pronamic_subscription->save(); |
|
477
|
|
|
} |
|
478
|
|
|
} |
|
479
|
|
|
|
|
480
|
|
|
/** |
|
481
|
|
|
* Record resume subscription. |
|
482
|
|
|
* |
|
483
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L227-L230 |
|
484
|
|
|
* @return void |
|
485
|
|
|
*/ |
|
486
|
|
|
public function record_resume_subscription() { |
|
487
|
|
|
|
|
488
|
|
|
} |
|
489
|
|
|
|
|
490
|
|
|
/** |
|
491
|
|
|
* Process cancel subscription. |
|
492
|
|
|
* |
|
493
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L232-L236 |
|
494
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L1687-L1715 |
|
495
|
|
|
* @param int $subscription_id Subscription id. |
|
496
|
|
|
* @return void |
|
497
|
|
|
*/ |
|
498
|
|
|
public function process_cancel_subscription( $subscription_id ) { |
|
499
|
|
|
$memberpress_subscription = MemberPress::get_subscription_by_id( $subscription_id ); |
|
500
|
|
|
|
|
501
|
|
|
if ( null === $memberpress_subscription ) { |
|
502
|
|
|
return; |
|
503
|
|
|
} |
|
504
|
|
|
|
|
505
|
|
|
/** |
|
506
|
|
|
* If the MemberPress subscription is already cancelled we bail out. |
|
507
|
|
|
*/ |
|
508
|
|
|
if ( MeprSubscription::$cancelled_str === $memberpress_subscription->status ) { |
|
509
|
|
|
return; |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
$pronamic_subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $memberpress_subscription->id ); |
|
513
|
|
|
|
|
514
|
|
|
if ( ! $pronamic_subscription ) { |
|
515
|
|
|
return; |
|
516
|
|
|
} |
|
517
|
|
|
|
|
518
|
|
|
// Add note. |
|
519
|
|
|
$note = sprintf( |
|
520
|
|
|
/* translators: %s: extension name */ |
|
521
|
|
|
__( '%s subscription cancelled.', 'pronamic_ideal' ), |
|
522
|
|
|
__( 'MemberPress', 'pronamic_ideal' ) |
|
523
|
|
|
); |
|
524
|
|
|
|
|
525
|
|
|
$pronamic_subscription->add_note( $note ); |
|
526
|
|
|
|
|
527
|
|
|
// The status of canceled or completed subscriptions will not be changed automatically. |
|
528
|
|
|
if ( ! in_array( $pronamic_subscription->get_status(), array( SubscriptionStatus::CANCELLED, SubscriptionStatus::COMPLETED ), true ) ) { |
|
529
|
|
|
$pronamic_subscription->set_status( SubscriptionStatus::CANCELLED ); |
|
530
|
|
|
|
|
531
|
|
|
$pronamic_subscription->next_payment_date = null; |
|
532
|
|
|
$pronamic_subscription->next_payment_delivery_date = null; |
|
533
|
|
|
|
|
534
|
|
|
// Delete next payment post meta. |
|
535
|
|
|
$pronamic_subscription->set_meta( 'next_payment', null ); |
|
536
|
|
|
$pronamic_subscription->set_meta( 'next_payment_delivery_date', null ); |
|
537
|
|
|
|
|
538
|
|
|
$pronamic_subscription->save(); |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
// Cancel MemberPress subscription. |
|
542
|
|
|
$memberpress_subscription->status = MeprSubscription::$cancelled_str; |
|
543
|
|
|
|
|
544
|
|
|
$memberpress_subscription->store(); |
|
545
|
|
|
|
|
546
|
|
|
// Expire the grace period (confirmation) if no completed payments have come through. |
|
547
|
|
|
if ( (int) $memberpress_subscription->txn_count <= 0 ) { |
|
548
|
|
|
$memberpress_subscription->expire_txns(); |
|
549
|
|
|
} |
|
550
|
|
|
|
|
551
|
|
|
$memberpress_subscription->limit_reached_actions(); |
|
552
|
|
|
|
|
553
|
|
|
// Send cancelled subscription notices. |
|
554
|
|
|
MeprUtils::send_cancelled_sub_notices( $memberpress_subscription ); |
|
555
|
|
|
} |
|
556
|
|
|
|
|
557
|
|
|
/** |
|
558
|
|
|
* Record cancel subscription. |
|
559
|
|
|
* |
|
560
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L238-L242 |
|
561
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L1717-L1753 |
|
562
|
|
|
* @return void |
|
563
|
|
|
*/ |
|
564
|
|
|
public function record_cancel_subscription() { |
|
565
|
|
|
|
|
566
|
|
|
} |
|
567
|
|
|
|
|
568
|
|
|
/** |
|
569
|
|
|
* Process signup form. |
|
570
|
|
|
* |
|
571
|
|
|
* Gets called when the signup form is posted used for running any payment |
|
572
|
|
|
* method specific actions when processing the customer signup form. |
|
573
|
|
|
* |
|
574
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L244-L247 |
|
575
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L1755-L1764 |
|
576
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
577
|
|
|
* @return void |
|
578
|
|
|
*/ |
|
579
|
|
|
public function process_signup_form( $txn ) { |
|
580
|
|
|
|
|
581
|
|
|
} |
|
582
|
|
|
|
|
583
|
|
|
/** |
|
584
|
|
|
* Display payment page. |
|
585
|
|
|
* |
|
586
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L249-L253 |
|
587
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L1766-L1768 |
|
588
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
589
|
|
|
* @return void |
|
590
|
|
|
* @throws \Exception Throws exception on gateway payment start error. |
|
591
|
|
|
*/ |
|
592
|
|
|
public function display_payment_page( $txn ) { |
|
593
|
|
|
|
|
594
|
|
|
} |
|
595
|
|
|
|
|
596
|
|
|
/** |
|
597
|
|
|
* Enqueue payment form scripts. |
|
598
|
|
|
* |
|
599
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/lib/MeprBaseGateway.php#L255-L258 |
|
600
|
|
|
* @return void |
|
601
|
|
|
*/ |
|
602
|
|
|
public function enqueue_payment_form_scripts() { |
|
603
|
|
|
|
|
604
|
|
|
} |
|
605
|
|
|
|
|
606
|
|
|
/** |
|
607
|
|
|
* Display payment form. |
|
608
|
|
|
* |
|
609
|
|
|
* This spits out html for the payment form on the registration / payment |
|
610
|
|
|
* page for the user to fill out for payment. |
|
611
|
|
|
* |
|
612
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/controllers/MeprCheckoutCtrl.php#L571 |
|
613
|
|
|
* @param float $amount Transaction amount to create a payment form for. |
|
614
|
|
|
* @param MeprUser $user MemberPress user object. |
|
615
|
|
|
* @param int $product_id Product ID. |
|
616
|
|
|
* @param int $txn_id Transaction ID. |
|
617
|
|
|
* @return void |
|
618
|
|
|
*/ |
|
619
|
|
|
public function display_payment_form( $amount, $user, $product_id, $txn_id ) { |
|
620
|
|
|
// Gateway. |
|
621
|
|
|
$config_id = $this->get_config_id(); |
|
622
|
|
|
|
|
623
|
|
|
$gateway = Plugin::get_gateway( $config_id ); |
|
|
|
|
|
|
624
|
|
|
|
|
625
|
|
|
if ( null === $gateway ) { |
|
|
|
|
|
|
626
|
|
|
|
|
627
|
|
|
$admin_message = null; |
|
628
|
|
|
|
|
629
|
|
|
if ( \current_user_can( 'manage_options' ) ) { |
|
630
|
|
|
$admin_message = __( 'For admins only: check payment method settings in MemberPress.', 'pronamic_ideal' ); |
|
631
|
|
|
} |
|
632
|
|
|
|
|
633
|
|
|
printf( |
|
634
|
|
|
'<div class="mp_wrapper mp_payment_form_wrapper"><ul><li>%s</li>%s</ul></div>', |
|
635
|
|
|
\esc_html( Plugin::get_default_error_message() ), |
|
636
|
|
|
null === $admin_message ? '' : sprintf( '<li><em>%s</em></li>', \esc_html( $admin_message ) ) |
|
637
|
|
|
); |
|
638
|
|
|
|
|
639
|
|
|
return; |
|
640
|
|
|
} |
|
641
|
|
|
|
|
642
|
|
|
// Invoice. |
|
643
|
|
|
$product = new MeprProduct( $product_id ); |
|
644
|
|
|
|
|
645
|
|
|
$coupon = false; |
|
646
|
|
|
|
|
647
|
|
|
$txn = new MeprTransaction( $txn_id ); |
|
648
|
|
|
|
|
649
|
|
|
// Artificially set the price of the $prd in case a coupon was used. |
|
650
|
|
|
if ( $product->price !== $amount ) { |
|
651
|
|
|
$coupon = true; |
|
652
|
|
|
$product->price = $amount; |
|
653
|
|
|
} |
|
654
|
|
|
|
|
655
|
|
|
$invoice = MeprTransactionsHelper::get_invoice( $txn ); |
|
656
|
|
|
|
|
657
|
|
|
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
658
|
|
|
echo $invoice; |
|
659
|
|
|
|
|
660
|
|
|
?> |
|
661
|
|
|
<div class="mp_wrapper mp_payment_form_wrapper"> |
|
662
|
|
|
<form action="" method="post" id="payment-form" class="mepr-form" novalidate> |
|
663
|
|
|
<input type="hidden" name="mepr_process_payment_form" value="Y"/> |
|
664
|
|
|
<input type="hidden" name="mepr_transaction_id" value="<?php echo \esc_attr( (string) $txn_id ); ?>"/> |
|
665
|
|
|
<input type="hidden" name="pronamic_pay_memberpress_pay" value="1"/> |
|
666
|
|
|
|
|
667
|
|
|
<div class="mepr_spacer"> </div> |
|
668
|
|
|
|
|
669
|
|
|
<?php |
|
670
|
|
|
|
|
671
|
|
|
$gateway->set_payment_method( $this->payment_method ); |
|
672
|
|
|
|
|
673
|
|
|
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
674
|
|
|
echo $gateway->get_input_html(); |
|
675
|
|
|
|
|
676
|
|
|
?> |
|
677
|
|
|
|
|
678
|
|
|
<div class="mepr_spacer"> </div> |
|
679
|
|
|
|
|
680
|
|
|
<input type="submit" class="mepr-submit" value="<?php esc_attr_e( 'Pay', 'pronamic_ideal' ); ?>"/> |
|
681
|
|
|
<img src="<?php echo \esc_url( admin_url( 'images/loading.gif' ) ); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
682
|
|
|
<?php MeprView::render( '/shared/has_errors', get_defined_vars() ); ?> |
|
683
|
|
|
|
|
684
|
|
|
<noscript> |
|
685
|
|
|
<p class="mepr_nojs"> |
|
686
|
|
|
<?php esc_html_e( 'JavaScript is disabled in your browser. You will not be able to complete your purchase until you either enable JavaScript in your browser, or switch to a browser that supports it.', 'pronamic_ideal' ); ?> |
|
687
|
|
|
</p> |
|
688
|
|
|
</noscript> |
|
689
|
|
|
</form> |
|
690
|
|
|
</div> |
|
691
|
|
|
<?php |
|
692
|
|
|
} |
|
693
|
|
|
|
|
694
|
|
|
/** |
|
695
|
|
|
* Single-page checkout payment fields. |
|
696
|
|
|
* |
|
697
|
|
|
* @return string |
|
698
|
|
|
*/ |
|
699
|
|
|
public function spc_payment_fields() { |
|
700
|
|
|
// Gateway. |
|
701
|
|
|
$config_id = $this->get_config_id(); |
|
702
|
|
|
|
|
703
|
|
|
$gateway = Plugin::get_gateway( $config_id ); |
|
|
|
|
|
|
704
|
|
|
|
|
705
|
|
|
if ( null === $gateway ) { |
|
|
|
|
|
|
706
|
|
|
return ''; |
|
707
|
|
|
} |
|
708
|
|
|
|
|
709
|
|
|
// Input HTML. |
|
710
|
|
|
$gateway->set_payment_method( $this->payment_method ); |
|
711
|
|
|
|
|
712
|
|
|
$html = $gateway->get_input_html(); |
|
713
|
|
|
|
|
714
|
|
|
if ( empty( $html ) ) { |
|
715
|
|
|
return ''; |
|
716
|
|
|
} |
|
717
|
|
|
|
|
718
|
|
|
return $html; |
|
719
|
|
|
} |
|
720
|
|
|
|
|
721
|
|
|
/** |
|
722
|
|
|
* Validate payment form. |
|
723
|
|
|
* |
|
724
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/controllers/MeprCheckoutCtrl.php#L648 |
|
725
|
|
|
* @param string[] $errors Array with errors. |
|
726
|
|
|
* @return string[] |
|
727
|
|
|
*/ |
|
728
|
|
|
public function validate_payment_form( $errors ) { |
|
729
|
|
|
return $errors; |
|
730
|
|
|
} |
|
731
|
|
|
|
|
732
|
|
|
/** |
|
733
|
|
|
* Display options form. |
|
734
|
|
|
* |
|
735
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/views/admin/options/gateway.php#L41 |
|
736
|
|
|
* @return void |
|
737
|
|
|
*/ |
|
738
|
|
|
public function display_options_form() { |
|
739
|
|
|
$mepr_options = MeprOptions::fetch(); |
|
740
|
|
|
|
|
741
|
|
|
?> |
|
742
|
|
|
<table> |
|
743
|
|
|
<tr> |
|
744
|
|
|
<?php |
|
745
|
|
|
|
|
746
|
|
|
$name = sprintf( |
|
747
|
|
|
'%s[%s][%s]', |
|
748
|
|
|
$mepr_options->integrations_str, |
|
749
|
|
|
$this->id, |
|
750
|
|
|
'config_id' |
|
751
|
|
|
); |
|
752
|
|
|
|
|
753
|
|
|
?> |
|
754
|
|
|
<td> |
|
755
|
|
|
<?php esc_html_e( 'Configuration', 'pronamic_ideal' ); ?> |
|
756
|
|
|
</td> |
|
757
|
|
|
<td> |
|
758
|
|
|
<select name="<?php echo esc_attr( $name ); ?>"> |
|
759
|
|
|
<?php |
|
760
|
|
|
|
|
761
|
|
|
foreach ( Plugin::get_config_select_options( $this->payment_method ) as $value => $label ) { |
|
762
|
|
|
printf( |
|
763
|
|
|
'<option value="%s" %s>%s</option>', |
|
764
|
|
|
esc_attr( $value ), |
|
765
|
|
|
selected( $value, $this->settings->config_id, false ), |
|
766
|
|
|
esc_html( $label ) |
|
767
|
|
|
); |
|
768
|
|
|
} |
|
769
|
|
|
|
|
770
|
|
|
?> |
|
771
|
|
|
</select> |
|
772
|
|
|
</td> |
|
773
|
|
|
</tr> |
|
774
|
|
|
</table> |
|
775
|
|
|
<?php |
|
776
|
|
|
} |
|
777
|
|
|
|
|
778
|
|
|
/** |
|
779
|
|
|
* Validate options form. |
|
780
|
|
|
* |
|
781
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/models/MeprOptions.php#L468 |
|
782
|
|
|
* @ilnk https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L2006-L2026 |
|
783
|
|
|
* @param string[] $errors Array with errors. |
|
784
|
|
|
* @return string[] |
|
785
|
|
|
*/ |
|
786
|
|
|
public function validate_options_form( $errors ) { |
|
787
|
|
|
return $errors; |
|
788
|
|
|
} |
|
789
|
|
|
|
|
790
|
|
|
/** |
|
791
|
|
|
* Enqueue user account scripts. |
|
792
|
|
|
* |
|
793
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/controllers/MeprAccountCtrl.php#L126 |
|
794
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L2028-L2044 |
|
795
|
|
|
* @return void |
|
796
|
|
|
*/ |
|
797
|
|
|
public function enqueue_user_account_scripts() { |
|
798
|
|
|
|
|
799
|
|
|
} |
|
800
|
|
|
|
|
801
|
|
|
/** |
|
802
|
|
|
* Display update account form. |
|
803
|
|
|
* |
|
804
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/controllers/MeprAccountCtrl.php#L438 |
|
805
|
|
|
* @param string $sub_id Subscription ID. |
|
806
|
|
|
* @param string[] $errors Array with errors. |
|
807
|
|
|
* @param string $message Update message. |
|
808
|
|
|
* @return void |
|
809
|
|
|
*/ |
|
810
|
|
|
public function display_update_account_form( $sub_id, $errors = array(), $message = '' ) { |
|
811
|
|
|
$subscriptions = \get_pronamic_subscriptions_by_source( 'memberpress_subscription', $sub_id ); |
|
812
|
|
|
|
|
813
|
|
|
$subscriptions = ( null === $subscriptions ) ? array() : $subscriptions; |
|
|
|
|
|
|
814
|
|
|
|
|
815
|
|
|
$subscription = \reset( $subscriptions ); |
|
816
|
|
|
|
|
817
|
|
|
$message = \__( 'The payment method for this subscription can not be updated manually.', 'pronamic_ideal' ); |
|
818
|
|
|
|
|
819
|
|
|
if ( false !== $subscription ) { |
|
820
|
|
|
// Set URL to mandate selection URL. |
|
821
|
|
|
$url = $subscription->get_mandate_selection_url(); |
|
822
|
|
|
|
|
823
|
|
|
// Maybe set URL to subscription renewal, |
|
824
|
|
|
// to catch up with last failed payment. |
|
825
|
|
|
$renewal_period = $subscription->get_renewal_period(); |
|
826
|
|
|
|
|
827
|
|
|
if ( SubscriptionStatus::ACTIVE !== $subscription->get_status() && null !== $renewal_period ) { |
|
828
|
|
|
$url = $subscription->get_renewal_url(); |
|
829
|
|
|
} |
|
830
|
|
|
|
|
831
|
|
|
$message = \sprintf( |
|
832
|
|
|
/* translators: %s: mandate selection URL anchor */ |
|
833
|
|
|
\__( 'To update the payment method for this subscription, please visit the %s page.', 'pronamic_ideal' ), |
|
834
|
|
|
\sprintf( |
|
835
|
|
|
'<a href="%1$s" title="%2$s">%3$s</a>', |
|
836
|
|
|
\esc_url( $url ), |
|
837
|
|
|
\esc_attr( \__( 'payment method update', 'pronamic_ideal' ) ), |
|
838
|
|
|
\esc_html( \__( 'payment method update', 'pronamic_ideal' ) ) |
|
839
|
|
|
) |
|
840
|
|
|
); |
|
841
|
|
|
} |
|
842
|
|
|
|
|
843
|
|
|
?> |
|
844
|
|
|
|
|
845
|
|
|
<h3> |
|
846
|
|
|
<?php echo \esc_html( __( 'Update payment method', 'pronamic_ideal' ) ); ?> |
|
847
|
|
|
</h3> |
|
848
|
|
|
|
|
849
|
|
|
<div> |
|
850
|
|
|
<?php echo \wp_kses_post( $message ); ?> |
|
851
|
|
|
</div> |
|
852
|
|
|
|
|
853
|
|
|
<?php |
|
854
|
|
|
} |
|
855
|
|
|
|
|
856
|
|
|
/** |
|
857
|
|
|
* Validate update account form. |
|
858
|
|
|
* |
|
859
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprAuthorizeGateway.php#L1182-L1197 |
|
860
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L2100-L2103 |
|
861
|
|
|
* @param string[] $errors Array with errors. |
|
862
|
|
|
* @return string[] |
|
863
|
|
|
*/ |
|
864
|
|
|
public function validate_update_account_form( $errors = array() ) { |
|
865
|
|
|
return $errors; |
|
866
|
|
|
} |
|
867
|
|
|
|
|
868
|
|
|
/** |
|
869
|
|
|
* Process update account form. |
|
870
|
|
|
* |
|
871
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/controllers/MeprAccountCtrl.php#L430 |
|
872
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L2105-L2111 |
|
873
|
|
|
* @param int $sub_id Subscription ID. |
|
874
|
|
|
* @return void |
|
875
|
|
|
*/ |
|
876
|
|
|
public function process_update_account_form( $sub_id ) { |
|
877
|
|
|
|
|
878
|
|
|
} |
|
879
|
|
|
|
|
880
|
|
|
/** |
|
881
|
|
|
* Is test mode. |
|
882
|
|
|
* |
|
883
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L374-375 |
|
884
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L2113-L2121 |
|
885
|
|
|
* @return boolean |
|
886
|
|
|
*/ |
|
887
|
|
|
public function is_test_mode() { |
|
888
|
|
|
return false; |
|
889
|
|
|
} |
|
890
|
|
|
|
|
891
|
|
|
/** |
|
892
|
|
|
* Force SSL. |
|
893
|
|
|
* |
|
894
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L377-378 |
|
895
|
|
|
* @link https://github.com/wp-premium/memberpress/blob/1.9.21/app/gateways/MeprStripeGateway.php#L2123-L2125 |
|
896
|
|
|
* @return boolean |
|
897
|
|
|
*/ |
|
898
|
|
|
public function force_ssl() { |
|
899
|
|
|
return false; |
|
900
|
|
|
} |
|
901
|
|
|
|
|
902
|
|
|
/** |
|
903
|
|
|
* Get config ID. |
|
904
|
|
|
* |
|
905
|
|
|
* @return int|null |
|
906
|
|
|
*/ |
|
907
|
|
|
protected function get_config_id() { |
|
908
|
|
|
// Get config ID setting. |
|
909
|
|
|
$config_id = $this->settings->config_id; |
|
910
|
|
|
|
|
911
|
|
|
// Check empty config ID. |
|
912
|
|
|
if ( empty( $config_id ) ) { |
|
913
|
|
|
$config_id = \get_option( 'pronamic_pay_config_id' ); |
|
914
|
|
|
} |
|
915
|
|
|
|
|
916
|
|
|
// Check empty config ID. |
|
917
|
|
|
if ( empty( $config_id ) ) { |
|
918
|
|
|
$config_id = null; |
|
919
|
|
|
} |
|
920
|
|
|
|
|
921
|
|
|
return (int) $config_id; |
|
922
|
|
|
} |
|
923
|
|
|
} |
|
924
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths