Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
MercadoPago::is_mercado_pago_onboarded
Check if the MercadoPago payment gateway is onboarded.
For MercadoPago, there are two different environments: sandbox/test and production/sale.
Метод класса: MercadoPago{}
Хуков нет.
Возвращает
?true|false. True if the payment gateway is onboarded, false otherwise. Null if we failed to determine the onboarding status.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_mercado_pago_onboarded( $payment_gateway ): ?bool;
- $payment_gateway(WC_Payment_Gateway) (обязательный)
- The payment gateway object.
Код MercadoPago::is_mercado_pago_onboarded() MercadoPago::is mercado pago onboarded WC 10.8.1
private function is_mercado_pago_onboarded( WC_Payment_Gateway $payment_gateway ): ?bool {
global $mercadopago;
try {
// 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() );
}
} catch ( \Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway is onboarded: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
// Let the caller know that we couldn't determine the onboarding status.
return null;
}