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

WooPaymentsRestController::handle_onboarding_business_verification_kyc_session_finishprotectedWC 1.0

Handle the onboarding business verification step KYC session finish action.

Метод класса: WooPaymentsRestController{}

Хуков нет.

Возвращает

WP_Error|WP_REST_Response. The response or error.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->handle_onboarding_business_verification_kyc_session_finish( $request );
$request(WP_REST_Request) (обязательный)
The request object.

Код WooPaymentsRestController::handle_onboarding_business_verification_kyc_session_finish() WC 10.5.0

protected function handle_onboarding_business_verification_kyc_session_finish( WP_REST_Request $request ) {
	$location = $request->get_param( 'location' );
	if ( empty( $location ) ) {
		// Fall back to the providers country if no location is provided.
		$location = $this->payments->get_country();
	}

	$source = $request->get_param( 'source' );

	try {
		$response = $this->woopayments->finish_onboarding_kyc_session( $location, $source );
	} catch ( ApiException $e ) {
		return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
	}

	// If there is no success key in the response, we assume the operation was successful.
	if ( ! isset( $response['success'] ) ) {
		$response['success'] = true;
	}

	return rest_ensure_response( $response );
}