From c072a8b8c21460583dacde0f5753eabd751853cb Mon Sep 17 00:00:00 2001 From: adyNabeelMadain Date: Thu, 15 Dec 2016 00:40:59 +0200 Subject: [PATCH] use https --- control/content/enums.js | 2 +- control/design/enums.js | 2 +- test/control/content/app.services.spec.js | 36 +++++++++++------------ test/control/content/enums.spec.js | 4 +-- test/widget/app.services.spec.js | 28 +++++++++--------- test/widget/enums.spec.js | 4 +-- widget/app.services.js | 11 +++++-- widget/enums.js | 3 +- 8 files changed, 49 insertions(+), 41 deletions(-) diff --git a/control/content/enums.js b/control/content/enums.js index 3ab2032..6bba1dc 100644 --- a/control/content/enums.js +++ b/control/content/enums.js @@ -20,6 +20,6 @@ ITEM_ARRAY_FOUND: 'Array of Items provided' }) .constant('SERVER', { - URL : 'http://loyalty.kaleoapps.com' + URL : 'https://loyalty.buildfire.com' }); })(window.angular); \ No newline at end of file diff --git a/control/design/enums.js b/control/design/enums.js index 848ba15..aeccab1 100644 --- a/control/design/enums.js +++ b/control/design/enums.js @@ -23,7 +23,7 @@ ITEM_ARRAY_FOUND: 'Array of Items provided' }) .constant('SERVER', { - URL: 'http://loyalty.kaleoapps.com' + URL: 'https://loyalty.buildfire.com' }) .constant('LAYOUTS', { listLayout: [ diff --git a/test/control/content/app.services.spec.js b/test/control/content/app.services.spec.js index 9d6876d..0ab53ae 100644 --- a/test/control/content/app.services.spec.js +++ b/test/control/content/app.services.spec.js @@ -34,7 +34,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.addEditApplication(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyApp') + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyApp') .respond(200, { status: "success" }); @@ -57,7 +57,7 @@ describe('Unit : loyaltyPluginContent content services', function () { $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyApp') + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyApp') .respond(null); $httpBackend.flush(); $rootScope.$digest(); @@ -74,7 +74,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.addEditApplication(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyApp') + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyApp') .respond(500, { status: null }); @@ -97,7 +97,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.getApplication(id); $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyApp/'+id) + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyApp/'+id) .respond(200, { status: "success" }); @@ -118,7 +118,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.getApplication(id); $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyApp/'+id) + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyApp/'+id) .respond(null); $httpBackend.flush(); $rootScope.$digest(); @@ -137,7 +137,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.getApplication(id); $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyApp/'+id) + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyApp/'+id) .respond(500, { status: null }); @@ -159,7 +159,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.addReward(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyRewards',data) + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyRewards',data) .respond(200, { status: "success" }); @@ -180,7 +180,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.addReward(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyRewards',data) + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyRewards',data) .respond(null); $httpBackend.flush(); $rootScope.$digest(); @@ -197,7 +197,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.addReward(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyRewards',data) + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyRewards',data) .respond(500, { status: null }); @@ -219,7 +219,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.getRewards(id); $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyRewards/'+id) + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyRewards/'+id) .respond(200, { status: "success" }); @@ -240,7 +240,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.getRewards(id); $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyRewards/'+id) + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyRewards/'+id) .respond(500, { status: null }); @@ -262,7 +262,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.updateReward(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyRewards',data) + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyRewards',data) .respond(200, { status: "success" }); @@ -283,7 +283,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.updateReward(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyRewards',data) + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyRewards',data) .respond(500, { status: null }); @@ -308,7 +308,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.removeReward(id,data); $httpBackend - .when('DELETE', 'http://loyalty.kaleoapps.com/api/loyaltyRewards/'+id+'?appId='+data.appId+'&userToken='+data.userToken+'&auth='+data.auth) + .when('DELETE', 'https://loyalty.buildfire.com/api/loyaltyRewards/'+id+'?appId='+data.appId+'&userToken='+data.userToken+'&auth='+data.auth) .respond(200, { status: "success" }); @@ -332,7 +332,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.removeReward(id,data); $httpBackend - .when('DELETE', 'http://loyalty.kaleoapps.com/api/loyaltyRewards/'+id+'?appId='+data.appId+'&userToken='+data.userToken+'&auth='+data.auth) + .when('DELETE', 'https://loyalty.buildfire.com/api/loyaltyRewards/'+id+'?appId='+data.appId+'&userToken='+data.userToken+'&auth='+data.auth) .respond(null); $httpBackend.flush(); $rootScope.$digest(); @@ -354,7 +354,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.removeReward(id,data); $httpBackend - .when('DELETE', 'http://loyalty.kaleoapps.com/api/loyaltyRewards/'+id+'?appId='+data.appId+'&userToken='+data.userToken+'&auth='+data.auth) + .when('DELETE', 'https://loyalty.buildfire.com/api/loyaltyRewards/'+id+'?appId='+data.appId+'&userToken='+data.userToken+'&auth='+data.auth) .respond(500, { status: null }); @@ -376,7 +376,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.sortRewards(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyRewardsSort',data) + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyRewardsSort',data) .respond(200, { status: "success" }); @@ -397,7 +397,7 @@ describe('Unit : loyaltyPluginContent content services', function () { LoyaltyAPI.sortRewards(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyRewardsSort',data) + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyRewardsSort',data) .respond(500, { status: null }); diff --git a/test/control/content/enums.spec.js b/test/control/content/enums.spec.js index df81538..ce5d154 100644 --- a/test/control/content/enums.spec.js +++ b/test/control/content/enums.spec.js @@ -65,8 +65,8 @@ describe('Unit : loyaltyPluginContent content Enums', function () { it('SERVER should exist and be an object', function () { expect(typeof SERVER).toEqual('object'); }); - it('SERVER.URL should exist and equals to "http://loyalty.kaleoapps.com"', function () { - expect(SERVER.URL).toEqual('http://loyalty.kaleoapps.com'); + it('SERVER.URL should exist and equals to "https://loyalty.buildfire.com"', function () { + expect(SERVER.URL).toEqual('https://loyalty.buildfire.com'); }); }); }); diff --git a/test/widget/app.services.spec.js b/test/widget/app.services.spec.js index e3ffa15..69aa967 100644 --- a/test/widget/app.services.spec.js +++ b/test/widget/app.services.spec.js @@ -29,7 +29,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { LoyaltyAPI.addApplication(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyApp') + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyApp') .respond(200, { status: "success" }); @@ -43,7 +43,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { LoyaltyAPI.addApplication(data); $httpBackend - .when('POST', 'http://loyalty.kaleoapps.com/api/loyaltyApp') + .when('POST', 'https://loyalty.buildfire.com/api/loyaltyApp') .respond(500, { status: null }); @@ -56,7 +56,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { LoyaltyAPI.getApplication(''); $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyApp/', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyApp/', { }) .respond(200, { data: 'value' }); @@ -68,7 +68,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { LoyaltyAPI.getApplication(''); $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyApp/', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyApp/', { }) .respond(500, { data: null }); @@ -83,7 +83,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyRewards/e22494ec-73ea-44ac-b82b-75f64b8bc535', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyRewards/e22494ec-73ea-44ac-b82b-75f64b8bc535', { }) .respond(200, { status: "success" @@ -98,7 +98,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyRewards/', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyRewards/', { }) .respond(500, { status: null @@ -127,7 +127,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyUser/557c6567c8faa5ec0f003728?userToken=EqrMk%2FnVWw3Qqwjikn277vxqp2JNTSreFbQdrq%2BzqEo%3D&loyaltyUnqiueId=1450083424880-07702731736935675', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyUser/557c6567c8faa5ec0f003728?userToken=EqrMk%2FnVWw3Qqwjikn277vxqp2JNTSreFbQdrq%2BzqEo%3D&loyaltyUnqiueId=1450083424880-07702731736935675', { }) .respond(200, { status: "success" @@ -143,7 +143,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyUser/'+userid+'?userToken=EqrMk%2FnVWw3Qqwjikn277vxqp2JNTSreFbQdrq%2BzqEo%3D&loyaltyUnqiueId=1450083424880-07702731736935675', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyUser/'+userid+'?userToken=EqrMk%2FnVWw3Qqwjikn277vxqp2JNTSreFbQdrq%2BzqEo%3D&loyaltyUnqiueId=1450083424880-07702731736935675', { }) .respond(500, { status: null @@ -158,7 +158,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyUserAddPoint/557c6567c8faa5ec0f003728?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&loyaltyUnqiueId=1450083424880-07702731736935675&redemptionPasscode=12345&purchaseAmount=1000', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyUserAddPoint/557c6567c8faa5ec0f003728?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&loyaltyUnqiueId=1450083424880-07702731736935675&redemptionPasscode=12345&purchaseAmount=1000', { }) .respond(200, { status: "success" @@ -174,7 +174,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyUserAddPoint/557c6567c8faa5ec0f003728?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&loyaltyUnqiueId='+loyalityUniqueId+'&redemptionPasscode=12345&purchaseAmount=1000', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyUserAddPoint/557c6567c8faa5ec0f003728?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&loyaltyUnqiueId='+loyalityUniqueId+'&redemptionPasscode=12345&purchaseAmount=1000', { }) .respond(500, { status: null @@ -189,7 +189,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyAppPassCode/1450083424880-07702731736935675?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&redemptionPasscode=12345', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyAppPassCode/1450083424880-07702731736935675?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&redemptionPasscode=12345', { }) .respond(200); $httpBackend.flush(); @@ -203,7 +203,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyAppPassCode/'+null+'?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&redemptionPasscode=12345', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyAppPassCode/'+null+'?userToken=RxkOcyDzsgXq0AqpzI8v5557D41sd56NiK%2B5%2F1Ef07A%3D&redemptionPasscode=12345', { }) .respond(500, { status: null @@ -218,7 +218,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyUserRedeem/557c6567c8faa5ec0f003728?loyaltyUnqiueId=1450237043026-01417660885490477&userToken=3paSyI1VnmWrRfrpnclagflkLezdxaQTHcskZBetTlw%3D&redeemId=5671028609db81b815000002', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyUserRedeem/557c6567c8faa5ec0f003728?loyaltyUnqiueId=1450237043026-01417660885490477&userToken=3paSyI1VnmWrRfrpnclagflkLezdxaQTHcskZBetTlw%3D&redeemId=5671028609db81b815000002', { }) .respond(200); $httpBackend.flush(); @@ -232,7 +232,7 @@ describe('Unit : loyaltyPluginWidget design services', function () { template:['Item_Details'] } $httpBackend - .when('GET', 'http://loyalty.kaleoapps.com/api/loyaltyUserRedeem/557c6567c8faa5ec0f003728?loyaltyUnqiueId=1450237043026-01417660885490477&userToken='+userToken+'&redeemId=5671028609db81b815000002', { + .when('GET', 'https://loyalty.buildfire.com/api/loyaltyUserRedeem/557c6567c8faa5ec0f003728?loyaltyUnqiueId=1450237043026-01417660885490477&userToken='+userToken+'&redeemId=5671028609db81b815000002', { }) .respond(500, { status: null diff --git a/test/widget/enums.spec.js b/test/widget/enums.spec.js index 3aa049d..e7e05a0 100644 --- a/test/widget/enums.spec.js +++ b/test/widget/enums.spec.js @@ -65,8 +65,8 @@ describe('Unit : loyaltyPluginWidget Widget Enums', function () { it('SERVER should exist and be an object', function () { expect(typeof SERVER).toEqual('object'); }); - it('SERVER.URL should exist and equals to "http://loyalty.kaleoapps.com"', function () { - expect(SERVER.URL).toEqual('http://loyalty.kaleoapps.com'); + it('SERVER.URL should exist and equals to "https://loyalty.buildfire.com"', function () { + expect(SERVER.URL).toEqual('https://loyalty.buildfire.com'); }); }); }); diff --git a/widget/app.services.js b/widget/app.services.js index fbdd9b8..ced4efb 100644 --- a/widget/app.services.js +++ b/widget/app.services.js @@ -58,12 +58,19 @@ }]) .factory('LoyaltyAPI', ['$q', 'STATUS_CODE', 'STATUS_MESSAGES', 'SERVER', '$http', function ($q, STATUS_CODE, STATUS_MESSAGES, SERVER, $http) { + var isAndroid = function () { + var userAgent = navigator.userAgent || navigator.vendor || window.opera; + return (/android/i.test(userAgent)); + }; + var getProxyServerUrl = function () { + return isAndroid() ? SERVER.httpURL : SERVER.URL; + }; var addApplication = function (app) { var deferred = $q.defer(); if (!app) { deferred.reject(new Error('Undefined app data')); } - $http.post(SERVER.URL + '/api/loyaltyApp', app).success(function (response) { + $http.post(getProxyServerUrl() + '/api/loyaltyApp', app).success(function (response) { if (response.statusCode == 200) deferred.resolve(response); else @@ -80,7 +87,7 @@ if (!id) { deferred.reject(new Error('Undefined app id')); } - $http.get(SERVER.URL + '/api/loyaltyApp/' + id).success(function (response) { + $http.get(getProxyServerUrl() + '/api/loyaltyApp/' + id).success(function (response) { if (response) deferred.resolve(response); else diff --git a/widget/enums.js b/widget/enums.js index 56ff286..c0cb074 100644 --- a/widget/enums.js +++ b/widget/enums.js @@ -20,7 +20,8 @@ ITEM_ARRAY_FOUND: 'Array of Items provided' }) .constant('SERVER', { - URL: 'http://loyalty.kaleoapps.com' + URL: 'https://loyalty.buildfire.com', + httpURL: 'http://loyalty.kaleoapps.com' }) .constant('TAG_NAMES', { LOYALTY_INFO: 'loyaltyInfo'