Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

PaymentGateway::is_in_test_mode_onboardingpublicWC 1.0

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

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.

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

Хуков нет.

Возвращает

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

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

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

Код PaymentGateway::is_in_test_mode_onboarding() WC 10.7.0

public function is_in_test_mode_onboarding( WC_Payment_Gateway $payment_gateway ): bool {
	try {
		// Try various gateway methods to check if the payment gateway is in test mode onboarding.
		if ( method_exists( $payment_gateway, 'is_test_mode_onboarding' ) && is_callable( array( $payment_gateway, 'is_test_mode_onboarding' ) ) ) {
			return wc_string_to_bool( $payment_gateway->is_test_mode_onboarding() );
		}
		if ( method_exists( $payment_gateway, 'is_in_test_mode_onboarding' ) && is_callable( array( $payment_gateway, 'is_in_test_mode_onboarding' ) ) ) {
			return wc_string_to_bool( $payment_gateway->is_in_test_mode_onboarding() );
		}
	} catch ( Throwable $e ) {
		// Do nothing but log so we can investigate.
		SafeGlobalFunctionProxy::wc_get_logger()->debug(
			'Failed to determine if gateway is in test mode onboarding: ' . $e->getMessage(),
			array(
				'gateway'   => $payment_gateway->id,
				'source'    => 'settings-payments',
				'exception' => $e,
			)
		);
	}

	return false;
}