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

WooPaymentsRestController::get_schema_for_get_onboarding_detailsprivateWC 1.0

Get the schema for the GET onboarding details request.

Method of the class: WooPaymentsRestController{}

No Hooks.

Returns

Array[].

Usage

// private - for code of main (parent) class only
$result = $this->get_schema_for_get_onboarding_details(): array;

WooPaymentsRestController::get_schema_for_get_onboarding_details() code WC 10.7.0

private function get_schema_for_get_onboarding_details(): array {
	$schema               = array(
		'$schema' => 'http://json-schema.org/draft-04/schema#',
		'title'   => 'WooCommerce Settings Payments WooPayments onboarding details for the given location.',
		'type'    => 'object',
	);
	$schema['properties'] = array(
		'state'    => array(
			'type'        => 'object',
			'description' => esc_html__( 'The general state of the onboarding process.', 'woocommerce' ),
			'context'     => array( 'view', 'edit' ),
			'readonly'    => true,
			'properties'  => array(
				'supported' => array(
					'type'        => 'boolean',
					'description' => esc_html__( 'Whether onboarding is supported.', 'woocommerce' ),
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'started'   => array(
					'type'        => 'boolean',
					'description' => esc_html__( 'Whether the onboarding process is started.', 'woocommerce' ),
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'completed' => array(
					'type'        => 'boolean',
					'description' => esc_html__( 'Whether the onboarding process is completed.', 'woocommerce' ),
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'test_mode' => array(
					'type'        => 'boolean',
					'description' => esc_html__( 'Whether the onboarding process is in test mode.', 'woocommerce' ),
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
				'dev_mode'  => array(
					'type'        => 'boolean',
					'description' => esc_html__( 'Whether WooPayments is in dev mode.', 'woocommerce' ),
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
				),
			),
		),
		'messages' => array(
			'type'                 => 'object',
			'description'          => esc_html__( 'Various messages to possibly show the user.', 'woocommerce' ),
			'context'              => array( 'view', 'edit' ),
			'readonly'             => true,
			'additionalProperties' => array(
				'type'        => 'string',
				'description' => esc_html__( 'Message to show the user.', 'woocommerce' ),
				'readonly'    => true,
			),
		),
		'steps'    => array(
			'type'        => 'array',
			'description' => esc_html__( 'The onboarding steps.', 'woocommerce' ),
			'context'     => array( 'view', 'edit' ),
			'readonly'    => true,
			'items'       => array(
				'type'       => 'object',
				'properties' => array(
					'id'             => array(
						'type'        => 'string',
						'description' => esc_html__( 'The unique identifier for the step.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'path'           => array(
						'type'        => 'string',
						'description' => esc_html__( 'The relative path of the step to use for frontend navigation.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
					'required_steps' => array(
						'type'        => 'array',
						'description' => esc_html__( 'The steps that are required to be completed before this step.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
						'items'       => array(
							'type' => 'string',
						),
					),
					'status'         => array(
						'type'        => 'string',
						'description' => esc_html__( 'The current status of the step.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
						'enum'        => array(
							WooPaymentsService::ONBOARDING_STEP_STATUS_NOT_STARTED,
							WooPaymentsService::ONBOARDING_STEP_STATUS_STARTED,
							WooPaymentsService::ONBOARDING_STEP_STATUS_COMPLETED,
						),
					),
					'errors'         => array(
						'type'        => 'array',
						'description' => esc_html__( 'Errors list for the step.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
						'items'       => array(
							'type'       => 'object',
							'properties' => array(
								'code'    => array(
									'type'     => 'string',
									'readonly' => true,
								),
								'message' => array(
									'type'     => 'string',
									'readonly' => true,
								),
								'context' => array(
									'type'     => 'object',
									'readonly' => true,
								),
							),
						),
					),
					'actions'        => array(
						'type'        => 'object',
						'description' => esc_html__( 'The available actions for the step.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
						'properties'  => array(
							'start'                => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to signal the step start.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'save'                 => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to save step information in the database.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'check'                => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to check the step status.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'finish'               => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to signal the step completion.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'clean'                => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to clean the step progress.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'auth'                 => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to authorize the WPCOM connection.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'init'                 => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to initialize a test account.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'kyc_session'          => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to create or resume an embedded KYC session.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'kyc_session_finish'   => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to finish an embedded KYC session.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'kyc_fallback'         => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to use as a fallback when dealing with errors with the embedded KYC.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'reset'                => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to reset the onboarding process, either partially, for a certain step, or fully.', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
							'test_account_disable' => array(
								'type'        => 'object',
								'description' => esc_html__( 'Action to disable the test account currently in use', 'woocommerce' ),
								'properties'  => $this->get_schema_properties_for_onboarding_step_action(),
								'context'     => array( 'view', 'edit' ),
								'readonly'    => true,
							),
						),
					),
					'context'        => array(
						'type'        => 'object',
						'description' => esc_html__( 'Various contextual data for the step to use.', 'woocommerce' ),
						'context'     => array( 'view', 'edit' ),
						'readonly'    => true,
					),
				),
			),
		),
		'context'  => array(
			'type'        => 'object',
			'description' => esc_html__( 'Various contextual data for the onboarding process to use.', 'woocommerce' ),
			'context'     => array( 'view', 'edit' ),
			'readonly'    => true,
		),
	);

	return $schema;
}