|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Gateway |
|
4
|
|
|
* |
|
5
|
|
|
* @author Pronamic <[email protected]> |
|
6
|
|
|
* @copyright 2005-2019 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 MeprDb; |
|
15
|
|
|
use MeprEmailFactory; |
|
16
|
|
|
use MeprOptions; |
|
17
|
|
|
use MeprProduct; |
|
18
|
|
|
use MeprSubscription; |
|
19
|
|
|
use MeprTransaction; |
|
20
|
|
|
use MeprTransactionsHelper; |
|
21
|
|
|
use MeprUser; |
|
22
|
|
|
use MeprUtils; |
|
23
|
|
|
use MeprView; |
|
24
|
|
|
use Pronamic\WordPress\Pay\Core\PaymentMethods; |
|
25
|
|
|
use Pronamic\WordPress\Pay\Core\Statuses; |
|
26
|
|
|
use Pronamic\WordPress\Pay\Core\Util as Core_Util; |
|
27
|
|
|
use Pronamic\WordPress\Pay\Plugin; |
|
28
|
|
|
use ReflectionClass; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* WordPress pay MemberPress gateway |
|
32
|
|
|
* |
|
33
|
|
|
* @author Remco Tolsma |
|
34
|
|
|
* @version 2.0.4 |
|
35
|
|
|
* @since 1.0.0 |
|
36
|
|
|
*/ |
|
37
|
|
|
class Gateway extends MeprBaseRealGateway { |
|
38
|
|
|
/** |
|
39
|
|
|
* Payment method. |
|
40
|
|
|
* |
|
41
|
|
|
* @var string |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $payment_method; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* MemberPress transaction. |
|
47
|
|
|
* |
|
48
|
|
|
* @var MeprTransaction |
|
49
|
|
|
*/ |
|
50
|
|
|
public $mp_txn; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Constructs and initialize iDEAL gateway. |
|
54
|
|
|
*/ |
|
55
|
|
|
public function __construct() { |
|
56
|
|
|
// Set the name of this gateway. |
|
57
|
|
|
// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L12-13. |
|
58
|
|
|
$this->name = __( 'Pronamic', 'pronamic_ideal' ); |
|
59
|
|
|
|
|
60
|
|
|
if ( ! empty( $this->payment_method ) ) { |
|
61
|
|
|
$this->name = PaymentMethods::get_name( $this->payment_method ); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
// Set the default settings. |
|
65
|
|
|
// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L72-73. |
|
66
|
|
|
$this->set_defaults(); |
|
67
|
|
|
|
|
68
|
|
|
// Set the capabilities of this gateway. |
|
69
|
|
|
// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L36-37. |
|
70
|
|
|
$this->capabilities = array(); |
|
71
|
|
|
|
|
72
|
|
|
// Setup the notification actions for this gateway. |
|
73
|
|
|
$this->notifiers = array(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Load the specified settings. |
|
78
|
|
|
* |
|
79
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L69-70 |
|
80
|
|
|
* |
|
81
|
|
|
* @param array $settings MemberPress gateway settings array. |
|
82
|
|
|
*/ |
|
83
|
|
|
public function load( $settings ) { |
|
84
|
|
|
$this->settings = (object) $settings; |
|
85
|
|
|
|
|
86
|
|
|
$this->set_defaults(); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Custom helper function to send transaction notices. |
|
91
|
|
|
* |
|
92
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprUtils.php#L1333-L1351 |
|
93
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/models/MeprTransaction.php |
|
94
|
|
|
* |
|
95
|
|
|
* @param MeprTransaction $transaction MemberPress transaction object. |
|
96
|
|
|
* @param string $method PHP function name to call. |
|
97
|
|
|
* |
|
98
|
|
|
* @return mixed |
|
99
|
|
|
*/ |
|
100
|
|
|
public function send_transaction_notices( $transaction, $method ) { |
|
101
|
|
|
$class = 'MeprUtils'; |
|
102
|
|
|
|
|
103
|
|
|
if ( ! Core_Util::class_method_exists( $class, $method ) ) { |
|
104
|
|
|
$class = $this; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
if ( 'MeprUtils' === $class && 'send_product_welcome_notices' === $method ) { |
|
108
|
|
|
// `send_product_welcome_notices` is called from `send_signup_notices` in newer versions. |
|
109
|
|
|
return; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
return call_user_func( array( $class, $method ), $transaction ); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Get icon function (this is not a MemberPress function). |
|
117
|
|
|
* |
|
118
|
|
|
* @since 1.0.2 |
|
119
|
|
|
* @return string |
|
120
|
|
|
*/ |
|
121
|
|
|
protected function get_icon() { |
|
122
|
|
|
return ''; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Get class alias name. |
|
127
|
|
|
* |
|
128
|
|
|
* @return string |
|
129
|
|
|
*/ |
|
130
|
|
|
public function get_alias() { |
|
131
|
|
|
return 'MeprPronamicGateway'; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* Set the default settings. |
|
136
|
|
|
* |
|
137
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L72-73 |
|
138
|
|
|
*/ |
|
139
|
|
|
protected function set_defaults() { |
|
140
|
|
|
if ( ! isset( $this->settings ) ) { |
|
141
|
|
|
$this->settings = array(); |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
$this->settings = (object) array_merge( |
|
145
|
|
|
array( |
|
146
|
|
|
'gateway' => $this->get_alias(), |
|
147
|
|
|
'id' => $this->generate_id(), |
|
148
|
|
|
'label' => '', |
|
149
|
|
|
'use_label' => true, |
|
150
|
|
|
'icon' => $this->get_icon(), |
|
151
|
|
|
'use_icon' => true, |
|
152
|
|
|
'desc' => '', |
|
153
|
|
|
'use_desc' => true, |
|
154
|
|
|
'config_id' => '', |
|
155
|
|
|
'email' => '', |
|
156
|
|
|
'sandbox' => false, |
|
157
|
|
|
'debug' => false, |
|
158
|
|
|
), |
|
159
|
|
|
(array) $this->settings |
|
160
|
|
|
); |
|
161
|
|
|
|
|
162
|
|
|
$this->id = $this->settings->id; |
|
163
|
|
|
$this->label = $this->settings->label; |
|
164
|
|
|
$this->use_label = $this->settings->use_label; |
|
165
|
|
|
$this->icon = $this->settings->icon; |
|
166
|
|
|
$this->use_icon = $this->settings->use_icon; |
|
167
|
|
|
$this->desc = $this->settings->desc; |
|
168
|
|
|
$this->use_desc = $this->settings->use_desc; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* Process payment. |
|
173
|
|
|
* |
|
174
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
175
|
|
|
* |
|
176
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L119-122 |
|
177
|
|
|
*/ |
|
178
|
|
|
public function process_payment( $txn ) { |
|
179
|
|
|
|
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* Record subscription payment. |
|
184
|
|
|
* |
|
185
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L140-145 |
|
186
|
|
|
*/ |
|
187
|
|
|
public function record_subscription_payment() { |
|
188
|
|
|
$transaction = $this->mp_txn; |
|
189
|
|
|
|
|
190
|
|
|
$transaction->status = MeprTransaction::$complete_str; |
|
191
|
|
|
$transaction->store(); |
|
192
|
|
|
|
|
193
|
|
|
$subscription = $transaction->subscription(); |
|
194
|
|
|
|
|
195
|
|
|
if ( $subscription ) { |
|
196
|
|
|
if ( MeprSubscription::$active_str !== $subscription->status ) { |
|
197
|
|
|
$subscription->status = MeprSubscription::$active_str; |
|
198
|
|
|
$subscription->store(); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
$subscription->expire_confirmation_txn(); |
|
202
|
|
|
|
|
203
|
|
|
$subscription->limit_payment_cycles(); |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
$this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
207
|
|
|
|
|
208
|
|
|
return $transaction; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* Record payment failure. |
|
213
|
|
|
* |
|
214
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L147-148 |
|
215
|
|
|
*/ |
|
216
|
|
|
public function record_payment_failure() { |
|
217
|
|
|
$transaction = $this->mp_txn; |
|
218
|
|
|
|
|
219
|
|
|
// @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprTransaction.php#L50. |
|
220
|
|
|
$transaction->status = MeprTransaction::$failed_str; |
|
221
|
|
|
$transaction->store(); |
|
222
|
|
|
|
|
223
|
|
|
// Expire associated transactions for subscription. |
|
224
|
|
|
$subscription = $transaction->subscription(); |
|
225
|
|
|
|
|
226
|
|
|
if ( $subscription ) { |
|
227
|
|
|
$subscription->expire_txns(); |
|
228
|
|
|
$subscription->store(); |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
$this->send_transaction_notices( $transaction, 'send_failed_txn_notices' ); |
|
232
|
|
|
|
|
233
|
|
|
return $transaction; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
/** |
|
237
|
|
|
* Record payment. |
|
238
|
|
|
* |
|
239
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L124-129 |
|
240
|
|
|
*/ |
|
241
|
|
|
public function record_payment() { |
|
242
|
|
|
$transaction = $this->mp_txn; |
|
243
|
|
|
|
|
244
|
|
|
$transaction->status = MeprTransaction::$complete_str; |
|
245
|
|
|
|
|
246
|
|
|
// This will only work before maybe_cancel_old_sub is run. |
|
247
|
|
|
$upgrade = $transaction->is_upgrade(); |
|
248
|
|
|
$downgrade = $transaction->is_downgrade(); |
|
249
|
|
|
|
|
250
|
|
|
$event_transaction = $transaction->maybe_cancel_old_sub(); |
|
|
|
|
|
|
251
|
|
|
|
|
252
|
|
|
$subscription = $transaction->subscription(); |
|
253
|
|
|
|
|
254
|
|
|
if ( $subscription ) { |
|
255
|
|
|
$event_subscription = $subscription->maybe_cancel_old_sub(); |
|
|
|
|
|
|
256
|
|
|
|
|
257
|
|
|
$subscription->status = MeprSubscription::$active_str; |
|
258
|
|
|
$subscription->created_at = $transaction->created_at; |
|
259
|
|
|
$subscription->store(); |
|
260
|
|
|
|
|
261
|
|
|
if ( false === $event_transaction && false !== $event_subscription ) { |
|
|
|
|
|
|
262
|
|
|
$event_transaction = $event_subscription; |
|
263
|
|
|
} |
|
264
|
|
|
} |
|
265
|
|
|
|
|
266
|
|
|
$transaction->store(); |
|
267
|
|
|
|
|
268
|
|
|
/* |
|
269
|
|
|
* For some reasons the `send_product_welcome_notices` function accepts 1 or 3 arguments. We are not sure |
|
270
|
|
|
* if this is a difference in the 'Business' and 'Developer' edition or between version `1.2.4` and `1.2.7`. |
|
271
|
|
|
* |
|
272
|
|
|
* @link https://github.com/wp-premium/memberpress-developer/blob/1.2.4/app/lib/MeprBaseGateway.php#L596-L612 |
|
273
|
|
|
* @link https://github.com/wp-premium/memberpress-business/blob/1.2.7/app/lib/MeprBaseGateway.php#L609-L619 |
|
274
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/models/MeprTransaction.php#L51 |
|
275
|
|
|
*/ |
|
276
|
|
|
$reflection = new ReflectionClass( 'MeprBaseRealGateway' ); |
|
277
|
|
|
|
|
278
|
|
|
if ( $reflection->hasMethod( 'send_product_welcome_notices' ) && 3 === $reflection->getMethod( 'send_product_welcome_notices' )->getNumberOfParameters() ) { |
|
279
|
|
|
$uemail = MeprEmailFactory::fetch( |
|
280
|
|
|
'MeprUserProductWelcomeEmail', |
|
281
|
|
|
'MeprBaseProductEmail', |
|
282
|
|
|
array( |
|
283
|
|
|
array( |
|
284
|
|
|
'product_id' => $transaction->product_id, |
|
285
|
|
|
), |
|
286
|
|
|
) |
|
287
|
|
|
); |
|
288
|
|
|
|
|
289
|
|
|
/** |
|
290
|
|
|
* The `send_product_welcome_notices` method is only available in earlier version of MemberPress. |
|
291
|
|
|
* |
|
292
|
|
|
* @scrutinizer ignore-call |
|
293
|
|
|
*/ |
|
294
|
|
|
$this->send_product_welcome_notices( |
|
295
|
|
|
$uemail, |
|
296
|
|
|
MeprTransactionsHelper::get_email_params( $transaction ), |
|
297
|
|
|
$transaction->user() |
|
298
|
|
|
); |
|
299
|
|
|
} else { |
|
300
|
|
|
$this->send_transaction_notices( $transaction, 'send_product_welcome_notices' ); |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
// Send upgrade/downgrade notices. |
|
304
|
|
|
$product = $transaction->product(); |
|
305
|
|
|
|
|
306
|
|
|
if ( 'lifetime' === $product->period_type ) { |
|
307
|
|
|
if ( $upgrade ) { |
|
308
|
|
|
$this->upgraded_sub( $transaction, $event_transaction ); |
|
|
|
|
|
|
309
|
|
|
$this->send_transaction_notices( $transaction, 'send_upgraded_txn_notices' ); |
|
310
|
|
|
} elseif ( $downgrade ) { |
|
311
|
|
|
$this->downgraded_sub( $transaction, $event_transaction ); |
|
|
|
|
|
|
312
|
|
|
$this->send_transaction_notices( $transaction, 'send_downgraded_txn_notices' ); |
|
313
|
|
|
} else { |
|
314
|
|
|
$this->new_sub( $transaction ); |
|
315
|
|
|
} |
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
$this->send_transaction_notices( $transaction, 'send_signup_notices' ); |
|
319
|
|
|
$this->send_transaction_notices( $transaction, 'send_transaction_receipt_notices' ); |
|
320
|
|
|
|
|
321
|
|
|
return $transaction; |
|
322
|
|
|
} |
|
323
|
|
|
|
|
324
|
|
|
/** |
|
325
|
|
|
* Process refund. |
|
326
|
|
|
* |
|
327
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
328
|
|
|
* |
|
329
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L131-133 |
|
330
|
|
|
*/ |
|
331
|
|
|
public function process_refund( MeprTransaction $txn ) { |
|
332
|
|
|
|
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* Record refund. |
|
337
|
|
|
* |
|
338
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L135-138 |
|
339
|
|
|
*/ |
|
340
|
|
|
public function record_refund() { |
|
341
|
|
|
|
|
342
|
|
|
} |
|
343
|
|
|
|
|
344
|
|
|
/** |
|
345
|
|
|
* Process trial payment. |
|
346
|
|
|
* |
|
347
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L150-157 |
|
348
|
|
|
* |
|
349
|
|
|
* @param MeprTransaction $transaction MemberPress transaction object. |
|
350
|
|
|
*/ |
|
351
|
|
|
public function process_trial_payment( $transaction ) { |
|
352
|
|
|
|
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
/** |
|
356
|
|
|
* Reord trial payment. |
|
357
|
|
|
* |
|
358
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L159-161 |
|
359
|
|
|
* |
|
360
|
|
|
* @param MeprTransaction $transaction MemberPress transaction object. |
|
361
|
|
|
*/ |
|
362
|
|
|
public function record_trial_payment( $transaction ) { |
|
363
|
|
|
|
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* Process create subscription. |
|
368
|
|
|
* |
|
369
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L163-167 |
|
370
|
|
|
* |
|
371
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
372
|
|
|
*/ |
|
373
|
|
|
public function process_create_subscription( $txn ) { |
|
374
|
|
|
|
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
/** |
|
378
|
|
|
* Record create subscription. |
|
379
|
|
|
* |
|
380
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L169-174 |
|
381
|
|
|
*/ |
|
382
|
|
|
public function record_create_subscription() { |
|
383
|
|
|
|
|
384
|
|
|
} |
|
385
|
|
|
|
|
386
|
|
|
/** |
|
387
|
|
|
* Process update subscription. |
|
388
|
|
|
* |
|
389
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L176 |
|
390
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseGateway.php#L194 |
|
391
|
|
|
* |
|
392
|
|
|
* @param int $sub_id Subscription ID. |
|
393
|
|
|
*/ |
|
394
|
|
|
public function process_update_subscription( $sub_id ) { |
|
395
|
|
|
|
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
/** |
|
399
|
|
|
* Record update subscription. |
|
400
|
|
|
* |
|
401
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L178-182 |
|
402
|
|
|
*/ |
|
403
|
|
|
public function record_update_subscription() { |
|
404
|
|
|
|
|
405
|
|
|
} |
|
406
|
|
|
|
|
407
|
|
|
/** |
|
408
|
|
|
* Process suspend subscription. |
|
409
|
|
|
* |
|
410
|
|
|
* @param int $sub_id Subscription id. |
|
411
|
|
|
* |
|
412
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L184-186 |
|
413
|
|
|
*/ |
|
414
|
|
|
public function process_suspend_subscription( $sub_id ) { |
|
415
|
|
|
if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
416
|
|
|
return; |
|
417
|
|
|
} |
|
418
|
|
|
|
|
419
|
|
|
$sub = new MeprSubscription( $sub_id ); |
|
420
|
|
|
|
|
421
|
|
|
if ( MeprSubscription::$suspended_str === $sub->status ) { |
|
422
|
|
|
// Subscription is already suspended. |
|
423
|
|
|
return; |
|
424
|
|
|
} |
|
425
|
|
|
|
|
426
|
|
|
$subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
427
|
|
|
|
|
428
|
|
|
if ( ! $subscription ) { |
|
429
|
|
|
return; |
|
430
|
|
|
} |
|
431
|
|
|
|
|
432
|
|
|
$sub->status = MeprSubscription::$suspended_str; |
|
433
|
|
|
|
|
434
|
|
|
$sub->store(); |
|
435
|
|
|
|
|
436
|
|
|
// Send suspended subscription notices. |
|
437
|
|
|
MeprUtils::send_suspended_sub_notices( $sub ); |
|
438
|
|
|
|
|
439
|
|
|
$note = sprintf( |
|
440
|
|
|
/* translators: %s: MemberPress */ |
|
441
|
|
|
__( '%s subscription on hold.', 'pronamic_ideal' ), |
|
442
|
|
|
__( 'MemberPress', 'pronamic_ideal' ) |
|
443
|
|
|
); |
|
444
|
|
|
|
|
445
|
|
|
$subscription->add_note( $note ); |
|
446
|
|
|
|
|
447
|
|
|
// The status of canceled or completed subscriptions will not be changed automatically. |
|
448
|
|
|
if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
449
|
|
|
$subscription->set_status( Statuses::OPEN ); |
|
450
|
|
|
|
|
451
|
|
|
$subscription->save(); |
|
452
|
|
|
} |
|
453
|
|
|
} |
|
454
|
|
|
|
|
455
|
|
|
/** |
|
456
|
|
|
* Record suspend subscription. |
|
457
|
|
|
* |
|
458
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L188-191 |
|
459
|
|
|
*/ |
|
460
|
|
|
public function record_suspend_subscription() { |
|
461
|
|
|
|
|
462
|
|
|
} |
|
463
|
|
|
|
|
464
|
|
|
/** |
|
465
|
|
|
* Process resume subscription. |
|
466
|
|
|
* |
|
467
|
|
|
* @param int $sub_id Subscription id. |
|
468
|
|
|
* |
|
469
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L193-195 |
|
470
|
|
|
*/ |
|
471
|
|
|
public function process_resume_subscription( $sub_id ) { |
|
472
|
|
|
if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
473
|
|
|
return; |
|
474
|
|
|
} |
|
475
|
|
|
|
|
476
|
|
|
$sub = new MeprSubscription( $sub_id ); |
|
477
|
|
|
|
|
478
|
|
|
if ( MeprSubscription::$active_str === $sub->status ) { |
|
479
|
|
|
// Subscription is already active. |
|
480
|
|
|
return; |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
$subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
484
|
|
|
|
|
485
|
|
|
if ( ! $subscription ) { |
|
486
|
|
|
return; |
|
487
|
|
|
} |
|
488
|
|
|
|
|
489
|
|
|
$sub->status = MeprSubscription::$active_str; |
|
490
|
|
|
|
|
491
|
|
|
$sub->store(); |
|
492
|
|
|
|
|
493
|
|
|
// Check if prior txn is expired yet or not, if so create a temporary txn so the user can access the content immediately. |
|
494
|
|
|
$prior_txn = $sub->latest_txn(); |
|
495
|
|
|
|
|
496
|
|
|
if ( false === $prior_txn || ! ( $prior_txn instanceof MeprTransaction ) || strtotime( $prior_txn->expires_at ) < time() ) { |
|
497
|
|
|
$txn = new MeprTransaction(); |
|
498
|
|
|
$txn->subscription_id = $sub->id; |
|
499
|
|
|
$txn->trans_num = $sub->subscr_id . '-' . uniqid(); |
|
500
|
|
|
$txn->status = MeprTransaction::$confirmed_str; |
|
501
|
|
|
$txn->txn_type = MeprTransaction::$subscription_confirmation_str; |
|
502
|
|
|
$txn->response = (string) $sub; |
|
503
|
|
|
$txn->expires_at = MeprUtils::ts_to_mysql_date( time() + MeprUtils::days( 1 ), 'Y-m-d 23:59:59' ); |
|
504
|
|
|
|
|
505
|
|
|
$txn->set_subtotal( 0.00 ); // Just a confirmation txn. |
|
506
|
|
|
|
|
507
|
|
|
$txn->store(); |
|
508
|
|
|
} |
|
509
|
|
|
|
|
510
|
|
|
// Send resumed subscription notices. |
|
511
|
|
|
MeprUtils::send_resumed_sub_notices( $sub ); |
|
512
|
|
|
|
|
513
|
|
|
// Add note. |
|
514
|
|
|
$note = sprintf( |
|
515
|
|
|
/* translators: %s: MemberPress */ |
|
516
|
|
|
__( '%s subscription reactivated.', 'pronamic_ideal' ), |
|
517
|
|
|
__( 'MemberPress', 'pronamic_ideal' ) |
|
518
|
|
|
); |
|
519
|
|
|
|
|
520
|
|
|
$subscription->add_note( $note ); |
|
521
|
|
|
|
|
522
|
|
|
// The status of canceled or completed subscriptions will not be changed automatically. |
|
523
|
|
|
if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
524
|
|
|
$subscription->set_status( Statuses::ACTIVE ); |
|
525
|
|
|
|
|
526
|
|
|
$subscription->save(); |
|
527
|
|
|
} |
|
528
|
|
|
} |
|
529
|
|
|
|
|
530
|
|
|
/** |
|
531
|
|
|
* Record resume subscription. |
|
532
|
|
|
* |
|
533
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L197-201 |
|
534
|
|
|
*/ |
|
535
|
|
|
public function record_resume_subscription() { |
|
536
|
|
|
|
|
537
|
|
|
} |
|
538
|
|
|
|
|
539
|
|
|
/** |
|
540
|
|
|
* Process cancel subscription. |
|
541
|
|
|
* |
|
542
|
|
|
* @param int $sub_id Subscription id. |
|
543
|
|
|
* |
|
544
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L202-206 |
|
545
|
|
|
*/ |
|
546
|
|
|
public function process_cancel_subscription( $sub_id ) { |
|
547
|
|
|
if ( ! MeprSubscription::exists( $sub_id ) ) { |
|
548
|
|
|
return; |
|
549
|
|
|
} |
|
550
|
|
|
|
|
551
|
|
|
$sub = new MeprSubscription( $sub_id ); |
|
552
|
|
|
|
|
553
|
|
|
if ( MeprSubscription::$cancelled_str === $sub->status ) { |
|
554
|
|
|
// Subscription is already cancelled. |
|
555
|
|
|
return; |
|
556
|
|
|
} |
|
557
|
|
|
|
|
558
|
|
|
$subscription = get_pronamic_subscription_by_meta( '_pronamic_subscription_source_id', $sub->id ); |
|
559
|
|
|
|
|
560
|
|
|
if ( ! $subscription ) { |
|
561
|
|
|
return; |
|
562
|
|
|
} |
|
563
|
|
|
|
|
564
|
|
|
$sub->status = MeprSubscription::$cancelled_str; |
|
565
|
|
|
|
|
566
|
|
|
$sub->store(); |
|
567
|
|
|
|
|
568
|
|
|
// Expire the grace period (confirmation) if no completed payments have come through. |
|
569
|
|
|
if ( (int) $sub->txn_count <= 0 ) { |
|
570
|
|
|
$sub->expire_txns(); |
|
571
|
|
|
} |
|
572
|
|
|
|
|
573
|
|
|
$sub->limit_reached_actions(); |
|
574
|
|
|
|
|
575
|
|
|
// Send cancelled subscription notices. |
|
576
|
|
|
MeprUtils::send_cancelled_sub_notices( $sub ); |
|
577
|
|
|
|
|
578
|
|
|
// Add note. |
|
579
|
|
|
$note = sprintf( |
|
580
|
|
|
/* translators: %s: MemberPress */ |
|
581
|
|
|
__( '%s subscription cancelled.', 'pronamic_ideal' ), |
|
582
|
|
|
__( 'MemberPress', 'pronamic_ideal' ) |
|
583
|
|
|
); |
|
584
|
|
|
|
|
585
|
|
|
$subscription->add_note( $note ); |
|
586
|
|
|
|
|
587
|
|
|
// The status of canceled or completed subscriptions will not be changed automatically. |
|
588
|
|
|
if ( ! in_array( $subscription->get_status(), array( Statuses::CANCELLED, Statuses::COMPLETED ), true ) ) { |
|
589
|
|
|
$subscription->set_status( Statuses::CANCELLED ); |
|
590
|
|
|
|
|
591
|
|
|
$subscription->save(); |
|
592
|
|
|
} |
|
593
|
|
|
} |
|
594
|
|
|
|
|
595
|
|
|
/** |
|
596
|
|
|
* Record cancel subscription. |
|
597
|
|
|
* |
|
598
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L208-212 |
|
599
|
|
|
*/ |
|
600
|
|
|
public function record_cancel_subscription() { |
|
601
|
|
|
|
|
602
|
|
|
} |
|
603
|
|
|
|
|
604
|
|
|
/** |
|
605
|
|
|
* Process signup form. |
|
606
|
|
|
* |
|
607
|
|
|
* Gets called when the signup form is posted used for running any payment |
|
608
|
|
|
* method specific actions when processing the customer signup form. |
|
609
|
|
|
* |
|
610
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L214-217 |
|
611
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L262 |
|
612
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseGateway.php#L232-L235 |
|
613
|
|
|
* |
|
614
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
615
|
|
|
*/ |
|
616
|
|
|
public function process_signup_form( $txn ) { |
|
617
|
|
|
|
|
618
|
|
|
} |
|
619
|
|
|
|
|
620
|
|
|
/** |
|
621
|
|
|
* Payment redirect. |
|
622
|
|
|
* |
|
623
|
|
|
* @since 1.0.2 |
|
624
|
|
|
* |
|
625
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
626
|
|
|
*/ |
|
627
|
|
|
public function payment_redirect( $txn ) { |
|
628
|
|
|
$txn = new MeprTransaction( $txn->id ); |
|
629
|
|
|
|
|
630
|
|
|
// Gateway. |
|
631
|
|
|
$config_id = $this->settings->config_id; |
|
632
|
|
|
|
|
633
|
|
|
$gateway = Plugin::get_gateway( $config_id ); |
|
634
|
|
|
|
|
635
|
|
|
if ( ! $gateway ) { |
|
636
|
|
|
return; |
|
637
|
|
|
} |
|
638
|
|
|
|
|
639
|
|
|
// Data. |
|
640
|
|
|
$data = new PaymentData( $txn, $this ); |
|
|
|
|
|
|
641
|
|
|
|
|
642
|
|
|
$payment = Plugin::start( $config_id, $gateway, $data, $this->payment_method ); |
|
643
|
|
|
|
|
644
|
|
|
/* |
|
645
|
|
|
* Update transaction subtotal. |
|
646
|
|
|
* |
|
647
|
|
|
* Notes: |
|
648
|
|
|
* - MemberPress also uses trial amount for prorated upgrade/downgrade |
|
649
|
|
|
* - Not updated BEFORE payment start, as transaction total amount is used for subscription amount. |
|
650
|
|
|
*/ |
|
651
|
|
|
$subscription = $txn->subscription(); |
|
652
|
|
|
|
|
653
|
|
|
if ( $subscription && $subscription->in_trial() ) { |
|
654
|
|
|
$txn->set_subtotal( $subscription->trial_amount ); |
|
655
|
|
|
$txn->store(); |
|
656
|
|
|
} |
|
657
|
|
|
|
|
658
|
|
|
$error = $gateway->get_error(); |
|
659
|
|
|
|
|
660
|
|
|
if ( ! is_wp_error( $error ) ) { |
|
661
|
|
|
// Redirect. |
|
662
|
|
|
$gateway->redirect( $payment ); |
|
663
|
|
|
} |
|
664
|
|
|
} |
|
665
|
|
|
|
|
666
|
|
|
/** |
|
667
|
|
|
* Display payment page. |
|
668
|
|
|
* |
|
669
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L219-223 |
|
670
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L290 |
|
671
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprPayPalGateway.php#L775-L850 |
|
672
|
|
|
* |
|
673
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
674
|
|
|
*/ |
|
675
|
|
|
public function display_payment_page( $txn ) { |
|
676
|
|
|
// Gateway. |
|
677
|
|
|
$config_id = $this->settings->config_id; |
|
678
|
|
|
|
|
679
|
|
|
$gateway = Plugin::get_gateway( $config_id ); |
|
680
|
|
|
|
|
681
|
|
|
if ( $gateway && '' === $gateway->get_input_html() ) { |
|
682
|
|
|
$this->payment_redirect( $txn ); |
|
683
|
|
|
} |
|
684
|
|
|
} |
|
685
|
|
|
|
|
686
|
|
|
/** |
|
687
|
|
|
* Process payment form. |
|
688
|
|
|
* |
|
689
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L239-289 |
|
690
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L336 |
|
691
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprPayPalGateway.php#L1011 |
|
692
|
|
|
* |
|
693
|
|
|
* @param MeprTransaction $txn MemberPress transaction object. |
|
694
|
|
|
* @return bool |
|
695
|
|
|
*/ |
|
696
|
|
|
public function process_payment_form( $txn ) { |
|
697
|
|
|
if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_memberpress_pay' ) ) { |
|
698
|
|
|
return false; |
|
699
|
|
|
} |
|
700
|
|
|
|
|
701
|
|
|
// Gateway. |
|
702
|
|
|
$config_id = $this->settings->config_id; |
|
703
|
|
|
|
|
704
|
|
|
$gateway = Plugin::get_gateway( $config_id ); |
|
705
|
|
|
|
|
706
|
|
|
if ( $gateway ) { |
|
707
|
|
|
$this->payment_redirect( $txn ); |
|
708
|
|
|
} |
|
709
|
|
|
} |
|
710
|
|
|
|
|
711
|
|
|
/** |
|
712
|
|
|
* Enqueue payment form scripts. |
|
713
|
|
|
* |
|
714
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L219-223 |
|
715
|
|
|
*/ |
|
716
|
|
|
public function enqueue_payment_form_scripts() { |
|
717
|
|
|
|
|
718
|
|
|
} |
|
719
|
|
|
|
|
720
|
|
|
/** |
|
721
|
|
|
* Display payment form. |
|
722
|
|
|
* |
|
723
|
|
|
* This spits out html for the payment form on the registration / payment |
|
724
|
|
|
* page for the user to fill out for payment. |
|
725
|
|
|
* |
|
726
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L230-233 |
|
727
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseGateway.php#L248-L251 |
|
728
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L318 |
|
729
|
|
|
* |
|
730
|
|
|
* @param float $amount Transaction amount to create a payment form for. |
|
731
|
|
|
* @param MeprUser $user MemberPress user object. |
|
732
|
|
|
* @param int $product_id Product ID. |
|
733
|
|
|
* @param int $txn_id Transaction ID. |
|
734
|
|
|
*/ |
|
735
|
|
|
public function display_payment_form( $amount, $user, $product_id, $txn_id ) { |
|
736
|
|
|
$product = new MeprProduct( $product_id ); |
|
737
|
|
|
|
|
738
|
|
|
$coupon = false; |
|
739
|
|
|
|
|
740
|
|
|
$txn = new MeprTransaction( $txn_id ); |
|
741
|
|
|
|
|
742
|
|
|
// Artifically set the price of the $prd in case a coupon was used. |
|
743
|
|
|
if ( $product->price !== $amount ) { |
|
744
|
|
|
$coupon = true; |
|
745
|
|
|
$product->price = $amount; |
|
746
|
|
|
} |
|
747
|
|
|
|
|
748
|
|
|
$invoice = MeprTransactionsHelper::get_invoice( $txn ); |
|
749
|
|
|
|
|
750
|
|
|
echo $invoice; // WPCS: XSS ok. |
|
751
|
|
|
|
|
752
|
|
|
?> |
|
753
|
|
|
<div class="mp_wrapper mp_payment_form_wrapper"> |
|
754
|
|
|
<form action="" method="post" id="payment-form" class="mepr-form" novalidate> |
|
755
|
|
|
<input type="hidden" name="mepr_process_payment_form" value="Y"/> |
|
756
|
|
|
<input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr( $txn_id ); ?>"/> |
|
757
|
|
|
<input type="hidden" name="pronamic_pay_memberpress_pay" value="1"/> |
|
758
|
|
|
|
|
759
|
|
|
<div class="mepr_spacer"> </div> |
|
760
|
|
|
|
|
761
|
|
|
<?php |
|
762
|
|
|
|
|
763
|
|
|
// Gateway. |
|
764
|
|
|
$config_id = $this->settings->config_id; |
|
765
|
|
|
|
|
766
|
|
|
$gateway = Plugin::get_gateway( $config_id ); |
|
767
|
|
|
|
|
768
|
|
|
if ( $gateway ) { |
|
769
|
|
|
echo $gateway->get_input_html(); // WPCS: XSS ok. |
|
770
|
|
|
} |
|
771
|
|
|
|
|
772
|
|
|
?> |
|
773
|
|
|
|
|
774
|
|
|
<div class="mepr_spacer"> </div> |
|
775
|
|
|
|
|
776
|
|
|
<input type="submit" class="mepr-submit" value="<?php esc_attr_e( 'Pay', 'pronamic_ideal' ); ?>"/> |
|
777
|
|
|
<img src="<?php echo esc_attr( admin_url( 'images/loading.gif' ) ); ?>" style="display: none;" class="mepr-loading-gif"/> |
|
778
|
|
|
<?php MeprView::render( '/shared/has_errors', get_defined_vars() ); ?> |
|
779
|
|
|
|
|
780
|
|
|
<noscript> |
|
781
|
|
|
<p class="mepr_nojs"> |
|
782
|
|
|
<?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' ); ?> |
|
783
|
|
|
</p> |
|
784
|
|
|
</noscript> |
|
785
|
|
|
</form> |
|
786
|
|
|
</div> |
|
787
|
|
|
<?php |
|
788
|
|
|
} |
|
789
|
|
|
|
|
790
|
|
|
/** |
|
791
|
|
|
* Validate payment form. |
|
792
|
|
|
* |
|
793
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L235-236 |
|
794
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L330 |
|
795
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseGateway.php#L253-L254 |
|
796
|
|
|
* |
|
797
|
|
|
* @param array $errors Array with errors. |
|
798
|
|
|
* @return array |
|
799
|
|
|
*/ |
|
800
|
|
|
public function validate_payment_form( $errors ) { |
|
801
|
|
|
return $errors; |
|
802
|
|
|
} |
|
803
|
|
|
|
|
804
|
|
|
/** |
|
805
|
|
|
* Display options form. |
|
806
|
|
|
* |
|
807
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L291-292 |
|
808
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/gateways/MeprAuthorizeGateway.php#L1027-1037 |
|
809
|
|
|
*/ |
|
810
|
|
|
public function display_options_form() { |
|
811
|
|
|
$mepr_options = MeprOptions::fetch(); |
|
812
|
|
|
|
|
813
|
|
|
?> |
|
814
|
|
|
<table> |
|
815
|
|
|
<tr> |
|
816
|
|
|
<?php |
|
817
|
|
|
|
|
818
|
|
|
$name = sprintf( |
|
819
|
|
|
'%s[%s][%s]', |
|
820
|
|
|
$mepr_options->integrations_str, |
|
821
|
|
|
$this->id, |
|
822
|
|
|
'config_id' |
|
823
|
|
|
); |
|
824
|
|
|
|
|
825
|
|
|
?> |
|
826
|
|
|
<td> |
|
827
|
|
|
<?php esc_html_e( 'Configuration', 'pronamic_ideal' ); ?> |
|
828
|
|
|
</td> |
|
829
|
|
|
<td> |
|
830
|
|
|
<select name="<?php echo esc_attr( $name ); ?>"> |
|
831
|
|
|
<?php |
|
832
|
|
|
|
|
833
|
|
|
foreach ( Plugin::get_config_select_options( $this->payment_method ) as $value => $label ) { |
|
834
|
|
|
printf( |
|
835
|
|
|
'<option value="%s" %s>%s</option>', |
|
836
|
|
|
esc_attr( $value ), |
|
837
|
|
|
selected( $value, $this->settings->config_id, false ), |
|
838
|
|
|
esc_html( $label ) |
|
839
|
|
|
); |
|
840
|
|
|
} |
|
841
|
|
|
|
|
842
|
|
|
?> |
|
843
|
|
|
</select> |
|
844
|
|
|
</td> |
|
845
|
|
|
</tr> |
|
846
|
|
|
</table> |
|
847
|
|
|
<?php |
|
848
|
|
|
} |
|
849
|
|
|
|
|
850
|
|
|
/** |
|
851
|
|
|
* Validate options form. |
|
852
|
|
|
* |
|
853
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L294-295 |
|
854
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprPayPalGateway.php#L909-L924 |
|
855
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/models/MeprOptions.php#L416-L423 |
|
856
|
|
|
* |
|
857
|
|
|
* @param array $errors Array with errors. |
|
858
|
|
|
* @return array |
|
859
|
|
|
*/ |
|
860
|
|
|
public function validate_options_form( $errors ) { |
|
861
|
|
|
return $errors; |
|
862
|
|
|
} |
|
863
|
|
|
|
|
864
|
|
|
/** |
|
865
|
|
|
* Enqueue user account scripts. |
|
866
|
|
|
* |
|
867
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L297-302 |
|
868
|
|
|
*/ |
|
869
|
|
|
public function enqueue_user_account_scripts() { |
|
870
|
|
|
|
|
871
|
|
|
} |
|
872
|
|
|
|
|
873
|
|
|
/** |
|
874
|
|
|
* Display update account form. |
|
875
|
|
|
* |
|
876
|
|
|
* @param int $sub_id Subscription ID. |
|
877
|
|
|
* @param array $errors Array with errors. |
|
878
|
|
|
* @param string $message Update message. |
|
879
|
|
|
* |
|
880
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L365-366 |
|
881
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseStaticGateway.php#L160-L161 |
|
882
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1108-L1168 |
|
883
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprAccountCtrl.php#L388 |
|
884
|
|
|
*/ |
|
885
|
|
|
public function display_update_account_form( $sub_id, $errors = array(), $message = '' ) { |
|
886
|
|
|
|
|
887
|
|
|
} |
|
888
|
|
|
|
|
889
|
|
|
/** |
|
890
|
|
|
* Validate update account form. |
|
891
|
|
|
* |
|
892
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L368-369 |
|
893
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1170-L1173 |
|
894
|
|
|
* |
|
895
|
|
|
* @param array $errors Array with errors. |
|
896
|
|
|
* @return array |
|
897
|
|
|
*/ |
|
898
|
|
|
public function validate_update_account_form( $errors = array() ) { |
|
899
|
|
|
return $errors; |
|
900
|
|
|
} |
|
901
|
|
|
|
|
902
|
|
|
/** |
|
903
|
|
|
* Process update account form. |
|
904
|
|
|
* |
|
905
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L371-372 |
|
906
|
|
|
* @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1175-L1181 |
|
907
|
|
|
* |
|
908
|
|
|
* @param int $sub_id Subscription ID. |
|
909
|
|
|
*/ |
|
910
|
|
|
public function process_update_account_form( $sub_id ) { |
|
911
|
|
|
|
|
912
|
|
|
} |
|
913
|
|
|
|
|
914
|
|
|
/** |
|
915
|
|
|
* Is test mode. |
|
916
|
|
|
* |
|
917
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L374-375 |
|
918
|
|
|
* |
|
919
|
|
|
* @return boolean |
|
920
|
|
|
*/ |
|
921
|
|
|
public function is_test_mode() { |
|
922
|
|
|
return false; |
|
923
|
|
|
} |
|
924
|
|
|
|
|
925
|
|
|
/** |
|
926
|
|
|
* Force SSL. |
|
927
|
|
|
* |
|
928
|
|
|
* @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L377-378 |
|
929
|
|
|
* |
|
930
|
|
|
* @return boolean |
|
931
|
|
|
*/ |
|
932
|
|
|
public function force_ssl() { |
|
933
|
|
|
return false; |
|
934
|
|
|
} |
|
935
|
|
|
} |
|
936
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.