Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders\WooPayments
WooPaymentsService::skip_onboarding_test_account_step
Skip the test account onboarding step forward due to a non-recoverable failure.
Marks the step completed (so onboarding can proceed), records an event, and throws a dedicated exception so the client can inform the merchant and advance.
Uses the internal record method (not mark_onboarding_step_completed()) because the onboarding lock was already released and this state change is the consequence of the failed initialization, not a new user action.
Method of the class: WooPaymentsService{}
No Hooks.
Returns
void. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->skip_onboarding_test_account_step( $location, ?string $source, $context ): void;
- $location(string) (required)
- The location for which we are onboarding. This is an ISO 3166-1 alpha-2 country code.
- ?string $source(required)
- .
- $context(array)
- Additional event context (e.g. reason, error code).
Default:array()
WooPaymentsService::skip_onboarding_test_account_step() WooPaymentsService::skip onboarding test account step code WC 11.1.2
private function skip_onboarding_test_account_step( string $location, ?string $source, array $context = array() ): void {
$step_recorded = $this->record_onboarding_step_completed( self::ONBOARDING_STEP_TEST_ACCOUNT, $location, false, $source, true );
if ( ! $step_recorded ) {
// Leave a trail before falling back to the regular failure handling.
$this->proxy->call_function( 'wc_get_logger' )->error(
'Failed to record the test account onboarding step as completed while skipping it forward.',
array(
'source' => 'settings-payments',
'location' => $location,
)
);
// Without the completed status persisted, advancing the client would desync it from
// the stored onboarding state. Fail the step instead: the client shows the regular
// error with a retry, and a later attempt can complete the skip.
$this->mark_onboarding_step_failed(
self::ONBOARDING_STEP_TEST_ACCOUNT,
$location,
array(
'code' => 'skip_forward_not_persisted',
'message' => esc_html__( 'Failed to record the onboarding progress.', 'woocommerce' ),
'context' => $context,
)
);
throw new ApiException(
'woocommerce_woopayments_onboarding_client_api_error',
esc_html__( 'Failed to initialize the test account.', 'woocommerce' ),
(int) WP_Http::FAILED_DEPENDENCY
);
}
$this->record_event(
self::EVENT_PREFIX . 'onboarding_test_account_skipped',
$location,
array_merge(
array( 'source' => $this->validate_onboarding_source( $source ) ),
$context
)
);
throw new ApiException(
'woocommerce_woopayments_onboarding_test_account_non_recoverable_error',
esc_html__( 'A test account could not be created, but onboarding can continue without it.', 'woocommerce' ),
(int) WP_Http::FAILED_DEPENDENCY
);
}