Update credit_billing.ts
This commit is contained in:
parent
0a607b9efa
commit
7689c31d35
@ -40,8 +40,10 @@ export async function supaBillTeam(team_id: string, credits: number) {
|
|||||||
let sortedCoupons = coupons.sort((a, b) => b.credits - a.credits);
|
let sortedCoupons = coupons.sort((a, b) => b.credits - a.credits);
|
||||||
// using coupon credits:
|
// using coupon credits:
|
||||||
if (couponCredits > 0) {
|
if (couponCredits > 0) {
|
||||||
|
// if there is no subscription and they have enough coupon credits
|
||||||
if (!subscription) {
|
if (!subscription) {
|
||||||
// using only coupon credits:
|
// using only coupon credits:
|
||||||
|
// if there are enough coupon credits
|
||||||
if (couponCredits >= credits) {
|
if (couponCredits >= credits) {
|
||||||
// remove credits from coupon credits
|
// remove credits from coupon credits
|
||||||
let usedCredits = credits;
|
let usedCredits = credits;
|
||||||
|
Loading…
Reference in New Issue
Block a user