Used ajax when canceling from the website (#8697)

* Used ajax when canceling from the website

* Fixed grammar issue
This commit is contained in:
Keith Holliday
2017-06-22 15:13:53 -06:00
committed by Sabe Jones
parent 773d546e4f
commit 8c8f0ea201
2 changed files with 17 additions and 4 deletions

View File

@@ -326,11 +326,23 @@ function($rootScope, User, $http, Content) {
paymentMethod = paymentMethod.toLowerCase();
}
var cancelUrl = '/' + paymentMethod + '/subscribe/cancel?_id=' + User.user._id + '&apiToken=' + User.settings.auth.apiToken;
var queryParams = {
_id: User.user._id,
apiToken: User.settings.auth.apiToken,
noRedirect: true,
};
if (group) {
cancelUrl += '&groupId=' + group._id;
queryParams.groupId = group._id;
}
window.location.href = cancelUrl;
var cancelUrl = '/' + paymentMethod + '/subscribe/cancel?' + $.param(queryParams);
$http.get(cancelUrl)
.then(function (success) {
alert(window.evn.t('paypalCanceled'));
window.location.href = '/';
});
}
Payments.encodeGift = function(uuid, gift) {