LLMS_Payment_Gateway_Manual::handle_pending_order( obj $order, obj $plan, obj $person, obj|false $coupon = false )

Handle a Pending Order Called by LLMS_Controller_Orders->create_pending_order() on checkout form submission All data will be validated before it’s passed to this function


Description Description


Parameters Parameters

$order

(obj) (Required) Instance LLMS_Order for the order being processed

$plan

(obj) (Required) Instance LLMS_Access_Plan for the order being processed

$person

(obj) (Required) Instance of LLMS_Student for the purchasing customer

$coupon

(obj|false) (Optional) Instance of LLMS_Coupon applied to the order being processed, or false when none is being used

Default value: false


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.gateway.manual.php

	public function handle_pending_order( $order, $plan, $person, $coupon = false ) {

		// no payment (free orders)
		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',
				) );

			}

			$this->complete_transaction( $order );

			// payment due
		} else {

			/**
			 * @hooked LLMS_Notification: manual_payment_due - 10
			 */
			do_action( 'llms_manual_payment_due', $order, $this );

			// show the user payment instructions for the order
			do_action( 'lifterlms_handle_pending_order_complete', $order );
			wp_redirect( $order->get_view_link() );
			exit;

		}// End if().

	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: