Fixed creating events within transaction

no-issue

If we are to perform the `linkSubscription` method inside of a
transaction, the addition of the paid subscription events would happen
outside of the transaction, and cause errors. This ensures that we pass
the options object (containing the transaction) to the models calls to
add paid subscription events
This commit is contained in:
Fabien O'Carroll 2021-03-10 15:24:43 +00:00 committed by Fabien 'egg' O'Carroll
parent 9be1d2de4f
commit 907ccd9f34

View File

@ -327,7 +327,7 @@ module.exports = class MemberRepository {
to_plan: updated.get('plan_id'),
currency: subscription.plan.currency,
mrr_delta: mrrDelta
});
}, options);
}
} else {
await this._StripeCustomerSubscription.add(subscriptionData, options);
@ -338,7 +338,7 @@ module.exports = class MemberRepository {
to_plan: subscription.plan.id,
currency: subscription.plan.currency,
mrr_delta: getMRRDelta({interval: subscription.plan.interval, amount: subscription.plan.amount, status: subscription.status})
});
}, options);
}
let status = 'free';