mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
fix(api): Grant remaining perks when canceling an Amazon subscription
* Add tests for payments lib * Add placeholder it blocks to be filled in closes #7660 closes #4840
This commit is contained in:
@@ -239,9 +239,12 @@ api.subscribeCancel = {
|
||||
AmazonBillingAgreementId: billingAgreementId,
|
||||
});
|
||||
|
||||
let subscriptionBlock = shared.content.subscriptionBlocks[user.purchased.plan.planId];
|
||||
let subscriptionLength = subscriptionBlock.months * 30;
|
||||
|
||||
await payments.cancelSubscription({
|
||||
user,
|
||||
nextBill: moment(user.purchased.plan.lastBillingDate).add({ days: 30 }),
|
||||
nextBill: moment(user.purchased.plan.lastBillingDate).add({ days: subscriptionLength }),
|
||||
paymentMethod: 'Amazon Payments',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user