# Comptes tiers et clients

## Adresses

## Création d'une adresse

<mark style="color:green;">`POST`</mark> `/accounts/addresses/create`

#### Headers

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

#### Request Body

| Name                                   | Type | Description                                                                              |
| -------------------------------------- | ---- | ---------------------------------------------------------------------------------------- |
| args<mark style="color:red;">\*</mark> | json | {"args": {"address1": "", "address2: "", "city": "", "country": "", "postal\_code": ""}} |

{% tabs %}
{% tab title="200: OK id : integer" %}

{% endtab %}
{% endtabs %}

## Récupération d'une adresse par identifiant

<mark style="color:green;">`POST`</mark> `/accounts/getAdressById/<int:address_id>`

#### Path Parameters

| Name        | Type    | Description              |
| ----------- | ------- | ------------------------ |
| address\_id | integer | Identifiant de l'adresse |

#### Headers

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

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="400: Bad Request L'adresse n'existe pas" %}

{% endtab %}
{% endtabs %}

<details>

<summary>Retour du web service</summary>

```json
{
    "address1": "98 Avenue Pierre Semard",
    "address2": null,
    "city": "CARPENTRAS",
    "country": "FRANCE",
    "creation_date": "Fri, 28 Jul 2023 16:50:45 GMT",
    "id": 1,
    "postal_code": "84200"
}
```

</details>

## Comptes tiers

## Récupération des comptes tiers

<mark style="color:blue;">`GET`</mark> `/accounts/suppliers/list`

#### Path Parameters

| Name   | Type   | Description                                                       |
| ------ | ------ | ----------------------------------------------------------------- |
| limit  | String | Nombres de résultats maximum à retourner                          |
| offset | String | Commencer à partir du Xème résultat                               |
| search | String | Filtrer fournisseur sur nom, email, SIRET, SIREN et numéro de TVA |
| order  | String | Choix de la colonne utilisé pour l'ordre.                         |

#### Headers

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

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="400: Bad Request Aucun compte fournisseur" %}

{% endtab %}
{% endtabs %}

<details>

<summary>Retour du web service</summary>

```json
{
    "suppliers": [
        {
            "address_id": 23,
            "creation_date": "Fri, 24 Mar 2023 16:07:33 GMT",
            "document_lang": "fra",
            "email": null,
            "form_id": null,
            "get_only_raw_footer": false,
            "iban": null,
            "id": 15,
            "lang": "fra",
            "name": "Au bon moulin",
            "pages": {},
            "positions": {},
            "siren": "787878784",
            "siret": "78787878400035",
            "skip_auto_validate": false,
            "status": "OK",
            "total": 8,
            "vat_number": "FR11999999998"
        }
    ]
}
```

</details>

## Récupération d'un compte tiers par identifiant

<mark style="color:blue;">`GET`</mark> `/accounts/suppliers/getById/<int:supplier_id>`

#### Path Parameters

| Name                                           | Type    | Description                       |
| ---------------------------------------------- | ------- | --------------------------------- |
| supplier\_id<mark style="color:red;">\*</mark> | integer | Identifiant du compte fournisseur |

#### Headers

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

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="400: Bad Request Le fournisseur n'existe pas" %}

{% endtab %}
{% endtabs %}

<details>

<summary>Retour du web service</summary>

```json
{
    "address_id": 8,
    "creation_date": "Tue, 04 Apr 2023 14:59:52 GMT",
    "document_lang": "fra",
    "email": null,
    "form_id": null,
    "get_only_raw_footer": false,
    "iban": null,
    "id": 7,
    "lang": "fra",
    "name": "Au bon moulin",
    "pages": {},
    "positions": {},
    "siren": "787878784",
    "siret": "78787878400035",
    "skip_auto_validate": false,
    "status": "OK",
    "vat_number": "FR11999999998"
}
```

</details>

## Création d'un compte tiers

<mark style="color:green;">`POST`</mark> `/accounts/suppliers/create`

#### Headers

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

#### Request Body

