From 472985351a72b10a8e28b11efceb83a69206810f Mon Sep 17 00:00:00 2001 From: Ruidy Date: Thu, 14 Nov 2024 23:15:21 +0100 Subject: [PATCH] create taxes only ofr booking platform --- internal/config/host.go | 3 +++ internal/service/booking/item.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/config/host.go b/internal/config/host.go index 44f82c1..0f9915b 100644 --- a/internal/config/host.go +++ b/internal/config/host.go @@ -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, diff --git a/internal/service/booking/item.go b/internal/service/booking/item.go index 0c301e0..8149bae 100644 --- a/internal/service/booking/item.go +++ b/internal/service/booking/item.go @@ -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",