Commit a3313374 authored by jonathan nifenecker's avatar jonathan nifenecker Committed by Vincent A

[cragr] Fix transaction raw patterns parsing

- the Transaction.Raw was not call in some cases
- when called, it correctly set the obj_label but that field was
overriden afterwards.
parent 8cdcb9d1
......@@ -576,6 +576,14 @@ class HistoryPage(LoggedPage, JsonPage):
# we do not use it.
obj_date = Date(CleanText(Dict('dateOperation')))
obj_label = CleanText(
Format(
'%s %s',
CleanText(Dict('libelleTypeOperation', default='')),
CleanText(Dict('libelleOperation'))
)
)
# Transactions in foreign currencies have no 'libelleTypeOperation'
# and 'libelleComplementaire' keys, hence the default values.
# The CleanText() gets rid of additional spaces.
......@@ -604,11 +612,6 @@ class HistoryPage(LoggedPage, JsonPage):
return rdate
return date
obj_label = CleanText(
Format(
'%s %s', CleanText(Dict('libelleTypeOperation', default='')), CleanText(Dict('libelleOperation'))
)
)
obj_amount = Eval(float_to_decimal, Dict('montant'))
obj_type = Map(
CleanText(Dict('libelleTypeOperation', default='')), TRANSACTION_TYPES, Transaction.TYPE_UNKNOWN
......@@ -655,8 +658,8 @@ class CardHistoryPage(LoggedPage, JsonPage):
class item(ItemElement):
klass = Transaction
obj_raw = CleanText(Dict('libelleOperation'))
obj_label = CleanText(Dict('libelleOperation'))
obj_raw = Transaction.Raw(CleanText(Dict('libelleOperation')))
obj_amount = Eval(float_to_decimal, Dict('montant'))
obj_type = Transaction.TYPE_DEFERRED_CARD
obj_bdate = Field('rdate')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment