Skip to content

Commit

Permalink
Merge pull request #40 from adyNabeelMadain/master
Browse files Browse the repository at this point in the history
Use https
  • Loading branch information
DanielHindi authored Dec 15, 2016
2 parents 462d5ad + c072a8b commit d068fed
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 41 deletions.
2 changes: 1 addition & 1 deletion control/content/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion control/design/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
36 changes: 18 additions & 18 deletions test/control/content/app.services.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
});
Expand All @@ -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();
Expand All @@ -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
});
Expand All @@ -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"
});
Expand All @@ -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();
Expand All @@ -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
});
Expand All @@ -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"
});
Expand All @@ -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();
Expand All @@ -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
});
Expand All @@ -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"
});
Expand All @@ -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
});
Expand All @@ -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"
});
Expand All @@ -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
});
Expand All @@ -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"
});
Expand All @@ -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();
Expand All @@ -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
});
Expand All @@ -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"
});
Expand All @@ -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
});
Expand Down
4 changes: 2 additions & 2 deletions test/control/content/enums.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});
Expand Down
28 changes: 14 additions & 14 deletions test/widget/app.services.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
});
Expand All @@ -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
});
Expand All @@ -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' });

Expand All @@ -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 });

Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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();
Expand All @@ -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
Expand All @@ -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();
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/widget/enums.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});
Expand Down
11 changes: 9 additions & 2 deletions widget/app.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion widget/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit d068fed

Please sign in to comment.