Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

PaymentGateway::get_details()publicWC 1.0

Extract the payment gateway provider details from the object.

Метод класса: PaymentGateway{}

Хуков нет.

Возвращает

Массив. The payment gateway provider details.

Использование

$PaymentGateway = new PaymentGateway();
$PaymentGateway->get_details( $gateway, $order, $country_code ): array;
$gateway(WC_Payment_Gateway) (обязательный)
The payment gateway object.
$order(int)
The order to assign.
По умолчанию: 0 if not provided
$country_code(строка)
The country code for which the details are being gathered. This should be a ISO 3166-1 alpha-2 country code.
По умолчанию: ''

Код PaymentGateway::get_details() WC 9.6.1

public function get_details( WC_Payment_Gateway $gateway, int $order = 0, string $country_code = '' ): array {
	$plugin_slug = $this->get_plugin_slug( $gateway );
	$plugin_file = $this->get_plugin_file( $gateway, $plugin_slug );

	return array(
		'id'          => $gateway->id,
		'_order'      => $order,
		'title'       => $this->get_title( $gateway ),
		'description' => $this->get_description( $gateway ),
		'icon'        => $this->get_icon( $gateway ),
		'supports'    => $this->get_supports_list( $gateway ),
		'state'       => array(
			'enabled'           => $this->is_enabled( $gateway ),
			'account_connected' => $this->is_account_connected( $gateway ),
			'needs_setup'       => $this->needs_setup( $gateway ),
			'test_mode'         => $this->is_in_test_mode( $gateway ),
			'dev_mode'          => $this->is_in_dev_mode( $gateway ),
		),
		'management'  => array(
			'_links' => array(
				'settings' => array(
					'href' => $this->get_settings_url( $gateway ),
				),
			),
		),
		'onboarding'  => array(
			'state'                       => array(
				'started'   => $this->is_onboarding_started( $gateway ),
				'completed' => $this->is_onboarding_completed( $gateway ),
				'test_mode' => $this->is_in_test_mode_onboarding( $gateway ),
			),
			'_links'                      => array(
				'onboard' => array(
					'href' => $this->get_onboarding_url( $gateway ),
				),
			),
			'recommended_payment_methods' => $this->get_recommended_payment_methods( $gateway, $country_code ),
		),
		'plugin'      => array(
			// Default to treating the payment gateway plugin as a WordPress.org plugin.
			'_type'  => PaymentProviders::EXTENSION_TYPE_WPORG,
			'slug'   => $plugin_slug,
			'file'   => $plugin_file,
			// The gateway underlying plugin is obviously active (aka the plugin code is running).
			'status' => PaymentProviders::EXTENSION_ACTIVE,
		),
	);
}