guard_admin(); if ( $check ) { return $check; } if ( $customer_id <= 0 ) { return [ 'error' => 'A valid customer_id is required.' ]; } try { $request = $this->build_request( 'GET', '/timetics/v1/customers/' . $customer_id, [], null, [ 'customer_id' => $customer_id ] ); if ( is_array( $request ) ) { return $request; } $controller = \Timetics\Core\Customers\Api_Customer::instance(); $data = $this->extract_response( $controller->get_item( $request ), "Customer #{$customer_id} was not found." ); if ( isset( $data['error'] ) ) { return $data; } return [ 'customer' => $this->shape_customer( $data ) ]; } catch ( \Throwable $e ) { Log::error( 'Timetics_Get_Customer_Tool error', [ 'error' => $e->getMessage() ] ); return [ 'error' => 'Failed to get customer: ' . $e->getMessage() ]; } } }