mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +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,
|
HasEndDate: true,
|
||||||
Taxes: 1.5,
|
Taxes: 1.5,
|
||||||
},
|
},
|
||||||
|
|
||||||
"Airport": {
|
"Airport": {
|
||||||
Name: "Airport",
|
Name: "Airport",
|
||||||
Price: 25.0,
|
Price: 25.0,
|
||||||
},
|
},
|
||||||
|
|
||||||
"Port": {
|
"Port": {
|
||||||
Name: "Port",
|
Name: "Port",
|
||||||
Price: 20.0,
|
Price: 20.0,
|
||||||
},
|
},
|
||||||
|
|
||||||
"Transport": {
|
"Transport": {
|
||||||
Name: "Transport",
|
Name: "Transport",
|
||||||
Price: 20.0,
|
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)
|
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
|
// TODO: fix the calendar integration
|
||||||
// if err = cs.Create(
|
// if err = cs.Create(
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/rjNemo/rentease/internal/config"
|
"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{
|
i := &Item{
|
||||||
BookingId: bookingId,
|
BookingId: bookingId,
|
||||||
Item: item.Name,
|
Item: item.Name,
|
||||||
|
|
@ -19,7 +19,7 @@ func (bs Service) CreateItem(bookingId int, item config.HostItem, quantity int,
|
||||||
}
|
}
|
||||||
items = append(items, i)
|
items = append(items, i)
|
||||||
|
|
||||||
if item.Taxes != 0.0 {
|
if item.Taxes != 0.0 && platform == "Booking" {
|
||||||
ti := &Item{
|
ti := &Item{
|
||||||
BookingId: bookingId,
|
BookingId: bookingId,
|
||||||
Item: "Taxes",
|
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)
|
b := bs.Create(*formatDate(arrivalDate), *formatDate(departureDate), customerName, "", customerEmail, "Booking", customerNumber, commissionAmount, &externalId)
|
||||||
if item, ok := config.NewHost().Items[itemName]; ok {
|
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
|
return b, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue