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