Skip to content

Commit

Permalink
create model method to check default plan is free or not + add unit t…
Browse files Browse the repository at this point in the history
…ests (#833)
  • Loading branch information
AmanGIT07 authored Dec 24, 2024
1 parent 7e8903b commit ceed362
Show file tree
Hide file tree
Showing 10 changed files with 1,271 additions and 6 deletions.
11 changes: 11 additions & 0 deletions billing/plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ func (p Plan) GetUserSeatProduct() (product.Product, bool) {
return product.Product{}, false
}

func (p Plan) IsFree() bool {
for _, prod := range p.Products {
for _, price := range prod.Prices {
if price.Amount > 0 {
return false
}
}
}
return true
}

type Filter struct {
IDs []string
Interval string
Expand Down
157 changes: 157 additions & 0 deletions core/event/mocks/checkout_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 85 additions & 0 deletions core/event/mocks/credit_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ceed362

Please sign in to comment.