315 lines
6.7 KiB
YAML
315 lines
6.7 KiB
YAML
basePath: /
|
|
definitions:
|
|
domain.Company:
|
|
properties:
|
|
cnpj:
|
|
type: string
|
|
corporate_name:
|
|
type: string
|
|
created_at:
|
|
type: string
|
|
id:
|
|
type: string
|
|
role:
|
|
description: pharmacy, distributor, admin
|
|
type: string
|
|
sanitary_license:
|
|
type: string
|
|
updated_at:
|
|
type: string
|
|
type: object
|
|
domain.Order:
|
|
properties:
|
|
buyer_id:
|
|
type: string
|
|
created_at:
|
|
type: string
|
|
id:
|
|
type: string
|
|
items:
|
|
items:
|
|
$ref: '#/definitions/domain.OrderItem'
|
|
type: array
|
|
seller_id:
|
|
type: string
|
|
status:
|
|
$ref: '#/definitions/domain.OrderStatus'
|
|
total_cents:
|
|
type: integer
|
|
updated_at:
|
|
type: string
|
|
type: object
|
|
domain.OrderItem:
|
|
properties:
|
|
batch:
|
|
type: string
|
|
expires_at:
|
|
type: string
|
|
id:
|
|
type: string
|
|
order_id:
|
|
type: string
|
|
product_id:
|
|
type: string
|
|
quantity:
|
|
type: integer
|
|
unit_cents:
|
|
type: integer
|
|
type: object
|
|
domain.OrderStatus:
|
|
enum:
|
|
- Pendente
|
|
- Pago
|
|
- Faturado
|
|
- Entregue
|
|
type: string
|
|
x-enum-varnames:
|
|
- OrderStatusPending
|
|
- OrderStatusPaid
|
|
- OrderStatusInvoiced
|
|
- OrderStatusDelivered
|
|
domain.PaymentPreference:
|
|
properties:
|
|
commission_pct:
|
|
type: number
|
|
gateway:
|
|
type: string
|
|
marketplace_fee:
|
|
type: integer
|
|
order_id:
|
|
type: string
|
|
payment_url:
|
|
type: string
|
|
seller_receivable:
|
|
type: integer
|
|
type: object
|
|
domain.Product:
|
|
properties:
|
|
batch:
|
|
type: string
|
|
created_at:
|
|
type: string
|
|
description:
|
|
type: string
|
|
expires_at:
|
|
type: string
|
|
id:
|
|
type: string
|
|
name:
|
|
type: string
|
|
price_cents:
|
|
type: integer
|
|
seller_id:
|
|
type: string
|
|
stock:
|
|
type: integer
|
|
updated_at:
|
|
type: string
|
|
type: object
|
|
handler.createOrderRequest:
|
|
properties:
|
|
buyer_id:
|
|
type: string
|
|
items:
|
|
items:
|
|
$ref: '#/definitions/domain.OrderItem'
|
|
type: array
|
|
seller_id:
|
|
type: string
|
|
type: object
|
|
handler.registerCompanyRequest:
|
|
properties:
|
|
cnpj:
|
|
type: string
|
|
corporate_name:
|
|
type: string
|
|
role:
|
|
type: string
|
|
sanitary_license:
|
|
type: string
|
|
type: object
|
|
handler.registerProductRequest:
|
|
properties:
|
|
batch:
|
|
type: string
|
|
description:
|
|
type: string
|
|
expires_at:
|
|
type: string
|
|
name:
|
|
type: string
|
|
price_cents:
|
|
type: integer
|
|
seller_id:
|
|
type: string
|
|
stock:
|
|
type: integer
|
|
type: object
|
|
handler.updateStatusRequest:
|
|
properties:
|
|
status:
|
|
type: string
|
|
type: object
|
|
info:
|
|
contact:
|
|
email: devops@saveinmed.com
|
|
name: Engenharia SaveInMed
|
|
description: API REST B2B para marketplace farmacêutico com split de pagamento e
|
|
rastreabilidade.
|
|
title: SaveInMed Performance Core API
|
|
version: "1.0"
|
|
paths:
|
|
/api/companies:
|
|
get:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/domain.Company'
|
|
type: array
|
|
summary: Lista empresas
|
|
tags:
|
|
- Empresas
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Cadastra farmácia, distribuidora ou administrador com CNPJ e licença
|
|
sanitária.
|
|
parameters:
|
|
- description: Dados da empresa
|
|
in: body
|
|
name: company
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.registerCompanyRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"201":
|
|
description: Created
|
|
schema:
|
|
$ref: '#/definitions/domain.Company'
|
|
summary: Registro de empresas
|
|
tags:
|
|
- Empresas
|
|
/api/orders:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: Pedido
|
|
in: body
|
|
name: order
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.createOrderRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"201":
|
|
description: Created
|
|
schema:
|
|
$ref: '#/definitions/domain.Order'
|
|
summary: Criação de pedido com split
|
|
tags:
|
|
- Pedidos
|
|
/api/orders/{id}:
|
|
get:
|
|
parameters:
|
|
- description: Order ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/domain.Order'
|
|
summary: Consulta pedido
|
|
tags:
|
|
- Pedidos
|
|
/api/orders/{id}/payment:
|
|
post:
|
|
parameters:
|
|
- description: Order ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"201":
|
|
description: Created
|
|
schema:
|
|
$ref: '#/definitions/domain.PaymentPreference'
|
|
summary: Cria preferência de pagamento Mercado Pago com split nativo
|
|
tags:
|
|
- Pagamentos
|
|
/api/orders/{id}/status:
|
|
patch:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: Order ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: string
|
|
- description: Novo status
|
|
in: body
|
|
name: status
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.updateStatusRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"204":
|
|
description: ""
|
|
summary: Atualiza status do pedido
|
|
tags:
|
|
- Pedidos
|
|
/api/products:
|
|
get:
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/domain.Product'
|
|
type: array
|
|
summary: Lista catálogo com lote e validade
|
|
tags:
|
|
- Produtos
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
parameters:
|
|
- description: Produto
|
|
in: body
|
|
name: product
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/handler.registerProductRequest'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"201":
|
|
description: Created
|
|
schema:
|
|
$ref: '#/definitions/domain.Product'
|
|
summary: Cadastro de produto com rastreabilidade de lote
|
|
tags:
|
|
- Produtos
|
|
schemes:
|
|
- http
|
|
swagger: "2.0"
|