The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

Commit 65c6fbe2 authored by Guillaume Risbourg's avatar Guillaume Risbourg Committed by Vincent A

[boursorama] Fix deferred card transactions date

The 'dateVal' key in the CSV with the list of all the deferred transactions is now empty.
The 'obj_date' for deferred cards is now determined with the list of deferred dates available on the website (calendar.ics).

Fixed 'obj_bdate' to get the correct format from the CSV : YYYY-MM-DD (previously it took YYYY-DD-MM)

Removed `replace_dots` for CleanDecimal in CardHistoryPage because
amounts in the CSV already are in the dot format.

Closes: 46551@sibi
parent adfc04e4
......@@ -356,6 +356,7 @@ def get_card_transactions(self, account, coming):
if self.deferred_card_calendar is None:
self.location(self.page.get_calendar_link())
params = {}
params['movementSearch[fromDate]'] = (date.today() - relativedelta(years=3)).strftime('%d/%m/%Y')
params['fullSearch'] = 1
......
......@@ -266,7 +266,6 @@ def condition(self):
return not self.is_external() and not any(x in Field('url')(self) for x in ('automobile', 'assurance/protection', 'assurance/comptes', 'assurance/famille'))
obj_label = CleanText('.//a[has-class("account--name")] | .//div[has-class("account--name")]')
obj_currency = FrenchTransaction.Currency('.//a[has-class("account--balance")]')
obj_valuation_diff = Async('details') & CleanDecimal('//li[h4[text()="Total des +/- values"]]/h3 |\
//li[span[text()="Total des +/- values latentes"]]/span[has-class("overview__value")]', replace_dots=True, default=NotAvailable)
......@@ -306,6 +305,8 @@ def obj_id(self):
raise SkipItem()
return id
obj_number = obj_id
def obj_type(self):
# card url is /compte/cav/xxx/carte/yyy so reverse to match "carte" before "cav"
for word in Field('url')(self).lower().split('/')[::-1]:
......@@ -567,16 +568,19 @@ class item(ItemElement):
klass = Transaction
obj_raw = Transaction.Raw(Dict('label'))
obj_date = Date(Dict('dateVal'), dayfirst=True)
obj_bdate = Date(Dict('dateOp'), dayfirst=True)
obj_bdate = Date(Dict('dateOp'))
def obj_date(self):
return self.page.browser.get_debit_date(Field('bdate')(self))
obj__account_label = Dict('accountLabel')
obj__is_coming = False
def obj_amount(self):
if Field('type')(self) == Transaction.TYPE_CARD_SUMMARY:
# '-' so the reimbursements appear positively in the card transactions:
return -CleanDecimal(Dict('amount'), replace_dots=True)(self)
return CleanDecimal(Dict('amount'), replace_dots=True)(self)
return -CleanDecimal.US(Dict('amount'))(self)
return CleanDecimal.US(Dict('amount'))(self)
def obj_rdate(self):
if self.obj.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