Skip to content

Commit ceed362

Browse files
authored
create model method to check default plan is free or not + add unit tests (#833)
1 parent 7e8903b commit ceed362

File tree

10 files changed

+1271
-6
lines changed

10 files changed

+1271
-6
lines changed

billing/plan/plan.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ func (p Plan) GetUserSeatProduct() (product.Product, bool) {
5757
return product.Product{}, false
5858
}
5959

60+
func (p Plan) IsFree() bool {
61+
for _, prod := range p.Products {
62+
for _, price := range prod.Prices {
63+
if price.Amount > 0 {
64+
return false
65+
}
66+
}
67+
}
68+
return true
69+
}
70+
6071
type Filter struct {
6172
IDs []string
6273
Interval string

core/event/mocks/checkout_service.go

Lines changed: 157 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/event/mocks/credit_service.go

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)