mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
* (fix) If coupon is not valid, display an error * (test) Add valid and invalid coupon tests for applyCoupon * Add test descriptions
This commit is contained in:
@@ -269,7 +269,11 @@ habitrpg.controller('SettingsCtrl',
|
||||
|
||||
$scope.applyCoupon = function(coupon){
|
||||
$http.post(ApiUrl.get() + '/api/v3/coupons/validate/'+coupon)
|
||||
.success(function(){
|
||||
.success(function(res, code){
|
||||
if (!res.data.valid) {
|
||||
Notification.error(env.t('invalidCoupon'), true);
|
||||
return;
|
||||
}
|
||||
Notification.text("Coupon applied!");
|
||||
var subs = Content.subscriptionBlocks;
|
||||
subs["basic_6mo"].discount = true;
|
||||
|
||||
Reference in New Issue
Block a user