| Name                                   | Type | Description                                                                                                                                                                             |
| -------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| args<mark style="color:red;">\*</mark> | json | {"args": {"get\_only\_raw\_footer": false, "name": "", "vat\_number": "", "siret": "", "siren": "", "iban": "", "email": "", "form\_id": 0, "document\_lang": "fra", "address\_id": 0}} |

{% tabs %}
{% tab title="200: OK id : integer" %}

{% endtab %}
{% endtabs %}

## Suppression d'un compte tiers

<mark style="color:red;">`DELETE`</mark> `accounts/suppliers/delete/<int:supplier_id>`

#### Path Parameters

| Name                                           | Type    | Description                       |
| ---------------------------------------------- | ------- | --------------------------------- |
| supplier\_id<mark style="color:red;">\*</mark> | integer | Identifiant du compte fournisseur |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}
{% endtabs %}

## Comptes clients

## Récupération des comptes clients

<mark style="color:blue;">`GET`</mark> `/accounts/customers/list`

#### Path Parameters

| Name   | Type   | Description                                                       |
| ------ | ------ | ----------------------------------------------------------------- |
| limit  | String | Nombres de résultats maximum à retourner                          |
| offset | String | Commencer à partir du Xème résultat                               |
| search | String | Filtrer fournisseur sur nom, email, SIRET, SIREN et numéro de TVA |
| order  | String | Choix de la colonne utilisé pour l'ordre.                         |
| module |        | verifier ou splitter                                              |

#### Headers

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

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}
{% endtabs %}

<details>

<summary>Retour du web service</summary>

```json
{
    "customers": [
        {
            "address_id": null,
            "company_number": null,
            "creation_date": "Mon, 09 Jan 2023 11:26:38 GMT",
            "id": 1,
            "module": "splitter",
            "name": "Splitter - Compte client par défaut",
            "siren": null,
            "siret": null,
            "status": "OK",
            "total": 2,
            "vat_number": null
        },
        {
            "address_id": 3,
            "company_number": null,
            "creation_date": "Wed, 22 Feb 2023 16:52:07 GMT",
            "id": 2,
            "module": "verifier",
            "name": "Edissyum Consulting",
            "siren": "510268261",
            "siret": "51026826100011",
            "status": "OK",
            "total": 2,
            "vat_number": "FR71510268261"
        }
    ]
}
```

</details>

## Récupération d'un compte client par identifiant

<mark style="color:blue;">`GET`</mark> `/accounts/customers/getById/<int:custom_id>`

#### Path Parameters

| Name                                           | Type    | Description                  |
| ---------------------------------------------- | ------- | ---------------------------- |
| customer\_id<mark style="color:red;">\*</mark> | integer | Identifiant du compte client |

#### Headers

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

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="400: Bad Request Compte client introuvable" %}

{% endtab %}
{% endtabs %}

<details>

<summary>Retour du web service</summary>

```json
{
    "address_id": 3,
    "company_number": null,
    "creation_date": "Wed, 22 Feb 2023 16:52:07 GMT",
    "id": 2,
    "module": "verifier",
    "name": "Edissyum Consulting",
    "siren": "510268261",
    "siret": "51026826100011",
    "status": "OK",
    "vat_number": "FR71510268261"
}
```

</details>

## Création d'un compte client

<mark style="color:green;">`POST`</mark> `/accounts/customers/create`

#### Headers

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

#### Request Body

| Name                                   | Type | Description                                                                                                                        |
| -------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------- |
| args<mark style="color:red;">\*</mark> | json | {"args": {"name": "", "vat\_number": "", "siret": "", "siren": "", "company\_number": "", "address\_id": 0, "module": "verifier"}} |

{% tabs %}
{% tab title="200: OK id : integer" %}

{% endtab %}
{% endtabs %}

## Suppression d'un compte client

<mark style="color:red;">`DELETE`</mark> `accounts/customers/delete/<int:customer_id>`

#### Path Parameters

| Name                                            | Type    | Description                  |
| ----------------------------------------------- | ------- | ---------------------------- |
| customer\_id><mark style="color:red;">\*</mark> | integer | Identifiant du compte client |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}
{% endtabs %}
