Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

MercadoPago::is_mercado_pago_in_sandbox_modeprivateWC 1.0

Check if the MercadoPago payment gateway is in sandbox mode.

For MercadoPago, there are two different environments: sandbox and production.

Method of the class: MercadoPago{}

No Hooks.

Returns

?true|false. True if the payment gateway is in sandbox mode, false otherwise. Null if the environment could not be determined.

Usage

// private - for code of main (parent) class only
$result = $this->is_mercado_pago_in_sandbox_mode(): ?bool;

MercadoPago::is_mercado_pago_in_sandbox_mode() code WC 9.8.5

private function is_mercado_pago_in_sandbox_mode(): ?bool {
	global $mercadopago;

	// phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
	if ( class_exists( '\MercadoPago\Woocommerce\WoocommerceMercadoPago' ) &&
		class_exists( '\MercadoPago\Woocommerce\Configs\Store' ) &&
		$mercadopago instanceof \MercadoPago\Woocommerce\WoocommerceMercadoPago &&
		! is_null( $mercadopago->storeConfig ) &&
		$mercadopago->storeConfig instanceof \MercadoPago\Woocommerce\Configs\Store &&
		is_callable( array( $mercadopago->storeConfig, 'isTestMode' ) )
	) {
		return $mercadopago->storeConfig->isTestMode();

	}

	// Let the caller know that we couldn't determine the environment.
	return null;
}