Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

Mollie::is_account_connectedpublicWC 1.0

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

Метод класса: Mollie{}

Хуков нет.

Возвращает

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.

Использование

$Mollie = new Mollie();
$Mollie->is_account_connected( $payment_gateway ): bool;
$payment_gateway(WC_Payment_Gateway) (обязательный)
The payment gateway object.

Код Mollie::is_account_connected() WC 10.7.0

public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
	try {
		$sandbox_mode = $this->is_mollie_in_sandbox_mode( $payment_gateway );
		// Let null results bubble up to the parent class.
		if ( true === $sandbox_mode ) {
			// If Mollie is in sandbox mode, we consider the account connected if the test API key is set.
			return ! empty( get_option( 'mollie-payments-for-woocommerce_test_api_key', '' ) );
		} elseif ( false === $sandbox_mode ) {
			// In production mode, we check the live API key.
			return ! empty( get_option( 'mollie-payments-for-woocommerce_live_api_key', '' ) );
		}
	} 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 );
}