Automattic\WooCommerce\Internal\Admin\Settings\PaymentProviders

PayPal::is_paypal_onboarded()privateWC 1.0

Check if the PayPal payment gateway is onboarded.

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

Хуков нет.

Возвращает

?true|false. True if the payment gateway is onboarded, false otherwise. Null if we failed to determine the onboarding status.

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

// private - только в коде основоного (родительского) класса
$result = $this->is_paypal_onboarded(): ?bool;

Код PayPal::is_paypal_onboarded() WC 9.6.0

private function is_paypal_onboarded(): ?bool {
	if ( class_exists( '\WooCommerce\PayPalCommerce\PPCP' ) &&
		is_callable( '\WooCommerce\PayPalCommerce\PPCP::container' ) &&
		defined( '\WooCommerce\PayPalCommerce\Onboarding\State::STATE_ONBOARDED' ) ) {

		try {
			$state = \WooCommerce\PayPalCommerce\PPCP::container()->get( 'onboarding.state' );
			return $state->current_state() >= \WooCommerce\PayPalCommerce\Onboarding\State::STATE_ONBOARDED;
		} catch ( \Exception $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
			// Ignore any exceptions.
		}
	}

	// Let the caller know that we couldn't determine the onboarding status.
	return null;
}