UNPKG

@stylusapparel/stylusop-api-node-wrapper

Version:

This is the official NodeJs wrapper for connecting to the StylusOP API

348 lines 13.3 kB
{ "MOCK_ORDER_ID": "TEST_ORDER_ID", "MOCK_GET_ORDER_RESPONSE": { "success": true, "message": "Successfully retrieved order", "order": { "_id": "5efa364e87d09383ed5b85f0", "orderStatus": "ordered", "priorityLabel": "normal", "orderId": "123456789", "companyRefId": "creoapp", "shippingMethod": "standard", "shippingInfo": { "street1": "1 Fawnhollow lane", "street2": "", "city": "Manchester", "state": "NJ", "postcode": "08759", "country_code": "US", "name": "Jose Fano", "phone": "7328817379" }, "returnToAddress": { "street1": "567 Newark ave", "street2": "", "city": "Kenilworth", "state": "NJ", "postcode": "07033", "country_code": "US", "company": "CREO CO.", "phone": "7328817379" }, "items": [ { "status": "preshipped", "_id": "5efa364e87d09383ed5b85f1", "assets": [], "itemNumber": "5959559", "product": "leggings", "properties": { "size": "SM", "color": "OC" }, "previewImgUrl": "", "quantity": 4, "price": 29, "sku": "RB250_OC_SM", "weight": { "value": 7, "units": "oz" }, "vendorSku": "RB250_OC_SM", "_product": "5c9b7564b7d86c0696cde403", "_vItems": [ { "status": "ordered", "_id": "5efa364e87d09383ed5b85f2", "itemId": "59595732", "uid": "595957321", "created_at": "2020-06-29T18:43:27.005Z", "updated_at": "2020-07-09T18:19:57.990Z" }, { "status": "ordered", "_id": "5efa364e87d09383ed5b85f3", "itemId": "59595732", "uid": "595957322", "created_at": "2020-06-29T18:43:27.005Z", "updated_at": "2020-07-09T18:19:57.990Z" }, { "status": "ordered", "_id": "5efa364e87d09383ed5b85f4", "itemId": "59595732", "uid": "595957323", "created_at": "2020-06-29T18:43:27.005Z", "updated_at": "2020-07-09T18:19:57.990Z" }, { "status": "ordered", "_id": "5efa364e87d09383ed5b85f5", "itemId": "59595732", "uid": "595957324", "created_at": "2020-06-29T18:43:27.006Z", "updated_at": "2020-07-09T18:19:57.990Z" } ], "created_at": "2020-06-29T18:43:26.949Z", "updated_at": "2020-07-10T11:30:46.751Z", "itemId": "59595732", "cancellationReason": "Vendor Requested", "cancelledAt": "2020-07-09T18:19:57.987Z" } ], "sale_datetime": "2020-06-18T13:31:58.000Z", "callbackUri": "https://ide43favb0.execute-api.us-east-1.amazonaws.com/staging/api/updateStatus?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c&statusType=ORDERS_UPDATE", "created_date": "2020-06-29T18:43:26.944Z", "createdAt": "2020-06-29T18:43:26.953Z", "updatedAt": "2020-07-10T11:30:46.754Z", "shipStationId": 692917951, "shipmentInfo": { "shipment_carrier": "ups", "shipment_cost": 0, "shipment_date": "2020-07-09T05:43:04.506Z", "shipment_id": 489574365, "shipment_label_url": "https://stylusapparelop-staging.s3.amazonaws.com/labels/label-creoapp-123456789-1594273378.447.pdf", "shipment_package": "mi_parcel_post", "shipment_service": "expedited_mail_innovations", "trackingNumber": "92612999937205543401584494" }, "cancellationReason": "Vendor Requested", "cancelledAt": "2020-07-09T18:19:57.986Z", "completedAt": "2020-07-08T23:47:30.403Z", "location": "A01" } }, "MOCK_LIST_ORDERS_RESPONSE": { "success": true, "message": "Successfully retrieved Orders", "orders": [ { "_id": "5ed6929e2abcc06d8b059e00", "orderStatus": "ordered", "priorityLabel": "qa", "notes": [], "orderId": "820982911946154500", "companyRefId": "creoapp", "shippingInfo": { "name": "Steve Shipper", "street1": "123 Shipping Street", "street2": "Shipping Company", "city": "Shippington", "state": "Kentucky", "phone": "555-555-SHIP", "postcode": "40003", "country_code": "US" }, "shippingMethod": "standard", "items": [ { "status": "ordered", "_id": "5ed6929e2abcc06d8b059e01", "assets": [], "itemId": "86657628", "itemNumber": "866550311766439000", "product": "leggings", "properties": { "size": "SM", "color": "" }, "previewImgUrl": "", "quantity": 1, "price": 29, "sku": "RB250_OC_SM", "weight": { "value": 7, "units": "oz" }, "_product": "5c9b7564b7d86c0696cde403", "_vItems": [ { "status": "ordered", "_id": "5ed6929e2abcc06d8b059e02", "itemId": "86657628", "uid": "866576281", "created_at": "2020-06-02T17:55:42.209Z", "updated_at": "2020-06-02T17:55:42.209Z" } ], "created_at": "2020-06-02T17:55:42.092Z", "updated_at": "2020-06-02T17:55:42.209Z" } ], "sale_datetime": "2020-05-28T05:08:16.000Z", "callbackUri": "https://7lk7jabt6a.execute-api.us-east-1.amazonaws.com/development/api/orderStatus?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", "created_date": "2020-06-02T17:55:42.090Z", "artworksInOrder": [], "alerts": [ { "_id": "5ed6929e2abcc06d8b059e04", "orderKey": "5ed6929e2abcc06d8b059e00", "type": "error", "title": "artwork", "message": "Error scheduling artwork files processing. Error: Order does not contain artworks information\n at /var/www/html/stylusopapi-staging/dist/api/controllers/Orders/index.js:1235:27\n at /var/www/html/stylusopapi-staging/node_modules/async/dist/async.js:3110:16\n at eachOfArrayLike (/var/www/html/stylusopapi-staging/node_modules/async/dist/async.js:1069:9)\n at eachOf (/var/www/html/stylusopapi-staging/node_modules/async/dist/async.js:1117:5)\n at Object.eachLimit (/var/www/html/stylusopapi-staging/node_modules/async/dist/async.js:3172:5)\n at OrdersController.scheduleArtworksDownload (/var/www/html/stylusopapi-staging/dist/api/controllers/Orders/index.js:1221:27)\n at OrdersController.doAfterOrdersCreated (/var/www/html/stylusopapi-staging/dist/api/controllers/Orders/index.js:430:29)\n at _callee5$ (/var/www/html/stylusopapi-staging/dist/api/controllers/Orders/index.js:675:26)\n at tryCatch (/var/www/html/stylusopapi-staging/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:45:40)\n at Generator.invoke [as _invoke] (/var/www/html/stylusopapi-staging/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:274:22)\n at Generator.prototype.(anonymous function) [as next] (/var/www/html/stylusopapi-staging/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:97:21)\n at asyncGeneratorStep (/var/www/html/stylusopapi-staging/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)\n at _next (/var/www/html/stylusopapi-staging/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)\n at /var/www/html/stylusopapi-staging/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7\n at new Promise (<anonymous>)\n at /var/www/html/stylusopapi-staging/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12", "timestamp": "2020-06-02T17:55:42.304Z" } ], "createdAt": "2020-06-02T17:55:42.093Z", "updatedAt": "2020-06-02T17:55:42.313Z", "__v": 1 } ] }, "MOCK_GET_ORDER_STATUS": { "orderId": "123456789", "status": "ordered", "message": "This order has been successfully ordered" }, "MOCK_GET_ORDER_ACTIVITY": { "success": true, "activity": [ { "affectedItems": [], "_id": "5f075fd317ddce5a918ab33a", "order": "5efa364e87d09383ed5b85f0", "title": "Updated order status", "action": "UPDATE_ORDER_STATUS", "user": { "_id": "5b3353fed422341310ac6e7f", "username": "admin", "avatar": "https://api.adorable.io/avatars/115/admin" }, "datetime": "2020-07-09T18:20:03.761Z" }, { "affectedItems": [], "_id": "5f075fce17ddce5a918ab337", "order": "5efa364e87d09383ed5b85f0", "title": "Cancelled order", "action": "CANCEL_ORDER", "user": { "_id": "5b3353fed422341310ac6e7f", "username": "admin", "avatar": "https://api.adorable.io/avatars/115/admin" }, "datetime": "2020-07-09T18:19:58.065Z" } ] }, "MOCK_CANCEL_ORDER_REQUEST":{ "reason":"Customer requested" }, "MOCK_CANCEL_ORDER_RESPONSE": { "success": true, "message": "Successfully cancelled order" }, "MOCK_CREATE_ORDER_REQUEST": { "orderId": 10000, "companyRefId": "xyzclothing", "shippingInfo": { "name": "TESTING", "street1": "271 COLLINS STREET", "street2": "LEVEL 3", "city": "MELBOURNE", "state": "VIC", "phone": "", "postcode": "3000", "country_code": "AU" }, "customerName": "TESTING", "shippingMethod": "standard", "items": [ { "assets": [ { "description": "artwork", "url": "https://s3-us-west-2.amazonaws.com/xyzclothing/XCN-19934L.png", "preview_url": "http://app.xyzclothing.com/vault/amazonthumbs/XCN-19934L.png" } ], "itemId": 131002, "itemNumber": 131219, "product": "leggings", "properties": { "size": "XL" }, "previewImgUrl": "http://app.xyzclothing.com/vault/amazonthumbs/XCN-19934L.png", "quantity": 1, "price": 1.99 } ], "sale_datetime": "2018-07-03T00:00:00.130Z" }, "MOCK_CREATE_ORDER_RESPONSE": { "reference_id": "5f147624ee96ff316dbc1e8c", "order": { "orderStatus": "ordered", "priorityLabel": "qa", "notes": [], "id": "5f147624ee96ff316dbc1e8c", "orderId": 10000, "companyRefId": "xyzclothing", "shippingInfo": { "name": "TESTING", "street1": "271 COLLINS STREET", "street2": "LEVEL 3", "city": "MELBOURNE", "state": "VIC", "postcode": "3000", "country_code": "AU" }, "shippingMethod": "standard", "items": [], "sale_datetime": "2018-07-03T00: 00: 00.130Z", "created_date": "2020-07-19T16: 34: 44.708Z", "artworksInOrder": [], "alerts": [], "createdAt": "2020-07-19T16: 34: 44.714Z", "updatedAt": "2020-07-19T16: 34: 44.799Z", "__v": 1 }, "errors": [] }, "MOCK_UPDATE_ORDER_REQUEST": { "priorityLabel": "vip", "shippingInfo": { "name": "your updated name", "street1": "your updated street1", "city": "your updated city" }, "returnToAddress": { "company": "your updated company name", "street1": "your updated street1", "city": "your updated city" }, "items": [ { "assets": [ { "description": "artwork", "url": "https://s3.amazonaws.com/merch-it--xlusion/MERLN-21463S.png", "preview_url": "https://app.merch-it.com/vault/amazonthumbs/MERLN-21463S.png" } ], "itemId": 2477539164242, "product": "leggings", "properties": { "size": "SM", "color": "OC" }, "sku": "X103_OC_SM", "description": "MERLN-21463S", "previewImgUrl": "https://app.merch-it.com/vault/amazonthumbs/MERLN-21463S.png", "quantity": 2, "price": 1.99, "weight": { "value": 7, "units": "ounces" } } ] }, "MOCK_UPDATE_ORDER_RESPONSE": { "success": true, "message": "The order has been patched", "reference_id": "5f147dfeee96ff316dbc1eb0" } }