mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
store items
This commit is contained in:
parent
0b5c12716c
commit
33c1c450e0
1 changed files with 3 additions and 14 deletions
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/labstack/gommon/log"
|
|
||||||
u "github.com/rjNemo/underscore"
|
u "github.com/rjNemo/underscore"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
|
|
@ -247,21 +246,11 @@ func (bs Service) ParseFromApi(rawContent string) (*Booking, error) {
|
||||||
item := extractString(`Maison 1 Chambre \((T2|T3) -`, content)
|
item := extractString(`Maison 1 Chambre \((T2|T3) -`, content)
|
||||||
standardRate := extractFloat(`Standard Rate\n\s+€ (\d+)`, content)
|
standardRate := extractFloat(`Standard Rate\n\s+€ (\d+)`, content)
|
||||||
|
|
||||||
result := map[string]any{
|
taxQty := (totalAmount - standardRate*float64(stayLength)) / 1.5
|
||||||
"from": formatDate(arrivalDate),
|
|
||||||
"to": formatDate(departureDate),
|
|
||||||
"stay_length": stayLength,
|
|
||||||
"total_amount": totalAmount,
|
|
||||||
"customer_name": customerName,
|
|
||||||
"email": customerEmail,
|
|
||||||
"customer_number": customerNumber,
|
|
||||||
"commission_amount": commissionAmount,
|
|
||||||
"item": item,
|
|
||||||
"price": standardRate,
|
|
||||||
}
|
|
||||||
log.Info(result)
|
|
||||||
|
|
||||||
b := bs.Create(*formatDate(arrivalDate), *formatDate(departureDate), customerName, "", customerEmail, "Booking", customerNumber, commissionAmount)
|
b := bs.Create(*formatDate(arrivalDate), *formatDate(departureDate), customerName, "", customerEmail, "Booking", customerNumber, commissionAmount)
|
||||||
|
bs.CreateItem(b.Id, item, stayLength, standardRate, "Card")
|
||||||
|
bs.CreateItem(b.Id, "Taxes", int(taxQty), 1.5, "Cash")
|
||||||
|
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue