Skip to content

Commit 3fc7750

Browse files
committed
fix: rabbit review
1 parent 04a6f96 commit 3fc7750

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

openmeter/billing/service/lineservice/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func UpdateTotalsFromDetailedLines(line *billing.StandardLine) error {
5757
}
5858

5959
// WARNING: Even if tempting to add discounts etc. here to the totals, we should always keep the logic as is.
60-
// The usageBasedLine will never be syncorinzed directly to stripe or other apps, only the detailed lines.
60+
// The usageBasedLine will never be synchronized directly to stripe or other apps, only the detailed lines.
6161
//
6262
// Given that the external systems will have their own logic for calculating the totals, we cannot expect
6363
// any custom logic implemented here to be carried over to the external systems.

openmeter/billing/stdinvoiceline.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,16 @@ func (i *StandardLine) SaveDBSnapshot() {
297297

298298
func (i StandardLine) Validate() error {
299299
var errs []error
300+
301+
// Fail fast cases (most of the validation logic uses these)
302+
if i.UsageBased == nil {
303+
return errors.New("usage based line is required")
304+
}
305+
306+
if i.UsageBased.Price == nil {
307+
return errors.New("usage based line price is required")
308+
}
309+
300310
if err := i.StandardLineBase.Validate(); err != nil {
301311
errs = append(errs, err)
302312
}

0 commit comments

Comments
 (0)