# Boleto de Cobrança

## Novo Boleto de Cobrança

<mark style="color:green;">`POST`</mark> `https://dev.stric.com.br/billets`

Endpoint para registro de boletos

#### Headers

| Name                                            | Type          | Description     |
| ----------------------------------------------- | ------------- | --------------- |
| authorization<mark style="color:red;">\*</mark> | String        | Token de client |
| account                                         | String (uuid) |                 |

#### Request Body

| Name                                                  | Type   | Description                                 |
| ----------------------------------------------------- | ------ | ------------------------------------------- |
| amount<mark style="color:red;">\*</mark>              | Number | Valor                                       |
| dueDate<mark style="color:red;">\*</mark>             | Date   | Data de vencimento                          |
| customer.{name}<mark style="color:red;">\*</mark>     | String | Nome                                        |
| customer.{document}<mark style="color:red;">\*</mark> | String | Documento CPF/CNPJ                          |
| customer.{zipCode}<mark style="color:red;">\*</mark>  | String | Cep                                         |
| customer.{State}<mark style="color:red;">\*</mark>    | String | Estado - (2 dígitos)                        |
| customer<mark style="color:red;">\*</mark>            | Object | Objeto do customer (cliente pagador/sacado) |

{% tabs %}
{% tab title="200: OK 200 - Cobrança gerada" %}

```javascript
{
    "type": "CHARGE",
    "ourNumber": "000000000169",
    "documentNumber": "000000000169",
    "amount": 1,
    "dueAt": "2022-06-15T03:00:00.000Z",
    "barCode": "65591901700000001000000002933500000000016900",
    "digitableLine": "65590.00002 02933.500007 00000.169003 1 90170000000100",
    "customerName": "Customer Name",
    "customerDocument": "Customer Document",
    "customerZipCode": "00000000",
    "customerState": "XX",
    "url": "https://sandboxboletos.fitbank.com.br/boleto/2022-06-15/qyhu0mpf.pdf",
    "id": "a44be28c-7df2-4c6b-be39-b3a9b460e8fb",
    "date": "2022-06-15T15:47:17.499Z"
}
```

{% endtab %}

{% tab title="400: Bad Request 400 - Erro de validação de parâmetros" %}

```javascript
{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Validation failed",
    "validation": {
        "body": {
            "source": "body",
            "keys": [
                "amount"
            ],
            "message": "\"amount\" must be a positive number"
        }
    }
}
```

{% endtab %}

{% tab title="400: Bad Request 400 - Erro de parâmetros inválidos" %}

```javascript
{
    "statusCode": 400,
    "message": "ISE0029 - Não é possivel gerar um boleto com data de vencimento inferior a atual 15/06/2022.",
    "friend": "ISE0029 - Não é possivel gerar um boleto com data de vencimento inferior a atual 15/06/2022."
}
```

{% endtab %}
{% endtabs %}

## Listar boletos gerados

<mark style="color:blue;">`GET`</mark> `https://dev.stric.com.br/billets`

Endpoint para listar todos os boletos gerados

#### Query Parameters

| Name                                    | Type   | Description |
| --------------------------------------- | ------ | ----------- |
| page<mark style="color:red;">\*</mark>  | Number |             |
| start<mark style="color:red;">\*</mark> | Date   |             |
| end<mark style="color:red;">\*</mark>   | Date   |             |

#### Headers

| Name                                            | Type          | Description     |
| ----------------------------------------------- | ------------- | --------------- |
| authorization<mark style="color:red;">\*</mark> | String        | Token de client |
| account<mark style="color:red;">\*</mark>       | String (uuid) |                 |

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

```javascript
{
    "current_page": 0,
    "total_pages": 0,
    "total_items": 1,
    "total_items_page": 1,
    "items": [
        {
            "id": "a44be28c-7df2-4c6b-be39-b3a9b460e8fb",
            "type": "CHARGE",
            "ourNumber": "000000000169",
            "documentNumber": "000000000169",
            "amount": 1,
            "dueAt": "2022-06-15T03:00:00.000Z",
            "barCode": "65591901700000001000000002933500000000016900",
            "digitableLine": "65590.00002 02933.500007 00000.169003 1 90170000000100",
            "paidAt": null,
            "creditAt": null,
            "customerName": "customerName",
            "customerDocument": "customerDocument",
            "customerZipCode": "00000000",
            "customerState": "XX",
            "url": "https://sandboxboletos.fitbank.com.br/boleto/2022-06-15/qyhu0mpf.pdf",
            "date": "2022-06-15T15:47:17.499Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}
