*/ public function get_settings(): array { return []; } /** * Manual payment has no configurable admin fields. * * @return array */ public function get_settings_fields(): array { return []; } /** * Capture rendered manual payment admin settings markup. * * @return string */ public function get_settings_fields_html(): string { ob_start(); $this->admin_fields(); return (string) ob_get_clean(); } /** * Render manual payment settings in the plugin admin. * * @return void */ public function admin_fields(): void { $this->render_template('admin-settings.php', ['gateway' => $this]); } /** * Output hidden payment method fields at the start of the reservation form. * * @param mixed|null $booking Optional booking context for gateway hooks. * @return void */ public function output_form_meta($booking = null): void { echo ''; do_action('bizdex_uplisting_gateway_hidden_payment_fields', $this, $booking); } /** * Output manual payment messaging in the checkout form. * * @param mixed|null $booking Optional booking context for the template. * @return void */ public function payment_fields($booking = null): void { $this->render_template('payment-fields.php', [ 'gateway' => $this, 'booking' => $booking, ]); } /** * Enqueue manual payment styles on the reservation page. * * @return void */ public function enqueue_scripts(): void { wp_register_style( 'bizdex-uplisting-manual-payment', $this->asset_url('assets/css/manual.css'), [], BIZDEX_UPLISTING_VERSION ); wp_enqueue_style('bizdex-uplisting-manual-payment'); } /** * Accept the booking request without collecting online payment. * * @param array $posted_data Checkout payload from the reservation form. * @return array{success: bool, message: string, data: array} */ public function process_payment(array $posted_data): array { return apply_filters('bizdex_uplisting_offline_process_payment', [ 'success' => true, 'message' => '', 'data' => [ 'payment_method' => $this->id, 'payment_status' => $this->booking_payment_status(), ], ], $posted_data, $this); } /** * Render a gateway template with explicit `$view_args` scope. * * @since 1.0.0 * * @param string $file Template filename relative to `templates/`. * @param array $args Variables available as `$view_args` in the template. */ private function render_template(string $file, array $args = []): void { $path = $this->template_path($file); if (!is_readable($path)) { return; } $view_args = $args; include $path; } /** * Get the path to a gateway template file. * * @since 1.0.0 * * @param string $file Template filename relative to `templates/`. * @return string The full path to the template file. */ private function template_path(string $file): string { return dirname(__FILE__) . '/templates/' . ltrim($file, '/'); } /** * Get the URL to a gateway asset file. * * @since 1.0.0 * * @param string $file Asset filename relative to `assets/`. * @return string The full URL to the asset file. */ private function asset_url(string $file): string { return plugin_dir_url(__FILE__) . ltrim($file, '/'); } }