{"info":{"_postman_id":"da439988-a3ae-4df5-8b5c-8f0d882b7d48","name":"Assignment docs","description":"<html><head></head><body><h1 id=\"get-started-here\">📄 Get started here</h1>\n<p>Well, it's just a simple documentation. Enjoy it! 🙂</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"📄 Get started here","slug":"get-started-here"}],"owner":"16889380","collectionId":"da439988-a3ae-4df5-8b5c-8f0d882b7d48","publishedId":"2sA3BuWUZa","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF9D9A"},"publishDate":"2024-04-29T06:12:52.000Z"},"item":[{"name":"Receipts","item":[{"name":"Make the receipt","event":[{"listen":"test","script":{"id":"27c64eeb-d58b-4d41-abf8-98254b616bee","exec":[""],"type":"text/javascript"}}],"id":"1298c633-1796-4a15-80f5-ed2b576fe731","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"receiptItems\": [\n        {\n            \"itemId\": 2,\n            \"quantity\": 6\n        },\n        {\n            \"itemId\": 1,\n            \"quantity\": 500\n        }\n    ]\n}\n\n ","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/receipts/checkout","description":"<p>Endpoint responsible for receiving a list of objects containing item <code>itemId</code> and <code>quantity</code> and returning the necessary information to generate a receipt.</p>\n","urlObject":{"protocol":"http","port":"9090","path":["api","v1","receipts","checkout"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"8feeb553-1055-441d-9a26-c228800ea452","name":"Successful Response","originalRequest":{"method":"GET","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"receiptItems\": [\n        {\n            \"itemId\": 3,\n            \"quantity\": 1\n        },\n        {\n            \"itemId\": 2,\n            \"quantity\": 6\n        },\n        {\n            \"itemId\": 1,\n            \"quantity\": 500\n        }\n    ]\n}\n\n ","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/carts/receipt"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"[\n    {\n        \"itemName\": \"Breads (4 days old)\",\n        \"finalPrice\": 1.0,\n        \"quantity\": 2,\n        \"unit\": \"PIECE\",\n        \"totalPrice\": 2.0,\n        \"totalDiscount\": 1.0,\n        \"basePrice\": 1.0\n    },\n    {\n        \"itemName\": \"Dutch Beer\",\n        \"finalPrice\": 2.0,\n        \"quantity\": 6,\n        \"unit\": \"PIECE\",\n        \"totalPrice\": 3.0,\n        \"totalDiscount\": 1.0,\n        \"basePrice\": 0.5\n    },\n    {\n        \"itemName\": \"Vegetables\",\n        \"finalPrice\": 4.75,\n        \"quantity\": 500,\n        \"unit\": \"GRAM\",\n        \"totalPrice\": 5.0,\n        \"totalDiscount\": 0.25,\n        \"basePrice\": 0.01\n    }\n]"},{"id":"fd44aa21-ab55-4bd6-8881-114302b5f503","name":"Bread expired Exception","originalRequest":{"method":"GET","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":" {\n    \"cartItems\": [\n        {\n            \"itemId\": 3,\n            \"quantity\": 2\n        }\n    ]\n }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/carts/receipt"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\n    \"timestamp\": \"2024-04-27T10:44:48.122+00:00\",\n    \"status\": 412,\n    \"error\": \"Precondition Failed\",\n    \"message\": \"Bread is too old to be sold! 🤮\",\n    \"path\": \"/api/v1/carts/checkout\"\n}"}],"_postman_id":"1298c633-1796-4a15-80f5-ed2b576fe731"}],"id":"fb4b8a96-b0b6-4793-ae7b-2f10560ecf03","description":"<p><code>api/v1/receipts</code> the endpoint used to compile everything and create a receipt</p>\n","_postman_id":"fb4b8a96-b0b6-4793-ae7b-2f10560ecf03"},{"name":"Items","item":[{"name":"Get all items","event":[{"listen":"test","script":{"id":"56f3b7e0-682a-4ba5-9b80-cf14fc616ea2","exec":[""],"type":"text/javascript"}}],"id":"f259a423-6bfd-479d-84f0-ff5811308815","request":{"method":"GET","header":[],"url":"http://localhost:9090/api/v1/items/all","description":"<p>Gets all items in the <code>Item</code> entity, by default there are 5.</p>\n","urlObject":{"protocol":"http","port":"9090","path":["api","v1","items","all"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"fde0a1d8-d48a-4a84-aced-d496e0d00027","name":"Successful Response","originalRequest":{"method":"GET","header":[],"url":"http://localhost:9090/api/v1/carts/all"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"[\n    {\n        \"id\": 1,\n        \"type\": \"VEGETABLES\",\n        \"name\": \"Vegetables\",\n        \"price\": 0.01,\n        \"unit\": \"GRAM\",\n        \"createdAt\": \"2024-04-24T10:00:00\",\n        \"discount\": {\n            \"id\": 1,\n            \"isConstantSlab\": false,\n            \"discountUnit\": \"PERCENTAGE\",\n            \"discountSlabs\": [\n                {\n                    \"id\": 13,\n                    \"unitsToGetDiscount\": 0,\n                    \"discountAmount\": 5.0\n                },\n                {\n                    \"id\": 14,\n                    \"unitsToGetDiscount\": 100,\n                    \"discountAmount\": 7.0\n                },\n                {\n                    \"id\": 15,\n                    \"unitsToGetDiscount\": 500,\n                    \"discountAmount\": 10.0\n                }\n            ],\n            \"hibernateLazyInitializer\": {}\n        }\n    },\n    {\n        \"id\": 2,\n        \"type\": \"BEERS\",\n        \"name\": \"Dutch Beer\",\n        \"price\": 0.5,\n        \"unit\": \"PIECE\",\n        \"createdAt\": \"2024-04-24T11:00:00\",\n        \"discount\": {\n            \"id\": 2,\n            \"isConstantSlab\": true,\n            \"discountUnit\": \"MONEY\",\n            \"discountSlabs\": [\n                {\n                    \"id\": 4,\n                    \"unitsToGetDiscount\": 6,\n                    \"discountAmount\": 1.0\n                }\n            ],\n            \"hibernateLazyInitializer\": {}\n        }\n    },\n    {\n        \"id\": 3,\n        \"type\": \"BREADS\",\n        \"name\": \"Bread\",\n        \"price\": 1.0,\n        \"unit\": \"PIECE\",\n        \"createdAt\": \"2024-04-19T11:00:00\",\n        \"discount\": {\n            \"id\": 3,\n            \"isConstantSlab\": false,\n            \"discountUnit\": \"MONEY\",\n            \"discountSlabs\": [],\n            \"hibernateLazyInitializer\": {}\n        }\n    },\n    {\n        \"id\": 4,\n        \"type\": \"BEERS\",\n        \"name\": \"Belgium Beer\",\n        \"price\": 0.75,\n        \"unit\": \"PIECE\",\n        \"createdAt\": \"2024-04-24T11:00:00\",\n        \"discount\": {\n            \"id\": 4,\n            \"isConstantSlab\": true,\n            \"discountUnit\": \"MONEY\",\n            \"discountSlabs\": [\n                {\n                    \"id\": 5,\n                    \"unitsToGetDiscount\": 6,\n                    \"discountAmount\": 1.5\n                }\n            ],\n            \"hibernateLazyInitializer\": {}\n        }\n    },\n    {\n        \"id\": 5,\n        \"type\": \"BEERS\",\n        \"name\": \"German Beer\",\n        \"price\": 1.0,\n        \"unit\": \"PIECE\",\n        \"createdAt\": \"2024-04-24T11:00:00\",\n        \"discount\": {\n            \"id\": 5,\n            \"isConstantSlab\": true,\n            \"discountUnit\": \"MONEY\",\n            \"discountSlabs\": [\n                {\n                    \"id\": 6,\n                    \"unitsToGetDiscount\": 6,\n                    \"discountAmount\": 2.0\n                }\n            ],\n            \"hibernateLazyInitializer\": {}\n        }\n    }\n]"}],"_postman_id":"f259a423-6bfd-479d-84f0-ff5811308815"},{"name":"Create an Item","event":[{"listen":"test","script":{"id":"27c64eeb-d58b-4d41-abf8-98254b616bee","exec":[""],"type":"text/javascript"}}],"id":"44ac264c-db84-4a6f-81ed-b961c4176da5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n        \"type\": \"VEGETABLES\",\n        \"name\": \"Vegetables\",\n        \"price\": 0.01,\n        \"unit\": \"GRAM\"\n }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/create-item","description":"<p>Endpoint used to insert a new item in the <code>Item</code> entity.</p>\n","urlObject":{"protocol":"http","port":"9090","path":["api","v1","items","create-item"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"d2986b4e-7361-42cd-9bf5-c9502515fbec","name":"Successful Response","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n        \"type\": \"VEGETABLES\",\n        \"name\": \"Vegetables\",\n        \"price\": 0.01,\n        \"unit\": \"GRAM\"\n }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/create-item"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\n    \"itemId\": 3,\n    \"type\": \"VEGETABLES\",\n    \"name\": \"Vegetables\",\n    \"price\": 0.21,\n    \"unit\": \"GRAM\",\n    \"createdAt\": \"2024-04-28T16:45:53.013792\",\n    \"discount\": null\n}"}],"_postman_id":"44ac264c-db84-4a6f-81ed-b961c4176da5"},{"name":"Update an item","event":[{"listen":"test","script":{"id":"27c64eeb-d58b-4d41-abf8-98254b616bee","exec":[""],"type":"text/javascript"}}],"id":"727b989d-59df-483a-8484-b84dc4a021b2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n        \"id\": 100,\n        \"price\": 1\n    }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/change-item","description":"<p>Update an <code>Item</code> in the database and return the item updated.</p>\n","urlObject":{"protocol":"http","port":"9090","path":["api","v1","items","change-item"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"a1689ac9-d53f-44cc-b293-a0351d7b8a46","name":"Successful Response","originalRequest":{"method":"GET","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"id\": 1,\n    \"type\": \"BREADS\",\n    \"name\": \"breaaad\",\n    \"price\": 1,\n    \"unit\": \"PIECE\"\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/change-item"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 1,\n    \"type\": \"BREADS\",\n    \"name\": \"breaaad\",\n    \"price\": 1.0,\n    \"unit\": \"PIECE\",\n    \"createdAt\": \"2024-04-24T10:00:00\",\n    \"discount\": {\n        \"id\": 1,\n        \"isConstantSlab\": false,\n        \"discountUnit\": \"PERCENTAGE\",\n        \"discountSlabs\": [\n            {\n                \"id\": 1,\n                \"unitsToGetDiscount\": 500,\n                \"discountAmount\": 10.0\n            },\n            {\n                \"id\": 2,\n                \"unitsToGetDiscount\": 100,\n                \"discountAmount\": 7.0\n            },\n            {\n                \"id\": 3,\n                \"unitsToGetDiscount\": 1,\n                \"discountAmount\": 5.0\n            }\n        ],\n        \"hibernateLazyInitializer\": {}\n    }\n}"}],"_postman_id":"727b989d-59df-483a-8484-b84dc4a021b2"},{"name":"Create an Item discount","event":[{"listen":"test","script":{"id":"27c64eeb-d58b-4d41-abf8-98254b616bee","exec":[""],"type":"text/javascript"}}],"id":"75157128-3ad3-4b2d-aeb9-272a960afa75","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"id\": 1,\n    \"discountUnit\": \"PERCENTAGE\",\n    \"isConstantSlab\": false,\n    \"discountSlabs\": [\n        {\n            \"discountAmount\": 5,\n            \"unitsToGetDiscount\": 0\n        },\n        {\n            \"discountAmount\": 7,\n            \"unitsToGetDiscount\": 100\n        },\n        {\n            \"discountAmount\": 10,\n            \"unitsToGetDiscount\": 500\n        }\n    ]\n }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/create-item-discount","description":"<p>Creates a <code>Discount</code> for an <code>Item</code> with the <code>Id</code> equal to the <code>Id</code> field.</p>\n","urlObject":{"protocol":"http","port":"9090","path":["api","v1","items","create-item-discount"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"75387fc8-04be-455b-87a0-3857c1655921","name":"Successful Response","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"id\": 1,\n    \"discountUnit\": \"PERCENTAGE\",\n    \"isConstantSlab\": false,\n    \"discountSlabs\": [\n        {\n            \"discountAmount\": 5,\n            \"unitsToGetDiscount\": 0\n        },\n        {\n            \"discountAmount\": 7,\n            \"unitsToGetDiscount\": 100\n        },\n        {\n            \"discountAmount\": 10,\n            \"unitsToGetDiscount\": 500\n        }\n    ]\n }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/create-item"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 1,\n    \"isConstantSlab\": false,\n    \"discountUnit\": \"PERCENTAGE\",\n    \"discountSlabs\": [\n        {\n            \"id\": 7,\n            \"unitsToGetDiscount\": 0,\n            \"discountAmount\": 5.0\n        },\n        {\n            \"id\": 8,\n            \"unitsToGetDiscount\": 100,\n            \"discountAmount\": 7.0\n        },\n        {\n            \"id\": 9,\n            \"unitsToGetDiscount\": 500,\n            \"discountAmount\": 10.0\n        }\n    ]\n}"}],"_postman_id":"75157128-3ad3-4b2d-aeb9-272a960afa75"},{"name":"Update item discount","event":[{"listen":"test","script":{"id":"27c64eeb-d58b-4d41-abf8-98254b616bee","exec":[""],"type":"text/javascript"}}],"id":"8788ba75-b985-4331-a0e8-0ac5935f21f2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"id\": 1,\n    \"discountUnit\": \"PERCENTAGE\",\n    \"isConstantSlab\": false,\n    \"discountSlabs\": [\n        {\n            \"discountAmount\": 5,\n            \"unitsToGetDiscount\": 0\n        },\n        {\n            \"discountAmount\": 7,\n            \"unitsToGetDiscount\": 100\n        }\n    ]\n }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/change-item-discount","description":"<p>Updates a <code>Discount</code> for an <code>Item</code> with the <code>Id</code> equal to the <code>Id</code> field.</p>\n","urlObject":{"protocol":"http","port":"9090","path":["api","v1","items","change-item-discount"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"556b67da-f7a4-4b24-84e0-7eca5c65e84f","name":"Successful Response","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"id\": 1,\n    \"discountUnit\": \"PERCENTAGE\",\n    \"isConstantSlab\": false,\n    \"discountSlabs\": [\n        {\n            \"discountAmount\": 5,\n            \"unitsToGetDiscount\": 0\n        },\n        {\n            \"discountAmount\": 7,\n            \"unitsToGetDiscount\": 100\n        },\n        {\n            \"discountAmount\": 10,\n            \"unitsToGetDiscount\": 500\n        }\n    ]\n }","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/create-item"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 1,\n    \"isConstantSlab\": false,\n    \"discountUnit\": \"PERCENTAGE\",\n    \"discountSlabs\": [\n        {\n            \"id\": 1,\n            \"unitsToGetDiscount\": 500,\n            \"discountAmount\": 10.0\n        },\n        {\n            \"id\": 2,\n            \"unitsToGetDiscount\": 100,\n            \"discountAmount\": 7.0\n        },\n        {\n            \"id\": 3,\n            \"unitsToGetDiscount\": 1,\n            \"discountAmount\": 5.0\n        },\n        {\n            \"id\": 7,\n            \"unitsToGetDiscount\": 0,\n            \"discountAmount\": 5.0\n        },\n        {\n            \"id\": 8,\n            \"unitsToGetDiscount\": 100,\n            \"discountAmount\": 7.0\n        },\n        {\n            \"id\": 9,\n            \"unitsToGetDiscount\": 500,\n            \"discountAmount\": 10.0\n        }\n    ]\n}"}],"_postman_id":"8788ba75-b985-4331-a0e8-0ac5935f21f2"},{"name":"Update an item discount rule","event":[{"listen":"test","script":{"id":"27c64eeb-d58b-4d41-abf8-98254b616bee","exec":[""],"type":"text/javascript"}}],"id":"b0fa6b13-1953-4e33-9cdd-9451b3ead934","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n    \"unitsToGetDiscount\": 30,\n    \"discountAmount\": 1.5\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/change-discount-rule/1","description":"<p>Updates the <code>DiscountSlab</code> with the <code>id</code> equal to the route param</p>\n","urlObject":{"protocol":"http","port":"9090","path":["api","v1","items","change-discount-rule","1"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"d829c444-3b89-4d0d-9eec-1c2cba8f4272","name":"Successful Response","originalRequest":{"method":"GET","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"unitsToGetDiscount\": 30,\n    \"discountAmount\": 1.5\n}","options":{"raw":{"language":"json"}}},"url":"http://localhost:9090/api/v1/items/change-discount-rule/1"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","name":"Content-Type","description":{"content":"","type":"text/plain"}}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 1,\n    \"unitsToGetDiscount\": 30,\n    \"discountAmount\": 1.5\n}"}],"_postman_id":"b0fa6b13-1953-4e33-9cdd-9451b3ead934"}],"id":"65fd4a28-6b8e-4b32-bb74-2e5ddef558ce","description":"<p>That's the <code>api/v1/items/</code>, here you'll find everything nested/related to items.</p>\n","_postman_id":"65fd4a28-6b8e-4b32-bb74-2e5ddef558ce"}],"event":[{"listen":"prerequest","script":{"id":"71d51737-fa55-4ded-83b7-0d33c212be3b","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"1d4fb6b2-5397-4e3c-badc-53dbc1b71a48","type":"text/javascript","exec":[""]}}]}