mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
fix(booking): create items during sync
This commit is contained in:
parent
508de01116
commit
4dc4d2f2b5
1 changed files with 9 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue