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:
Blade Barringer
2016-06-26 08:08:49 -05:00
parent a7d4b76c58
commit 81ac45f2a7
4 changed files with 203 additions and 49 deletions

View File

@@ -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',
});