2.6.4
get '/api/v1/pay_methods'
{
http://localhost:3000/api/v1/pay_methods
}
{
"id":1,
"name":"Cartão de Crédito",
"tax":5,
"limit_days":4
},
{
"id":2,
"name":"Boleto",
"tax":0,
"limit_days":15
}
get "/api/v1/payments/cpf"
{
http://localhost:3000/api/v1/payments/123456
}
{
"cpf": "123456",
"payments":[
{
"value" :40.0,
"dt_venc" :"2019-09-15",
"status" :"pending"
},
{
"value" :40.0,
"dt_venc" :"2019-10-15",
"status" :"pending"
},
...
]
}
POST /api/v1/notifications/
-
Parametros para gerar os pagamentos
{ "client": { "name": "Matilda chata", "cpf": "666666", "plan_id": 1, "unity_id": 1, "pay_method_id": 1 } }
-
Resultado
{ "name": "Matilda chata", "cpf": "666666", "payments": [ { "value": 167.38, "dt_venc": "2019-09-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2019-10-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2019-11-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2019-12-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-01-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-02-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-03-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-04-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-05-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-06-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-07-18", "status": "pending" }, { "value": 167.38, "dt_venc": "2020-08-18", "status": "pending" } ] }
-
Lançar aulas avulsa
get "/api/v1/plans"
{ http://localhost:3000/api/v1/plans }
[ { "id": 1, "name": "Paulista", "value": null }
...
]
# Lista um plano:
### **Exemplo:**
get "/api/v1/plans"
http://localhost:3000/api/v1/plans/ID
### Resultado:
{ "id": 5, "name": "teste2", "value": 50.0 }
# Listar todas as unidades:
get "/api/v1/unity"
{
http://localhost:3000/api/v1/plans
}
[
{
"id": 1,
"name": "Paulista",
"value": null
}
...
]
post 'http://localhost:3000/api/v1/registrations', params: { name: 'Godofredo',
cpf: '123456',
unity_id: unity.id,
plan_id: plan.id,
pay_method_id: pay_method.id
}
[
{
"id": 1,
"name": "Godofredo",
"cpf": "123456",
"unity": "Paulista",
"plan": "Executivo",
pagamentos: [
{
"cpf": "123456",
"status": "pending",
"value": 40.0
"dt_venc": "2019-10-19"
}
{
"cpf": "123456",
"status": "pending",
"value": 40.0
"dt_venc": "2019-11-19"
}
{
"cpf": "123456",
"status": "pending",
"value": 40.0
"dt_venc": "2019-12-19"
}
...
]
}
]
get 'http://localhost:3000/api/v1/pay_methods', params: { name: 'Boleto'}
{
http://localhost:3000/api/v1/pay_methods?name=boleto
}
[
{
"id": 1,
"name": "boleto"
}
]
- Lançar aula avulsa post '/api/v1/single_class'
post '/api/v1/single_class'
http://localhost:3000/api/v1/single_class
post '/api/v1/single_class', params: {
single_class:
{
name: 'Boxe',
unit: 'Paulista',
date: '2019-09-17',
price: 100,
cpf: '123456'
}
}
post 'http://localhost:3000/api/v1/registrations', params: { registration:{ plan_id: plan.id, unity_id: unity.id, name:'diogo', cpf: '1323', pay_method_id: pay_method.id}}
http://localhost:3000/api/v1/registrations?registration[name]=diiii®istration[cpf]=9876667®istration[unity_id]=1®istration[pay_method_id]=1®istration[plan_id]=1
{
"usuario": {
"id": 5,
"created_at": "2019-09-18T23:18:19.909Z",
"updated_at": "2019-09-18T23:18:19.909Z",
"name": "diiii",
"cpf": "8",
"unity_id": 1,
"plan_id": 1,
"pay_method_id": 1
},
"pagamentos": [
{
"id": 38,
"created_at": "2019-09-18T23:18:19.959Z",
"updated_at": "2019-09-18T23:18:19.959Z",
"value": 40.0,
"dt_venc": "2019-10-18",
"registration_id": 5,
"pay_method_id": 1,
"status": "pending"
},
{
"id": 39,
"created_at": "2019-09-18T23:18:19.985Z",
"updated_at": "2019-09-18T23:18:19.985Z",
"value": 40.0,
"dt_venc": "2019-11-18",
"registration_id": 5,
"pay_method_id": 1,
"status": "pending"
},
...
]
}
post 'http://localhost:3000/api/v1/plans', params: { plan:{ name: 'Executivo', value: 40}}
http://localhost:3000/api/v1/plans?plan[name]=teste2&plan[value]=50
curl -d "plan[name]=teste3&plan[value]=20" -X POST http://localhost:3000/api/v1/plans
{
"id": 5,
"name": "teste2",
"value": 50.0
}
post 'http://localhost:3000/api/v1/unity', params: { unity: { name: 'Paulista' }}
http://localhost:3000/api/v1/unity?unity[name]=Augusta
{
"id": 2,
"name": "Augusta",
"created_at": "2019-09-19T00:17:24.513Z",
"updated_at": "2019-09-19T00:17:24.513Z"
}
post 'http://localhost:3000/api/v1/pay_methods', params: { pay_method: { name: 'Boleto', tax: 1, limit_days: 15}}
http://localhost:3000/api/v1/pay_methods?pay_method[name]=Bit&pay_method[tax]=1&pay_method[limit_days]=1
{
"id": 2,
"name": "Bit",
"created_at": "2019-09-19T00:20:52.073Z",
"updated_at": "2019-09-19T00:20:52.073Z",
"tax": 1.0,
"limit_days": 1
}
post "/api/v1/payments/ban" params: { cpf: '123456' }
{"msg": "CPF 123456 com todas as suas faturas canceladas"}
-Aplica cupom em mensalidade em aberto
{
"message":"Sucesso ao aplicar cupom"
},
{
"message":"Este cupom já foi utilizado"
},
{
"message":"Esta promoçāo já foi encerrada"
},
{
"message":"Cupom nāo encontrado"
}
- Disponibiliza a mensagem sobre a solicitação feita
post "/api/v1/promotions/promotion_id/apply" params: {code:'CODIGO0001', registration:'ID'}
-Valida status de cupom
{
"message":"ativo"
},
{
"message":"aplicado"
},
{
"message":"não encontrado"
}
- Disponibiliza a mensagem sobre a solicitação feita
get "/api/v1/promotions/:promotion_id/cupons/:id/validate"