Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
Visa::is_account_connected
Check if the payment gateway has a payments processor account connected.
Method of the class: Visa{}
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
$Visa = new Visa(); $Visa->is_account_connected( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
Visa::is_account_connected() Visa::is account connected code WC 10.9.4
public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
try {
if ( is_callable( array( $payment_gateway, 'get_config_settings' ) ) &&
defined( 'VISA_ACCEPTANCE_ENVIRONMENT_TEST' ) &&
defined( 'VISA_ACCEPTANCE_ENVIRONMENT_PRODUCTION' ) ) {
$settings = $payment_gateway->get_config_settings();
return is_array( $settings ) && isset( $settings['environment'] ) &&
( ( \VISA_ACCEPTANCE_ENVIRONMENT_TEST === $settings['environment'] &&
! empty( $settings['test_merchant_id'] ) &&
! empty( $settings['test_api_key'] ) &&
! empty( $settings['test_api_shared_secret'] ) ) ||
( \VISA_ACCEPTANCE_ENVIRONMENT_PRODUCTION === $settings['environment'] &&
! empty( $settings['merchant_id'] ) &&
! empty( $settings['api_key'] ) &&
! empty( $settings['api_shared_secret'] ) ) );
}
} 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 );
}