diff --git a/README.md b/README.md index 27ca547..76d0bee 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,29 @@ if you have issues with this you may want to try installing mocha globally like --- +For Canada +==== + +Set the urls.json file to be: +``` +{ + "referer":"https://order.dominos.ca/en/pages/order/", + "sourceUri":"order.dominos.ca", + "store": { + "find": "https://order.dominos.ca/power/store-locator?s=${line1}&c=${line2}&type=${type}", + "info": "https://order.dominos.ca/power/store/${storeID}/profile", + "menu": "https://order.dominos.ca/power/store/${storeID}/menu?lang=${lang}&structured=true" + }, + "order": { + "validate": "https://order.dominos.ca/power/validate-order", + "price": "https://order.dominos.ca/power/price-order", + "place": "https://order.dominos.ca/power/place-order" + }, + "track": "https://trkweb.dominos.ca/orderstorage/GetTrackerData?" +} + +``` + Finding Stores ==== diff --git a/src/Address.js b/src/Address.js index 4c73e73..7d0c16c 100644 --- a/src/Address.js +++ b/src/Address.js @@ -93,7 +93,7 @@ var Address = function(parameters) { splitAddress[i] = splitAddress[i].trim(); } - this.PostalCode=Number(splitAddress[splitAddress.length-1]) + this.PostalCode= splitAddress[splitAddress.length-1] //need better intellegence for auto determining address parts //added some, should externalize it diff --git a/src/Order.js b/src/Order.js index ed81af2..df5b9f0 100644 --- a/src/Order.js +++ b/src/Order.js @@ -27,7 +27,7 @@ var Order = function(parameters) { this.Market = ''; this.Currency = ''; this.ServiceMethod = parameters.deliveryMethod || 'Delivery'; - this.SourceOrganizationURI = 'order.dominos.com'; + this.SourceOrganizationURI = urls.sourceUri; this.StoreID = parameters.storeID||''; this.Tags = {}; this.Version = '1.0'; diff --git a/src/http-json.js b/src/http-json.js index e9f95fe..8201143 100644 --- a/src/http-json.js +++ b/src/http-json.js @@ -1,4 +1,5 @@ var http = require('request'); +var urls = require('./urls.json') module.exports.post = function(url, req, callback) { if(typeof req != 'string') @@ -7,7 +8,7 @@ module.exports.post = function(url, req, callback) { var requestBody = { uri: url, headers: { - Referer:'https://order.dominos.com/en/pages/order/', + Referer: urls.referer, 'Content-Type': 'application/json' }, body: req @@ -49,7 +50,7 @@ module.exports.get = function(url, callback){ var requestBody = { uri: url, headers: { - 'Referer': 'https://order.dominos.com/en/pages/order/' + 'Referer': urls.referer } }; http.get(requestBody, function (error, res, body) { diff --git a/src/urls.json b/src/urls.json index 7d83a8e..2b57a17 100644 --- a/src/urls.json +++ b/src/urls.json @@ -1,4 +1,6 @@ { + "referer":"https://order.dominos.com/en/pages/order/", + "sourceUri":"order.dominos.com", "store": { "find": "https://order.dominos.com/power/store-locator?s=${line1}&c=${line2}&type=${type}", "info": "https://order.dominos.com/power/store/${storeID}/profile",