{
  "info": {
    "name": "API Vente",
    "description": "",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Status",
      "request": {
        "method": "GET",
        "header": [],
        "auth": {
          "type": "noauth"
        },
        "description": "",
        "url": {
          "raw": "{{host}}/pharmacies/{{finess}}/status",
          "protocol": "",
          "host": [
            "{{host}}"
          ],
          "path": [
            "pharmacies",
            "{{finess}}",
            "status"
          ],
          "query": [],
          "variable": []
        }
      }
    },
    {
      "name": "standard Flow",
      "item": [
        {
          "name": "Check",
          "request": {
            "method": "POST",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "description": "",
            "url": {
              "raw": "{{host}}/pharmacies/{{finess}}/cart/{{saleUUID}}/patient/{{patientId}}/prescriber",
              "protocol": "",
              "host": [
                "{{host}}"
              ],
              "path": [
                "pharmacies",
                "{{finess}}",
                "cart",
                "{{saleUUID}}",
                "patient",
                "{{patientId}}",
                "prescriber"
              ],
              "query": [],
              "variable": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"dateOrder\": \"2025-04-18\",\n  \"inseeCode\": \"\",\n  \"rpps\": \"99900023138\",\n  \"finessAdministratif\": \"991111022\",\n  \"finessGeographique\": \"\",\n  \"name\": \"ALAIN\",\n  \"address\": \"\",\n  \"address2\": \"\",\n  \"zipcode\": \"34000\",\n  \"city\": \"Montpellier\",\n  \"prescriberSante\": {\n    \"specialtyDescription\": \"Omnipraticien\",\n    \"specialtyCode\": \"1\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "items",
          "request": {
            "method": "POST",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "description": "",
            "url": {
              "raw": "{{host}}/pharmacies/{{finess}}/cart/{{saleUUID}}/patient/{{patientId}}/items",
              "protocol": "",
              "host": [
                "{{host}}"
              ],
              "path": [
                "pharmacies",
                "{{finess}}",
                "cart",
                "{{saleUUID}}",
                "patient",
                "{{patientId}}",
                "items"
              ],
              "query": [],
              "variable": []
            },
            "body": {
              "mode": "raw",
              "raw": "[\n   {\n    \"cip\": \"3400934507786\",\n    \"description\": \"DOLIPRANE 500MG GELULE 16\",\n    \"quantity\": 1,\n    \"unitDoseQuantity\": 1,\n    \"lineNumber\": 1,\n    \"salePriceIt\": 0.77,\n    \"salePriceEt\": 0.77,\n    \"lotNumber\": \"\",\n    \"serialNumber\": \"\",\n    \"expirationDate\": \"\",\n    \"comment\": \"\",\n    \"shape\": \"Gélule\",\n    \"compositionLabel\": \"Gélule\",\n    \"isNotPilbox\": false,\n    \"qtyPromised\": \"\",\n    \"productHeight\": \"\",\n    \"productLength\": \"Gélule\",\n    \"productWidth\": \"Gélule\",\n    \"isFrigo\": false\n  }\n]",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Patient",
          "request": {
            "method": "PUT",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "description": "",
            "url": {
              "raw": "{{host}}/pharmacies/{{finess}}/cart/{{saleUUID}}/patient/{{patientId}}",
              "protocol": "",
              "host": [
                "{{host}}"
              ],
              "path": [
                "pharmacies",
                "{{finess}}",
                "cart",
                "{{saleUUID}}",
                "patient",
                "{{patientId}}"
              ],
              "query": [],
              "variable": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"dateOfBirthYear\": \"1975\",\n  \"DateLastVisit\": \"2025-04-18\",\n  \"patientId\": {{patientId}},\n  \"isFirstSale\": true,\n  \"patientPDA\": true,\n  \"patientContact\": {\n    \"lastName\": \"DUPONT\",\n    \"firstNames\": \"JEAN\",\n    \"birthDate\": \"1975-01-01\",\n    \"gender\": \"MALE\",\n    \"address\": \"1, place Bellecour\",\n    \"address2\": \"\",\n    \"zipcode\": \"69002\",\n    \"city\": \"Lyon\",\n    \"birthLastName\": \"DUPONT\",\n    \"birthFirstNames\": \"JEAN PAUL JACQUES\",\n    \"birthPlace\": \"PARIS\",\n    \"phone\": \"0102030405\",\n    \"email\": \"jean.dupont@smart-rx.com\",\n    \"establishmentName\": \"\",\n    \"establishmentCode\": \"\",\n    \"patientRoom\": \"\"\n  },\n  \"patientSante\": {\n    \"ins\": \"175017500000000\",\n    \"oid\": \"\",\n    \"noSS\": \"175017500000000\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "packages": {},
                "requests": {},
                "exec": [
                  "// Generate a random UUID",
                  "const patientId = bru.interpolate('{{$randomInt}}');",
                  "bru.setVar(\"patientId\", patientId);",
                  ""
                ]
              }
            }
          ]
        },
        {
          "name": "Prescription",
          "request": {
            "method": "POST",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "description": "",
            "url": {
              "raw": "{{host}}/pharmacies/{{finess}}/cart/{{saleUUID}}/patient/{{patientId}}/prescription",
              "protocol": "",
              "host": [
                "{{host}}"
              ],
              "path": [
                "pharmacies",
                "{{finess}}",
                "cart",
                "{{saleUUID}}",
                "patient",
                "{{patientId}}",
                "prescription"
              ],
              "query": [],
              "variable": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"prescriptionId\": {{$randomInt}},\n  \"exchangeSante\": {\n    \"prescriptionBase64\": \"data:image/{{fileExtension}};base64,{{fileContent}}\",\n    \"prescriptionDate\": \"2025-04-18\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Start",
          "request": {
            "method": "PUT",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "description": "",
            "url": {
              "raw": "{{host}}/pharmacies/{{finess}}/cart/{{saleUUID}}",
              "protocol": "",
              "host": [
                "{{host}}"
              ],
              "path": [
                "pharmacies",
                "{{finess}}",
                "cart",
                "{{saleUUID}}"
              ],
              "query": [],
              "variable": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pharmacyName\": \"Serveur LNE\",\n  \"operatorCode\": \"56\",\n  \"operatorContact\": {\n    \"lastName\": \"Snow\",\n    \"firstName\": \"Jon\"\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "prerequest",
              "script": {
                "type": "text/javascript",
                "packages": {},
                "requests": {},
                "exec": [
                  "// Generate a random UUID",
                  "const saleUUID = bru.interpolate('{{$randomUUID}}');",
                  "bru.setVar(\"saleUUID\", saleUUID);",
                  ""
                ]
              }
            }
          ]
        },
        {
          "name": "Validation",
          "request": {
            "method": "POST",
            "header": [],
            "auth": {
              "type": "noauth"
            },
            "description": "",
            "url": {
              "raw": "{{host}}/pharmacies/{{finess}}/cart/{{saleUUID}}/validation",
              "protocol": "",
              "host": [
                "{{host}}"
              ],
              "path": [
                "pharmacies",
                "{{finess}}",
                "cart",
                "{{saleUUID}}",
                "validation"
              ],
              "query": [],
              "variable": []
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"saleNumber\": 2025041800339,\n  \"invoiceNumbe\": \"00000000000001\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "host",
      "value": "",
      "type": "default"
    },
    {
      "key": "finess",
      "value": "",
      "type": "default"
    },
    {
      "key": "saleUUID",
      "value": "",
      "type": "default"
    },
    {
      "key": "patientId",
      "value": "",
      "type": "default"
    },
    {
      "key": "$randomInt",
      "value": "",
      "type": "default"
    },
    {
      "key": "fileExtension",
      "value": "",
      "type": "default"
    },
    {
      "key": "fileContent",
      "value": "",
      "type": "default"
    },
    {
      "key": "$randomUUID",
      "value": "",
      "type": "default"
    }
  ]
}