Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

MercadoPago::is_mercado_pago_onboardedprivateWC 1.0

Check if the MercadoPago payment gateway is onboarded.

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

Method of the class: MercadoPago{}

No Hooks.

Returns

?true|false. True if the payment gateway is onboarded, false otherwise. Null if we failed to determine the onboarding status.

Usage

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

MercadoPago::is_mercado_pago_onboarded() code WC 9.8.5

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

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

	}

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