Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
HelioPay::is_account_connected
Check if the payment gateway has a payments processor account connected.
Method of the class: HelioPay{}
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
$HelioPay = new HelioPay(); $HelioPay->is_account_connected( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
HelioPay::is_account_connected() HelioPay::is account connected code WC 10.7.0
public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
try {
if ( $this->is_in_test_mode( $payment_gateway ) ) {
if ( defined( 'HELIO_API_KEY_DEVNET' ) &&
defined( 'HELIO_API_SECRET_DEVNET' ) ) {
return ! empty( $payment_gateway->get_option( \HELIO_API_KEY_DEVNET ) ) && ! empty( $payment_gateway->get_option( \HELIO_API_SECRET_DEVNET ) );
}
} elseif ( defined( 'HELIO_API_KEY_MAINNET' ) &&
defined( 'HELIO_API_SECRET_MAINNET' ) ) {
return ! empty( $payment_gateway->get_option( \HELIO_API_KEY_MAINNET ) ) && ! empty( $payment_gateway->get_option( \HELIO_API_SECRET_MAINNET ) );
}
} 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 );
}