mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
Group migration fixes (#8555)
* fix(migration): better subs handling * feat(migration): award jackalopes * fix(lint): no console logs
This commit is contained in:
@@ -196,14 +196,19 @@ api.cancelSubscription = async function cancelSubscription (options = {}) {
|
||||
|
||||
let details = await this.getBillingAgreementDetails({
|
||||
AmazonBillingAgreementId: billingAgreementId,
|
||||
}).catch(function errorCatch (err) {
|
||||
return err;
|
||||
});
|
||||
|
||||
if (details.BillingAgreementDetails.BillingAgreementStatus.State !== 'Closed') {
|
||||
let badBAStates = ['Canceled', 'Closed', 'Suspended'];
|
||||
if (details && details.BillingAgreementDetails && details.BillingAgreementDetails.BillingAgreementStatus &&
|
||||
badBAStates.indexOf(details.BillingAgreementDetails.BillingAgreementStatus.State) === -1) {
|
||||
await this.closeBillingAgreement({
|
||||
AmazonBillingAgreementId: billingAgreementId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
let subscriptionBlock = common.content.subscriptionBlocks[planId];
|
||||
let subscriptionLength = subscriptionBlock.months * 30;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user