id = $id; // Go through the props and set them on the object. foreach ( $props as $prop => $value ) { $this->$prop = $value; } } /** * Return whether or not this gateway still requires setup to function. * * @return bool */ public function needs_setup() { return $this->needs_setup; } /** * Get the gateway settings page URL. * * @return string The gateway settings page URL. */ public function get_settings_url(): string { if ( isset( $this->settings_url ) ) { return $this->settings_url; } return admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $this->id ) ); } /** * Get the gateway onboarding start/continue URL. * * @return string The gateway onboarding start/continue URL. */ public function get_connection_url(): string { if ( isset( $this->connection_url ) ) { return $this->connection_url; } return $this->get_settings_url(); } /** * Get the recommended payment methods list. * * @param string $country_code Optional. The business location country code. * * @return array List of recommended payment methods for the given country. */ public function get_recommended_payment_methods( string $country_code = '' ): array { return $this->recommended_payment_methods; } /** * Check if the gateway is in test mode. * * @return bool True if the gateway is in test mode, false otherwise. */ public function is_test_mode(): bool { return $this->test_mode; } /** * Check if the gateway is in dev mode. * * @return bool True if the gateway is in dev mode, false otherwise. */ public function is_dev_mode(): bool { return $this->dev_mode; } /** * Check if the gateway has an account connected. * * @return bool True if the gateway has an account connected, false otherwise. */ public function is_account_connected(): bool { return $this->account_connected; } /** * Check if the gateway has started onboarding. * * @return bool True if the gateway has started onboarding, false otherwise. */ public function is_onboarding_started(): bool { return $this->onboarding_started; } /** * Check if the gateway has completed onboarding. * * @return bool True if the gateway has completed onboarding, false otherwise. */ public function is_onboarding_completed(): bool { return $this->onboarding_completed; } /** * Check if the gateway is in test mode onboarding. * * @return bool True if the gateway is in test mode onboarding, false otherwise. */ public function is_test_mode_onboarding(): bool { return $this->test_mode_onboarding; } }