From 07552a88cd7d91dead6340c9ece20aa8e90c14d9 Mon Sep 17 00:00:00 2001 From: Patrick Dube Date: Wed, 7 Sep 2016 21:16:54 -0400 Subject: [PATCH 1/4] Adapting for Canada --- src/Address.js | 2 +- src/Order.js | 2 +- src/http-json.js | 4 ++-- src/urls.json | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) 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..aef6e7e 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 = 'order.dominos.ca'; this.StoreID = parameters.storeID||''; this.Tags = {}; this.Version = '1.0'; diff --git a/src/http-json.js b/src/http-json.js index e9f95fe..d80964e 100644 --- a/src/http-json.js +++ b/src/http-json.js @@ -7,7 +7,7 @@ module.exports.post = function(url, req, callback) { var requestBody = { uri: url, headers: { - Referer:'https://order.dominos.com/en/pages/order/', + Referer: 'https://order.dominos.ca/en/pages/order/', 'Content-Type': 'application/json' }, body: req @@ -49,7 +49,7 @@ module.exports.get = function(url, callback){ var requestBody = { uri: url, headers: { - 'Referer': 'https://order.dominos.com/en/pages/order/' + 'Referer': 'https://order.dominos.ca/en/pages/order/' } }; http.get(requestBody, function (error, res, body) { diff --git a/src/urls.json b/src/urls.json index 7d83a8e..1a07dda 100644 --- a/src/urls.json +++ b/src/urls.json @@ -1,13 +1,13 @@ { "store": { - "find": "https://order.dominos.com/power/store-locator?s=${line1}&c=${line2}&type=${type}", - "info": "https://order.dominos.com/power/store/${storeID}/profile", - "menu": "https://order.dominos.com/power/store/${storeID}/menu?lang=${lang}&structured=true" + "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.com/power/validate-order", - "price": "https://order.dominos.com/power/price-order", - "place": "https://order.dominos.com/power/place-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.com/orderstorage/GetTrackerData?" + "track": "https://trkweb.dominos.ca/orderstorage/GetTrackerData?" } From 17c416f4c5917bcf65d13cf8b1152c6e670265fe Mon Sep 17 00:00:00 2001 From: Patrick Dube Date: Wed, 7 Sep 2016 21:22:35 -0400 Subject: [PATCH 2/4] Pulling out urls to urls.json --- src/Order.js | 2 +- src/http-json.js | 5 +++-- src/urls.json | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Order.js b/src/Order.js index aef6e7e..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.ca'; + 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 d80964e..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.ca/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.ca/en/pages/order/' + 'Referer': urls.referer } }; http.get(requestBody, function (error, res, body) { diff --git a/src/urls.json b/src/urls.json index 1a07dda..fc19204 100644 --- a/src/urls.json +++ b/src/urls.json @@ -1,4 +1,6 @@ { + "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", From c4af3a00edd2e2f8d55e3e0c1a8754cf7c65e35c Mon Sep 17 00:00:00 2001 From: Patrick Dube Date: Wed, 7 Sep 2016 21:23:39 -0400 Subject: [PATCH 3/4] Setting to US for PR --- src/urls.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/urls.json b/src/urls.json index fc19204..2b57a17 100644 --- a/src/urls.json +++ b/src/urls.json @@ -1,15 +1,15 @@ { - "referer":"https://order.dominos.ca/en/pages/order/", - "sourceUri":"order.dominos.ca", + "referer":"https://order.dominos.com/en/pages/order/", + "sourceUri":"order.dominos.com", "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" + "find": "https://order.dominos.com/power/store-locator?s=${line1}&c=${line2}&type=${type}", + "info": "https://order.dominos.com/power/store/${storeID}/profile", + "menu": "https://order.dominos.com/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" + "validate": "https://order.dominos.com/power/validate-order", + "price": "https://order.dominos.com/power/price-order", + "place": "https://order.dominos.com/power/place-order" }, - "track": "https://trkweb.dominos.ca/orderstorage/GetTrackerData?" + "track": "https://trkweb.dominos.com/orderstorage/GetTrackerData?" } From 4275ffe4515df87b87000bdb7218eb744ab9387e Mon Sep 17 00:00:00 2001 From: pdube Date: Wed, 7 Sep 2016 21:27:16 -0400 Subject: [PATCH 4/4] Update README.md for Canada info --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 ====