fix(booking): create items during sync

This commit is contained in:
Ruidy 2025-11-16 17:40:00 +01:00
parent 508de01116
commit 4dc4d2f2b5
No known key found for this signature in database
GPG key ID: 705C24D202990805

View file

@ -10,11 +10,17 @@ func (bs Service) ParseFromAPI(rawContent string) (*Booking, error) {
return nil, err
}
itm := b.Items[0]
items := b.Items
b = bs.Create(b.From, b.To, b.Name, b.PhoneNumber, b.Email, string(b.Platform), b.CustomerNumber, b.PlatformFees, b.ExternalID)
if item, ok := config.NewHost().Items[itm.Item]; ok {
bs.CreateItem(b.ID, item, itm.Quantity, itm.Price, itm.PaymentMethod, b.CustomerNumber, string(b.Platform))
hostItems := config.NewHost().Items
for _, itm := range items {
hostItem, ok := hostItems[itm.Item]
if !ok {
continue
}
bs.CreateItem(b.ID, hostItem, itm.Quantity, itm.Price, itm.PaymentMethod, b.CustomerNumber, string(b.Platform))
}
return b, nil