mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-18 09:52:20 +00:00
fix(subs): record creation for gifts
This commit is contained in:
parent
cd545e08d5
commit
f8751b002c
2 changed files with 9 additions and 0 deletions
|
|
@ -145,6 +145,14 @@ describe('payments/index', () => {
|
|||
expect(recipient.purchased.plan.dateUpdated).to.exist;
|
||||
});
|
||||
|
||||
it('sets plan.dateCreated if it did not previously exist', async () => {
|
||||
expect(recipient.purchased.plan.dateCreated).to.not.exist;
|
||||
|
||||
await api.createSubscription(data);
|
||||
|
||||
expect(recipient.purchased.plan.dateCreated).to.exist;
|
||||
});
|
||||
|
||||
it('does not change plan.customerId if it already exists', async () => {
|
||||
recipient.purchased.plan = plan;
|
||||
data.customerId = 'purchaserCustomerId';
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ api.createSubscription = async function createSubscription (data) {
|
|||
plan.dateTerminated = moment(plan.dateTerminated).add({months}).toDate();
|
||||
} else {
|
||||
plan.dateTerminated = moment().add({months}).toDate();
|
||||
plan.dateCreated = today;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue