{"info":{"_postman_id":"91cbbfcf-838e-4cf8-ade4-f01995e4bae2","name":"Temando Guide -  Automated Order Processing","description":"<html><head></head><body><p>Temando guides demonstrate common use cases through the platform.</p>\n<p>This guide takes the reader through the process of configuring and executed Automated Order Processing by:</p>\n<ol>\n<li>Generating a session token for the account</li>\n<li>Creating a location</li>\n<li>Creating a container</li>\n<li>Creating an experience to automatically fulfill an shipment created for an order</li>\n<li>Create and automatically process the order.</li>\n</ol>\n<p>For more information, see <a href=\"http://teman.do/platform-api\">Platform Documentation</a> and the <a href=\"http://teman.do/openapi\">Open API Reference</a>.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"4574372","collectionId":"91cbbfcf-838e-4cf8-ade4-f01995e4bae2","publishedId":"RW1bnK6X","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2018-04-30T05:15:35.000Z"},"item":[{"name":"Generate a session token","event":[{"listen":"test","script":{"type":"text/javascript","exec":["const responseJson = JSON.parse(responseBody);","const sessionToken = responseJson.data.attributes.sessionToken;","const apiUrl = responseJson.data.attributes.apiUrl;","","tests[\"Session token is created.\"] = responseCode.code === 201;","","postman.setEnvironmentVariable(\"sessionToken\", sessionToken);","postman.setEnvironmentVariable(\"regionEndpoint\", apiUrl);","","// Debugging","console.log(\"--- Begin Debugging ---\");","console.log(\"sessionToken = \" + postman.getEnvironmentVariable(\"sessionToken\"));","console.log(responseJson);","console.log(\"--- End Debugging ---\");"]}}],"id":"ee890158-f9f2-437f-837c-07ec4d1ec778","request":{"method":"POST","header":[{"key":"Accept","value":"application/vnd.api+json"},{"key":"Content-Type","value":"application/vnd.api+json"}],"body":{"mode":"raw","raw":"{\n  \"data\": {\n    \"type\": \"session\",\n    \"attributes\": {\n      \"bearerToken\": \"{{bearerToken}}\",\n      \"accountId\": \"{{accountId}}\",\n      \"scope\":\"admin\"\n    }\n  }\n}"},"url":"{{endpoint}}/sessions","description":"<p>Uses bearer token to generate session tokens.</p>\n<p>Returns session token to be used in header of later requests.</p>\n","urlObject":{"path":["sessions"],"host":["{{endpoint}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"ee890158-f9f2-437f-837c-07ec4d1ec778"},{"name":"Create a location","event":[{"listen":"test","script":{"type":"text/javascript","exec":["const responseJson = JSON.parse(responseBody);","const locationId = responseJson.data.id;","","tests[\"Location is created.\"] = responseCode.code === 201;","","postman.setEnvironmentVariable(\"locationId\", locationId);","","// Debugging","console.log(\"--- Begin Debugging ---\");","console.log(\"locationId = \" + postman.getEnvironmentVariable(\"locationId\"));","console.log(responseJson);","console.log(\"--- End Debugging ---\");"]}}],"id":"069a1cef-0341-4656-8161-8e7b02603055","request":{"method":"POST","header":[{"key":"Accept","value":"application/vnd.api+json"},{"key":"Content-Type","value":"application/vnd.api+json"},{"key":"Authorization","value":"Bearer {{sessionToken}}"}],"body":{"mode":"raw","raw":"{\n  \"data\": {\n    \"type\": \"location\",\n    \"attributes\": {\n      \"name\": \"Warehouse\",\n      \"type\": \"Warehouse\",\n      \"enabled\": true,\n      \"isDefault\": true,\n      \"address\": {\n        \"lines\": [\n          \"Level 8\",\n          \"100 Skyring Terrace\"\n        ],\n        \"locality\": \"Newstead\",\n        \"countryCode\": \"AU\",\n        \"postalCode\": \"4006\",\n        \"longitude\": 153.042590,\n        \"latitude\": -27.450527,\n        \"administrativeArea\": \"QLD\"\n      },\n      \"contact\": {\n        \"personFirstName\": \"Jean\",\n        \"personLastName\": \"Dupont\",\n        \"email\": \"jeandupont@testdomain.fr\",\n        \"phoneNumber\": \"9876543210\"\n      }\n    }\n  }\n}"},"url":"{{regionEndpoint}}/locations","description":"<p>Create a location.</p>\n","urlObject":{"path":["locations"],"host":["{{regionEndpoint}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"069a1cef-0341-4656-8161-8e7b02603055"},{"name":"Create a container","event":[{"listen":"test","script":{"type":"text/javascript","exec":["const responseJson = JSON.parse(responseBody);","const containerId = responseJson.data.id;","","tests[\"Container is created.\"] = responseCode.code === 201;","","postman.setEnvironmentVariable(\"containerId\", containerId);"]}}],"id":"2e0f2fbd-28d4-4e91-b3b6-73ce6fdd5986","request":{"method":"POST","header":[{"key":"Accept","value":"application/vnd.api+json"},{"key":"Content-Type","value":"application/vnd.api+json"},{"key":"Authorization","value":"Bearer {{sessionToken}}"}],"body":{"mode":"raw","raw":"{\n  \"data\": {\n    \"type\": \"container\",\n    \"attributes\": {\n      \"name\": \"Large Box\",\n      \"type\": \"box\",\n      \"outerDimensions\": {\n        \"length\": 15,\n        \"width\": 15,\n        \"height\": 15,\n        \"unit\": \"cm\"\n      },\n      \"innerDimensions\": {\n        \"length\": 14,\n        \"width\": 14,\n        \"height\": 14,\n        \"unit\": \"cm\"\n      },\n      \"tareWeight\": {\n        \"value\": 100,\n        \"unit\": \"g\"\n      },\n      \"maximumWeight\": {\n        \"value\": 1000,\n        \"unit\": \"g\"\n      }\n    }\n  }\n}"},"url":"{{regionEndpoint}}/containers","description":"<p>Create a container.</p>\n","urlObject":{"path":["containers"],"host":["{{regionEndpoint}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"2e0f2fbd-28d4-4e91-b3b6-73ce6fdd5986"},{"name":"Create experience for automated order processing","event":[{"listen":"test","script":{"type":"text/javascript","exec":["const responseJson = JSON.parse(responseBody);","","tests[\"Experience is stored.\"] = responseCode.code === 201;","","// Debugging","console.log(\"--- Begin Debugging ---\");","console.log(responseJson);","console.log(\"--- End Debugging ---\");"]}}],"id":"9b991a18-1bdd-4764-9c10-86bb776fd78e","request":{"method":"POST","header":[{"key":"Accept","value":"application/vnd.api+json"},{"key":"Content-Type","value":"application/vnd.api+json"},{"key":"Authorization","value":"Bearer {{sessionToken}}"}],"body":{"mode":"raw","raw":"{\n  \"data\": {\n    \"type\": \"experience\",\n    \"attributes\": {\n      \"name\": \"automated-order-processing\",\n      \"status\": \"draft\",\n      \"actions\": [{\n        \"name\": \"orderAllocation\",\n        \"concurrency\": 1,\n        \"rules\": [{\n          \"name\": \"Allocate order\",\n          \"conditions\": [{ \"path\": \"order\" }],\n          \"outcomes\": [\n            {\n              \"func\": \"SetOrderOrigin\",\n              \"args\": {\n                \"locationId\": \"{{locationId}}\"\n              }\n            },\n            {\n              \"func\": \"SetOrderPackage\",\n              \"args\": {\n                \"packageId\": \"{{containerId}}\",\n                \"grossWeight\": {\n                  \"value\": 5,\n                  \"unit\": \"kg\"\n                }\n              }\n            }\n          ]\n        }]\n      },\n      {\n        \"name\": \"orderFulfillment\",\n        \"concurrency\": 1,\n        \"rules\": [\n          {\n            \"name\": \"Fulfill shipment\",\n            \"conditions\": [\n              {\n                \"path\": \"shipments[].status\",\n                \"operator\": \"is\",\n                \"value\": \"pending\"\n              }\n            ],\n            \"outcomes\": [\n              {\n                \"func\": \"FulfillWithCarrier\",\n                \"args\": {\n                  \"path\": \"shipments[]\",\n                  \"carrier\": {\n                    \"integrationServiceId\": \"{{auspostExpressPostServiceId}}\",\n                    \"configurationId\": \"{{auspostConfigurationId}}\"\n                  }\n                }\n              }\n            ]\n          }\n        ]\n      }]\n    }\n  }\n}"},"url":"{{regionEndpoint}}/experiences","description":"<p>Create an experience that:</p>\n<ol>\n<li>Allocates created order to specified location.</li>\n<li>Packs items in order into specified container.</li>\n<li>Automatically creates and fulfills shipment for order.</li>\n</ol>\n","urlObject":{"path":["experiences"],"host":["{{regionEndpoint}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9b991a18-1bdd-4764-9c10-86bb776fd78e"},{"name":"Create and process Order destined for AU","event":[{"listen":"test","script":{"type":"text/javascript","exec":["const responseJson = JSON.parse(responseBody);","var data = responseJson.data;","var included = responseJson.included;","","tests[\"Order is created.\"] = responseCode.code === 201;","tests[\"Shipment is included.\"] = included[1].id !== undefined;","","postman.setEnvironmentVariable(\"orderId\", data.id);","postman.setEnvironmentVariable(\"shipmentId\", included[1].id);","","// Debugging","console.log(\"--- Begin Debugging ---\");","console.log(\"orderId = \" + postman.getEnvironmentVariable(\"orderId\"));","console.log(\"shipmentId = \" + postman.getEnvironmentVariable(\"shipmentId\"));","console.log(responseJson);","console.log(\"--- End Debugging ---\");"]}}],"id":"0fb3a8bc-bdbe-43eb-88a7-ea0bd9e85d36","request":{"method":"POST","header":[{"key":"Accept","value":"application/vnd.api+json"},{"key":"Content-Type","value":"application/vnd.api+json"},{"key":"Authorization","value":"Bearer {{sessionToken}}"}],"body":{"mode":"raw","raw":"{\n  \"data\": {\n    \"type\": \"order\",\n    \"attributes\": {\n      \"total\": {\n        \"amount\": 50,\n        \"currency\": \"AUD\"\n      },\n      \"items\": [{\n          \"quantity\": 2,\n          \"product\": {\n            \"weight\": {\n              \"unit\": \"g\",\n              \"value\": 100\n            },\n            \"monetaryValue\": {\n              \"amount\": 20,\n              \"currency\": \"AUD\"\n            },\n            \"description\": \"Electonics\",\n            \"categories\": [\"electronic\"],\n            \"sku\": \"SKU1\",\n            \"dimensions\": {\n              \"unit\": \"cm\",\n              \"length\": 1,\n              \"width\": 1,\n              \"height\": 1\n            }\n          }\n        },\n        {\n          \"quantity\": 2,\n          \"product\": {\n            \"weight\": {\n              \"unit\": \"g\",\n              \"value\": 100\n            },\n            \"monetaryValue\": {\n              \"amount\": 30,\n              \"currency\": \"AUD\"\n            },\n            \"description\": \"Mirror\",\n            \"category\": \"furniture\",\n            \"sku\": \"SKU3\",\n            \"dimensions\": {\n              \"unit\": \"cm\",\n              \"length\": 20,\n              \"width\": 20,\n              \"height\": 20\n            }\n          }\n        }\n      ],\n      \"deliverTo\": {\n        \"address\": {\n          \"lines\": [\n            \"Level 4\",\n            \"140 William Street\"\n          ],\n          \"countryCode\": \"AU\",\n          \"postalCode\": \"2011\",\n          \"locality\": \"Woolloomooloo\",\n          \"administrativeArea\": \"NSW\"\n        },\n        \"contact\": {\n          \"personTitle\": \"M.\",\n          \"personFirstName\": \"Tout\",\n          \"personLastName\": \"Le Monde\",\n          \"email\": \"tout-le-monde@testcustomer.fr\",\n          \"phoneNumber\": \"0123456789\",\n          \"secondaryPhoneNumber\": \"0123456789\",\n          \"mobilePhoneNumber\": \"0123456789\"\n        }\n      },\n      \"customer\": {\n        \"contact\": {\n          \"personFirstName\": \"Jean\",\n          \"personLastName\": \"Dupont\",\n          \"email\": \"jeandupont@testdomain.fr\",\n          \"phoneNumber\": \"0123456789\"\n        }\n      }\n    }\n  }\n}"},"url":"{{regionEndpoint}}/orders?action=allocate&experience=automatic-order-processing","description":"<p>Create and automatically process order.</p>\n<p>Because of experience, shipment is also created, fulfilled, and added to <code>included</code> array.</p>\n","urlObject":{"path":["orders"],"host":["{{regionEndpoint}}"],"query":[{"key":"action","value":"allocate"},{"key":"experience","value":"automatic-order-processing"}],"variable":[]}},"response":[],"_postman_id":"0fb3a8bc-bdbe-43eb-88a7-ea0bd9e85d36"}],"event":[{"listen":"prerequest","script":{"id":"48f88332-1d60-437c-a2b9-9f1b43a5a5cc","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"6536c7a8-fce0-4c35-a85f-85124e82ffb2","type":"text/javascript","exec":[""]}}]}