Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

WCCore::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.

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

Хуков нет.

Возвращает

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

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

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

Код WCCore::is_in_test_mode_onboarding() WC 10.8.1

public function is_in_test_mode_onboarding( WC_Payment_Gateway $payment_gateway ): bool {
	// Provide custom test mode onboarding logic for core payment gateways.
	switch ( $payment_gateway->id ) {
		case WC_Gateway_BACS::ID:
		case WC_Gateway_Cheque::ID:
		case WC_Gateway_COD::ID:
			return false; // These gateways do not have a test mode onboarding.
		case WC_Gateway_Paypal::ID:
			// Test mode is actually sandbox mode for PayPal, affecting the API keys used.
			return $this->is_in_test_mode( $payment_gateway );
	}

	return parent::is_in_test_mode_onboarding( $payment_gateway );
}