Info
Welcome to the generated API reference. Get Postman Collection
Assinaturas
Geração de assinaturas no sistema interno
Gerar assinatura
Gera uma assinatura de um cliente
Example request:
curl -X POST "http://faturaapi.test/api/assinaturas/gerar-assinatura" \
-H "Content-Type: application/json" \
-d '{"api_token":"nihil","cliente_id":18,"spe_id":2,"data_vencimento":"19\/06\/2019"}'
const url = new URL("http://faturaapi.test/api/assinaturas/gerar-assinatura");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "nihil",
"cliente_id": 18,
"spe_id": 2,
"data_vencimento": "19\/06\/2019"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/assinaturas/gerar-assinatura
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
cliente_id | integer | required | ID do cliente no CMS |
spe_id | integer | required | ID do consórcio onde o cliente se encontra |
data_vencimento | string | required | Data de Vencimento da fatura CEMIG. |
Gerar assinaturas por SPE
Cria assinaturas de clientes finalizados ou aguardando cancelamento em uma respectiva SPE
Example request:
curl -X POST "http://faturaapi.test/api/assinaturas/gerar-assinaturas-spe" \
-H "Content-Type: application/json" \
-d '{"api_token":"at","spe":"architecto"}'
const url = new URL("http://faturaapi.test/api/assinaturas/gerar-assinaturas-spe");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "at",
"spe": "architecto"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/assinaturas/gerar-assinaturas-spe
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
spe | string | required | Título do consórcio onde o cliente se encontra |
Clientes
Geração de clientes em massa ou individualmente na IUGU
Gerar Cliente Único
Gera um cliente único na IUGU a partir de seu ID de Cliente Órigo e do título da SPE onde está cadastrado
Example request:
curl -X POST "http://faturaapi.test/api/clientes/gerar-cliente" \
-H "Content-Type: application/json" \
-d '{"api_token":"aliquam","cliente_id":11,"spe":"Tiradentes"}'
const url = new URL("http://faturaapi.test/api/clientes/gerar-cliente");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "aliquam",
"cliente_id": 11,
"spe": "Tiradentes"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/clientes/gerar-cliente
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
cliente_id | integer | required | ID do cliente que será gerado na IUGU |
spe | string | required | Título da SPE onde o cliente se encontra. |
Gerar Clientes em Lote
Gera clientes na IUGU em Lote a partir do nome da uma SPE
Example request:
curl -X POST "http://faturaapi.test/api/clientes/gerar-clientes" \
-H "Content-Type: application/json" \
-d '{"api_token":"molestiae","spe":"Tiradentes"}'
const url = new URL("http://faturaapi.test/api/clientes/gerar-clientes");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "molestiae",
"spe": "Tiradentes"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/clientes/gerar-clientes
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
spe | string | required | Título da SPE da qual se gerará os clientes. |
Obter Cliente Plano
Endpoint para uso da API Cemig, para obter o cliente pela UC e realizar a consulta utilizando Número do Cliente
Example request:
curl -X POST "http://faturaapi.test/api/clientes/obter-cliente-plano" \
-H "Content-Type: application/json" \
-d '{"api_token":"aliquid","uc":14}'
const url = new URL("http://faturaapi.test/api/clientes/obter-cliente-plano");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "aliquid",
"uc": 14
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/clientes/obter-cliente-plano
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
uc | integer | required | UC do cliente desejado |
Gerar clientes pela assinatura
Example request:
curl -X POST "http://faturaapi.test/api/clientes/gerar-clientes-assinatura" \
-H "Content-Type: application/json" \
-d '{"api_token":"aut"}'
const url = new URL("http://faturaapi.test/api/clientes/gerar-clientes-assinatura");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "aut"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/clientes/gerar-clientes-assinatura
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
Créditos
Gerenciamento de Créditos
Retorna desconto específico
Example request:
curl -X GET -G "http://faturaapi.test/api/creditos?api_token=2ca3d5a1c2a6da81e&id=2616"
const url = new URL("http://faturaapi.test/api/creditos");
let params = {
"api_token": "2ca3d5a1c2a6da81e",
"id": "2616",
};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"id": 2616,
"id_cliente": 1831,
"cliente_plano": 1655,
"id_desconto": null,
"tipo": "uso_credito",
"operacao": "D",
"tipo_desconto": "C",
"valor": 1266.57,
"descricao": "Desconto crédito acumulado - ago\/19",
"referencia": "AGO\/19",
"created_at": "2019-11-04 13:29:42",
"updated_at": "2019-11-04 13:29:42",
"deleted_at": null,
"cms_user_id": null,
"status": 1,
"data_provisionamento": "2019-06-01"
}
HTTP Request
GET api/creditos
Query Parameters
Parameter | Status | Description |
---|---|---|
api_token | required | Token de acesso para a API. |
id | required | ID do desconto. |
Insere um novo desconto para um cliente
Desconto pode ser para crédito ou débito, bastando apenas setar a operação.
Example request:
curl -X POST "http://faturaapi.test/api/creditos?api_token=2ca3d5a1c2a6da81e" \
-H "Content-Type: application/json" \
-d '{"id_cliente":11913,"cliente_plano":11750,"operacao":"C","valor":1020.63,"descricao":"Desconto Teste","cms_user_id":1,"referencia_mes":11,"referencia_ano":2019}'
const url = new URL("http://faturaapi.test/api/creditos");
let params = {
"api_token": "2ca3d5a1c2a6da81e",
};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"id_cliente": 11913,
"cliente_plano": 11750,
"operacao": "C",
"valor": 1020.63,
"descricao": "Desconto Teste",
"cms_user_id": 1,
"referencia_mes": 11,
"referencia_ano": 2019
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"id_cliente": "11913",
"cliente_plano": "11750",
"tipo": "credito_adicional",
"operacao": "C",
"referencia": "NOV\/19",
"tipo_desconto": "C",
"valor": 1020.63,
"descricao": "Desconto Teste",
"updated_at": "2019-12-13 11:08:24",
"created_at": "2019-12-13 11:08:24",
"id": 8143
}
HTTP Request
POST api/creditos
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
id_cliente | integer | required | ID do cliente. |
cliente_plano | integer | required | ID do plano do cliente. |
operacao | string | required | Operação, pode ser C (Crédito) ou D (Débito). |
valor | float | required | Valor do desconto. |
descricao | string | required | Descrição do desconto. |
cms_user_id | integer | required | ID do usuário do CMS. |
referencia_mes | integer | required | Mês de referência dos descontos com 2 dígitos. |
referencia_ano | integer | required | Ano de referência dos descontos com 4 dígitos. |
Query Parameters
Parameter | Status | Description |
---|---|---|
api_token | required | Token de acesso para a API. |
Retorna os descontos de um determinado cliente
Example request:
curl -X GET -G "http://faturaapi.test/api/creditos/1?api_token=2ca3d5a1c2a6da81e&referencia_mes=08&referencia_ano=2019"
const url = new URL("http://faturaapi.test/api/creditos/1");
let params = {
"api_token": "2ca3d5a1c2a6da81e",
"referencia_mes": "08",
"referencia_ano": "2019",
};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"total_credito": 1266.57,
"total_debito": 1266.57,
"credito_disponivel": 0,
"descontos": [
{
"id": 2616,
"id_cliente": 1831,
"cliente_plano": 1655,
"id_desconto": null,
"tipo": "uso_credito",
"operacao": "D",
"tipo_desconto": "C",
"valor": 1266.57,
"descricao": "Desconto crédito acumulado - ago\/19",
"referencia": "AGO\/19",
"created_at": "2019-11-04 13:29:42",
"updated_at": "2019-11-04 13:29:42",
"deleted_at": null,
"cms_user_id": null,
"status": 1,
"data_provisionamento": "2019-06-01"
},
{
"id": 2815,
"id_cliente": 1831,
"cliente_plano": 1655,
"id_desconto": null,
"tipo": "interrupcao",
"operacao": "C",
"tipo_desconto": "R",
"valor": 1266.57,
"descricao": "Interrupção Programada - AGO\/19",
"referencia": "AGO\/19",
"created_at": "2019-11-04 12:26:29",
"updated_at": "2019-11-04 12:26:29",
"deleted_at": null,
"cms_user_id": null,
"status": 0,
"data_provisionamento": null
}
]
}
HTTP Request
GET api/creditos/{credito}
Query Parameters
Parameter | Status | Description |
---|---|---|
api_token | required | Token de acesso para a API. |
referencia_mes | optional | int Mês de referência dos descontos com 2 dígitos. |
referencia_ano | optional | int Ano de referência dos descontos com 4 dígitos. |
Atualiza um desconto existente
Desconto pode ser para crédito ou débito, bastando apenas setar a operação.
Example request:
curl -X PUT "http://faturaapi.test/api/creditos/1?api_token=2ca3d5a1c2a6da81e" \
-H "Content-Type: application/json" \
-d '{"id_cliente":11913,"cliente_plano":11750,"operacao":"C","valor":2320,"descricao":"Desconto Teste Alterado","cms_user_id":1,"referencia_mes":11,"referencia_ano":2019}'
const url = new URL("http://faturaapi.test/api/creditos/1");
let params = {
"api_token": "2ca3d5a1c2a6da81e",
};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"id_cliente": 11913,
"cliente_plano": 11750,
"operacao": "C",
"valor": 2320,
"descricao": "Desconto Teste Alterado",
"cms_user_id": 1,
"referencia_mes": 11,
"referencia_ano": 2019
}
fetch(url, {
method: "PUT",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"id": 8142,
"id_cliente": 11913,
"cliente_plano": 11750,
"id_desconto": null,
"tipo": "credito_adicional",
"operacao": "C",
"tipo_desconto": "C",
"valor": 2320,
"descricao": "Desconto Teste Alterado",
"referencia": "NOV\/19",
"created_at": "2019-12-11 16:57:52",
"updated_at": "2019-12-13 10:35:46",
"deleted_at": "2019-12-12 11:07:36",
"cms_user_id": 1,
"status": 0,
"data_provisionamento": null
}
HTTP Request
PUT api/creditos/{credito}
PATCH api/creditos/{credito}
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
id_cliente | integer | required | ID do cliente. |
cliente_plano | integer | required | ID do plano do cliente. |
operacao | string | required | Operação, pode ser C (Crédito) ou D (Débito). |
valor | float | required | Valor do desconto. |
descricao | string | required | Descrição do desconto. |
cms_user_id | integer | required | ID do usuário do CMS. |
referencia_mes | integer | required | Mês de referência dos descontos com 2 dígitos. |
referencia_ano | integer | required | Ano de referência dos descontos com 4 dígitos. |
Query Parameters
Parameter | Status | Description |
---|---|---|
api_token | required | Token de acesso para a API. |
Deleta um desconto existente
Atribui estado de deletado a um desconto existente.
Example request:
curl -X DELETE "http://faturaapi.test/api/creditos/1?api_token=2ca3d5a1c2a6da81e"
const url = new URL("http://faturaapi.test/api/creditos/1");
let params = {
"api_token": "2ca3d5a1c2a6da81e",
};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"id": 8143,
"id_cliente": 11913,
"cliente_plano": 11750,
"id_desconto": null,
"tipo": "credito_adicional",
"operacao": "C",
"tipo_desconto": "C",
"valor": 1020.63,
"descricao": "Desconto Teste",
"referencia": "NOV\/19",
"created_at": "2019-12-13 11:08:24",
"updated_at": "2019-12-13 11:10:01",
"deleted_at": "2019-12-13 11:10:01",
"cms_user_id": null,
"status": 0,
"data_provisionamento": null
}
HTTP Request
DELETE api/creditos/{credito}
Query Parameters
Parameter | Status | Description |
---|---|---|
api_token | required | Token de acesso para a API. |
Descontos
Processamento de descontos para os clientes Órigo
Processar todos os descontos
Cria uma fila para processamento dos descontos de todos os clientes, na seguinte ordem: 1 - Descontos Comerciais, 2 - Descontos Nação Energia, 3 - Desconto Geração
Example request:
curl -X POST "http://faturaapi.test/api/descontos/todos" \
-H "Content-Type: application/json" \
-d '{"api_token":"quia","geracao":false,"mes":10,"ano":12,"spe":11}'
const url = new URL("http://faturaapi.test/api/descontos/todos");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "quia",
"geracao": false,
"mes": 10,
"ano": 12,
"spe": 11
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/descontos/todos
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
geracao | boolean | optional | optional Determina se deseja que sejam calculados os descontos de geração do mês |
mes | integer | required | Mês para o qual se fará o calculo de descontos. Ex: (11) |
ano | integer | required | Ano para o qual se fará o calculo de descontos. Ex: (19) |
spe | integer | optional | optional SPE para o qual se fará o calculo de descontos, se nada for preenchido, fará por todas as disponíveis. Ex: (2) |
Processar descontos
Cria uma fila para processamento apenas dos descontos comerciais
Example request:
curl -X POST "http://faturaapi.test/api/descontos/comerciais" \
-H "Content-Type: application/json" \
-d '{"api_token":"similique","mes":1,"ano":18,"spe":18}'
const url = new URL("http://faturaapi.test/api/descontos/comerciais");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "similique",
"mes": 1,
"ano": 18,
"spe": 18
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/descontos/comerciais
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
mes | integer | required | Mês para o qual se fará o calculo de descontos. Ex: (11) |
ano | integer | required | Ano para o qual se fará o calculo de descontos. Ex: (19) |
spe | integer | optional | optional SPE para o qual se fará o calculo de descontos, se nada for preenchido, fará por todas as disponíveis. Ex: (2) |
Processar descontos nação energia
Cria uma fila para processamento apenas dos descontos de nação energia (porém estes dependem que os descontos comerciais estejam atualizados para calculo correto das faturas)
Example request:
curl -X POST "http://faturaapi.test/api/descontos/nacao-energia" \
-H "Content-Type: application/json" \
-d '{"api_token":"facilis","mes":17,"ano":15,"spe":1}'
const url = new URL("http://faturaapi.test/api/descontos/nacao-energia");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "facilis",
"mes": 17,
"ano": 15,
"spe": 1
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/descontos/nacao-energia
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
mes | integer | required | Mês para o qual se fará o calculo de descontos. Ex: (11) |
ano | integer | required | Ano para o qual se fará o calculo de descontos. Ex: (19) |
spe | integer | optional | optional SPE para o qual se fará o calculo de descontos, se nada for preenchido, fará por todas as disponíveis. Ex: (2) |
Processar descontos recorrentes
Cria uma fila para processamento apenas dos descontos recorrentes (depende da conta de energia processada)
Example request:
curl -X POST "http://faturaapi.test/api/descontos/geracao" \
-H "Content-Type: application/json" \
-d '{"api_token":"ipsum","mes":8,"ano":19,"spe":12}'
const url = new URL("http://faturaapi.test/api/descontos/geracao");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "ipsum",
"mes": 8,
"ano": 19,
"spe": 12
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/descontos/geracao
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
mes | integer | required | Mês para o qual se fará o calculo de descontos. Ex: (11) |
ano | integer | required | Ano para o qual se fará o calculo de descontos. Ex: (19) |
spe | integer | optional | optional SPE para o qual se fará o calculo de descontos, se nada for preenchido, fará por todas as disponíveis. Ex: (2) |
Faturas
Geração de faturas por cliente
Gerar faturas
Gera a próxima fatura para o cliente informado, levando em consideração seus descontos provisionados se existirem (apenas para dev)
Example request:
curl -X POST "http://faturaapi.test/api/faturas/gerar" \
-H "Content-Type: application/json" \
-d '{"api_token":"soluta","uc":14,"referencia":"delectus"}'
const url = new URL("http://faturaapi.test/api/faturas/gerar");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "soluta",
"uc": 14,
"referencia": "delectus"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/gerar
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
uc | integer | required | UC do Cliente Órigo que terá a fatura gerada |
referencia | string | required | Referência para a qual deseja criar a fatura. Ex: (10/2019) |
Gerar fatura Órigo
Gera apenas a fatura Órigo, porém depende dos descontos e da fatura CEMIG, utilizar apenas para desenvolvimento.
IniciaFaturaJob - aguarda a finalização das requisições em API CEMIG para então montar as faturas Órigo provisionando descontos e atualizando a conta de energia do mês
Example request:
curl -X POST "http://faturaapi.test/api/faturas/gerar-origo" \
-H "Content-Type: application/json" \
-d '{"api_token":"quidem"}'
const url = new URL("http://faturaapi.test/api/faturas/gerar-origo");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "quidem"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/gerar-origo
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
Gerar faturas do mês
Gera os dados da fatura CEMIG à partir das assinaturas ativas no sistema utilizando requisição à API da CEMIG em seguida inicia o processamento da criação da fatura Órigo do mês vigente
1 - FaturaCemigJob - realiza requisição para a API CEMIG fazer download da fatura mais recente de cada assinatura ativa em fila no servidor 2 - IniciaFaturaJob - aguarda a finalização das requisições em API CEMIG para então montar as faturas Órigo provisionando descontos e atualizando a conta de energia do mês
Example request:
curl -X POST "http://faturaapi.test/api/faturas/gerar-mes" \
-H "Content-Type: application/json" \
-d '{"api_token":"voluptatem"}'
const url = new URL("http://faturaapi.test/api/faturas/gerar-mes");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "voluptatem"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/gerar-mes
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
api/faturas/fatura-conta-energia
Example request:
curl -X POST "http://faturaapi.test/api/faturas/fatura-conta-energia"
const url = new URL("http://faturaapi.test/api/faturas/fatura-conta-energia");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/fatura-conta-energia
Gerar descontos e faturas do mês
Gera e provisiona descontos, atualizando ou mantendo os existentes em seguida realiza o processo de obter dados da fatura CEMIG e geração da fatura do mês
A execução dos Jobs seguem ordem determinada por dependencia do Job anterior.
1 - DescontosJob - calcula os descontos comerciais de todos os clientes em fila no servidor 2 - NacaoEnergiaJob - calcula os descontos de nação energia de todos os clientes em fila no servidor 3 - FaturaCemigJob - realiza requisição para a API CEMIG fazer download da fatura mais recente de cada assinatura ativa em fila no servidor 4 - IniciaFaturaJob - aguarda a finalização das requisições em API CEMIG para então montar as faturas Órigo provisionando descontos e atualizando a conta de energia do mês
Example request:
curl -X POST "http://faturaapi.test/api/faturas/gerar-desconto" \
-H "Content-Type: application/json" \
-d '{"api_token":"aut"}'
const url = new URL("http://faturaapi.test/api/faturas/gerar-desconto");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "aut"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/gerar-desconto
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
api/faturas/criar-conta
Example request:
curl -X POST "http://faturaapi.test/api/faturas/criar-conta"
const url = new URL("http://faturaapi.test/api/faturas/criar-conta");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/criar-conta
Cancelar Faturas
Cancela todas as faturas emitidas em uma determinada data (cuidado para não rodar em produção)
Example request:
curl -X POST "http://faturaapi.test/api/faturas/cancelar" \
-H "Content-Type: application/json" \
-d '{"api_token":"sapiente","data_criacao":"19\/06\/2019"}'
const url = new URL("http://faturaapi.test/api/faturas/cancelar");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "sapiente",
"data_criacao": "19\/06\/2019"
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/cancelar
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
data_criacao | string | required | Data de criação da fatura (a data de vencimento da fatura será calculada com base nessa). |
Exportação XLS de Conta de Energia com Descontos
Gera XLS com os dados de conta de energia por SPE (ou geral) de um mês e ano
Example request:
curl -X POST "http://faturaapi.test/api/faturas/conta-energia-descontos" \
-H "Content-Type: application/json" \
-d '{"api_token":"magni","mes":20,"ano":6,"spe":10}'
const url = new URL("http://faturaapi.test/api/faturas/conta-energia-descontos");
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
}
let body = {
"api_token": "magni",
"mes": 20,
"ano": 6,
"spe": 10
}
fetch(url, {
method: "POST",
headers: headers,
body: body
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/faturas/conta-energia-descontos
Body Parameters
Parameter | Type | Status | Description |
---|---|---|---|
api_token | string | required | Token de acesso para a API. |
mes | integer | required | Mês de referência. |
ano | integer | required | Ano de referência. |
spe | integer | optional | optional SPE de referência. |
api/contas-energia
Example request:
curl -X POST "http://faturaapi.test/api/contas-energia"
const url = new URL("http://faturaapi.test/api/contas-energia");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/contas-energia
general
Get the key performance stats for the dashboard.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/stats"
const url = new URL("http://faturaapi.test/horizon/api/stats");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"jobsPerMinute": 0,
"processes": 16,
"queueWithMaxRuntime": "fatura_api",
"queueWithMaxThroughput": "fatura_api",
"failedJobs": 2,
"recentJobs": 0,
"status": "running",
"wait": {
"redis:cemig_api": 0
},
"periods": {
"failedJobs": 60,
"recentJobs": 60
}
}
HTTP Request
GET horizon/api/stats
Get the current queue workload for the application.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/workload"
const url = new URL("http://faturaapi.test/horizon/api/workload");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
[
{
"name": "cemig_api",
"length": 0,
"wait": 0,
"processes": 8
},
{
"name": "fatura_api",
"length": 0,
"wait": 0,
"processes": 8
}
]
HTTP Request
GET horizon/api/workload
Get all of the master supervisors and their underlying supervisors.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/masters"
const url = new URL("http://faturaapi.test/horizon/api/masters");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"nb106-L37j": {
"name": "nb106-L37j",
"pid": "9737",
"status": "running",
"supervisors": [
{
"name": "nb106-L37j:supervisor-1",
"master": "nb106-L37j",
"pid": "9766",
"status": "running",
"processes": {
"redis:cemig_api": 4
},
"options": {
"balance": "high",
"connection": "redis",
"queue": "cemig_api",
"delay": "0",
"force": false,
"maxProcesses": "4",
"minProcesses": "1",
"maxTries": "3",
"memory": "128",
"nice": "0",
"name": "nb106-L37j:supervisor-1",
"sleep": "3",
"timeout": "20"
}
}
]
},
"nb106-WxXj": {
"name": "nb106-WxXj",
"pid": "9738",
"status": "running",
"supervisors": [
{
"name": "nb106-WxXj:supervisor-1",
"master": "nb106-WxXj",
"pid": "9767",
"status": "running",
"processes": {
"redis:cemig_api": 4
},
"options": {
"balance": "high",
"connection": "redis",
"queue": "cemig_api",
"delay": "0",
"force": false,
"maxProcesses": "4",
"minProcesses": "1",
"maxTries": "3",
"memory": "128",
"nice": "0",
"name": "nb106-WxXj:supervisor-1",
"sleep": "3",
"timeout": "20"
}
}
]
},
"nb106-jX9J": {
"name": "nb106-jX9J",
"pid": "9740",
"status": "running",
"supervisors": [
{
"name": "nb106-jX9J:supervisor-2",
"master": "nb106-jX9J",
"pid": "9765",
"status": "running",
"processes": {
"redis:fatura_api": 4
},
"options": {
"balance": "simple",
"connection": "redis",
"queue": "fatura_api",
"delay": "0",
"force": false,
"maxProcesses": "4",
"minProcesses": "1",
"maxTries": "3",
"memory": "128",
"nice": "0",
"name": "nb106-jX9J:supervisor-2",
"sleep": "3",
"timeout": "90"
}
}
]
},
"nb106-ldzN": {
"name": "nb106-ldzN",
"pid": "9739",
"status": "running",
"supervisors": [
{
"name": "nb106-ldzN:supervisor-2",
"master": "nb106-ldzN",
"pid": "9768",
"status": "running",
"processes": {
"redis:fatura_api": 4
},
"options": {
"balance": "simple",
"connection": "redis",
"queue": "fatura_api",
"delay": "0",
"force": false,
"maxProcesses": "4",
"minProcesses": "1",
"maxTries": "3",
"memory": "128",
"nice": "0",
"name": "nb106-ldzN:supervisor-2",
"sleep": "3",
"timeout": "90"
}
}
]
}
}
HTTP Request
GET horizon/api/masters
Get all of the monitored tags and their job counts.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/monitoring"
const url = new URL("http://faturaapi.test/horizon/api/monitoring");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
[]
HTTP Request
GET horizon/api/monitoring
Start monitoring the given tag.
Example request:
curl -X POST "http://faturaapi.test/horizon/api/monitoring"
const url = new URL("http://faturaapi.test/horizon/api/monitoring");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST horizon/api/monitoring
Paginate the jobs for a given tag.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/monitoring/1"
const url = new URL("http://faturaapi.test/horizon/api/monitoring/1");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"jobs": [],
"total": 0
}
HTTP Request
GET horizon/api/monitoring/{tag}
Stop monitoring the given tag.
Example request:
curl -X DELETE "http://faturaapi.test/horizon/api/monitoring/1"
const url = new URL("http://faturaapi.test/horizon/api/monitoring/1");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "DELETE",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
DELETE horizon/api/monitoring/{tag}
Get all of the measured jobs.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/metrics/jobs"
const url = new URL("http://faturaapi.test/horizon/api/metrics/jobs");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
[
"App\\Jobs\\DevFaturaManualJob"
]
HTTP Request
GET horizon/api/metrics/jobs
Get metrics for a given job.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/metrics/jobs/1"
const url = new URL("http://faturaapi.test/horizon/api/metrics/jobs/1");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
[]
HTTP Request
GET horizon/api/metrics/jobs/{id}
Get all of the measured queues.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/metrics/queues"
const url = new URL("http://faturaapi.test/horizon/api/metrics/queues");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
[
"fatura_api"
]
HTTP Request
GET horizon/api/metrics/queues
Get metrics for a given queue.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/metrics/queues/1"
const url = new URL("http://faturaapi.test/horizon/api/metrics/queues/1");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
[]
HTTP Request
GET horizon/api/metrics/queues/{id}
Get all of the recent jobs.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/jobs/recent"
const url = new URL("http://faturaapi.test/horizon/api/jobs/recent");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"jobs": [],
"total": 0
}
HTTP Request
GET horizon/api/jobs/recent
Get all of the failed jobs.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/jobs/failed"
const url = new URL("http://faturaapi.test/horizon/api/jobs/failed");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
{
"jobs": [
{
"id": "92",
"connection": "redis",
"queue": "fatura_api",
"name": "App\\Jobs\\DevFaturaManualJob",
"status": "failed",
"payload": {
"type": "job",
"timeout": null,
"tags": [
"fatura_carga",
"uc: 3006027399",
"valor fatura: 2962.53"
],
"id": "92",
"data": {
"command": "O:27:\"App\\Jobs\\DevFaturaManualJob\":12:{s:39:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000devService\";O:23:\"App\\Services\\DevService\":1:{s:6:\"fatura\";a:0:{}}s:31:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000uc\";d:3006027399;s:37:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000subitens\";a:2:{i:0;a:3:{s:11:\"description\";s:47:\"Órigo Fazenda Solar - Pampulha - UC 3006027399\";s:8:\"quantity\";i:1;s:11:\"price_cents\";s:6:\"352200\";}i:1;a:3:{s:11:\"description\";s:44:\"Desconto Interrupção Programada - nov\/2019\";s:8:\"quantity\";i:1;s:11:\"price_cents\";i:-55947;}}s:40:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000valorFatura\";s:7:\"2962.53\";s:5:\"tries\";i:30;s:6:\"\u0000*\u0000job\";N;s:10:\"connection\";N;s:5:\"queue\";N;s:15:\"chainConnection\";N;s:10:\"chainQueue\";N;s:5:\"delay\";N;s:7:\"chained\";a:0:{}}",
"commandName": "App\\Jobs\\DevFaturaManualJob"
},
"displayName": "App\\Jobs\\DevFaturaManualJob",
"timeoutAt": null,
"pushedAt": "1576180829.3128",
"job": "Illuminate\\Queue\\CallQueuedHandler@call",
"maxTries": 30,
"delay": null,
"attempts": 30
},
"exception": "Exception: {\"id_iugu\":null,\"erros\":{\"payer.cpf_cnpj\":[\"não pode ficar em branco\"],\"payer.name\":[\"não pode ficar em branco\"],\"payer.address.zip_code\":[\"não pode ficar em branco\",\"não é válido\"],\"payer.address.number\":[\"não pode ficar em branco\"]}} in \/mnt\/c\/OrigoApis\/faturaapi\/app\/Services\/Dev\/DevService.php:352\nStack trace:\n#0 \/mnt\/c\/OrigoApis\/faturaapi\/app\/Services\/Dev\/DevService.php(330): App\\Services\\DevService::criarFatura(Object(Iugu_Invoice), Object(App\\Models\\ClientePlano), '2962.53', '11\/2019')\n#1 \/mnt\/c\/OrigoApis\/faturaapi\/app\/Jobs\/Dev\/DevFaturaManualJob.php(48): App\\Services\\DevService::montarFatura(3006027399, Array, '2962.53')\n#2 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Redis\/Limiters\/DurationLimiter.php(90): App\\Jobs\\DevFaturaManualJob->App\\Jobs\\{closure}()\n#3 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Redis\/Limiters\/DurationLimiterBuilder.php(113): Illuminate\\Redis\\Limiters\\DurationLimiter->block(3, Object(Closure))\n#4 \/mnt\/c\/OrigoApis\/faturaapi\/app\/Jobs\/Dev\/DevFaturaManualJob.php(52): Illuminate\\Redis\\Limiters\\DurationLimiterBuilder->then(Object(Closure), Object(Closure))\n#5 [internal function]: App\\Jobs\\DevFaturaManualJob->handle()\n#6 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(32): call_user_func_array(Array, Array)\n#7 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(90): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()\n#8 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))\n#9 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/Container.php(576): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)\n#10 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Bus\/Dispatcher.php(94): Illuminate\\Container\\Container->call(Array)\n#11 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(App\\Jobs\\DevFaturaManualJob))\n#12 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php(104): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\DevFaturaManualJob))\n#13 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Bus\/Dispatcher.php(98): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))\n#14 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/CallQueuedHandler.php(49): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(App\\Jobs\\DevFaturaManualJob), false)\n#15 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Jobs\/Job.php(88): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\RedisJob), Array)\n#16 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php(337): Illuminate\\Queue\\Jobs\\Job->fire()\n#17 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php(283): Illuminate\\Queue\\Worker->process('redis', Object(Illuminate\\Queue\\Jobs\\RedisJob), Object(Illuminate\\Queue\\WorkerOptions))\n#18 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php(118): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\RedisJob), 'redis', Object(Illuminate\\Queue\\WorkerOptions))\n#19 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Console\/WorkCommand.php(102): Illuminate\\Queue\\Worker->daemon('redis', 'fatura_api', Object(Illuminate\\Queue\\WorkerOptions))\n#20 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Console\/WorkCommand.php(86): Illuminate\\Queue\\Console\\WorkCommand->runWorker('redis', 'fatura_api')\n#21 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/horizon\/src\/Console\/WorkCommand.php(46): Illuminate\\Queue\\Console\\WorkCommand->handle()\n#22 [internal function]: Laravel\\Horizon\\Console\\WorkCommand->handle()\n#23 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(32): call_user_func_array(Array, Array)\n#24 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(90): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()\n#25 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))\n#26 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/Container.php(576): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)\n#27 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php(183): Illuminate\\Container\\Container->call(Array)\n#28 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Command\/Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))\n#29 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php(170): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))\n#30 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Application.php(921): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#31 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Application.php(273): Symfony\\Component\\Console\\Application->doRunCommand(Object(Laravel\\Horizon\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#32 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Application.php(149): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#33 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Application.php(90): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#34 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Console\/Kernel.php(133): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#35 \/mnt\/c\/OrigoApis\/faturaapi\/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#36 {main}",
"failed_at": "1576181031.2938",
"completed_at": null,
"retried_by": [
{
"id": "151",
"status": "completed",
"retried_at": 1576181232
}
],
"reserved_at": "1576181031.0255",
"index": 0
},
{
"id": "52",
"connection": "redis",
"queue": "fatura_api",
"name": "App\\Jobs\\DevFaturaManualJob",
"status": "failed",
"payload": {
"type": "job",
"timeout": null,
"tags": [
"fatura_carga",
"uc: 3006619250",
"valor fatura: 8472.00"
],
"id": "52",
"data": {
"command": "O:27:\"App\\Jobs\\DevFaturaManualJob\":12:{s:39:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000devService\";O:23:\"App\\Services\\DevService\":1:{s:6:\"fatura\";a:0:{}}s:31:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000uc\";d:3006619250;s:37:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000subitens\";a:1:{i:0;a:3:{s:11:\"description\";s:47:\"Órigo Fazenda Solar - Pampulha - UC 3006619250\";s:8:\"quantity\";i:1;s:11:\"price_cents\";s:6:\"847200\";}}s:40:\"\u0000App\\Jobs\\DevFaturaManualJob\u0000valorFatura\";s:7:\"8472.00\";s:5:\"tries\";i:30;s:6:\"\u0000*\u0000job\";N;s:10:\"connection\";N;s:5:\"queue\";N;s:15:\"chainConnection\";N;s:10:\"chainQueue\";N;s:5:\"delay\";N;s:7:\"chained\";a:0:{}}",
"commandName": "App\\Jobs\\DevFaturaManualJob"
},
"displayName": "App\\Jobs\\DevFaturaManualJob",
"timeoutAt": null,
"pushedAt": "1576180829.2493",
"job": "Illuminate\\Queue\\CallQueuedHandler@call",
"maxTries": 30,
"delay": null,
"attempts": 30
},
"exception": "Exception: {\"id_iugu\":\"165F80DD01B34BD3B71F8194A07A6ECC\",\"erros\":{\"email\":[\"não é válido\"]}} in \/mnt\/c\/OrigoApis\/faturaapi\/app\/Services\/Dev\/DevService.php:352\nStack trace:\n#0 \/mnt\/c\/OrigoApis\/faturaapi\/app\/Services\/Dev\/DevService.php(330): App\\Services\\DevService::criarFatura(Object(Iugu_Invoice), Object(App\\Models\\ClientePlano), '8472.00', '11\/2019')\n#1 \/mnt\/c\/OrigoApis\/faturaapi\/app\/Jobs\/Dev\/DevFaturaManualJob.php(48): App\\Services\\DevService::montarFatura(3006619250, Array, '8472.00')\n#2 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Redis\/Limiters\/DurationLimiter.php(90): App\\Jobs\\DevFaturaManualJob->App\\Jobs\\{closure}()\n#3 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Redis\/Limiters\/DurationLimiterBuilder.php(113): Illuminate\\Redis\\Limiters\\DurationLimiter->block(3, Object(Closure))\n#4 \/mnt\/c\/OrigoApis\/faturaapi\/app\/Jobs\/Dev\/DevFaturaManualJob.php(52): Illuminate\\Redis\\Limiters\\DurationLimiterBuilder->then(Object(Closure), Object(Closure))\n#5 [internal function]: App\\Jobs\\DevFaturaManualJob->handle()\n#6 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(32): call_user_func_array(Array, Array)\n#7 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(90): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()\n#8 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))\n#9 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/Container.php(576): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)\n#10 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Bus\/Dispatcher.php(94): Illuminate\\Container\\Container->call(Array)\n#11 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php(128): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(App\\Jobs\\DevFaturaManualJob))\n#12 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php(104): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\DevFaturaManualJob))\n#13 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Bus\/Dispatcher.php(98): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))\n#14 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/CallQueuedHandler.php(49): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(App\\Jobs\\DevFaturaManualJob), false)\n#15 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Jobs\/Job.php(88): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\RedisJob), Array)\n#16 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php(337): Illuminate\\Queue\\Jobs\\Job->fire()\n#17 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php(283): Illuminate\\Queue\\Worker->process('redis', Object(Illuminate\\Queue\\Jobs\\RedisJob), Object(Illuminate\\Queue\\WorkerOptions))\n#18 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Worker.php(118): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\RedisJob), 'redis', Object(Illuminate\\Queue\\WorkerOptions))\n#19 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Console\/WorkCommand.php(102): Illuminate\\Queue\\Worker->daemon('redis', 'fatura_api', Object(Illuminate\\Queue\\WorkerOptions))\n#20 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Queue\/Console\/WorkCommand.php(86): Illuminate\\Queue\\Console\\WorkCommand->runWorker('redis', 'fatura_api')\n#21 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/horizon\/src\/Console\/WorkCommand.php(46): Illuminate\\Queue\\Console\\WorkCommand->handle()\n#22 [internal function]: Laravel\\Horizon\\Console\\WorkCommand->handle()\n#23 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(32): call_user_func_array(Array, Array)\n#24 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(90): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()\n#25 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))\n#26 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Container\/Container.php(576): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)\n#27 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php(183): Illuminate\\Container\\Container->call(Array)\n#28 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Command\/Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))\n#29 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php(170): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))\n#30 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Application.php(921): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#31 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Application.php(273): Symfony\\Component\\Console\\Application->doRunCommand(Object(Laravel\\Horizon\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#32 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/symfony\/console\/Application.php(149): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#33 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Application.php(90): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#34 \/mnt\/c\/OrigoApis\/faturaapi\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Console\/Kernel.php(133): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#35 \/mnt\/c\/OrigoApis\/faturaapi\/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\n#36 {main}",
"failed_at": "1576181021.9346",
"completed_at": null,
"retried_by": [
{
"id": "150",
"status": "completed",
"retried_at": 1576181167
}
],
"reserved_at": "1576181021.646",
"index": 1
}
],
"total": 2
}
HTTP Request
GET horizon/api/jobs/failed
Get a failed job instance.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/api/jobs/failed/1"
const url = new URL("http://faturaapi.test/horizon/api/jobs/failed/1");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
[]
HTTP Request
GET horizon/api/jobs/failed/{id}
Retry a failed job.
Example request:
curl -X POST "http://faturaapi.test/horizon/api/jobs/retry/1"
const url = new URL("http://faturaapi.test/horizon/api/jobs/retry/1");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST horizon/api/jobs/retry/{id}
Single page application catch-all route.
Example request:
curl -X GET -G "http://faturaapi.test/horizon/1"
const url = new URL("http://faturaapi.test/horizon/1");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (200):
null
HTTP Request
GET horizon/{view?}
api/dev/download-faturas
Example request:
curl -X GET -G "http://faturaapi.test/api/dev/download-faturas"
const url = new URL("http://faturaapi.test/api/dev/download-faturas");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (401):
{
"success": false,
"error": "API Token Inválido"
}
HTTP Request
GET api/dev/download-faturas
api/dev/contas-energia
Example request:
curl -X GET -G "http://faturaapi.test/api/dev/contas-energia"
const url = new URL("http://faturaapi.test/api/dev/contas-energia");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (401):
{
"success": false,
"error": "API Token Inválido"
}
HTTP Request
GET api/dev/contas-energia
api/dev/gerar-faturas
Example request:
curl -X POST "http://faturaapi.test/api/dev/gerar-faturas"
const url = new URL("http://faturaapi.test/api/dev/gerar-faturas");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/dev/gerar-faturas
api/dev/deletar-faturas
Example request:
curl -X POST "http://faturaapi.test/api/dev/deletar-faturas"
const url = new URL("http://faturaapi.test/api/dev/deletar-faturas");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/dev/deletar-faturas
api/dev/retorna-clientes-tiradentes
Example request:
curl -X POST "http://faturaapi.test/api/dev/retorna-clientes-tiradentes"
const url = new URL("http://faturaapi.test/api/dev/retorna-clientes-tiradentes");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/dev/retorna-clientes-tiradentes
api/dev/cadastro-conta-energia
Example request:
curl -X POST "http://faturaapi.test/api/dev/cadastro-conta-energia"
const url = new URL("http://faturaapi.test/api/dev/cadastro-conta-energia");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/dev/cadastro-conta-energia
Função para utilizar uma planilha de faturamento e a partir dela gravar o desconto aplicado no histórico de creditos dos clientes.
OBS: Função de Dev.
Example request:
curl -X POST "http://faturaapi.test/api/dev/provisionar"
const url = new URL("http://faturaapi.test/api/dev/provisionar");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/dev/provisionar
api/dev/adicionais
Example request:
curl -X POST "http://faturaapi.test/api/dev/adicionais"
const url = new URL("http://faturaapi.test/api/dev/adicionais");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/dev/adicionais
api/dev/auditoria-planilha
Example request:
curl -X POST "http://faturaapi.test/api/dev/auditoria-planilha"
const url = new URL("http://faturaapi.test/api/dev/auditoria-planilha");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "POST",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
HTTP Request
POST api/dev/auditoria-planilha
api/public/email-data
Example request:
curl -X GET -G "http://faturaapi.test/api/public/email-data"
const url = new URL("http://faturaapi.test/api/public/email-data");
let headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
fetch(url, {
method: "GET",
headers: headers,
})
.then(response => response.json())
.then(json => console.log(json));
Example response (401):
{
"success": false,
"error": "API Token Inválido"
}
HTTP Request
GET api/public/email-data