mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
RE19 taxes only for booking (#24)
* create taxes only ofr booking platform * also for sync sync
This commit is contained in:
parent
42764ab6cc
commit
6376fbd234
4 changed files with 7 additions and 4 deletions
|
|
@ -58,14 +58,17 @@ func NewHost() *Host {
|
|||
HasEndDate: true,
|
||||
Taxes: 1.5,
|
||||
},
|
||||
|
||||
"Airport": {
|
||||
Name: "Airport",
|
||||
Price: 25.0,
|
||||
},
|
||||
|
||||
"Port": {
|
||||
Name: "Port",
|
||||
Price: 20.0,
|
||||
},
|
||||
|
||||
"Transport": {
|
||||
Name: "Transport",
|
||||
Price: 20.0,
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ func handleCreateItem(bs *booking.Service, hc *config.Host) echo.HandlerFunc {
|
|||
return fmt.Errorf("invalid item name %q", ni.Item)
|
||||
}
|
||||
|
||||
newItems := bs.CreateItem(b.Id, itm, ni.Quantity, ni.Price, ni.PaymentMethod, b.CustomerNumber)
|
||||
newItems := bs.CreateItem(b.Id, itm, ni.Quantity, ni.Price, ni.PaymentMethod, b.CustomerNumber, b.Platform)
|
||||
|
||||
// TODO: fix the calendar integration
|
||||
// if err = cs.Create(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/rjNemo/rentease/internal/config"
|
||||
)
|
||||
|
||||
func (bs Service) CreateItem(bookingId int, item config.HostItem, quantity int, price float64, paymentMethod string, customerNumber int) (items []*Item) {
|
||||
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,
|
||||
|
|
@ -19,7 +19,7 @@ func (bs Service) CreateItem(bookingId int, item config.HostItem, quantity int,
|
|||
}
|
||||
items = append(items, i)
|
||||
|
||||
if item.Taxes != 0.0 {
|
||||
if item.Taxes != 0.0 && platform == "Booking" {
|
||||
ti := &Item{
|
||||
BookingId: bookingId,
|
||||
Item: "Taxes",
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ func (bs Service) ParseFromApi(rawContent string) (*Booking, error) {
|
|||
|
||||
b := bs.Create(*formatDate(arrivalDate), *formatDate(departureDate), customerName, "", customerEmail, "Booking", customerNumber, commissionAmount, &externalId)
|
||||
if item, ok := config.NewHost().Items[itemName]; ok {
|
||||
bs.CreateItem(b.Id, item, stayLength, standardRate, "Card", customerNumber)
|
||||
bs.CreateItem(b.Id, item, stayLength, standardRate, "Card", customerNumber, b.Platform)
|
||||
}
|
||||
|
||||
return b, nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue