> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vellaro.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Test Connection (/iute/settings/test)

> Le tre letture con le chiavi SALVATE dell'ambiente (`environment` del corpo, assente = quello salvato):
`public_key` (`GET /client/eshop/settings`), `admin_key` (`GET /management/loan-product`), `limits`
(`range-set`); da R1 anche `status_path` e `product_mapping`, informative. Esito per lettura: `ok`,
`missing_key`, `key_rejected`, `unavailable`, `remote_error`, `keys_mismatch` su `public_key` se le due chiavi
portano id del commerciante diversi, `path_missing` su `status_path`, e `out_of_time` per una lettura che il tetto
di tutta la prova (`settings.TEST_BUDGET_S`, sotto i 60 s di nginx) ha fermato; un errore di Iute NON è un errore
della rotta (200 con `ok: false`). Anche fermata dal tetto la prova si registra e si mette nell'audit prima della
risposta.

Registra l'esito nell'ambiente (`connection.<env>`: la riuscita vale 24 ore per accendere) e `merchant_id_<env>`
solo se la prova è riuscita e la risposta dell'admin key porta un solo id. Se le chiavi dell'ambiente cambiano
durante la prova l'esito si scarta (`recorded: false`). 409 `iute.not_allowed` (`data = {environment}`) senza
il permesso dell'hub: nessuna chiamata a Iute, nulla registrato, nessun audit. 429 oltre 5 prove al minuto per
negozio. Audit `iute.connection_test` con ambiente ed esiti, senza chiavi né risposte di Iute.



## OpenAPI

````yaml https://api.vellaro.io/openapi/admin.json post /api/v1/admin/iute/settings/test
openapi: 3.1.0
info:
  title: Vellaro Admin API
  description: >-
    Store management under `/api/v1/admin`, for back ends and integrations.
    Every call takes `Authorization: Bearer <token>`: an admin API token or a
    staff user's token. The permissions of its role decide what it can do,
    always in its own store.
  version: 0.1.0
servers:
  - url: https://api.vellaro.io
    description: Produzione
security: []
tags:
  - name: Orders
    description: >-
      Orders and manual orders, payments, refunds, shipments, invoices, returns,
      customer subscriptions.
  - name: Products
    description: Products, variants, images, prices and discounts, product lookups.
  - name: Categories & catalog setup
    description: >-
      Categories, brands, attributes, options, filters, downloadable files,
      recurring profiles.
  - name: Inventory
    description: Stock of the variants and stock statuses.
  - name: Customers
    description: Customers, customer groups, custom fields.
  - name: Reviews & questions
    description: Moderation of product reviews and questions.
  - name: Promotions & coupons
    description: Coupons and gift vouchers.
  - name: Marketing
    description: Campaigns, newsletter subscribers, affiliates and their commissions.
  - name: Content
    description: >-
      CMS pages, menus, banners, information pages, flipbooks, media library,
      SEO URLs, email templates, translations.
  - name: Settings
    description: >-
      Store settings, email delivery, languages, currencies, physical stores,
      social login providers.
  - name: Shipping
    description: Couriers, shipping rates, weight and length classes.
  - name: Taxes & geo
    description: Tax classes, rates and rules; countries, zones and geo zones.
  - name: Integrations & modules
    description: >-
      Integrations, plugins and modules (Iute, extra warranty, Nextera, Financa
      5, WhatsApp, Firebase), outbound webhooks.
  - name: AI
    description: AI content generation and the settings of the AI shopping assistant.
  - name: Imports
    description: 'CSV imports and the universal import: runs, mappings, previews, undo.'
  - name: Reports & dashboard
    description: Dashboard figures and reports.
  - name: Users & API keys
    description: Staff users and roles, publishable keys, admin API tokens.
  - name: Audit
    description: The store's audit log.
