{"info":{"_postman_id":"a41dc98d-629c-4062-9bd2-3445336ca33e","name":"Order System","description":"<html><head></head><body><p>The Order System is a microservice that handles ordering merchandise from an e-commerce web app. It stores the order history of a user, integrates with third-party payment providers such as PayPal and Stripe, and stores custom account information.</p>\n<p>This microservice is designed to be integrated with other services that handle things such as the product catalog to create a whole e-commerce platform.</p>\n<ul>\n<li><strong>Note:</strong> Although some requests are documented with the <code>application/x-www-form-urlencoded</code> type, they also support <code>application/json</code>.</li>\n</ul>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"1912959","collectionId":"a41dc98d-629c-4062-9bd2-3445336ca33e","publishedId":"RzZ3L2tj","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2018-10-30T13:41:56.000Z"},"item":[{"name":"Orders","item":[{"name":"Create Order","event":[{"listen":"test","script":{"id":"9a4d9b89-1d96-4e31-8a11-29f22f67fe02","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Set `order` environment variable\", function () {","    var json = pm.response.json();","    pm.environment.set(\"order\", json.id);","});","","pm.test(\"Set `jwt_token` environment variable\", function () {","    var json = pm.response.json();","    pm.environment.set(\"jwt_token\", json.authToken);","});"],"type":"text/javascript"}}],"id":"928a186a-d4b7-454c-ad42-c45eebf4a5c1","request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"addresses\": {\n\t\t\"billing\": {\n\t\t\t\"street\": \"156 Plumberry Ln.\",\n\t\t\t\"zip\": \"15620\",\n\t\t\t\"city\": \"Cidersville\",\n\t\t\t\"country\": \"Notherling\"\n\t\t}\n\t},\n\t\"items\": [\n\t\t{\n\t\t\t\"productID\": 1,\n\t\t\t\"quantity\": 4\n\t\t}\t\n\t]\n}"},"url":"http://localhost:8082/v1/orders","description":"<p>Creates a new order that a customer can pay for. The new order contains information such as the items in the order, the customer's billing address, and their shipping address.</p>\n<p>Although this route does not require authentication, a token can be passed in and the <code>email</code> and <code>id</code> values in the payload will be used to identify the order. Otherwise, it will be considered a guest order.</p>\n","urlObject":{"protocol":"http","port":"8082","path":["v1","orders"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"0e7d9432-7d80-4cf3-a7ca-e5a53d660b51","name":"Create Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"addresses\": {\n\t\t\"billing\": {\n\t\t\t\"street\": \"156 Plumberry Ln.\",\n\t\t\t\"zip\": \"15620\",\n\t\t\t\"city\": \"Cidersville\",\n\t\t\t\"country\": \"Notherling\"\n\t\t}\n\t},\n\t\"items\": [\n\t\t{\n\t\t\t\"productID\": 1,\n\t\t\t\"quantity\": 4,\n\t\t\t\"taxRate\": 7.42\n\t\t}\t\n\t]\n}"},"url":"http://localhost:8080/v1/orders"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"881"},{"key":"date","value":"Thu, 01 Nov 2018 20:47:03 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 11,\n    \"userID\": 8225173777548120213,\n    \"authToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImNyaXQiOlsiZXhwIiwiYXVkIl19.eyJleHAiOjY0MDkyMjExMjAwLCJlbWFpbCI6Imp3dC50b2tlbkBleGFtcGxlLmNvbSIsImlkIjo4MjI1MTczNzc3NTQ4MTIwMjEzLCJpYXQiOjE1NDExMDUyMDYuNjQ3MDI4OX0.Az6K6zKTRftnRYtvTgpNzhkEJM1LB_UHMNY1rcaccJLvT2FOD0Bw37nQJp-3m-iep11XEGZ8tYAcBqZT43zAMEL6LuGkaR2P2q_thqvP43rjs9Bcugt3DUXzRj5HuzQOpLubpDb0xcQK1g9TSCWB6kZdkV3ImG3WgXGqjHgzwoqCq0zRRuuYO6ZmSiT6BnQibtmNUYnSW5Sm_keHceGLosP8IcUq6dZC58u8AEdEXRrDKBmrY7snpAvAXAHfS74dfdol36pf6dQCm8wwd4SDsepewvghl77yAQ2Ou1xo90x9x5IenihDfPJhsqSKXZ9-Xrw_MXuqP-dU6BuATCNxHA\",\n    \"tax\": 0,\n    \"refundedTotal\": 0,\n    \"total\": 0,\n    \"paidTotal\": 0,\n    \"billingAddress\": {\n        \"country\": \"Notherling\",\n        \"street\": \"156 Plumberry Ln.\",\n        \"zip\": \"15620\",\n        \"city\": \"Cidersville\"\n    },\n    \"items\": [\n        {\n            \"taxRate\": 7.42,\n            \"quantity\": 4,\n            \"productID\": 1\n        }\n    ],\n    \"guest\": false,\n    \"email\": \"jwt.token@example.com\",\n    \"status\": 0,\n    \"paymentStatus\": 0\n}"}],"_postman_id":"928a186a-d4b7-454c-ad42-c45eebf4a5c1"},{"name":"Get Order by ID","event":[{"listen":"test","script":{"id":"f1700f40-8a13-41ef-8387-97b54d433965","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Your test name\", function () {","    var json = pm.response.json();","    var id = pm.environment.get(\"order\");","    pm.expect(json.id).to.eql(id);","});"],"type":"text/javascript"}}],"id":"5084dfb1-7502-4fc4-91cb-7d3de91899cd","request":{"auth":{"type":"bearer","bearer":{"token":"{{jwt_token}}"},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:8080/v1/orders/{{order}}","description":"<p>Gets the order for a user with a specific ID. The order's user ID is fetched from the JWT auth token passed in the <code>Authorization</code> header.</p>\n","urlObject":{"protocol":"http","port":"8080","path":["v1","orders","{{order}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"8a6685b6-d306-4052-a797-234dd4ef00d0","name":"Get Order by ID","originalRequest":{"method":"GET","header":[],"url":"http://localhost:8080/v1/orders/{{order}}"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"881"},{"key":"date","value":"Thu, 01 Nov 2018 20:47:54 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 11,\n    \"userID\": 8225173777548120213,\n    \"authToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImNyaXQiOlsiZXhwIiwiYXVkIl19.eyJleHAiOjY0MDkyMjExMjAwLCJlbWFpbCI6Imp3dC50b2tlbkBleGFtcGxlLmNvbSIsImlkIjo4MjI1MTczNzc3NTQ4MTIwMjEzLCJpYXQiOjE1NDExMDUyMDYuNjQ3MDI4OX0.Az6K6zKTRftnRYtvTgpNzhkEJM1LB_UHMNY1rcaccJLvT2FOD0Bw37nQJp-3m-iep11XEGZ8tYAcBqZT43zAMEL6LuGkaR2P2q_thqvP43rjs9Bcugt3DUXzRj5HuzQOpLubpDb0xcQK1g9TSCWB6kZdkV3ImG3WgXGqjHgzwoqCq0zRRuuYO6ZmSiT6BnQibtmNUYnSW5Sm_keHceGLosP8IcUq6dZC58u8AEdEXRrDKBmrY7snpAvAXAHfS74dfdol36pf6dQCm8wwd4SDsepewvghl77yAQ2Ou1xo90x9x5IenihDfPJhsqSKXZ9-Xrw_MXuqP-dU6BuATCNxHA\",\n    \"tax\": 0,\n    \"refundedTotal\": 0,\n    \"total\": 0,\n    \"paidTotal\": 0,\n    \"billingAddress\": {\n        \"country\": \"Notherling\",\n        \"street\": \"156 Plumberry Ln.\",\n        \"zip\": \"15620\",\n        \"city\": \"Cidersville\"\n    },\n    \"items\": [\n        {\n            \"taxRate\": 7.42,\n            \"quantity\": 4,\n            \"productID\": 1\n        }\n    ],\n    \"guest\": false,\n    \"email\": \"jwt.token@example.com\",\n    \"status\": 0,\n    \"paymentStatus\": 0\n}"}],"_postman_id":"5084dfb1-7502-4fc4-91cb-7d3de91899cd"},{"name":"Get Orders for User","event":[{"listen":"test","script":{"id":"c367f5f0-940f-41bf-b31f-9d348cd0fe14","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Received array as response\", function () {","    var json = pm.response.json();","    ","    pm.expect(json).instanceOf(Array);","});","","pm.test(\"New order returned\", function () {","    var json = pm.response.json();","    var id = pm.environment.get(\"order\");","    ","    var result = json.find(function (el) { el.id ==  id});","    if (result) {","        pm.expect(result.id).to.eql(id);   ","    }","});"],"type":"text/javascript"}}],"id":"d49f6371-4416-4cc9-969b-ed8fc5192a18","request":{"auth":{"type":"bearer","bearer":{"token":"{{jwt_token}}"},"isInherited":false},"method":"GET","header":[],"url":"http://localhost:8080/v1/orders","description":"<p>Gets a user's order history. The orders are fetched that have a user ID matching the ID in the JWT auth token.</p>\n","urlObject":{"protocol":"http","port":"8080","path":["v1","orders"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"89a1808b-fa29-4f0c-ab21-c1a8964be0f6","name":"Get Orders for User","originalRequest":{"method":"GET","header":[],"url":"http://localhost:8080/v1/orders"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"452"},{"key":"date","value":"Thu, 25 Oct 2018 21:17:40 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"[\n    {\n        \"status\": 0,\n        \"userID\": 4533041739374140682,\n        \"guest\": false,\n        \"id\": 7,\n        \"tax\": 1038,\n        \"items\": [\n            {\n                \"quantity\": 4,\n                \"sku\": \"672A75A7-EA1E-4D9A-95BC-11885E5070EE\",\n                \"price\": 3500,\n                \"tax\": 1038,\n                \"taxRate\": 7.42,\n                \"totalWithTax\": 15038,\n                \"total\": 14000,\n                \"description\": \"We have no description\",\n                \"name\": \"Mince-meat Pie\"\n            }\n        ],\n        \"refundedTotal\": 0,\n        \"paymentStatus\": 0,\n        \"total\": 14000,\n        \"billingAddress\": {\n            \"country\": \"Notherling\",\n            \"street\": \"156 Plumberry Ln.\",\n            \"zip\": \"15620\",\n            \"city\": \"Cidersville\"\n        },\n        \"paidTotal\": 0\n    }\n]"}],"_postman_id":"d49f6371-4416-4cc9-969b-ed8fc5192a18"},{"name":"Add Item to Order","event":[{"listen":"test","script":{"id":"8fd2dde7-a645-4b0e-9534-8fdc960c1313","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Added item object\", function () {","    var json = pm.response.json();","    var items = json.items.filter(function (el) { el.productID == 2 });","    ","    pm.expect(items.length).to.equal(1);","    pm.expect(items[0].quantity).to.equal(2)","});"],"type":"text/javascript"}}],"id":"93c269c0-b2ae-4fea-9091-026dc18a9837","request":{"auth":{"type":"bearer","bearer":{"token":"{{jwt_token}}"},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"productID\": 2,\n\t\"quantity\": 2\n}"},"url":"http://localhost:8080/v1/orders/{{order}}/items","description":"<p>Adds a new item to an order model.</p>\n","urlObject":{"protocol":"http","port":"8080","path":["v1","orders","{{order}}","items"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"a3e88d6a-633c-4e87-ac76-e4890dce8ac3","name":"Add Item to Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"productID\": 2,\n\t\"quantity\": 2,\n\t\"taxRate\": 7.42\n}"},"url":"http://localhost:8080/v1/orders/{{order}}/items"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"904"},{"key":"date","value":"Mon, 05 Nov 2018 22:39:57 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"status\": 0,\n    \"userID\": 8994818343213048547,\n    \"authToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImNyaXQiOlsiZXhwIiwiYXVkIl19.eyJleHAiOjY0MDkyMjExMjAwLCJlbWFpbCI6Imp3dC50b2tlbkBleGFtcGxlLmNvbSIsImlkIjo4OTk0ODE4MzQzMjEzMDQ4NTQ3LCJpYXQiOjE1NDE0NTcwNTMuMTY3MTJ9.JZRNNlSsE7pSTOHdWRJAGiKkEeBOzO_fyAvMge8Stz6QUIHlbUBPE9dkWutNGwxa_m61vnUVcnWQCwihU2VXT87AeKrkQP6mgzAqYyP2D5nB4VlwKnvKt0wvDeP4wT3FXOoQbjSWDYzPuYst95qEq81kbm_arx88bNLrIHlFpHXkgA5nr80xGKnqS-g71QdXTbnXQ3uO4PH4DJUiaPm1deeb1D3vMo9-bDu8P-n9zWJnD4cGS_HEXejajaahU8u-JP2LXbSosOcUI39T1a9PS7S44Awx9Qlh3dElaXnOsxP-vh9CmgafA2H9MM_o27LQJUn9I78dX1uJPFpAfZlHxw\",\n    \"id\": 16,\n    \"guest\": false,\n    \"items\": [\n        {\n            \"taxRate\": 7.42,\n            \"quantity\": 4,\n            \"productID\": 1\n        },\n        {\n            \"taxRate\": 7.42,\n            \"quantity\": 2,\n            \"productID\": 2\n        }\n    ],\n    \"refundedTotal\": 0,\n    \"email\": \"jwt.token@example.com\",\n    \"paymentStatus\": 0,\n    \"billingAddress\": {\n        \"country\": \"Notherling\",\n        \"street\": \"156 Plumberry Ln.\",\n        \"zip\": \"15620\",\n        \"city\": \"Cidersville\"\n    },\n    \"paidTotal\": 0\n}"}],"_postman_id":"93c269c0-b2ae-4fea-9091-026dc18a9837"},{"name":"Remove Item from Order","event":[{"listen":"test","script":{"id":"6e5d472f-7b2e-48e2-b460-fb11b72fec82","exec":["pm.test(\"Status code is 204\", function () {","    pm.response.to.have.status(200);","});"],"type":"text/javascript"}}],"id":"af1cd1d7-0de8-4c58-b841-82a68c46e9dc","request":{"auth":{"type":"bearer","bearer":{"token":"{{jwt_token}}"},"isInherited":false},"method":"DELETE","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://localhost:8080/v1/orders/{{order}}/items/{{item}}","description":"<p>Removes an item from an order model.</p>\n","urlObject":{"protocol":"http","port":"8080","path":["v1","orders","{{order}}","items","{{item}}"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"b8571c3a-e43f-4ae3-9f45-157e1b4f9aff","name":"Remove Item from Order","originalRequest":{"method":"DELETE","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json","disabled":true}],"body":{"mode":"formdata","formdata":[]},"url":"http://localhost:8080/v1/orders/{{order}}/items/{{item}}"},"status":"No Content","code":204,"_postman_previewlanguage":"plain","header":[{"key":"date","value":"Mon, 05 Nov 2018 22:45:11 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":null}],"_postman_id":"af1cd1d7-0de8-4c58-b841-82a68c46e9dc"}],"id":"4fd811fa-0306-487d-ade9-87c144db291e","description":"<p>An <code>Order</code> model represents the items a customer is purchasing from a merchant and handles additional metadata, such as the customer’s information (<code>firstname</code>, <code>lastname</code>, <code>email</code>, etc), its payment status, or if the order is made by a guest.</p>\n<p>An order also as the parent for multiple other model types, including <code>Item</code> which represents a product in the order, <code>Address</code> which holds the information for the order’s payment or billing addresses, and <code>Payment</code>, which is the internal payment information that connects to an external payment from a third-party payment provider such as PayPal or Stripe.</p>\n","event":[{"listen":"prerequest","script":{"id":"efb991af-5d5d-442c-a1ad-295afe4d236e","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"ee85e3f6-6450-4902-b4ce-1bfe5cd45b6c","type":"text/javascript","exec":[""]}}],"_postman_id":"4fd811fa-0306-487d-ade9-87c144db291e"},{"name":"Payments","item":[{"name":"Create PayPal Payment For Order","event":[{"listen":"test","script":{"id":"f4fbf14f-0061-45ca-bdbf-efb117f187ca","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"`rel` is 'approval_url'\", function () {","    var json = pm.response.json();","    pm.expect(json.rel).to.eql('approval_url');","});","","pm.test(\"`method` is 'REDIRECT'\", function () {","    var json = pm.response.json();","    pm.expect(json.method).to.eql('REDIRECT');","});"],"type":"text/javascript"}}],"id":"308d94c8-2b05-41bb-9988-d1e43d29ed07","request":{"auth":{"type":"bearer","bearer":{"token":"{{jwt_token}}"},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/x-www-form-urlencoded","type":"text"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"currency","value":"usd","description":"<p>The currency to use for the payment. (Required)</p>\n","type":"text"},{"key":"shipping","value":"3000","description":"<p>The price of shipping.</p>\n","type":"text"},{"key":"shippingDiscount","value":"1200","description":"<p>The discount the customer receives on the shipping price.</p>\n","type":"text"},{"key":"handling","value":"1500","description":"<p>The price for handing.</p>\n","type":"text"},{"key":"insurence","value":"2000","description":"<p>The price for insurence.</p>\n","type":"text"},{"key":"giftWrap","value":"250","description":"<p>The price for gift wrap.</p>\n","type":"text"}]},"url":"http://localhost:8080/v1/orders/{{order}}/payment/paypal/create","description":"<p>Creates a new PayPal payment based on an <code>Order</code> model's <code>Item</code> prices.</p>\n<p>The response returned is the JSON representation of a PayPal link. Usually, you will redirect your client to the URI in the <code>href</code> key. The client can then authorize the PayPal payment so you can execute it.</p>\n","urlObject":{"protocol":"http","port":"8080","path":["v1","orders","{{order}}","payment","paypal","create"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"2eaef809-9c56-49b5-a72a-62b8e3e912b5","name":"Create PayPal Payment For Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"}],"body":{"mode":"raw","raw":"{\n\t\"currency\": \"USD\",\n\t\"shipping\": 3000,\n\t\"shippingDiscount\": 1200,\n\t\"handling\": 1500,\n\t\"insurence\": 2000,\n\t\"giftWrap\": 250\n}"},"url":"http://localhost:8080/v1/orders/{{order}}/payment/paypal/create"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"150"},{"key":"date","value":"Thu, 25 Oct 2018 21:39:28 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"rel\": \"approval_url\",\n    \"href\": \"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-04B42176RC427425A\",\n    \"method\": \"REDIRECT\"\n}"}],"_postman_id":"308d94c8-2b05-41bb-9988-d1e43d29ed07"},{"name":"Execute PayPal Payment for Order","event":[{"listen":"test","script":{"id":"49e90629-8822-49c6-bb0c-da97a8084adc","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"`id` equals `order` value\", function () {","    var json = pm.response.json();","    var id = pm.environment.get(\"order\");","    pm.expect(json.id).to.eql(id);","});"],"type":"text/javascript"}}],"id":"58887ce7-4b88-4310-bdb4-80c6b82bbcf4","request":{"auth":{"type":"bearer","bearer":{"token":"{{jwt_token}}"},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/x-www-form-urlencoded","type":"text"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"payerID","value":"B5DMWWRJTB6G4","type":"text","description":"<p>The ID of the user in the PayPal system that is making the payment.</p>\n"},{"key":"paymentID","value":"PAY-0B756831FK924644ALPMFOXA","type":"text","description":"<p>The ID of the payment to execute.</p>\n"}]},"url":"http://localhost:8080/v1/orders/{{order}}/payment/paypal/execute","description":"<p>Executes a PayPal payment that was created for an order.</p>\n<p>The body of this request expects 2 values, <code>payerID</code> and <code>paymentID</code>. These values come from the <code>accept</code> redirect request for the payment that is executed.</p>\n<ul>\n<li>Note: The <code>payerID</code> query-string key is <code>PayerID</code> and <code>paymentID</code> is <code>paymentId</code>.</li>\n</ul>\n","urlObject":{"protocol":"http","port":"8080","path":["v1","orders","{{order}}","payment","paypal","execute"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"28a8a6e6-e154-425b-82f1-081371ee5ad0","name":"Execute PayPal Payment for Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"payerID\": \"B5DMWWRJTB6G4\",\n\t\"paymentID\": \"PAYID-LPJDQGY8RX5968459466911A\"\n}"},"url":"http://localhost:8080/v1/orders/{{order}}/payment/paypal/execute"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"247"},{"key":"date","value":"Thu, 25 Oct 2018 21:45:11 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"id\": 7,\n    \"insurence\": 2000,\n    \"giftWrap\": 250,\n    \"shipping\": 3000,\n    \"tax\": 1038,\n    \"orderID\": 13,\n    \"paymentMethod\": \"paypal\",\n    \"handling\": 1500,\n    \"subtotal\": 14000,\n    \"refunded\": 0,\n    \"shippingDiscount\": 1200,\n    \"currency\": \"USD\",\n    \"externalID\": \"PAYID-LPJDQGY8RX5968459466911A\",\n    \"paid\": 0\n}"}],"_postman_id":"58887ce7-4b88-4310-bdb4-80c6b82bbcf4"},{"name":"Execute Stripe Payment for Order","event":[{"listen":"test","script":{"id":"f861a134-67bd-4dae-8fc0-731c11d8e40d","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"`success` is true\", function () {","    var json = pm.response.json();","    pm.expect(json.success).to.eql(true);","});","","pm.test(\"`message` is 'Success'\", function () {","    var json = pm.response.json();","    pm.expect(json.message).to.eql('Success');","});","",""],"type":"text/javascript"}}],"id":"4576a95a-8c07-4068-9107-0e3c272ef588","request":{"auth":{"type":"bearer","bearer":{"token":"{{jwt_token}}"},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"stripeToken\": \"tok_1Dz2iT2DSdLg2fx4o0efKbkz\",\n\t\"currency\": \"usd\",\n\t\"shipping\": 3000,\n\t\"shippingDiscount\": 1200,\n\t\"handling\": 1500,\n\t\"insurence\": 2000,\n\t\"giftWrap\": 250\n}"},"url":"http://localhost:8082/v1/orders/{{order}}/payment/stripe-cc","description":"<p>Takes a Stripe credit card token and creates a charge with it.</p>\n","urlObject":{"protocol":"http","port":"8082","path":["v1","orders","{{order}}","payment","stripe-cc"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"e5eabebf-efd7-4e2c-bd87-459e7c507d84","name":"Execute Stripe Payment for Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/x-www-form-urlencoded","type":"text"}],"body":{"mode":"urlencoded","urlencoded":[{"key":"stripeToken","value":"tok_1DPGsL2DSdLg2fx4QreVIQGU","description":"The Strip credit card token, returned from the Stripe API when the data is submitted from your front-end. (Required)","type":"text"},{"key":"currency","value":"usd","description":"The currency to use for the payment. (Required)","type":"text"},{"key":"shipping","value":"3000","description":"The price of shipping.","type":"text"},{"key":"shippingDiscount","value":"","description":"The discount the customer receives on the shipping price.","type":"text","disabled":true},{"key":"handling","value":"1500","description":"The price for handing.","type":"text"},{"key":"insurence","value":"2000","description":"The price for insurence.","type":"text"},{"key":"giftWrap","value":"","description":"The price for gift wrap.","type":"text","disabled":true}]},"url":"http://localhost:8080/v1/orders/{{order}}/payment/stripe-cc"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"36"},{"key":"date","value":"Thu, 25 Oct 2018 22:00:23 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"message\": \"Success\"\n}"}],"_postman_id":"4576a95a-8c07-4068-9107-0e3c272ef588"},{"name":"Execute Cash Payment for Order","event":[{"listen":"test","script":{"id":"9bcd9865-06d2-4ed4-b0c6-37d4ca139f0a","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"`paymentMethod` is 'cash'\", function () {","    var json = pm.response.json();","    pm.expect(json.paymentMethod).to.eql('cash');","});","","pm.test(\"`orderID` matches environment variable\", function () {","    var json = pm.response.json();","    pm.expect(json.orderID).to.eql(pm.environment.get('order'));","});","",""],"type":"text/javascript"}}],"id":"6ebaa2a2-fe1d-4c3c-9f45-1ecbc158d8d1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"token":"{{cash_payment_token}}"},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"currency\": \"usd\",\n\t\"shipping\": 3000,\n\t\"shippingDiscount\": 1200,\n\t\"handling\": 1500,\n\t\"insurence\": 2000,\n\t\"giftWrap\": 250\n}"},"url":"http://localhost:8082/v1/orders/{{order}}/payment/cash","description":"<p>Creates a <code>Payment</code> object for an <code>Order</code> without interacting with an third-part payment provider. This can be used when tangible money is manually transfered from the customer to the seller.</p>\n","urlObject":{"protocol":"http","port":"8082","path":["v1","orders","{{order}}","payment","cash"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"ff812f22-1125-4362-9d0f-73886b74063a","name":"Execute Cash Payment for Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"currency\": \"usd\",\n\t\"shipping\": 3000,\n\t\"shippingDiscount\": 1200,\n\t\"handling\": 1500,\n\t\"insurence\": 2000,\n\t\"giftWrap\": 250\n}"},"url":"http://localhost:8082/v1/orders/{{order}}/payment/cash"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"content-type","value":"application/json; charset=utf-8"},{"key":"content-length","value":"196"},{"key":"date","value":"Tue, 12 Feb 2019 15:55:55 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"insurence\": 2000,\n    \"id\": 2,\n    \"giftWrap\": 250,\n    \"tax\": 253,\n    \"orderID\": 7,\n    \"paymentMethod\": \"cash\",\n    \"shipping\": 3000,\n    \"handling\": 1500,\n    \"subtotal\": 3500,\n    \"refunded\": 0,\n    \"shippingDiscount\": 1200,\n    \"currency\": \"usd\",\n    \"paid\": 0\n}"}],"_postman_id":"6ebaa2a2-fe1d-4c3c-9f45-1ecbc158d8d1"}],"id":"f17abc54-e0e4-48ff-bf9d-7c81fb4504b7","description":"<p>Payments can be made for an <code>Order</code> resource using any one of the configured third-party payment providers. By default these are PayPal and Stripe.</p>\n<p>Depending on the provider you use, you will have to follow different steps to create and execute the remote payment. For some, you call the <code>create</code> endpoint, and when that succeeded, you call <code>execute</code>. For others, you create the payment from the client and when that succeeds, you execute it. This is done when you need to pass credit card information to the provider and want to avoid it going through your server. This helps your app to remain <a href=\"https://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard\">PCI complient</a>.</p>\n<h3 id=\"paypal\">PayPal</h3>\n<p>PayPal payments are made in two steps. First you create the payment, then you execute it.</p>\n<p>After you create an <code>Order</code>, you can call the <a href><code>POST /orders/:order/payment/paypal/create</code></a> route which will both create the payment with PayPal and an internal <code>Payment</code> instance. Once the payment is created, you can execute it with the <a href><code>POST /orders/:order/payment/paypal/execute</code></a> route.</p>\n<h3 id=\"stripe\">Stripe</h3>\n<p>While you could say a Stripe payment is create with two steps, it only requires one on your service. First you need to create the payment with Stripe from your front-end. You can follow their <a href=\"https://stripe.com/docs/quickstart\">quickstart guide</a> to do that. You will want to set the credit card form’s action to the <a href><code>POST /orders/:order/payment/stripe-cc</code></a> route and make sure the form data sends the required payment information in the request’s body.</p>\n<p>You should end up with the form submission sending the Stripe credit card token, plus additional payment data, to your order service.</p>\n<ul>\n<li>Note: All currency amounts are done in the currency's smallest format possible, so if an items's price is <code>$5.50</code> USD, you would pass in <code>550</code>.</li>\n</ul>\n","event":[{"listen":"prerequest","script":{"id":"1095dfc5-0ae9-4c5d-a030-b8786e6ac7e6","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"0b075582-c956-4e07-8496-587cf46b7c8c","type":"text/javascript","exec":[""]}}],"_postman_id":"f17abc54-e0e4-48ff-bf9d-7c81fb4504b7"},{"name":"Service Health","event":[{"listen":"test","script":{"id":"7345f8b6-4c17-4685-8bda-a574a0de2f30","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","pm.test(\"Body matches string\", function () {","    pm.expect(pm.response.text()).to.equal(\"All Good!\");","});"],"type":"text/javascript"}}],"id":"fafaf174-ebed-4453-a34a-6d7ecfed6ee6","request":{"method":"GET","header":[],"url":"http://localhost:8080/v1/orders/health","description":"<p>Used by an app's load balancer to check the health of the service.</p>\n","urlObject":{"protocol":"http","port":"8080","path":["v1","orders","health"],"host":["localhost"],"query":[],"variable":[]}},"response":[{"id":"5644e821-9499-44ef-9e8d-dd334b05535d","name":"Service Health","originalRequest":{"method":"GET","header":[],"url":"http://localhost:8080/v1/orders/health"},"status":"OK","code":200,"_postman_previewlanguage":"plain","header":[{"key":"content-type","value":"text/plain; charset=utf-8"},{"key":"content-length","value":"9"},{"key":"date","value":"Thu, 25 Oct 2018 21:11:54 GMT"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"All Good!"}],"_postman_id":"fafaf174-ebed-4453-a34a-6d7ecfed6ee6"}],"event":[{"listen":"prerequest","script":{"id":"84a4de3d-a9e4-47ca-8c4e-00d70d4e3aaf","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"678d69a9-36c8-4ceb-9c03-e5d9abd0a3cf","type":"text/javascript","exec":[""]}}],"variable":[{"key":"JWT_TOKEN","value":"REPLACE_ME"}]}