From 8a1cecd5b68f22313f679f21e207f60754f33148 Mon Sep 17 00:00:00 2001 From: Maxime Pommier Date: Thu, 11 Apr 2019 15:56:51 +0200 Subject: [PATCH] [creditmutuel] Add bdate to deferred card transaction --- modules/creditmutuel/browser.py | 1 + modules/creditmutuel/pages.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/creditmutuel/browser.py b/modules/creditmutuel/browser.py index 80710eec78..be2e24cf7c 100644 --- a/modules/creditmutuel/browser.py +++ b/modules/creditmutuel/browser.py @@ -421,6 +421,7 @@ def get_history(self, account): history = self.page.get_history(date=self.tr_date) for tr in history: + # For regrouped transaction, we have to go through each one to get details if tr._regroup: self.location(tr._regroup) for tr2 in self.page.get_tr_merged(): diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 44ebd3b6cf..8a9ade41f8 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -725,7 +725,7 @@ class item(Transaction.TransactionElement): obj_original_amount = CleanDecimal(TableCell('original_amount'), default=NotAvailable, replace_dots=True) obj_original_currency = FrenchTransaction.Currency(TableCell('original_amount')) obj_type = Transaction.TYPE_DEFERRED_CARD - obj_rdate = Transaction.Date(TableCell('date')) + obj_rdate = obj_bdate = Transaction.Date(TableCell('date')) obj_date = obj_vdate = Env('date') obj__is_coming = Env('_is_coming') @@ -905,7 +905,7 @@ def condition(self): return len(self.el.xpath('./td')) >= 4 and not CleanText(TableCell('commerce'))(self).startswith('RETRAIT CB') obj_raw = Transaction.Raw(Format("%s %s", CleanText(TableCell('commerce')), CleanText(TableCell('ville')))) - obj_rdate = Field('vdate') + obj_rdate = obj_bdate = Field('vdate') obj_date = Env('date') def obj_type(self): @@ -933,6 +933,8 @@ def obj__is_coming(self): return True return False + # Some payment made on the same organization are regrouped, + # we have to get the detail for each one later def obj__regroup(self): if "Regroupement" in CleanText('./td')(self): return Link('./td/span/a')(self) @@ -959,6 +961,10 @@ def obj_type(self): return Transaction.TYPE_DEFERRED_CARD return Transaction.TYPE_CARD_SUMMARY + def obj_bdate(self): + if Field('type')(self) == Transaction.TYPE_DEFERRED_CARD: + return Transaction.Date(TableCell('date'))(self) + def has_more_operations(self): xp = CleanText(self.doc.xpath('//div[@class="ei_blocpaginb"]/a'))(self) if xp == 'Suite des opérations': @@ -985,7 +991,7 @@ def condition(self): return not CleanText(TableCell('commerce'))(self).startswith('RETRAIT CB') obj_raw = Transaction.Raw(Format("%s %s", CleanText(TableCell('commerce')), CleanText(TableCell('ville')))) - obj_rdate = Field('vdate') + obj_rdate = obj_bdate = Field('vdate') obj_date = Env('date') def obj_type(self): -- GitLab