paths:
  /api/v1/admin/iute/settings/test:
    post:
      tags:
        - Integrations & modules
      summary: Test Connection (/iute/settings/test)
      description: >-
        Le tre letture con le chiavi SALVATE dell'ambiente (`environment` del
        corpo, assente = quello salvato):

        `public_key` (`GET /client/eshop/settings`), `admin_key` (`GET
        /management/loan-product`), `limits`

        (`range-set`); da R1 anche `status_path` e `product_mapping`,
        informative. Esito per lettura: `ok`,

        `missing_key`, `key_rejected`, `unavailable`, `remote_error`,
        `keys_mismatch` su `public_key` se le due chiavi

        portano id del commerciante diversi, `path_missing` su `status_path`, e
        `out_of_time` per una lettura che il tetto

        di tutta la prova (`settings.TEST_BUDGET_S`, sotto i 60 s di nginx) ha
        fermato; un errore di Iute NON è un errore

        della rotta (200 con `ok: false`). Anche fermata dal tetto la prova si
        registra e si mette nell'audit prima della

        risposta.


        Registra l'esito nell'ambiente (`connection.<env>`: la riuscita vale 24
        ore per accendere) e `merchant_id_<env>`

        solo se la prova è riuscita e la risposta dell'admin key porta un solo
        id. Se le chiavi dell'ambiente cambiano

        durante la prova l'esito si scarta (`recorded: false`). 409
        `iute.not_allowed` (`data = {environment}`) senza

        il permesso dell'hub: nessuna chiamata a Iute, nulla registrato, nessun
        audit. 429 oltre 5 prove al minuto per

        negozio. Audit `iute.connection_test` con ambiente ed esiti, senza
        chiavi né risposte di Iute.
      operationId: test_connection_api_v1_admin_iute_settings_test_post
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/IuteTestIn'
                - type: 'null'
              title: Body
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_IuteTestOut_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    IuteTestIn:
      properties:
        environment:
          anyOf:
            - type: string
              enum:
                - test
                - live
            - type: 'null'
          title: Environment
      additionalProperties: false
      type: object
      title: IuteTestIn
      description: >-
        POST /admin/iute/settings/test: l'ambiente da provare (assente = quello
        salvato). Si provano solo le chiavi

        SALVATE: la prova vale per quelle, ed è la condizione per accendere.
    ApiResponse_IuteTestOut_:
      properties:
        data:
          anyOf:
            - $ref: '#/components/schemas/IuteTestOut'
            - type: 'null'
        meta:
          anyOf:
            - $ref: '#/components/schemas/PaginationMeta'
            - type: 'null'
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ApiResponse[IuteTestOut]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    IuteTestOut:
      properties:
        environment:
          type: string
          enum:
            - test
            - live
          title: Environment
        ok:
          type: boolean
          title: Ok
        tested_at:
          type: string
          format: date-time
          title: Tested At
        checks:
          items:
            $ref: '#/components/schemas/IuteCheckOut'
          type: array
          title: Checks
        connection:
          $ref: '#/components/schemas/IuteConnectionOut'
        recorded:
          type: boolean
          title: Recorded
      type: object
      required:
        - environment
        - ok
        - tested_at
        - checks
        - connection
        - recorded
      title: IuteTestOut
    PaginationMeta:
      properties:
        page:
          type: integer
          title: Page
        page_size:
          type: integer
          title: Page Size
        total:
          type: integer
          title: Total
        total_pages:
          type: integer
          title: Total Pages
      type: object
      required:
        - page
        - page_size
        - total
        - total_pages
      title: PaginationMeta
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    IuteCheckOut:
      properties:
        name:
          type: string
          enum:
            - public_key
            - admin_key
            - limits
            - status_path
            - product_mapping
          title: Name
        ok:
          type: boolean
          title: Ok
        code:
          type: string
          enum:
            - ok
            - missing_key
            - key_rejected
            - unavailable
            - remote_error
            - keys_mismatch
            - path_missing
            - out_of_time
          title: Code
        http_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Http Status
        details:
          additionalProperties: true
          type: object
          title: Details
      type: object
      required:
        - name
        - ok
        - code
      title: IuteCheckOut
      description: L'esito di una lettura della prova.
    IuteConnectionOut:
      properties:
        checked_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Checked At
        ok_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ok At
        result:
          anyOf:
            - type: string
              enum:
                - ok
                - failed
            - type: 'null'
          title: Result
        fresh:
          type: boolean
          title: Fresh
        merchant_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Merchant Id
        status_path:
          anyOf:
            - type: string
              enum:
                - v2
                - v1
                - loan_application
            - type: 'null'
          title: Status Path
        status_path_verified:
          type: boolean
          title: Status Path Verified
          default: false
        status_path_checked_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Status Path Checked At
        pay_now_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Pay Now Enabled
        pay_in_parts_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Pay In Parts Enabled
        mapping_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Mapping Count
        probe_orders:
          items:
            $ref: '#/components/schemas/ProbeOrder'
          type: array
          title: Probe Orders
      type: object
      required:
        - checked_at
        - ok_at
        - result
        - fresh
        - merchant_id
      title: IuteConnectionOut
      description: L'ultima prova connessione di un ambiente.
    ProbeOrder:
      properties:
        order_id:
          type: string
          title: Order Id
        created_at:
          type: string
          title: Created At
        code:
          type: string
          enum:
            - ok
            - missing_key
            - key_rejected
            - signature_rejected
            - rejected
            - unavailable
            - remote_error
          title: Code
          default: ok
        http_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Http Status
        variant:
          $ref: '#/components/schemas/ProbeVariant'
        has_checkout_url:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Has Checkout Url
        rejected_fields:
          items:
            type: string
          type: array
          title: Rejected Fields
        reads:
          additionalProperties:
            $ref: '#/components/schemas/StatusReadState'
          propertyNames:
            enum:
              - v2
              - v1
              - loan_application
          type: object
          title: Reads
        iute_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Iute Code
        pay_now_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Pay Now Enabled
        pay_in_parts_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Pay In Parts Enabled
        session_id_shape:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id Shape
        body_keys:
          items:
            type: string
          type: array
          title: Body Keys
      type: object
      required:
        - order_id
        - created_at
      title: ProbeOrder
      description: >-
        Una voce di `probe_orders_<env>`: una sessione di prova SENZA domanda
        (IUTE-11e, REV-4). Solo codici, nomi dei

        campi e forme: mai il corpo, mai dati di un cliente. `reads` = per rotta
        l'ultima lettura dello stato di

        `order_id` (una rotta mai letta manca); la scrivono la prova sessione e
        la prova connessione.
    ProbeVariant:
      properties:
        currency:
          type: string
          enum:
            - ALL
            - lek
            - all
          title: Currency
          default: ALL
        lines:
          type: string
          enum:
            - raw
            - prorated
          title: Lines
          default: raw
        signed:
          type: boolean
          title: Signed
          default: true
        repeat_of:
          anyOf:
            - type: string
            - type: 'null'
          title: Repeat Of
        totals:
          type: string
          enum:
            - number
            - text
          title: Totals
          default: number
        checkout_mode:
          anyOf:
            - type: string
              const: REDIRECT
            - type: 'null'
          title: Checkout Mode
        signature:
          type: string
          enum:
            - valid
            - altered
            - stale
          title: Signature
          default: valid
        cart:
          type: string
          enum:
            - decimal
            - whole
          title: Cart
          default: decimal
        headers:
          type: string
          enum:
            - both
            - admin
            - api
          title: Headers
          default: both
        phone:
          type: string
          enum:
            - e164
            - local
          title: Phone
          default: e164
      type: object
      title: ProbeVariant
      description: >-
        Le varianti di P-1 di una sessione di prova (IUTE-8): la forma della
        valuta, il modo delle righe, la firma, e

        l'`orderId` di una sessione precedente riusato (P-1 (10)) o None. Da
        IUTE-11e anche `totals` (`number` = i totali

        numeri JSON e `a` lo `strval` del totale come WOO, P-1 (1); `text` =
        totali stringa a due decimali anche nella

        firma, P-1 (2)) e `checkout_mode` (`REDIRECT` = `checkoutMode` nel
        payload oltre agli URL di ritorno, P-1 (9));

        poi `signature` (con `signed`: `valid`, `altered` = una firma che non
        torna, `stale` = firmata 30 minuti prima),

        `cart` (`decimal` = il carrello di REV-5, 8278,50; `whole` = lo stesso a
        lek interi, P-1 (4)), `headers` (C9,

        P-1 (8): `both`, solo `admin` key o solo chiave pubblica `api`) e
        `phone` (`e164` o `local`, P-1 (11)). Una voce

        scritta prima vale coi predefiniti, che sono le forme del checkout.
    StatusReadState:
      properties:
        code:
          type: string
          enum:
            - ok
            - path_missing
            - key_rejected
            - unavailable
            - remote_error
            - missing_key
          title: Code
        status:
          anyOf:
            - type: string
              enum:
                - PENDING
                - IN_PROGRESS
                - SIGNED
                - PAID
                - CANCELLED
                - NOT_FOUND
                - UNKNOWN
            - type: 'null'
          title: Status
        http_status:
          anyOf:
            - type: integer
            - type: 'null'
          title: Http Status
        checked_at:
          type: string
          title: Checked At
        mismatch:
          anyOf:
            - type: string
              enum:
                - order_id
                - order_id_missing
                - session_id
                - entries
            - type: 'null'
          title: Mismatch
        raw_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Raw Status
        body_keys:
          items:
            type: string
          type: array
          title: Body Keys
      type: object
      required:
        - code
        - checked_at
      title: StatusReadState
      description: >-
        L'ultima lettura dello stato di un `orderId` su una rotta
        (`IuteStatusRead` dell'admin): solo codici.


        Dalla prova sessione (IUTE-11e) anche le forme della risposta, per
        IUTE-7 e IUTE-8: `mismatch` (perché è ambigua,

        con `status` UNKNOWN), `raw_status` (uno stato che non conosciamo, solo
        se ha la forma di un nome) e `body_keys` (i

        NOMI dei campi del corpo, mai i valori). Facoltativi: una lettura della
        prova connessione non li porta.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.