Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders\WooPayments

WooPaymentsService::check_if_onboarding_step_action_is_acceptableprivateWC 1.0

Check if an onboarding step 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_step_action_is_acceptable( $step_id, $location ): void;
$step_id(string) (required)
The ID of the onboarding step.
$location(string) (required)
The location for which we are onboarding. This is an ISO 3166-1 alpha-2 country code.

WooPaymentsService::check_if_onboarding_step_action_is_acceptable() code WC 10.8.1

private function check_if_onboarding_step_action_is_acceptable( string $step_id, string $location ): void {
	// First, check general onboarding actions.
	$this->check_if_onboarding_action_is_acceptable();

	// Second, do onboarding step specific checks.
	if ( ! $this->is_valid_onboarding_step_id( $step_id ) ) {
		throw new ApiArgumentException(
			'woocommerce_woopayments_onboarding_invalid_step_id',
			esc_html__( 'Invalid onboarding step ID.', 'woocommerce' ),
			(int) WP_Http::BAD_REQUEST
		);
	}
	if ( ! $this->check_onboarding_step_requirements( $step_id, $location ) ) {
		throw new ApiException(
			'woocommerce_woopayments_onboarding_step_requirements_not_met',
			esc_html__( 'Onboarding step requirements are not met.', 'woocommerce' ),
			(int) WP_Http::FORBIDDEN
		);
	}
	if ( $this->is_onboarding_step_blocked( $step_id, $location ) ) {
		throw new ApiException(
			'woocommerce_woopayments_onboarding_step_blocked',
			esc_html__( 'There are environment or store setup issues which are blocking progress. Please resolve them to proceed.', 'woocommerce' ),
			(int) WP_Http::FORBIDDEN,
			array(
				'error' => map_deep( $this->get_onboarding_step_error( $step_id, $location ), 'esc_html' ),
			),
		);
	}
}