Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

Vivacom::is_account_connectedpublicWC 1.0

Check if the payment gateway has a payments processor account connected.

Method of the class: Vivacom{}

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

$Vivacom = new Vivacom();
$Vivacom->is_account_connected( $payment_gateway ): bool;
$payment_gateway(WC_Payment_Gateway) (required)
The payment gateway object.

Vivacom::is_account_connected() code WC 10.8.1

public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
	try {
		if ( $this->is_in_test_mode( $payment_gateway ) ) {
			return property_exists( $payment_gateway, 'test_client_id' ) && ! empty( $payment_gateway->test_client_id )
				&& property_exists( $payment_gateway, 'test_client_secret' ) && ! empty( $payment_gateway->test_client_secret )
				&& property_exists( $payment_gateway, 'test_source_code' ) && ! empty( $payment_gateway->test_source_code );
		} else {
			return property_exists( $payment_gateway, 'client_id' ) && ! empty( $payment_gateway->client_id )
				&& property_exists( $payment_gateway, 'client_secret' ) && ! empty( $payment_gateway->client_secret )
				&& property_exists( $payment_gateway, 'source_code' ) && ! empty( $payment_gateway->source_code );
		}
	} 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 );
}