API para o sistema de cartões com autenticação OAuth
Sistema de testes criado no curso da Mastertech
Base URLs:
- HTTP Authentication, scheme: bearer
Code samples
GET http://localhost:8081/cliente HTTP/1.1
Host: localhost:8081
GET /cliente
Request para obter todos os clientes.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/cliente HTTP/1.1
Host: localhost:8081
Content-Type: application/json
POST /cliente
Request para criar um novo cliente, deve dar erro de validação do campo.
Body parameter
{
"nome": ""
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | PostCustomerWrongValidationRequest | true | none |
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cliente/X HTTP/1.1
Host: localhost:8081
GET /cliente/X
Request para obter um cliente pelo id, deve dar erro de validação do campo.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cliente/123456789 HTTP/1.1
Host: localhost:8081
GET /cliente/123456789
Request para obter um cliente que não existe. Deve retornar mensagem informativa.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cliente/3 HTTP/1.1
Host: localhost:8081
GET /cliente/3
Request para obter um cliente por id.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cartao HTTP/1.1
Host: localhost:8081
GET /cartao
Request para obter todos os cartões cadastrados.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/cartao HTTP/1.1
Host: localhost:8081
Content-Type: application/json
POST /cartao
Request para criar um novo cartão associado a um cliente que existe.
Body parameter
{
"numero": "112358132134",
"clienteId": 3
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | PostCardRequest | true | none |
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cartao/id/X HTTP/1.1
Host: localhost:8081
GET /cartao/id/X
Request para obter o cartão pelo id. Deve retornar erro de validação do campo.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cartao/id/123456 HTTP/1.1
Host: localhost:8081
GET /cartao/id/123456
Request para obter o cartão pelo id. Deve retornar que o cartão não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cartao/id/1 HTTP/1.1
Host: localhost:8081
GET /cartao/id/1
Request para obter o cartão pelo id.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cartao/id/3 HTTP/1.1
Host: localhost:8081
GET /cartao/id/3
Request para obter o cartão pelo id recém criado.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/pagamento HTTP/1.1
Host: localhost:8081
Content-Type: application/json
POST /pagamento
Request para criar um pagamento no cartão. Deve retornar informando que o cartão está desativado.
Body parameter
{
"cartao_id": 3,
"descricao": "Compra de Cerveja",
"valor": 10.5
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | PostPaymentDeactivatedErrorRequest | true | none |
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
PATCH http://localhost:8081/cartao/112358132134 HTTP/1.1
Host: localhost:8081
Content-Type: application/json
PATCH /cartao/112358132134
Request para ativar um cartão.
Body parameter
{
"ativo": true
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | PatchCardActivationRequest | true | none |
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cartao/112358132134 HTTP/1.1
Host: localhost:8081
GET /cartao/112358132134
Request para obter um cartão pelo número.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/cartao/123456789101212 HTTP/1.1
Host: localhost:8081
GET /cartao/123456789101212
Request para obter um cartão pelo número. Deve retornar informando que o cartão não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/X/3 HTTP/1.1
Host: localhost:8081
GET /X/3
Request para obter a fatura. Deve retornar erro de validação do campo.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/123456/3 HTTP/1.1
Host: localhost:8081
GET /123456/3
Request para obter a fatura. Deve retornar que o cliente não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/3/123456 HTTP/1.1
Host: localhost:8081
GET /3/123456
Request para obter a fatura. Deve retornar que o cartão não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
GET http://localhost:8081/3/3 HTTP/1.1
Host: localhost:8081
GET /3/3
Request para obter a fatura.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/X/3/pagar HTTP/1.1
Host: localhost:8081
POST /X/3/pagar
Request para pagar a fatura. Deve retornar erro de validação do campo.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/123456/3/pagar HTTP/1.1
Host: localhost:8081
POST /123456/3/pagar
Request para pagar a fatura. Deve retornar informando que o cliente não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/3/123456/pagar HTTP/1.1
Host: localhost:8081
POST /3/123456/pagar
Request para pagar a fatura. Deve retornar informando que o cartão não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/3/3/pagar HTTP/1.1
Host: localhost:8081
POST /3/3/pagar
Request para pagar a fatura.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/X/3/expirar HTTP/1.1
Host: localhost:8081
POST /X/3/expirar
Request para expirar o cartão do cliente. Deve retornar erro de validação do campo.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/123456/3/expirar HTTP/1.1
Host: localhost:8081
POST /123456/3/expirar
Request para expirar o cartão do cliente. Deve retornar que o cliente não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/3/123456/expirar HTTP/1.1
Host: localhost:8081
POST /3/123456/expirar
Request para expirar o cartão do cliente. Deve retornar que o cartão não existe.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
Code samples
POST http://localhost:8081/3/3/expirar HTTP/1.1
Host: localhost:8081
POST /3/3/expirar
Request para expirar o cartão do cliente.
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | none | None |
{
"nome": ""
}
PostCustomerWrongValidationRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
nome | string | true | none | none |
{
"nome": "Leonardo Fibonacci"
}
PostCustomerRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
nome | string | true | none | none |
{
"numero": "112358132134",
"clienteId": 3
}
PostCardRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
numero | string | true | none | none |
clienteId | integer(int32) | true | none | none |
{
"numero": "112358132134",
"clienteId": 3
}
PostCardDuplicatedErrorRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
numero | string | true | none | none |
clienteId | integer(int32) | true | none | none |
{
"cartao_id": 3,
"descricao": "Compra de Cerveja",
"valor": 10.5
}
PostPaymentDeactivatedErrorRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
cartao_id | integer(int32) | true | none | none |
descricao | string | true | none | none |
valor | number | true | none | none |
{
"ativo": true
}
PatchCardActivationRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
ativo | boolean | true | none | none |
{
"cartao_id": 3,
"descricao": "",
"valor": 0
}
PostPaymentWrongValidationsRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
cartao_id | integer(int32) | true | none | none |
descricao | string | true | none | none |
valor | integer(int32) | true | none | none |
{
"cartao_id": 123456,
"descricao": "Compra de Cerveja",
"valor": 10.5
}
PostPaymentCardNotExistsRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
cartao_id | integer(int32) | true | none | none |
descricao | string | true | none | none |
valor | number | true | none | none |
{
"cartao_id": 3,
"descricao": "Compra de Cerveja",
"valor": 10.5
}
PostPaymentRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
cartao_id | integer(int32) | true | none | none |
descricao | string | true | none | none |
valor | number | true | none | none |
{
"cartao_id": 3,
"descricao": "Compra de Cerveja",
"valor": 10.5
}
PostPaymentExpiredErrorRequest
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
cartao_id | integer(int32) | true | none | none |
descricao | string | true | none | none |
valor | number | true | none | none |