mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
21 lines
542 B
Go
21 lines
542 B
Go
package booking
|
|
|
|
import (
|
|
"github.com/rjNemo/rentease/internal/config"
|
|
)
|
|
|
|
func (bs Service) ParseFromApi(rawContent string) (*Booking, error) {
|
|
b, err := bs.parser.Parse(rawContent)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
itm := b.Items[0]
|
|
b = bs.Create(b.From, b.To, b.Name, b.PhoneNumber, b.Email, 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, b.Platform)
|
|
}
|
|
|
|
return b, nil
|
|
}
|