mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-10 12:46:53 +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.
61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package booking
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/rjNemo/rentease/internal/config"
|
|
)
|
|
|
|
func (bs Service) CreateItem(bookingID int, item config.HostItem, quantity int, price float64, paymentMethod string, customerNumber int, platform string) (items []*Item) {
|
|
i := &Item{
|
|
BookingID: bookingID,
|
|
Item: item.Name,
|
|
Quantity: quantity,
|
|
Price: price,
|
|
PaymentMethod: paymentMethod,
|
|
}
|
|
if err := bs.store.CreateItem(i); err != nil {
|
|
log.Println(err)
|
|
}
|
|
items = append(items, i)
|
|
|
|
if item.Taxes != 0.0 && platform == "Booking" {
|
|
ti := &Item{
|
|
BookingID: bookingID,
|
|
Item: "Taxes",
|
|
Quantity: quantity * customerNumber,
|
|
Price: item.Taxes,
|
|
PaymentMethod: "Cash",
|
|
}
|
|
if err := bs.store.CreateItem(ti); err != nil {
|
|
log.Println(err)
|
|
}
|
|
items = append(items, ti)
|
|
}
|
|
|
|
return items
|
|
}
|
|
|
|
func (bs Service) PayItem(id int) *Item {
|
|
i, err := bs.store.PayItem(id)
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
return i
|
|
}
|
|
|
|
func (bs Service) OneItem(id int) *Item {
|
|
i, err := bs.store.GetItem(id)
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
return i
|
|
}
|
|
|
|
func (bs Service) UpdateItem(id int, item string, qty int, price float64, paymentMethod, paymentStatus string) *Item {
|
|
i, err := bs.store.UpdateItem(id, item, paymentMethod, paymentStatus, qty, price)
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
return i
|
|
}
|