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.
Return Return
(null)
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.order.transactions.php
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | 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 } |
Expand full source code Collapse full source code View on GitHub
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. |