Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
Komoju::is_account_connected
Check if the payment gateway has a payments processor account connected.
Method of the class: Komoju{}
No Hooks.
Returns
bool. True if the payment gateway account is connected, false otherwise. If the payment gateway does not provide the information, it will return true.
Usage
$Komoju = new Komoju(); $Komoju->is_account_connected( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
Komoju::is_account_connected() Komoju::is account connected code WC 11.2.1
public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
try {
// KOMOJU doesn't expose a dedicated "is connected" API. It considers the merchant
// connected once a secret key is saved.
return ! empty( $this->get_secret_key( $payment_gateway ) );
} catch ( Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway account is connected: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
return parent::is_account_connected( $payment_gateway );
}