LLMS_Payment_Gateway_Manual::handle_pending_order( LLMS_Order $order, LLMS_Access_Plan $plan, LLMS_Student $student, LLMS_Coupon|boolean $coupon = false )
Handle a Pending Order.
Parameters Parameters
- $order
-
(LLMS_Order) (Required) Order object.
- $plan
-
(LLMS_Access_Plan) (Required) Access plan object.
- $student
-
(LLMS_Student) (Required) Student object.
- $coupon
-
(LLMS_Coupon|boolean) (Optional) Coupon object or
falsewhen no coupon is being used for the order.Default value: false
Return Return
(void)
Source Source
File: includes/class.llms.gateway.manual.php
public function handle_pending_order( $order, $plan, $student, $coupon = false ) {
// Free orders (no payment is due).
if ( floatval( 0 ) === $order->get_initial_price( array(), 'float' ) ) {
// Free access plans do not generate receipts.
if ( $plan->is_free() ) {
$order->set( 'status', 'llms-completed' );
// Free trial, reduced to free via coupon, etc....
// We do want to record a transaction and then generate a receipt.
} else {
// Record a $0.00 transaction to ensure a receipt is sent.
$order->record_transaction(
array(
'amount' => floatval( 0 ),
'source_description' => __( 'Free', 'lifterlms' ),
'transaction_id' => uniqid(),
'status' => 'llms-txn-succeeded',
'payment_gateway' => 'manual',
'payment_type' => 'single',
)
);
}
return $this->complete_transaction( $order );
}
/**
* Action triggered when a manual payment is due.
*
* @hooked LLMS_Notification: manual_payment_due - 10
*
* @since Unknown.
*
* @param LLMS_Order $order The order object.
* @param LLMS_Payment_Gateway_Manual $gateway Manual gateway instance.
*/
do_action( 'llms_manual_payment_due', $order, $this );
/**
* Action triggered when the pending order processing has been completed.
*
* @since Unknown.
*
* @param LLMS_Order $order The order object.
*/
do_action( 'lifterlms_handle_pending_order_complete', $order );
llms_redirect_and_exit( $order->get_view_link() );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 6.4.0 | Use llms_redirect_and_exit() in favor of wp_redirect() and exit(). |
| 3.10.0 | Unknown. |
| 3.0.0 | Introduced. |