Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders
WooPayments::needs_setup()
Check if the payment gateway needs setup.
Метод класса: WooPayments{}
Хуков нет.
Возвращает
true|false
. True if the payment gateway needs setup, false otherwise.
Использование
$WooPayments = new WooPayments(); $WooPayments->needs_setup( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (обязательный)
- The payment gateway object.
Код WooPayments::needs_setup() WooPayments::needs setup WC 9.6.1
public function needs_setup( WC_Payment_Gateway $payment_gateway ): bool { // No account means we need setup. if ( ! $this->is_account_connected( $payment_gateway ) ) { return true; } if ( function_exists( '\wcpay_get_container' ) && class_exists( '\WC_Payments_Account' ) ) { $account = \wcpay_get_container()->get( \WC_Payments_Account::class ); if ( is_callable( array( $account, 'get_account_status_data' ) ) ) { // Test-drive accounts don't need setup. $account_status = $account->get_account_status_data(); if ( ! empty( $account_status['testDrive'] ) ) { return false; } } } return parent::needs_setup( $payment_gateway ); }