mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Small payment fixes (#9082)
* Fixed some parameter passing and computed placements * reset edit when user change * Lint fix
This commit is contained in:
@@ -36,11 +36,11 @@
|
|||||||
strong {{user.purchased.plan.dateTerminated | date}}
|
strong {{user.purchased.plan.dateTerminated | date}}
|
||||||
tr(v-if='!hasCanceledSubscription'): td
|
tr(v-if='!hasCanceledSubscription'): td
|
||||||
h4 {{ $t('subscribed') }}
|
h4 {{ $t('subscribed') }}
|
||||||
p(v-if='hasPlan && !hasGroupPlan') {{ $t('purchasedPlanId', {purchasedPlanIdInfo}) }}
|
p(v-if='hasPlan && !hasGroupPlan') {{ $t('purchasedPlanId', purchasedPlanIdInfo) }}
|
||||||
p(v-if='hasGroupPlan') {{ $t('youHaveGroupPlan') }}
|
p(v-if='hasGroupPlan') {{ $t('youHaveGroupPlan') }}
|
||||||
tr(v-if='user.purchased.plan.extraMonths'): td
|
tr(v-if='user.purchased.plan.extraMonths'): td
|
||||||
span.glyphicon.glyphicon-credit-card
|
span.glyphicon.glyphicon-credit-card
|
||||||
| {{ $t('purchasedPlanExtraMonths', {purchasedPlanExtraMonthsDetails}) }}
|
| {{ $t('purchasedPlanExtraMonths', purchasedPlanExtraMonthsDetails) }}
|
||||||
tr(v-if='hasConsecutiveSubscription'): td
|
tr(v-if='hasConsecutiveSubscription'): td
|
||||||
span.glyphicon.glyphicon-forward
|
span.glyphicon.glyphicon-forward
|
||||||
| {{ $t('consecutiveSubscription') }}
|
| {{ $t('consecutiveSubscription') }}
|
||||||
@@ -208,7 +208,7 @@ export default {
|
|||||||
},
|
},
|
||||||
purchasedPlanExtraMonthsDetails () {
|
purchasedPlanExtraMonthsDetails () {
|
||||||
return {
|
return {
|
||||||
months: this.user.purchased.plan.extraMonths.toFixed(2),
|
months: parseFloat(this.user.purchased.plan.extraMonths).toFixed(2),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
buyGemsGoldCap () {
|
buyGemsGoldCap () {
|
||||||
@@ -238,6 +238,14 @@ export default {
|
|||||||
amount: this.numberOfMysticHourglasses,
|
amount: this.numberOfMysticHourglasses,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
canCancelSubscription () {
|
||||||
|
return (
|
||||||
|
this.user.purchased.plan.paymentMethod !== this.paymentMethods.GOOGLE &&
|
||||||
|
this.user.purchased.plan.paymentMethod !== this.paymentMethods.APPLE &&
|
||||||
|
!this.hasCanceledSubscription &&
|
||||||
|
!this.hasGroupPlan
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async applyCoupon (coupon) {
|
async applyCoupon (coupon) {
|
||||||
@@ -253,14 +261,6 @@ export default {
|
|||||||
subs.basic_6mo.discount = true;
|
subs.basic_6mo.discount = true;
|
||||||
subs.google_6mo.discount = false;
|
subs.google_6mo.discount = false;
|
||||||
},
|
},
|
||||||
canCancelSubscription () {
|
|
||||||
return (
|
|
||||||
this.user.purchased.plan.paymentMethod !== this.paymentMethods.GOOGLE &&
|
|
||||||
this.user.purchased.plan.paymentMethod !== this.paymentMethods.APPLE &&
|
|
||||||
!this.hasCanceledSubscription &&
|
|
||||||
!this.hasGroupPlan
|
|
||||||
);
|
|
||||||
},
|
|
||||||
async cancelSubscription (config) {
|
async cancelSubscription (config) {
|
||||||
if (config && config.group && !confirm(this.$t('confirmCancelGroupPlan'))) return;
|
if (config && config.group && !confirm(this.$t('confirmCancelGroupPlan'))) return;
|
||||||
if (!confirm(this.$t('sureCancelSub'))) return;
|
if (!confirm(this.$t('sureCancelSub'))) return;
|
||||||
@@ -298,6 +298,7 @@ export default {
|
|||||||
this.$router.push('/');
|
this.$router.push('/');
|
||||||
},
|
},
|
||||||
getCancelSubInfo () {
|
getCancelSubInfo () {
|
||||||
|
// @TODO: String 'cancelSubInfoGroup Plan' not found. ?
|
||||||
return this.$t(`cancelSubInfo${this.user.purchased.plan.paymentMethod}`);
|
return this.$t(`cancelSubInfo${this.user.purchased.plan.paymentMethod}`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -653,6 +653,9 @@ export default {
|
|||||||
user () {
|
user () {
|
||||||
let user = this.userLoggedIn;
|
let user = this.userLoggedIn;
|
||||||
|
|
||||||
|
// Reset editing when user is changed. Move to watch or is this good?
|
||||||
|
this.editing = false;
|
||||||
|
|
||||||
let profileUser = this.$store.state.profileUser;
|
let profileUser = this.$store.state.profileUser;
|
||||||
if (profileUser._id && profileUser._id !== this.userLoggedIn._id) {
|
if (profileUser._id && profileUser._id !== this.userLoggedIn._id) {
|
||||||
user = profileUser;
|
user = profileUser;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Equivalent of jQuery's param
|
// Equivalent of jQuery's param
|
||||||
|
|
||||||
export default function (params) {
|
export default function (params) {
|
||||||
Object.keys(params).map((k) => {
|
return Object.keys(params).map((k) => {
|
||||||
return `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`;
|
return `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`;
|
||||||
}).join('&');
|
}).join('&');
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user