Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

PaymentGateway::get_detailspublicWC 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 an ISO 3166-1 alpha-2 country code.
По умолчанию: ''

Код PaymentGateway::get_details() WC 10.4.3

public function get_details( WC_Payment_Gateway $gateway, int $order = 0, string $country_code = '' ): array {
	$onboarding_supported = $this->is_onboarding_supported( $gateway, $country_code ) ?? true; // Assume supported if unknown.

	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 ),
		'links'       => $this->get_provider_links( $gateway, $country_code ),
		'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(
			'type'                        => self::ONBOARDING_TYPE_EXTERNAL,
			'state'                       => array(
				'supported' => $onboarding_supported,
				'started'   => $this->is_onboarding_started( $gateway ),
				'completed' => $this->is_onboarding_completed( $gateway ),
				'test_mode' => $this->is_in_test_mode_onboarding( $gateway ),
			),
			'messages'                    => array(
				'not_supported' => ! $onboarding_supported ? $this->get_onboarding_not_supported_message( $gateway, $country_code ) : null,
			),
			'_links'                      => array(
				'onboard' => array(
					'href' => $this->get_onboarding_url( $gateway ),
				),
			),
			'recommended_payment_methods' => $this->get_recommended_payment_methods( $gateway, $country_code ),
		),
		'plugin'      => $this->get_plugin_details( $gateway ),
	);
}