backend: parse tariff information
This commit is contained in:
parent
8fc01cf986
commit
da59b69e9d
|
@ -8,6 +8,12 @@ proc mkParseJourney*(common: CommonData): proc =
|
|||
var common = common
|
||||
common.dateStr = j{"date"}.getStr()
|
||||
|
||||
if j{"trfRes"}{"statusCode"}.getStr == "OK":
|
||||
result.price = some(Price(
|
||||
amount: j["trfRes"]["fareSetL"][0]["fareL"][0]["prc"].getInt / 100,
|
||||
currency: some("Euro"),
|
||||
))
|
||||
|
||||
result.refreshToken = j{"ctxRecon"}.getStr()
|
||||
result.legs = j{"secL"}.getElems().map(mkParseLeg(common))
|
||||
result.lastUpdated = common.timeStamp
|
||||
|
|
|
@ -100,10 +100,10 @@ type
|
|||
max*: Option[int]
|
||||
nr*: Option[int]
|
||||
|
||||
# TODO: Make this unnecessary :3
|
||||
Price* = object
|
||||
amount*: Option[float]
|
||||
amount*: float
|
||||
currency*: Option[string]
|
||||
hint*: Option[string]
|
||||
|
||||
StopoverPart* = object
|
||||
plannedTime*: Option[int64]
|
||||
|
|
Loading…
Reference in a new issue