Commit 309ae667 authored by Maxime Gasselin's avatar Maxime Gasselin Committed by Romain Bignon

[creditmutuel] Skip immediate debit cards

In the card space, we handle some immediate debit cards. For skipping them we
have to reach the good page to discriminate which is deferred or
immmediate card.
parent a1d5a221
......@@ -1849,6 +1849,7 @@ class NewCardsListPage(LoggedPage, HTMLPage):
obj_type = Account.TYPE_CARD
obj__new_space = True
obj__is_inv = False
load_details = Field('_link_id') & AsyncLoad
def obj_currency(self):
curr = CleanText('.//tbody/tr[1]/td/span')(self)
......@@ -1886,6 +1887,20 @@ class NewCardsListPage(LoggedPage, HTMLPage):
def obj__parent_id(self):
return'\d+', CleanText('./div/div/div/p', replace=[(' ', '')])(self)).group(0)[-16:]
def parse(self, el):
# We have to reach the good page with the information of the type of card
async_page = Async('details').loaded_page(self)
card_type_page = Link('//div/ul/li/a[contains(text(), "Fonctions")]')(async_page.doc)
doc =
card_type_line = doc.xpath('//tbody/tr[th[contains(text(), "Débit des paiements")]]')
if card_type_line:
if CleanText('./td')(card_type_line[0]) != 'Différé':
raise SkipItem()
elif doc.xpath('//div/p[contains(text(), "Vous n\'avez pas l\'autorisation")]'):
self.logger.warning("The user can't reach this page")
assert False, 'xpath for card type information could have changed'
def get_unavailable_cards(self):
cards = []
for card in self.doc.xpath('//li[@class="item"]'):
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