Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

Stripe::is_account_connected()publicWC 1.0

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

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

Хуков нет.

Возвращает

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.

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

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

Код Stripe::is_account_connected() WC 9.6.1

public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
	if ( class_exists( '\WC_Stripe' ) && is_callable( '\WC_Stripe::get_instance' ) ) {
		$stripe = \WC_Stripe::get_instance();
		if ( isset( $stripe->account ) &&
			class_exists( '\WC_Stripe_Account' ) &&
			defined( '\WC_Stripe_Account::STATUS_NO_ACCOUNT' ) &&
			$stripe->account instanceof \WC_Stripe_Account &&
			is_callable( array( $stripe->account, 'get_account_status' ) ) ) {

			return \WC_Stripe_Account::STATUS_NO_ACCOUNT !== $stripe->account->get_account_status();
		}
	}

	return parent::is_account_connected( $payment_gateway );
}