Automattic\WooCommerce\Internal\Admin\Settings

PaymentsProviders::get_payment_gateway_detailspublicWC 1.0

Get the payment gateways details.

Method of the class: PaymentsProviders{}

No Hooks.

Returns

array. The payment gateway details.

Usage

$PaymentsProviders = new PaymentsProviders();
$PaymentsProviders->get_payment_gateway_details( $payment_gateway, $payment_gateway_order, $country_code ): array;
$payment_gateway(WC_Payment_Gateway) (required)
The payment gateway object.
$payment_gateway_order(int) (required)
The order of the payment gateway.
$country_code(string)
The country code for which the details are being gathered. This should be an ISO 3166-1 alpha-2 country code.
Default: ''

PaymentsProviders::get_payment_gateway_details() code WC 11.1.1

public function get_payment_gateway_details( WC_Payment_Gateway $payment_gateway, int $payment_gateway_order, string $country_code = '' ): array {
	// Normalize the country code to uppercase.
	$country_code = strtoupper( $country_code );

	$cache_key              = get_current_user_id() . '__' . $payment_gateway->id . '__' . $country_code;
	$cached_gateway_details = wp_cache_get( self::GATEWAY_DETAILS_REQUEST_CACHE_KEY, self::GATEWAY_DETAILS_REQUEST_CACHE_GROUP );
	if ( is_array( $cached_gateway_details ) && isset( $cached_gateway_details[ $cache_key ] ) && is_array( $cached_gateway_details[ $cache_key ] ) ) {
		$details = $cached_gateway_details[ $cache_key ];
	} else {
		$details = $this->enhance_payment_gateway_details(
			$this->get_payment_gateway_base_details( $payment_gateway, 0, $country_code ),
			$payment_gateway,
			$country_code
		);

		if ( ! is_array( $cached_gateway_details ) ) {
			$cached_gateway_details = array();
		}
		$cached_gateway_details[ $cache_key ] = $details;
		wp_cache_set( self::GATEWAY_DETAILS_REQUEST_CACHE_KEY, $cached_gateway_details, self::GATEWAY_DETAILS_REQUEST_CACHE_GROUP );
	}

	$details['_order'] = $payment_gateway_order;

	return $details;
}