mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
Used ajax when canceling from the website (#8697)
* Used ajax when canceling from the website * Fixed grammar issue
This commit is contained in:
parent
773d546e4f
commit
8c8f0ea201
2 changed files with 17 additions and 4 deletions
|
|
@ -326,11 +326,23 @@ function($rootScope, User, $http, Content) {
|
||||||
paymentMethod = paymentMethod.toLowerCase();
|
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) {
|
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) {
|
Payments.encodeGift = function(uuid, gift) {
|
||||||
|
|
|
||||||
|
|
@ -170,5 +170,6 @@
|
||||||
"missingPaymentId": "Missing req.query.paymentId",
|
"missingPaymentId": "Missing req.query.paymentId",
|
||||||
"missingCustomerId": "Missing req.query.customerId",
|
"missingCustomerId": "Missing req.query.customerId",
|
||||||
"missingPaypalBlock": "Missing req.session.paypalBlock",
|
"missingPaypalBlock": "Missing req.session.paypalBlock",
|
||||||
"missingSubKey": "Missing req.query.sub"
|
"missingSubKey": "Missing req.query.sub",
|
||||||
|
"paypalCanceled": "Your subscription has been canceled"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue