mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
This commit standardizes the naming of identifier and API key fields across the codebase to use consistent camel case (e.g., `ID`, `APIKey`, `DatabaseURL`). This includes updates to struct fields, method names, function parameters, and environment variable references. The changes improve code clarity and maintainability by reducing ambiguity and aligning with Go naming conventions. No functional behavior is changed.
35 lines
632 B
Go
35 lines
632 B
Go
package booking
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"time"
|
|
|
|
"github.com/rjNemo/rentease/internal/config"
|
|
)
|
|
|
|
type Line struct {
|
|
From time.Time
|
|
To time.Time
|
|
CustomerName string
|
|
Platform string
|
|
ID int
|
|
Total float64
|
|
PlatformFees float64
|
|
Canceled bool
|
|
}
|
|
|
|
func (l Line) InvoiceNumber(hc *config.Host) string {
|
|
return fmt.Sprintf("%s%04s", hc.InvoicePrefix, strconv.Itoa(l.ID+hc.CustomerSeed))
|
|
}
|
|
|
|
func (l Line) Fee() float64 {
|
|
if l.Platform == "Other" {
|
|
return l.Total * 5 / 100
|
|
}
|
|
return l.Total * 10 / 100
|
|
}
|
|
|
|
func (l Line) Profit() float64 {
|
|
return l.Total - l.PlatformFees - l.Fee()
|
|
}
|