Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders
PayPal::is_paypal_in_sandbox_mode()
Check if the PayPal payment gateway is in sandbox mode.
For PayPal, there are two different environments: sandbox and production.
Метод класса: PayPal{}
Хуков нет.
Возвращает
?true|false
. True if the payment gateway is in sandbox mode, false otherwise. Null if the environment could not be determined.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_paypal_in_sandbox_mode(): ?bool;
Код PayPal::is_paypal_in_sandbox_mode() PayPal::is paypal in sandbox mode WC 9.6.1
private function is_paypal_in_sandbox_mode(): ?bool { if ( class_exists( '\WooCommerce\PayPalCommerce\PPCP' ) && is_callable( '\WooCommerce\PayPalCommerce\PPCP::container' ) && defined( '\WooCommerce\PayPalCommerce\Onboarding\Environment::SANDBOX' ) ) { try { $environment = \WooCommerce\PayPalCommerce\PPCP::container()->get( 'onboarding.environment' ); $current_environment = $environment->current_environment(); return \WooCommerce\PayPalCommerce\Onboarding\Environment::SANDBOX === $current_environment; } catch ( \Exception $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch // Ignore any exceptions. } } // Let the caller know that we couldn't determine the environment. return null; }