Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Meta_Box_Order_Transactions::save_transaction( int $post_id )

Save method, records manual transactions


Description Description


Parameters Parameters

$post_id

(int) (Required) Post ID of the Order


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/class.llms.meta.box.order.transactions.php

	private function save_transaction( $post_id ) {
		if ( empty( $_POST['llms_txn_amount'] ) ) {
			return $this->add_error( __( 'Refund Error: Missing or invalid payment amount', 'lifterlms' ) );
		}

		$order = new LLMS_Order( $post_id );

		$txn = $order->record_transaction( array(
			'amount' => floatval( $_POST['llms_txn_amount'] ),
			'source_description' => sanitize_text_field( $_POST['llms_txn_source'] ),
			'transaction_id' => sanitize_text_field( $_POST['llms_txn_id'] ),
			'status' => 'llms-txn-succeeded',
			'payment_gateway' => 'manual',
			'payment_type' => 'single',
		) );

		if ( ! empty( $_POST['llms_txn_note'] ) ) {
			$order->add_note( sanitize_text_field( $_POST['llms_txn_note'] ), true );
		}

		if ( is_wp_error( $txn ) ) {
			$this->add_error( sprintf( _x( 'Refund Error: %s', 'admin error message', 'lifterlms' ), $refund->get_error_message() ) );
		}
	}

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.