Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders\WooPayments
WooPaymentsService::check_if_onboarding_action_is_acceptable
Check if an onboarding action should be allowed to be processed.
Method of the class: WooPaymentsService{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->check_if_onboarding_action_is_acceptable();
WooPaymentsService::check_if_onboarding_action_is_acceptable() WooPaymentsService::check if onboarding action is acceptable code WC 10.8.1
private function check_if_onboarding_action_is_acceptable() {
// If the WooPayments plugin is not active, we can't do anything.
if ( ! $this->is_extension_active() ) {
throw new ApiException(
'woocommerce_woopayments_onboarding_extension_not_active',
/* translators: %s: WooPayments. */
sprintf( esc_html__( 'The %s extension is not active.', 'woocommerce' ), 'WooPayments' ),
(int) WP_Http::FORBIDDEN
);
}
// If the WooPayments installed version is less than the minimum required version, we can't do anything.
if ( Constants::is_defined( 'WCPAY_VERSION_NUMBER' ) &&
version_compare( Constants::get_constant( 'WCPAY_VERSION_NUMBER' ), self::EXTENSION_MINIMUM_VERSION, '<' ) ) {
throw new ApiException(
'woocommerce_woopayments_onboarding_extension_version',
/* translators: %s: WooPayments. */
sprintf( esc_html__( 'The %s extension is not up-to-date. Please update to the latest version and try again.', 'woocommerce' ), 'WooPayments' ),
(int) WP_Http::FORBIDDEN
);
}
// If the onboarding is locked, we shouldn't do anything.
if ( $this->is_onboarding_locked() ) {
throw new ApiException(
'woocommerce_woopayments_onboarding_locked',
esc_html__( 'Another onboarding action is already in progress. Please wait for it to finish.', 'woocommerce' ),
(int) WP_Http::CONFLICT
);
}
}