File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change @@ -297,6 +297,16 @@ func (i *StandardLine) SaveDBSnapshot() {
297297
298298func (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 }
You can’t perform that action at this time.
0 commit comments