def iter_accounts(self): if self.accounts: for account in self.accounts: yield account return for project in self.users['projects']: me = self.request('/user/%s/project/%s/' % (self.users['userId'], project['projectId'])) a = Account() a.id = "".join(me['numeroContrat'].split()) a.label = " ".join(me['supportEpargne'].split("_")) a.type = Account.TYPE_LIFE_INSURANCE if "assurance vie" in a.label.lower() else \ Account.TYPE_MARKET if "compte titre" in a.label.lower() else \ Account.TYPE_UNKNOWN a.balance = CleanDecimal().filter(me['solde']) a.iban = me['ibancompteTitre'] if me[ 'ibancompteTitre'] else NotAvailable a.number = project['projectId'] a.valuation_diff = CleanDecimal().filter(me['performanceEuro']) a._startbalance = me['montantDepart'] self.accounts.append(a) self.iter_investment(a, me['sousJacents']) yield a
def iter_accounts(self): if self.accounts: for account in self.accounts: yield account return waiting = False for project in self.users['projects']: self.open('/user/%s/project/%s/' % (self.users['userId'], project['projectId']), method="OPTIONS") me = self.request('/user/%s/project/%s/' % (self.users['userId'], project['projectId']), headers=self.request_headers) waiting = (me['status'] in self.waiting_statuses) # Check project in progress if not me['numeroContrat'] or not me['dateAdhesion'] or not me[ 'solde']: continue a = Account() a.id = "".join(me['numeroContrat'].split()) a.number = me['numeroContrat'] a.label = " ".join(me['supportEpargne'].split("_")) a.type = Account.TYPE_LIFE_INSURANCE if "assurance vie" in a.label.lower() else \ Account.TYPE_MARKET if "compte titre" in a.label.lower() else \ Account.TYPE_PEA if "pea" in a.label.lower() else \ Account.TYPE_UNKNOWN a.balance = CleanDecimal().filter(me['solde']) a.currency = u'EUR' # performanceEuro, montantEuro everywhere in Yomoni JSON a.iban = me['ibancompteTitre'] or NotAvailable a._project_id = project['projectId'] a.valuation_diff = CleanDecimal().filter(me['performanceEuro']) a._startbalance = me['montantDepart'] self.accounts.append(a) self.iter_investment(a, me['sousJacents']) yield a if not self.accounts and waiting: raise ActionNeeded( "Le service client Yomoni est en attente d'un retour de votre part." )
def iter_accounts(self): if self.accounts: for account in self.accounts: yield account return waiting = False for project in self.users['projects']: me = self.request('/user/%s/project/%s/' % (self.users['userId'], project['projectId'])) waiting = (me['status'] in ('RETURN_CUSTOMER_SERVICE', 'SUBSCRIPTION_STEP_3')) # Check project in progress if not me['numeroContrat'] or not me['dateAdhesion']: continue a = Account() a.id = "".join(me['numeroContrat'].split()) a.label = " ".join(me['supportEpargne'].split("_")) a.type = Account.TYPE_LIFE_INSURANCE if "assurance vie" in a.label.lower() else \ Account.TYPE_MARKET if "compte titre" in a.label.lower() else \ Account.TYPE_UNKNOWN a.balance = CleanDecimal().filter(me['solde']) a.iban = me['ibancompteTitre'] or NotAvailable a.number = project['projectId'] a.valuation_diff = CleanDecimal().filter(me['performanceEuro']) a._startbalance = me['montantDepart'] self.accounts.append(a) self.iter_investment(a, me['sousJacents']) yield a if not self.accounts and waiting: raise ActionNeeded( "Le service client Yomoni est en attente d'un retour de votre part" )
def iter_accounts(self): if self.accounts: for account in self.accounts: yield account return waiting = False for project in self.users['projects']: self.open('/user/%s/project/%s/' % (self.users['userId'], project['projectId']), method="OPTIONS") me = self.request('/user/%s/project/%s/' % (self.users['userId'], project['projectId']), headers=self.request_headers) waiting = (me['status'] in self.waiting_statuses) # Check project in progress if not me['numeroContrat'] or not me['dateAdhesion']: continue a = Account() a.id = "".join(me['numeroContrat'].split()) a.label = " ".join(me['supportEpargne'].split("_")) a.type = Account.TYPE_LIFE_INSURANCE if "assurance vie" in a.label.lower() else \ Account.TYPE_MARKET if "compte titre" in a.label.lower() else \ Account.TYPE_PEA if "pea" in a.label.lower() else \ Account.TYPE_UNKNOWN a.balance = CleanDecimal().filter(me['solde']) a.currency = u'EUR' # performanceEuro, montantEuro everywhere in Yomoni JSON a.iban = me['ibancompteTitre'] or NotAvailable a.number = project['projectId'] a.valuation_diff = CleanDecimal().filter(me['performanceEuro']) a._startbalance = me['montantDepart'] self.accounts.append(a) self.iter_investment(a, me['sousJacents']) yield a if not self.accounts and waiting: raise ActionNeeded("Le service client Yomoni est en attente d'un retour de votre part.")