LLMS_Order::can_be_retried()

Determine if the order can be retried for recurring payments


Return Return

(boolean)


Top ↑

Source Source

File: includes/models/model.llms.order.php

411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
public function can_be_retried() {
 
    $can_retry = true;
 
    if (
        // Only recurring orders can be retried.
        ! $this->is_recurring() ||
        // Recurring rety feature is disabled.
        ! llms_parse_bool( get_option( 'lifterlms_recurring_payment_retry', 'yes' ) ) ||
        // Only active & on-hold orders qualify for a retry.
        ! in_array( $this->get( 'status' ), array( 'llms-active', 'llms-on-hold' ), true )
    ) {
        $can_retry = false;
    } else {
 
        // If the gateway isn't active or the gateway doesn't support recurring retries.
        $gateway = $this->get_gateway();
        if ( is_wp_error( $gateway ) || ! $gateway->supports( 'recurring_retry' ) ) {
            $can_retry = false;
        }
    }
 
    /**
     * Filters whether or not a recurring order can be retried
     *
     * @since 5.2.1
     *
     * @param boolean    $can_retry Whether or not the order can be retried.
     * @param LLMS_Order $order     Order object.
     */
    return apply_filters( 'llms_order_can_be_retried', $can_retry, $this );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.2.1 Combine conditions that return false.
5.2.0 Use strict type comparison.
3.10.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.