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_refund( int $post_id )

Save method, processes refunds


Parameters Parameters

$post_id

(int) (Required) Post ID of the Order.


Top ↑

Return Return

(null)


Top ↑

Source Source

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

	private function save_refund( $post_id ) {

		// phpcs:disable WordPress.Security.NonceVerification.Missing -- Nonce is verified in the save() method of this class.

		$txn_id = llms_filter_input( INPUT_POST, 'llms_refund_txn_id', FILTER_SANITIZE_NUMBER_INT );
		$amount = llms_filter_input_sanitize_string( INPUT_POST, 'llms_refund_amount' );
		if ( empty( $txn_id ) ) {
			return $this->add_error( __( 'Refund Error: Missing a transaction ID', 'lifterlms' ) );
		} elseif ( empty( $amount ) ) {
			return $this->add_error( __( 'Refund Error: Missing or invalid refund amount', 'lifterlms' ) );
		}

		$txn = new LLMS_Transaction( $txn_id );

		$refund = $txn->process_refund(
			$amount,
			llms_filter_input_sanitize_string( INPUT_POST, 'llms_refund_note' ),
			llms_filter_input_sanitize_string( INPUT_POST, 'llms_process_refund' )
		);

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

		// phpcs:enable WordPress.Security.NonceVerification.Missing

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.9.0 Stop using deprecated FILTER_SANITIZE_STRING.
3.35.0 Verify nonces and sanitize $_POST data.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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