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

WooPaymentsService::clean_onboarding_step_progresspublicWC 1.0

Cleans an onboarding step progress.

Method of the class: WooPaymentsService{}

No Hooks.

Returns

true|false. Whether the onboarding step was cleaned.

Usage

$WooPaymentsService = new WooPaymentsService();
$WooPaymentsService->clean_onboarding_step_progress( $step_id, $location ): 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.

WooPaymentsService::clean_onboarding_step_progress() code WC 10.8.1

public function clean_onboarding_step_progress( string $step_id, string $location ): bool {
	// We need to do reduced acceptance checks here because this is a cleanup action.
	// First, check general if the onboarding action is acceptable.
	$this->check_if_onboarding_action_is_acceptable();
	// Second, check if the step ID is valid.
	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
		);
	}

	// Clear possible failed or blocked status for the step.
	$this->clear_onboarding_step_failed( $step_id, $location );
	$this->clear_onboarding_step_blocked( $step_id, $location );

	// Reset the stored step statuses.
	$result = $this->save_nox_profile_onboarding_step_entry( $step_id, $location, 'statuses', array() );

	if ( $result ) {
		// Record an event for the step being cleaned.
		$this->record_event(
			self::EVENT_PREFIX . 'onboarding_step_progress_reset',
			$location,
			array(
				'step_id' => $step_id,
			)
		);
	}

	return $result;
}