Automattic\WooCommerce\Internal\RestApi\Routes\V4\Orders
ActionController::action_payment_complete
Mark the order as paid.
Метод класса: ActionController{}
Хуков нет.
Возвращает
true|WP_Error.
Использование
// private - только в коде основоного (родительского) класса $result = $this->action_payment_complete( $action_value, $order, $request );
- $action_value(true|false) (обязательный)
- The action value.
- $order(WC_Order) (обязательный)
- The order object.
- $request(WP_REST_Request) (обязательный)
- The request object.
Код ActionController::action_payment_complete() ActionController::action payment complete WC 10.5.2
private function action_payment_complete( $action_value, WC_Order $order, WP_REST_Request $request ) {
if ( $action_value ) {
$result = $order->payment_complete( $request['transaction_id'] ?? '' );
if ( ! $result ) {
return new WP_Error( 'woocommerce_rest_payment_complete_failed', __( 'Could not mark the order as paid.', 'woocommerce' ) );
}
}
return true;
}