{
  "info": {
    "_postman_id": "c79a2d91-04e6-5357-b550-f3b8d7f4ce63",
    "name": "Distsys API v1",
    "description": "API REST de integração da Distsys (mktplcs). Documentação: https://distsys.com/doc/integration/rest/\n\n1. Preencha clientId e clientSecret nas variáveis da collection (credencial criada na página da corporação).\n2. Execute 1. Autenticação > Obter token.\n3. As demais requisições usam o token salvo em accessToken.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{accessToken}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "1. Autenticação",
      "description": "Troca o client_id e o client_secret da credencial (criada na página da corporação) por um token de 15 minutos.",
      "item": [
        {
          "name": "Obter token",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/oauth2/token",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "oauth2",
                "token"
              ]
            },
            "description": "OAuth 2.0 Client Credentials (client_secret_basic). O token retornado é salvo em {{accessToken}} e usado pelas demais requisições.",
            "auth": {
              "type": "basic",
              "basic": [
                {
                  "key": "username",
                  "value": "{{clientId}}",
                  "type": "string"
                },
                {
                  "key": "password",
                  "value": "{{clientSecret}}",
                  "type": "string"
                }
              ]
            },
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "grant_type",
                  "value": "client_credentials",
                  "type": "text"
                },
                {
                  "key": "scope",
                  "value": "stores:read items:write",
                  "type": "text",
                  "disabled": true,
                  "description": "Opcional: subconjunto dos escopos da credencial"
                }
              ]
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "const body = pm.response.json();",
                  "pm.collectionVariables.set(\"accessToken\", body.access_token);",
                  "pm.test(\"token salvo\", () => pm.expect(body.access_token).to.be.a(\"string\"));"
                ]
              }
            }
          ]
        },
        {
          "name": "Chaves públicas (JWKS)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/oauth2/jwks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "oauth2",
                "jwks"
              ]
            },
            "description": "Chave pública RSA para quem quiser validar a assinatura dos tokens.",
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "2. Lojas (stores)",
      "item": [
        {
          "name": "Listar lojas",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/stores",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores"
              ]
            },
            "description": "Lojas da corporação permitidas à credencial (escopo stores:read). Se {{storeId}} estiver vazio, guarda a primeira."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));",
                  "const body = pm.response.json();",
                  "if (!pm.collectionVariables.get(\"storeId\") && body.data.length) pm.collectionVariables.set(\"storeId\", body.data[0].id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Cadastrar loja",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/stores",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores"
              ]
            },
            "description": "Escopo stores:write; credenciais restritas a lojas não podem cadastrar. O id criado é salvo em {{storeId}}.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Loja Exemplo API\",\n  \"taxNumber\": \"{{newStoreTaxNumber}}\",\n  \"zipCode\": \"01001-000\",\n  \"state\": \"SP\",\n  \"city\": \"São Paulo\",\n  \"address\": \"Praça da Sé, 100\",\n  \"phone\": \"(11) 3333-4444\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "// CNPJ aleatório para o exemplo poder ser executado várias vezes",
                  "const d = () => Math.floor(Math.random() * 10);",
                  "pm.collectionVariables.set('newStoreTaxNumber', `${d()}${d()}.${d()}${d()}${d()}.${d()}${d()}${d()}/0001-${d()}${d()}`);"
                ]
              }
            },
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 201\", () => pm.response.to.have.status(201));",
                  "const body = pm.response.json();",
                  "if (body.id) pm.collectionVariables.set(\"storeId\", body.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Detalhar loja",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}"
              ]
            },
            "description": "Escopo stores:read."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Atualizar loja",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}"
              ]
            },
            "description": "Altera apenas os campos enviados (escopo stores:write).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"phone\": \"(11) 4002-8922\",\n  \"site\": \"https://www.exemplo.com.br\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "3. Itens (items)",
      "description": "Itens da corporação, identificados pelo código do ERP ({{itemCode}}). Preço e estoque são por loja.",
      "item": [
        {
          "name": "Cadastrar ou atualizar item",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/items/{{itemCode}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "items",
                "{{itemCode}}"
              ]
            },
            "description": "Idempotente: cria se o código não existe, atualiza se existe (escopo items:write).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"description\": \"Camiseta básica algodão\",\n  \"ean13\": \"7891234567895\",\n  \"brand\": \"Marca X\",\n  \"enabled\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Detalhar item",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/items/{{itemCode}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "items",
                "{{itemCode}}"
              ]
            },
            "description": "Escopo items:read."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar itens",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/items?page=0&size=100&updatedSince=2026-01-01T00:00:00-03:00",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "items"
              ],
              "query": [
                {
                  "key": "page",
                  "value": "0"
                },
                {
                  "key": "size",
                  "value": "100"
                },
                {
                  "key": "updatedSince",
                  "value": "2026-01-01T00:00:00-03:00",
                  "disabled": true
                }
              ]
            },
            "description": "Paginado; updatedSince filtra pela data de alteração (escopo items:read)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Cadastrar ou atualizar itens em lote",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/items/batch",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "items",
                "batch"
              ]
            },
            "description": "Até 500 itens; cada um é processado separadamente (escopo items:write).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"items\": [\n    {\n      \"code\": \"CAM-002\",\n      \"description\": \"Camiseta gola V\"\n    },\n    {\n      \"code\": \"CAM-003\",\n      \"description\": \"Camiseta manga longa\",\n      \"ean13\": \"7891234567802\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Preços e estoques da loja",
          "item": [
            {
              "name": "Atualizar preço na loja",
              "request": {
                "method": "PUT",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/v1/stores/{{storeId}}/items/{{itemCode}}/price",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "v1",
                    "stores",
                    "{{storeId}}",
                    "items",
                    "{{itemCode}}",
                    "price"
                  ]
                },
                "description": "Escopo prices:write.",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"price\": 59.9\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Atualizar estoque na loja",
              "request": {
                "method": "PUT",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/v1/stores/{{storeId}}/items/{{itemCode}}/stock",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "v1",
                    "stores",
                    "{{storeId}}",
                    "items",
                    "{{itemCode}}",
                    "stock"
                  ]
                },
                "description": "Escopo stock:write.",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"quantity\": 12\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Preço e estoque do item na loja",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{baseUrl}}/v1/stores/{{storeId}}/items/{{itemCode}}",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "v1",
                    "stores",
                    "{{storeId}}",
                    "items",
                    "{{itemCode}}"
                  ]
                },
                "description": "Escopo items:read."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Itens com preço e estoque da loja",
              "request": {
                "method": "GET",
                "header": [],
                "url": {
                  "raw": "{{baseUrl}}/v1/stores/{{storeId}}/items?page=0&size=100",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "v1",
                    "stores",
                    "{{storeId}}",
                    "items"
                  ],
                  "query": [
                    {
                      "key": "page",
                      "value": "0"
                    },
                    {
                      "key": "size",
                      "value": "100"
                    }
                  ]
                },
                "description": "Escopo items:read."
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Atualizar preços em lote",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/v1/stores/{{storeId}}/prices/batch",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "v1",
                    "stores",
                    "{{storeId}}",
                    "prices",
                    "batch"
                  ]
                },
                "description": "Até 500 itens (escopo prices:write).",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"items\": [\n    {\n      \"code\": \"CAM-002\",\n      \"price\": 49.9\n    },\n    {\n      \"code\": \"CAM-003\",\n      \"price\": 69.9\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                    ]
                  }
                }
              ]
            },
            {
              "name": "Atualizar estoques em lote",
              "request": {
                "method": "POST",
                "header": [
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ],
                "url": {
                  "raw": "{{baseUrl}}/v1/stores/{{storeId}}/stock/batch",
                  "host": [
                    "{{baseUrl}}"
                  ],
                  "path": [
                    "v1",
                    "stores",
                    "{{storeId}}",
                    "stock",
                    "batch"
                  ]
                },
                "description": "Até 500 itens (escopo stock:write).",
                "body": {
                  "mode": "raw",
                  "raw": "{\n  \"items\": [\n    {\n      \"code\": \"CAM-002\",\n      \"quantity\": 5\n    },\n    {\n      \"code\": \"CAM-003\",\n      \"quantity\": 0\n    }\n  ]\n}",
                  "options": {
                    "raw": {
                      "language": "json"
                    }
                  }
                }
              },
              "event": [
                {
                  "listen": "test",
                  "script": {
                    "type": "text/javascript",
                    "exec": [
                      "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                    ]
                  }
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name": "4. Anúncios (offers)",
      "item": [
        {
          "name": "Cadastrar anúncio",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/offers",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "offers"
              ]
            },
            "description": "Registra o anúncio na Distsys vinculado ao item (escopo offers:write). Ainda não publica no marketplace. O id é salvo em {{offerId}}.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"marketplace\": \"mercadolivre\",\n  \"externalId\": \"MLB{{$timestamp}}\",\n  \"sku\": \"{{itemCode}}\",\n  \"title\": \"Camiseta básica algodão\",\n  \"price\": 59.9,\n  \"stock\": 10,\n  \"status\": \"ACTIVE\",\n  \"url\": \"https://produto.mercadolivre.com.br/MLB-1234567890\",\n  \"itemCode\": \"{{itemCode}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 201\", () => pm.response.to.have.status(201));",
                  "const body = pm.response.json();",
                  "if (body.id) pm.collectionVariables.set(\"offerId\", body.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar anúncios",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/offers?marketplace=mercadolivre&itemCode={{itemCode}}&page=0&size=100",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "offers"
              ],
              "query": [
                {
                  "key": "marketplace",
                  "value": "mercadolivre",
                  "disabled": true
                },
                {
                  "key": "itemCode",
                  "value": "{{itemCode}}",
                  "disabled": true
                },
                {
                  "key": "page",
                  "value": "0"
                },
                {
                  "key": "size",
                  "value": "100"
                }
              ]
            },
            "description": "Escopo offers:read."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Detalhar anúncio",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/offers/{{offerId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "offers",
                "{{offerId}}"
              ]
            },
            "description": "Escopo offers:read."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Atualizar anúncio",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/offers/{{offerId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "offers",
                "{{offerId}}"
              ]
            },
            "description": "Altera apenas os campos enviados; itemCode \"\" desvincula do item (escopo offers:write).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"price\": 54.9,\n  \"stock\": 8,\n  \"status\": \"PAUSED\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "5. Vendas (sales)",
      "item": [
        {
          "name": "Cadastrar venda",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/sales",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "sales"
              ]
            },
            "description": "Única por loja + marketplace + número do pedido (escopo sales:write). O id é salvo em {{saleId}}.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"marketplace\": \"mercadolivre\",\n  \"externalOrderId\": \"PED-{{$timestamp}}\",\n  \"offerId\": \"{{offerId}}\",\n  \"buyerName\": \"Maria Silva\",\n  \"totalAmount\": 119.8,\n  \"status\": \"PAID\",\n  \"createdAt\": \"2026-10-22T09:30:00-03:00\",\n  \"paidAt\": \"2026-10-22T09:31:00-03:00\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 201\", () => pm.response.to.have.status(201));",
                  "const body = pm.response.json();",
                  "if (body.id) pm.collectionVariables.set(\"saleId\", body.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Listar vendas",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/sales?status=PAID&marketplace=mercadolivre&createdFrom=2026-10-01T00:00:00-03:00&createdTo=2026-11-01T00:00:00-03:00&page=0&size=100",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "sales"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "PAID",
                  "disabled": true
                },
                {
                  "key": "marketplace",
                  "value": "mercadolivre",
                  "disabled": true
                },
                {
                  "key": "createdFrom",
                  "value": "2026-10-01T00:00:00-03:00",
                  "disabled": true
                },
                {
                  "key": "createdTo",
                  "value": "2026-11-01T00:00:00-03:00",
                  "disabled": true
                },
                {
                  "key": "page",
                  "value": "0"
                },
                {
                  "key": "size",
                  "value": "100"
                }
              ]
            },
            "description": "Mais recentes primeiro (escopo sales:read)."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Detalhar venda",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/sales/{{saleId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "sales",
                "{{saleId}}"
              ]
            },
            "description": "Escopo sales:read."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        },
        {
          "name": "Atualizar venda (nota fiscal e envio)",
          "request": {
            "method": "PATCH",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/v1/stores/{{storeId}}/sales/{{saleId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "v1",
                "stores",
                "{{storeId}}",
                "sales",
                "{{saleId}}"
              ]
            },
            "description": "Altera apenas os campos enviados (escopo sales:write).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"SHIPPED\",\n  \"invoiceKey\": \"35261012345678000190550010000012341000012345\",\n  \"invoiceNumber\": \"1234\",\n  \"shippedAt\": \"2026-10-23T14:00:00-03:00\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test(\"status 200\", () => pm.response.to.have.status(200));"
                ]
              }
            }
          ]
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://distsys.com"
    },
    {
      "key": "clientId",
      "value": ""
    },
    {
      "key": "clientSecret",
      "value": ""
    },
    {
      "key": "accessToken",
      "value": ""
    },
    {
      "key": "storeId",
      "value": ""
    },
    {
      "key": "itemCode",
      "value": "CAM-001"
    },
    {
      "key": "offerId",
      "value": ""
    },
    {
      "key": "saleId",
      "value": ""
    },
    {
      "key": "newStoreTaxNumber",
      "value": ""
    }
  ]
}