def get_revolving_attributes(self, account): loan = Loan() loan.id = account.id loan.label = '%s - %s' %(account.label, account.id) loan.currency = account.currency loan.url = account.url loan.used_amount = CleanDecimal.US('//tr[td[contains(text(), "Montant Utilisé") or contains(text(), "Montant utilisé")]]/td[2]')(self.doc) loan.available_amount = CleanDecimal.US(Regexp(CleanText('//tr[td[contains(text(), "Montant Disponible") or contains(text(), "Montant disponible")]]/td[2]'), r'(.*) au'))(self.doc) loan.balance = -loan.used_amount loan._has_cards = False loan.type = Account.TYPE_REVOLVING_CREDIT return loan
def get_revolving_attributes(self, account): loan = Loan() loan.id = account.id loan.label = '%s - %s' %(account.label, account.id) loan.currency = account.currency loan.url = account.url loan.available_amount = CleanDecimal('//tr[td[contains(text(), "Montant Maximum Autorisé") or contains(text(), "Montant autorisé")]]/td[2]')(self.doc) loan.used_amount = loan.used_amount = CleanDecimal('//tr[td[contains(text(), "Montant Utilisé") or contains(text(), "Montant utilisé")]]/td[2]')(self.doc) loan.available_amount = CleanDecimal(Regexp(CleanText('//tr[td[contains(text(), "Montant Disponible") or contains(text(), "Montant disponible")]]/td[2]'), r'(.*) au'))(self.doc) loan._has_cards = False loan.type = Account.TYPE_REVOLVING_CREDIT return loan
def get_loan_attributes(self, account): loan = Loan() loan.total_amount = CleanDecimal('//div/span[contains(text(), "Capital initial")]/following-sibling::*[1]', replace_dots=True)(self.doc) owner_name = CleanText('//a[@class="lien-entete login"]/span')(self.doc) loan.name = ' '.join(owner_name.split()[1:]) loan.subscription_date = Date(Regexp(CleanText('//h4[span[contains(text(), "Date de départ du prêt")]]'), r'(\d{2}\/\d{2}\/\d{4})'), dayfirst=True)(self.doc) loan.maturity_date = Date(Regexp(CleanText('//h4[span[contains(text(), "Date de fin du prêt")]]'), r'(\d{2}\/\d{2}\/\d{4})'), dayfirst=True)(self.doc) loan.rate = Eval(lambda x: x / 100, CleanDecimal('//div/span[contains(text(), "Taux fixe")]/following-sibling::*[1]', replace_dots=True))(self.doc) loan.last_payment_amount = CleanDecimal('//div[@class="txt-detail " and not (@style)]//span[contains(text(), "Echéance du")]/following-sibling::span[1]')(self.doc) loan.last_payment_date = Date(Regexp(CleanText('//div[@class="txt-detail " and not (@style)]//span[contains(text(), "Echéance du")]'), r'(\d{2}\/\d{2}\/\d{4})'), dayfirst=True)(self.doc) loan.id = account.id loan.currency = account.currency loan.label = account.label loan.balance = account.balance loan.coming = account.coming loan.type = account.type loan._uncleaned_id = account._uncleaned_id loan._multiple_type = account._multiple_type return loan
def get_revolving_attributes(self, account): loan = Loan() loan.available_amount = CleanDecimal('//div/span[contains(text(), "Montant disponible")]/following-sibling::*[1]', replace_dots=True)(self.doc) loan.used_amount = CleanDecimal('//div/span[contains(text(), "Montant Utilisé")]/following-sibling::*[1]', replace_dots=True)(self.doc) loan.total_amount = CleanDecimal('//div/span[contains(text(), "Réserve accordée")]/following-sibling::*[1]', replace_dots=True)(self.doc) loan.last_payment_amount = CleanDecimal('//div/span[contains(text(), "Echéance Précédente")]/following-sibling::*[1]', replace_dots=True)(self.doc) loan.last_payment_date = Date(Regexp(CleanText('//div/span[contains(text(), "Echéance Précédente")]/following-sibling::*[2]'), r'(\d{2}\/\d{2}\/\d{4})'), dayfirst=True)(self.doc) owner_name = CleanText('//a[@class="lien-entete login"]/span')(self.doc) loan.name = ' '.join(owner_name.split()[1:]) loan.id = account.id loan.currency = account.currency loan.label = account.label loan.balance = account.balance loan.coming = account.coming loan.type = account.type loan._uncleaned_id = account._uncleaned_id loan._multiple_type = account._multiple_type return loan