Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
Antom::is_account_connected
Check if the payment gateway has a payments processor account connected.
Method of the class: Antom{}
No Hooks.
Returns
true|false. True if the payment gateway account is connected, false otherwise. If the payment gateway does not provide the information, it will return true.
Usage
$Antom = new Antom(); $Antom->is_account_connected( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
Antom::is_account_connected() Antom::is account connected code WC 10.9.4
public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
try {
if ( function_exists( '\antom_is_active' ) &&
! \antom_is_active() ) {
return false;
}
if ( function_exists( '\antom_get_core_settings' ) ) {
$core_settings = \antom_get_core_settings();
if ( ! is_array( $core_settings ) ) {
return false;
}
unset( $core_settings['test_mode'] );
// All remaining entries must not be empty.
foreach ( $core_settings as $setting ) {
if ( empty( $setting ) ) {
return false;
}
}
return true;
}
} catch ( Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway has an account connected: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
return parent::is_account_connected( $payment_gateway );
}