def iter_documents(self, proto_doc, subscription): date = self.get_date() # Bulletin de salaire frm = self.doc.xpath('//form[@name="formBulletinSalaire"]') if frm: bs = Document() bs.id = "%s_%s" % (proto_doc.id, "bs") bs.date = date bs.format = "pdf" bs.type = DocumentTypes.OTHER bs.label = "Bulletin de salaire %s %s" % ( subscription.label, date.strftime("%d/%m/%Y")) bs.url = Attr(".", "action")(frm[0]) yield bs # Relevé mensuel btn = self.doc.xpath('//input[@id="btRecapEdit"]') if btn: rm = Document() rm.id = "%s_%s" % (proto_doc.id, "rm") rm.date = date rm.format = "pdf" rm.type = DocumentTypes.OTHER rm.label = "Relevé mensuel %s %s" % (subscription.label, date.strftime("%d/%m/%Y")) rm.url = Regexp(Attr(".", "onclick", default=""), r"open\('([^\']+)'", default=None)(btn[0]) rm._need_refresh_previous_page = True yield rm # Certificat d'Enregistrement btn = self.doc.xpath('//input[@id="genererPDF"]') if btn: ce = Document() ce.id = "%s_%s" % (proto_doc.id, "ce") ce.date = date ce.format = "pdf" ce.type = DocumentTypes.OTHER ce.label = "Certificat d'enregistrement %s %s" % ( subscription.label, date.strftime("%d/%m/%Y")) ce.url = Regexp(Attr(".", "onclick", default=""), r"open\('([^\']+)'", default=None)(btn[0]) ce._need_refresh_previous_page = True yield ce # Cotisations frm = self.doc.xpath('//form[@name="formDecomptCoti"]') if frm: dc = Document() dc.id = "%s_%s" % (proto_doc.id, "dc") dc.date = date dc.format = "pdf" dc.type = DocumentTypes.OTHER dc.label = "Décompte de cotisations %s %s" % ( subscription.label, date.strftime("%d/%m/%Y")) dc.url = Attr(".", "action")(frm[0]) yield dc
def iter_documents(self, subscription): next_page = None try: form = self.get_form('//input[@id="id_btn_valider"]/parent::form') next_yr = self.doc.xpath( '//select[@name="annee"]/option[@selected]/following-sibling::option' ) if len(next_yr): form["annee"] = Attr(".", "value")(next_yr[0]) next_page = form.request except FormNotFound: pass empty = self.doc.xpath('//text()[contains(., "Aucun volet social")]') if not empty: frm = self.doc.xpath('//input[@id="modeGarde"]/parent::form')[0] d = Document() d._annee = CleanText(Attr('.//input[@id="annee"]', "value"))(frm) d.id = "%s_%s" % (subscription.id, d._annee) d.date = parse_french_date("%s-12-31" % d._annee) d.label = "Attestation fiscale %s" % (d._annee) d.type = DocumentTypes.OTHER d.format = "pdf" d.url = Link("./table//div/a")(frm) yield d if next_page: raise NextPage(next_page)
def get_justificatif(self, sub_id): doc = Document() doc.id = 'doc-justificatif#%s' % sub_id doc.format = 'pdf' doc.date = NotAvailable doc.label = 'Justificatif de domicile' doc.url = 'https://mon-espace.ekwateur.fr/client/justificatif_de_domicile' yield doc
def iter_documents(self, subid): for d in self.doc['data']['items']: doc = Document() doc.id = '%s_%s' % (subid, d['id']) doc._docid = d['id'] doc.label = d['import']['name'] doc.date = parse_date(d['import']['endDate']) doc.url = urljoin(self.url, '/pagga/download/%s' % doc._docid) doc.type = DocumentTypes.BILL doc.format = 'pdf' yield doc
def _fetch_rib_document(self, subscription): d = Document() d.id = subscription.id + '_RIB' d.url = self.rib_pdf_page.build( params={ 'b64e200_prestationIdTechnique': subscription._internal_id }) d.type = DocumentTypes.RIB d.format = 'pdf' d.label = 'RIB' return d
def get_cgv(self, sub_id): CGV = Document() CGV.id = 'doc-CGV#%s' % sub_id CGV.format = 'pdf' CGV.date = NotAvailable CGV.label = 'CGV électricité' CGV.type = 'cgv' for item in XPath( './/div[has-class("table__foot__adobe-reader__link")]//a')( self.doc): if 'CGV' in item.text: CGV.url = item.attrib['href'] yield CGV
def iter_documents(self): for inv in self.iter_investments(): if inv.label == "Liquidités": continue doc = Document() doc.id = inv.id doc.url = inv._docurl doc.label = 'Contrat %s' % inv.label doc.type = DocumentTypes.CONTRACT doc.format = 'pdf' yield doc self.profile.go() for doc in self.page.iter_documents(): yield doc
def iter_documents(self): account, = self.doc['donnees']['comptes'] statements = account['releves'] for document in statements: d = Document() d.date = datetime.strptime(document['dateEdition'], '%d/%m/%Y') d.label = '%s %s' % (account['libelle'], document['dateEdition']) d.type = DocumentTypes.STATEMENT d.format = 'pdf' d.id = '%s_%s' % (account['id'], document['dateEdition'].replace( '/', '')) d.url = '/icd/syd-front/data/syd-rce-telechargerReleve.html?b64e4000_sceau=%s' % quote_plus( document['sceau']) yield d
def iter_documents(self, subscription): for a in self.doc.xpath('//a[contains(@href, "pdf")]'): d = Document() d.format = 'pdf' d.label = CleanText('.')(a) if 'Récapitulatif annuel' in d.label: continue date_filter = Regexp(CleanText('.'), r'(\d{2}/\d{2}/\d{4})') d.date = Date(date_filter, dayfirst=True)(a) d.url = Regexp(Link('.'), r"= '(.*)';")(a) d.id = '%s_%s' % (subscription.id, date_filter(a).replace('/', '')) d.type = 'document' yield d