Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
Stripe::is_account_connected
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() Stripe::is account connected WC 10.5.0
public function is_account_connected( WC_Payment_Gateway $payment_gateway ): bool {
try {
if ( class_exists( '\WC_Stripe' ) && is_callable( '\WC_Stripe::get_instance' ) ) {
$stripe = \WC_Stripe::get_instance();
if ( is_object( $stripe ) && 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();
}
}
} catch ( Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway has account connected: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
return parent::is_account_connected( $payment_gateway );
}