wp-pay-extensions /
memberpress
| 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.1.2 |
||
| 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' ); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 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() ) ) { |
||
|
0 ignored issues
–
show
The expression
$this->pronamic_payment->get_recurring() of type boolean|null is loosely compared to false; this is ambiguous if the boolean can be false. You might want to explicitly use !== null instead.
If an expression can have both $a = canBeFalseAndNull();
// Instead of
if ( ! $a) { }
// Better use one of the explicit versions:
if ($a !== null) { }
if ($a !== false) { }
if ($a !== null && $a !== false) { }
Loading history...
|
|||
| 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(); |
||
|
0 ignored issues
–
show
Are you sure the assignment to
$event_transaction is correct as $transaction->maybe_cancel_old_sub() targeting MeprTransaction::maybe_cancel_old_sub() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 281 | |||
| 282 | $subscription = $transaction->subscription(); |
||
| 283 | |||
| 284 | if ( $subscription ) { |
||
| 285 | $event_subscription = $subscription->maybe_cancel_old_sub(); |
||
|
0 ignored issues
–
show
Are you sure the assignment to
$event_subscription is correct as $subscription->maybe_cancel_old_sub() targeting MeprSubscription::maybe_cancel_old_sub() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 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 | $sub->status = MeprSubscription::$cancelled_str; |
||
| 595 | |||
| 596 | $sub->store(); |
||
| 597 | |||
| 598 | // Expire the grace period (confirmation) if no completed payments have come through. |
||
| 599 | if ( (int) $sub->txn_count <= 0 ) { |
||
| 600 | $sub->expire_txns(); |
||
| 601 | } |
||
| 602 | |||
| 603 | $sub->limit_reached_actions(); |
||
| 604 | |||
| 605 | // Send cancelled subscription notices. |
||
| 606 | MeprUtils::send_cancelled_sub_notices( $sub ); |
||
| 607 | |||
| 608 | // Add note. |
||
| 609 | $note = sprintf( |
||
| 610 | /* translators: %s: extension name */ |
||
| 611 | __( '%s subscription cancelled.', 'pronamic_ideal' ), |
||
| 612 | __( 'MemberPress', 'pronamic_ideal' ) |
||
| 613 | ); |
||
| 614 | |||
| 615 | $subscription->add_note( $note ); |
||
| 616 | |||
| 617 | // The status of canceled or completed subscriptions will not be changed automatically. |
||
| 618 | if ( ! in_array( $subscription->get_status(), array( SubscriptionStatus::CANCELLED, SubscriptionStatus::COMPLETED ), true ) ) { |
||
| 619 | $subscription->set_status( SubscriptionStatus::CANCELLED ); |
||
| 620 | |||
| 621 | $subscription->save(); |
||
| 622 | } |
||
| 623 | } |
||
| 624 | |||
| 625 | /** |
||
| 626 | * Record cancel subscription. |
||
| 627 | * |
||
| 628 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L208-212 |
||
| 629 | */ |
||
| 630 | public function record_cancel_subscription() { |
||
| 631 | |||
| 632 | } |
||
| 633 | |||
| 634 | /** |
||
| 635 | * Process signup form. |
||
| 636 | * |
||
| 637 | * Gets called when the signup form is posted used for running any payment |
||
| 638 | * method specific actions when processing the customer signup form. |
||
| 639 | * |
||
| 640 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L214-217 |
||
| 641 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L262 |
||
| 642 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseGateway.php#L232-L235 |
||
| 643 | * |
||
| 644 | * @param MeprTransaction $txn MemberPress transaction object. |
||
| 645 | */ |
||
| 646 | public function process_signup_form( $txn ) { |
||
| 647 | |||
| 648 | } |
||
| 649 | |||
| 650 | /** |
||
| 651 | * Payment redirect. |
||
| 652 | * |
||
| 653 | * @param MeprTransaction $txn MemberPress transaction object. |
||
| 654 | * |
||
| 655 | * @throws \Exception Throws exception on gateway payment start error. |
||
| 656 | * @since 1.0.2 |
||
| 657 | */ |
||
| 658 | public function payment_redirect( $txn ) { |
||
| 659 | $txn = new MeprTransaction( $txn->id ); |
||
| 660 | |||
| 661 | // Gateway. |
||
| 662 | $config_id = $this->settings->config_id; |
||
| 663 | |||
| 664 | $gateway = Plugin::get_gateway( $config_id ); |
||
|
0 ignored issues
–
show
Are you sure the assignment to
$gateway is correct as Pronamic\WordPress\Pay\P...get_gateway($config_id) targeting Pronamic\WordPress\Pay\Plugin::get_gateway() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 665 | |||
| 666 | if ( ! $gateway ) { |
||
| 667 | return; |
||
| 668 | } |
||
| 669 | |||
| 670 | // Create Pronamic payment. |
||
| 671 | $payment = Pronamic::get_payment( $txn ); |
||
| 672 | |||
| 673 | $payment->config_id = $this->settings->config_id; |
||
| 674 | $payment->method = $this->payment_method; |
||
| 675 | |||
| 676 | $error = null; |
||
| 677 | |||
| 678 | try { |
||
| 679 | $payment = Plugin::start_payment( $payment ); |
||
| 680 | } catch ( \Exception $e ) { |
||
| 681 | $error = $e; |
||
| 682 | } |
||
| 683 | |||
| 684 | /* |
||
| 685 | * Update transaction subtotal. |
||
| 686 | * |
||
| 687 | * Notes: |
||
| 688 | * - MemberPress also uses trial amount for prorated upgrade/downgrade |
||
| 689 | * - Not updated BEFORE payment start, as transaction total amount is used for subscription amount. |
||
| 690 | * - Reload transaction to make sure actual status is being used (i.e. on free downgrade). |
||
| 691 | */ |
||
| 692 | $txn = new MeprTransaction( $txn->id ); |
||
| 693 | |||
| 694 | $subscription = $txn->subscription(); |
||
| 695 | |||
| 696 | if ( $subscription && $subscription->in_trial() ) { |
||
| 697 | $txn->set_subtotal( $subscription->trial_amount ); |
||
| 698 | $txn->store(); |
||
| 699 | } |
||
| 700 | |||
| 701 | if ( $error instanceof \Exception ) { |
||
| 702 | // Rethrow error, catched by MemberPress. |
||
| 703 | throw $error; |
||
| 704 | } |
||
| 705 | |||
| 706 | // Redirect. |
||
| 707 | $gateway->redirect( $payment ); |
||
| 708 | } |
||
| 709 | |||
| 710 | /** |
||
| 711 | * Display payment page. |
||
| 712 | * |
||
| 713 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L219-223 |
||
| 714 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L290 |
||
| 715 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprPayPalGateway.php#L775-L850 |
||
| 716 | * |
||
| 717 | * @param MeprTransaction $txn MemberPress transaction object. |
||
| 718 | * |
||
| 719 | * @throws \Exception Throws exception on gateway payment start error. |
||
| 720 | */ |
||
| 721 | public function display_payment_page( $txn ) { |
||
| 722 | // Gateway. |
||
| 723 | $config_id = $this->settings->config_id; |
||
| 724 | |||
| 725 | $gateway = Plugin::get_gateway( $config_id ); |
||
|
0 ignored issues
–
show
Are you sure the assignment to
$gateway is correct as Pronamic\WordPress\Pay\P...get_gateway($config_id) targeting Pronamic\WordPress\Pay\Plugin::get_gateway() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 726 | |||
| 727 | if ( $gateway && '' === $gateway->get_input_html() ) { |
||
| 728 | $this->payment_redirect( $txn ); |
||
| 729 | } |
||
| 730 | } |
||
| 731 | |||
| 732 | /** |
||
| 733 | * Process payment form. |
||
| 734 | * |
||
| 735 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L239-289 |
||
| 736 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L336 |
||
| 737 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprPayPalGateway.php#L1011 |
||
| 738 | * |
||
| 739 | * @param MeprTransaction $txn MemberPress transaction object. |
||
| 740 | * |
||
| 741 | * @return bool |
||
| 742 | * @throws \Exception Throws exception on gateway payment start error. |
||
| 743 | */ |
||
| 744 | public function process_payment_form( $txn ) { |
||
| 745 | if ( ! filter_has_var( INPUT_POST, 'pronamic_pay_memberpress_pay' ) ) { |
||
| 746 | return false; |
||
| 747 | } |
||
| 748 | |||
| 749 | // Gateway. |
||
| 750 | $config_id = $this->settings->config_id; |
||
| 751 | |||
| 752 | $gateway = Plugin::get_gateway( $config_id ); |
||
|
0 ignored issues
–
show
Are you sure the assignment to
$gateway is correct as Pronamic\WordPress\Pay\P...get_gateway($config_id) targeting Pronamic\WordPress\Pay\Plugin::get_gateway() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 753 | |||
| 754 | if ( $gateway ) { |
||
| 755 | $this->payment_redirect( $txn ); |
||
| 756 | } |
||
| 757 | } |
||
| 758 | |||
| 759 | /** |
||
| 760 | * Enqueue payment form scripts. |
||
| 761 | * |
||
| 762 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L219-223 |
||
| 763 | */ |
||
| 764 | public function enqueue_payment_form_scripts() { |
||
| 765 | |||
| 766 | } |
||
| 767 | |||
| 768 | /** |
||
| 769 | * Display payment form. |
||
| 770 | * |
||
| 771 | * This spits out html for the payment form on the registration / payment |
||
| 772 | * page for the user to fill out for payment. |
||
| 773 | * |
||
| 774 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L230-233 |
||
| 775 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseGateway.php#L248-L251 |
||
| 776 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L318 |
||
| 777 | * |
||
| 778 | * @param float $amount Transaction amount to create a payment form for. |
||
| 779 | * @param MeprUser $user MemberPress user object. |
||
| 780 | * @param int $product_id Product ID. |
||
| 781 | * @param int $txn_id Transaction ID. |
||
| 782 | */ |
||
| 783 | public function display_payment_form( $amount, $user, $product_id, $txn_id ) { |
||
| 784 | $product = new MeprProduct( $product_id ); |
||
| 785 | |||
| 786 | $coupon = false; |
||
| 787 | |||
| 788 | $txn = new MeprTransaction( $txn_id ); |
||
| 789 | |||
| 790 | // Artifically set the price of the $prd in case a coupon was used. |
||
| 791 | if ( $product->price !== $amount ) { |
||
| 792 | $coupon = true; |
||
| 793 | $product->price = $amount; |
||
| 794 | } |
||
| 795 | |||
| 796 | $invoice = MeprTransactionsHelper::get_invoice( $txn ); |
||
| 797 | |||
| 798 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
||
| 799 | echo $invoice; |
||
| 800 | |||
| 801 | ?> |
||
| 802 | <div class="mp_wrapper mp_payment_form_wrapper"> |
||
| 803 | <form action="" method="post" id="payment-form" class="mepr-form" novalidate> |
||
| 804 | <input type="hidden" name="mepr_process_payment_form" value="Y"/> |
||
| 805 | <input type="hidden" name="mepr_transaction_id" value="<?php echo esc_attr( $txn_id ); ?>"/> |
||
| 806 | <input type="hidden" name="pronamic_pay_memberpress_pay" value="1"/> |
||
| 807 | |||
| 808 | <div class="mepr_spacer"> </div> |
||
| 809 | |||
| 810 | <?php |
||
| 811 | |||
| 812 | // Gateway. |
||
| 813 | $config_id = $this->settings->config_id; |
||
| 814 | |||
| 815 | $gateway = Plugin::get_gateway( $config_id ); |
||
|
0 ignored issues
–
show
Are you sure the assignment to
$gateway is correct as Pronamic\WordPress\Pay\P...get_gateway($config_id) targeting Pronamic\WordPress\Pay\Plugin::get_gateway() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 816 | |||
| 817 | if ( $gateway ) { |
||
| 818 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
||
| 819 | echo $gateway->get_input_html(); |
||
| 820 | } |
||
| 821 | |||
| 822 | ?> |
||
| 823 | |||
| 824 | <div class="mepr_spacer"> </div> |
||
| 825 | |||
| 826 | <input type="submit" class="mepr-submit" value="<?php esc_attr_e( 'Pay', 'pronamic_ideal' ); ?>"/> |
||
| 827 | <img src="<?php echo esc_attr( admin_url( 'images/loading.gif' ) ); ?>" style="display: none;" class="mepr-loading-gif"/> |
||
| 828 | <?php MeprView::render( '/shared/has_errors', get_defined_vars() ); ?> |
||
| 829 | |||
| 830 | <noscript> |
||
| 831 | <p class="mepr_nojs"> |
||
| 832 | <?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' ); ?> |
||
| 833 | </p> |
||
| 834 | </noscript> |
||
| 835 | </form> |
||
| 836 | </div> |
||
| 837 | <?php |
||
| 838 | } |
||
| 839 | |||
| 840 | /** |
||
| 841 | * Validate payment form. |
||
| 842 | * |
||
| 843 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L235-236 |
||
| 844 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprCheckoutCtrl.php#L330 |
||
| 845 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseGateway.php#L253-L254 |
||
| 846 | * |
||
| 847 | * @param array $errors Array with errors. |
||
| 848 | * @return array |
||
| 849 | */ |
||
| 850 | public function validate_payment_form( $errors ) { |
||
| 851 | return $errors; |
||
| 852 | } |
||
| 853 | |||
| 854 | /** |
||
| 855 | * Display options form. |
||
| 856 | * |
||
| 857 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L291-292 |
||
| 858 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/gateways/MeprAuthorizeGateway.php#L1027-1037 |
||
| 859 | */ |
||
| 860 | public function display_options_form() { |
||
| 861 | $mepr_options = MeprOptions::fetch(); |
||
| 862 | |||
| 863 | ?> |
||
| 864 | <table> |
||
| 865 | <tr> |
||
| 866 | <?php |
||
| 867 | |||
| 868 | $name = sprintf( |
||
| 869 | '%s[%s][%s]', |
||
| 870 | $mepr_options->integrations_str, |
||
| 871 | $this->id, |
||
| 872 | 'config_id' |
||
| 873 | ); |
||
| 874 | |||
| 875 | ?> |
||
| 876 | <td> |
||
| 877 | <?php esc_html_e( 'Configuration', 'pronamic_ideal' ); ?> |
||
| 878 | </td> |
||
| 879 | <td> |
||
| 880 | <select name="<?php echo esc_attr( $name ); ?>"> |
||
| 881 | <?php |
||
| 882 | |||
| 883 | foreach ( Plugin::get_config_select_options( $this->payment_method ) as $value => $label ) { |
||
| 884 | printf( |
||
| 885 | '<option value="%s" %s>%s</option>', |
||
| 886 | esc_attr( $value ), |
||
| 887 | selected( $value, $this->settings->config_id, false ), |
||
| 888 | esc_html( $label ) |
||
| 889 | ); |
||
| 890 | } |
||
| 891 | |||
| 892 | ?> |
||
| 893 | </select> |
||
| 894 | </td> |
||
| 895 | </tr> |
||
| 896 | </table> |
||
| 897 | <?php |
||
| 898 | } |
||
| 899 | |||
| 900 | /** |
||
| 901 | * Validate options form. |
||
| 902 | * |
||
| 903 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L294-295 |
||
| 904 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprPayPalGateway.php#L909-L924 |
||
| 905 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/models/MeprOptions.php#L416-L423 |
||
| 906 | * |
||
| 907 | * @param array $errors Array with errors. |
||
| 908 | * @return array |
||
| 909 | */ |
||
| 910 | public function validate_options_form( $errors ) { |
||
| 911 | return $errors; |
||
| 912 | } |
||
| 913 | |||
| 914 | /** |
||
| 915 | * Enqueue user account scripts. |
||
| 916 | * |
||
| 917 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L297-302 |
||
| 918 | */ |
||
| 919 | public function enqueue_user_account_scripts() { |
||
| 920 | |||
| 921 | } |
||
| 922 | |||
| 923 | /** |
||
| 924 | * Display update account form. |
||
| 925 | * |
||
| 926 | * @param int $sub_id Subscription ID. |
||
| 927 | * @param array $errors Array with errors. |
||
| 928 | * @param string $message Update message. |
||
| 929 | * |
||
| 930 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L365-366 |
||
| 931 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/lib/MeprBaseStaticGateway.php#L160-L161 |
||
| 932 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1108-L1168 |
||
| 933 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/controllers/MeprAccountCtrl.php#L388 |
||
| 934 | */ |
||
| 935 | public function display_update_account_form( $sub_id, $errors = array(), $message = '' ) { |
||
| 936 | |||
| 937 | } |
||
| 938 | |||
| 939 | /** |
||
| 940 | * Validate update account form. |
||
| 941 | * |
||
| 942 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L368-369 |
||
| 943 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1170-L1173 |
||
| 944 | * |
||
| 945 | * @param array $errors Array with errors. |
||
| 946 | * @return array |
||
| 947 | */ |
||
| 948 | public function validate_update_account_form( $errors = array() ) { |
||
| 949 | return $errors; |
||
| 950 | } |
||
| 951 | |||
| 952 | /** |
||
| 953 | * Process update account form. |
||
| 954 | * |
||
| 955 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L371-372 |
||
| 956 | * @link https://github.com/wp-premium/memberpress-basic/blob/1.3.18/app/gateways/MeprStripeGateway.php#L1175-L1181 |
||
| 957 | * |
||
| 958 | * @param int $sub_id Subscription ID. |
||
| 959 | */ |
||
| 960 | public function process_update_account_form( $sub_id ) { |
||
| 961 | |||
| 962 | } |
||
| 963 | |||
| 964 | /** |
||
| 965 | * Is test mode. |
||
| 966 | * |
||
| 967 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L374-375 |
||
| 968 | * |
||
| 969 | * @return boolean |
||
| 970 | */ |
||
| 971 | public function is_test_mode() { |
||
| 972 | return false; |
||
| 973 | } |
||
| 974 | |||
| 975 | /** |
||
| 976 | * Force SSL. |
||
| 977 | * |
||
| 978 | * @link https://gitlab.com/pronamic/memberpress/blob/1.2.4/app/lib/MeprBaseGateway.php#L377-378 |
||
| 979 | * |
||
| 980 | * @return boolean |
||
| 981 | */ |
||
| 982 | public function force_ssl() { |
||
| 983 | return false; |
||
| 984 | } |
||
| 985 | } |
||
| 986 |