Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

WooPayments::is_in_test_mode_onboardingpublicWC 1.0

Try to determine if the payment gateway is in test mode onboarding (aka sandbox or test-drive).

This is a best-effort attempt, as there is no standard way to determine this. Trust the true value, but don't consider a false value as definitive.

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

Хуков нет.

Возвращает

true|false. True if the payment gateway is in test mode onboarding, false otherwise.

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

$WooPayments = new WooPayments();
$WooPayments->is_in_test_mode_onboarding( $payment_gateway ): bool;
$payment_gateway(WC_Payment_Gateway) (обязательный)
The payment gateway object.

Код WooPayments::is_in_test_mode_onboarding() WC 10.4.3

public function is_in_test_mode_onboarding( WC_Payment_Gateway $payment_gateway ): bool {
	if ( $this->proxy->call_function( 'class_exists', 'WC_Payments' ) &&
		$this->proxy->call_function( 'is_callable', 'WC_Payments::mode' ) ) {

		$woopayments_mode = $this->proxy->call_static( 'WC_Payments', 'mode' );
		if ( $this->proxy->call_function( 'method_exists', $woopayments_mode, 'is_test_mode_onboarding' ) &&
			$this->proxy->call_function( 'is_callable', array( $woopayments_mode, 'is_test_mode_onboarding' ) ) ) {

			return $woopayments_mode->is_test_mode_onboarding();
		}
	}

	return parent::is_in_test_mode_onboarding( $payment_gateway );
}