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

WooPaymentsService::mark_onboarding_step_blockedprivateWC 1.0

Mark an onboarding step as blocked.

This is for internal use only as a blocked step status should not be the result of a user action.

Method of the class: WooPaymentsService{}

No Hooks.

Returns

true|false. Whether the onboarding step was marked as blocked.

Usage

// private - for code of main (parent) class only
$result = $this->mark_onboarding_step_blocked( $step_id, $location, $errors ): bool;
$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.
$errors(array)
A list of errors to be stored for the step to provide context to API consumers.
Default: array()

WooPaymentsService::mark_onboarding_step_blocked() code WC 10.7.0

private function mark_onboarding_step_blocked( string $step_id, string $location, array $errors = array() ): bool {
	// There is no need to do onboarding checks because setting a step as blocked should be possible at any time.

	// Record the error for the step, even if it is empty.
	// This will ensure we only store the most recent error.
	$this->save_nox_profile_onboarding_step_data_entry( $step_id, $location, 'error', $this->sanitize_onboarding_step_error( $errors ) );

	$statuses = (array) $this->get_nox_profile_onboarding_step_entry( $step_id, $location, 'statuses' );

	// Mark the step as blocked and record the timestamp.
	$statuses[ self::ONBOARDING_STEP_STATUS_BLOCKED ] = $this->proxy->call_function( 'time' );

	// Make sure we clear the failed status if it was set since blocked and failed should be mutually exclusive.
	unset( $statuses[ self::ONBOARDING_STEP_STATUS_FAILED ] );

	// Store the updated step data.
	return $this->save_nox_profile_onboarding_step_entry( $step_id, $location, 'statuses', $statuses );
}