diff --git a/modules/paypal/browser.py b/modules/paypal/browser.py index d3ff7ac6df71e939eaf76f61fdeffa6d8c9caaa5..397df67d6fc159aa89d6e76c70e2d668d8ff303c 100644 --- a/modules/paypal/browser.py +++ b/modules/paypal/browser.py @@ -65,6 +65,7 @@ class Paypal(LoginBrowser): promo = URL('https://www.paypal.com/fr/webapps/mpp/clickthru/paypal-app-promo-2.*', '/fr/webapps/mpp/clickthru.*', PromoPage) account = URL('https://www.paypal.com/businessexp/money', + 'https://www.paypal.com/myaccount/money', 'https://www.paypal.com/webapps/business/money', AccountPage) pro_history = URL('https://\w+.paypal.com/businessexp/transactions/activity\?.*', ProHistoryPage) diff --git a/modules/paypal/pages.py b/modules/paypal/pages.py index a2604b7befde4929a2d822a0a84ae9da4512797e..4f520b83b77f66eb94dc01a7613d375fba31090a 100644 --- a/modules/paypal/pages.py +++ b/modules/paypal/pages.py @@ -24,7 +24,7 @@ from weboob.tools.compat import unicode from weboob.capabilities.bank import Account -from weboob.capabilities.base import NotAvailable, Currency +from weboob.capabilities.base import NotAvailable from weboob.exceptions import BrowserUnavailable, ActionNeeded from weboob.browser.exceptions import ServerError from weboob.browser.pages import HTMLPage, JsonPage, LoggedPage @@ -169,22 +169,18 @@ def get_account(self, _id): def get_accounts(self): accounts = {} - content = self.doc.xpath('//div[@id="moneyPage" or @id="MoneyPage"]')[0] + content = self.doc.xpath('//section[@id="contents"]')[0] # Multiple accounts - lines = content.xpath('(//div[@class="col-md-8 multi-currency"])[1]/ul/li') + lines = content.xpath('.//ul[@class="multiCurrency-container"][1]/li') for li in lines: account = Account() account.iban = NotAvailable account.type = Account.TYPE_CHECKING - currency_code = CleanText().filter((li.xpath('./span[@class="currencyUnit"]/span') or li.xpath('./span[1]'))[0]) - currency = Currency.get_currency(currency_code) - if not currency: - self.logger.warning('Unable to find currency %r', currency_code) - continue + currency = CleanText().filter(li.xpath('.//span[contains(@class, "multiCurrency-label_alignMiddle")]')[0]) account.id = currency account.currency = currency - account.balance = CleanDecimal(replace_dots=True).filter(li.xpath('./span[@class="amount"]/text()')) + account.balance = CleanDecimal(replace_dots=True).filter(li.xpath('.//span[contains(@class, "multiCurrency-label_right")]/text()')[0]) account.label = u'%s %s*' % (self.browser.username, account.currency) accounts[account.id] = account self.browser.account_currencies.append(account.currency)