# Module Vérificateur

## Upload d'un ou plusieurs fichiers

<mark style="color:green;">`POST`</mark> `/verifier/upload`

#### Headers

| Name                                            | Type            | Description |
| ----------------------------------------------- | --------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer \<token> |             |

#### Request Body (form-data)

| Name                                         | Type        | Description                                                                                                                                                                               |
| -------------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| workflowId<mark style="color:red;">\*</mark> | string      | Identifiant technique du workflow (e.g : default\_workflow)                                                                                                                               |
| siret                                        | string      | SIRET d'un tiers. Si non présent dans la base Open-Capture, tentative de le créer depuis la base INSEE                                                                                    |
| vat\_number                                  | string      | Numéro de TVA d'un tiers. Si non présent dans la base Open-Capture, tentative de le créer depuis la base européenne                                                                       |
| siren                                        | string      | SIREN d'un tiers. Si non présent dans la base Open-Capture, tentative de le créer depuis la base INSEE                                                                                    |
| returnUniqueUrl                              | Boolean     | Si `true`, retourne un URL unique d'accès au viewer du Vérificateur pour traitement du document sans authentification. Un token est également retourné pour vérifier l'état du processus. |
| files<mark style="color:red;">\*</mark>      | FileStorage |                                                                                                                                                                                           |

{% tabs %}
{% tab title="200: OK " %}
```json
[
    {
        "filename": "YOUR_FILE_1.pdf",
        "token": "XXXXXX_XXXXXXXX_XXXXXXX",
        "uniqueUrl":"http://localhost/opencapture/edissyum/dist/#/verifier/viewer_token/XXXXX.XXXXX.XXXXXXX"
    },
    {
        "filename": "YOUR_FILE_2.pdf",
        "token": "XXXXXX_XXXXXXXX_XXXXXXX"
    }
]
```
{% endtab %}

{% tab title="400: Bad Request Paramètre obligatoire manquant ou erreur inconnue lors du traitement" %}

{% endtab %}

{% tab title="403: Forbidden returnUniqueUrl est à true mais le paramétrage de l'URL unique est erroné" %}

{% endtab %}
{% endtabs %}

## Récupération des documents

<mark style="color:blue;">`GET`</mark> `verifier/documents/list`

#### Path Parameters

| Name             | Type   | Description                                                                             |
| ---------------- | ------ | --------------------------------------------------------------------------------------- |
| time             | String | Récupérer les documents du jour, d'hier ou plus vieux (`today`, `yesterday` ou `older`) |
| search           | String | Fitrer les documents sur le numéro de facture ou le nom du tier                         |
| form\_id         | String | Filtrer les documents par formulaire                                                    |
| status           | String | Filtrer les documents par status                                                        |
| allowedCustomers | String | Filtrer les documents par compte client associé                                         |
| allowedSuppliers | String | Filtrer les documents par compte tiers associé                                          |

#### Headers

| Name                                            | Type            | Description |
| ----------------------------------------------- | --------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer \<token> |             |

{% tabs %}
{% tab title="200: OK " %}
```json
{
    "documents": [
        {
            "customer_id": 1,
            "datas": {
                "address1": "19 RUE VACON",
                "address2": null,
                "city": "Marseille",
                "country": "France",
                "document_date": "15/12/2016",
                "document_due_date": "14/01/2017",
                "duns": null,
                "form_id": 3,
                "invoice_number": "INV-001510",
                "lines_count": 0,
                "name": "Calinda Software",
                "no_rate_amount": 2042.5,
                "postal_code": 13001,
                "quotation_number": "AM161941219-1607",
                "siren": "493811251",
                "siret": "49381125100047",
                "taxes_count": 1,
                "total_ht": 2042.5,
                "total_ttc": 2451.0,
                "total_vat": "408.50",
                "vat_amount": "408.50",
                "vat_number": "FR71510268261",
                "vat_rate": 20.0
            },
            "date": "09-05-2023 à 15:29:47",
            "default_form": false,
            "document_id": 791,
            "enabled": true,
            "facturx": false,
            "facturx_level": null,
            "filename": "09052023_152946_b0fa2928eb7a448cb05f187e60c1de05.pdf",
            "form_id": 3,
            "form_label": "Formulaire par défaut",
            "full_jpg_filename": "e31e0ee3-172b-4559-b42c-d64584187846-001.jpg",
            "id": 3,
            "img_width": 2481,
            "label": "Formulaire par défaut",
            "labels": {},
            "locked": false,
            "locked_by": "admin",
            "module": "verifier",
            "nb_pages": 2,
            "original_filename": "CALINDA_INV-001510_bbeq.pdf",
            "outputs": [
                "1",
                "3"
            ],
            "pages": {
                "document_date": 1,
                "document_due_date": 1,
                "invoice_number": 1,
                "no_rate_amount": 1,
                "quotation_number": 1,
                "total_ht": 1,
                "total_ttc": 1,
                "vat_rate": 1
            },
            "path": "/var/docservers/opencapture/edissyum/verifier/original_pdf//2023/05",
            "positions": {
                "document_date": {
                    "height": 32,
                    "width": 737,
                    "x": 197,
                    "y": 605
                },
                "document_due_date": {
                    "height": 40,
                    "width": 2087,
                    "x": 197,
                    "y": 825
                },
                "invoice_number": {
                    "height": 40,
                    "width": 2095,
                    "x": 194,
                    "y": 243
                },
                "no_rate_amount": {
                    "height": 48,
                    "width": 594,
                    "x": 1664,
                    "y": 2831
                },
                "quotation_number": {
                    "height": 47,
                    "width": 2089,
                    "x": 197,
                    "y": 920
                },
                "siren": "",
                "total_ht": {
                    "height": 48,
                    "width": 594,
                    "x": 1664,
                    "y": 2831
                },
                "total_ttc": {
                    "height": 34,
                    "width": 515,
                    "x": 1743,
                    "y": 3060
                },
                "vat_rate": {
                    "height": 33,
                    "width": 593,
                    "x": 1665,
                    "y": 2949
                }
            },
            "purchase_or_sale": "purchase",
            "register_date": "Tue, 09 May 2023 15:29:47 GMT",
            "settings": {
                "allow_automatic_validation": false,
                "automatic_validation_data": "only_ocr",
                "delete_documents_after_outputs": true,
                "supplier_verif": false,
                "unique_url": {
                    "allow_supplier_autocomplete": true,
                    "change_form": true,
                    "create_supplier": true,
                    "enable_supplier": true,
                    "expiration": 7,
                    "refuse_document": true,
                    "validate_document": true
                }
            },
            "status": "OK",
            "supplier_id": 1,
            "supplier_name": "Calinda Software",
            "thumb": "B64 THUMB"
        }
    ]
}
```
{% endtab %}
{% endtabs %}
