Commit f7cbb9b3 authored by sinopsysHK's avatar sinopsysHK Committed by ntome

[americanexpress] get correct accounts currency

get correct accounts currency from users session locales rather than
static so it works for other currencies than EUR
parent f712ff5c
......@@ -52,7 +52,7 @@ class AmericanExpressBrowser(LoginBrowser):
js_posted = URL(r'/account-data/v1/financials/transactions\?limit=1000&offset=(?P<offset>\d+)&statement_end_date=(?P<end>[0-9-]+)&status=posted',
JsonHistory)
js_periods = URL(r'/account-data/v1/financials/statement_periods', JsonPeriods)
currency_page = URL(r'https://www.aexp-static.com/cdaas/axp-app/modules/axp-offers/1.11.1/fr-fr/axp-offers.json', CurrencyPage)
currency_page = URL(r'https://www.aexp-static.com/cdaas/axp-app/modules/axp-balance-summary/4.7.0/(?P<locale>\w\w-\w\w)/axp-balance-summary.json', CurrencyPage)
no_card = URL(r'https://www.americanexpress.com/us/content/no-card/',
r'https://www.americanexpress.com/us/no-card/', NoCardPage)
......@@ -93,7 +93,8 @@ class AmericanExpressBrowser(LoginBrowser):
self.page.set_balances(accounts)
# get currency
self.currency_page.go()
loc = self.session.cookies.get_dict(domain=".americanexpress.com")['axplocale'].lower()
self.currency_page.go(locale=loc)
currency = self.page.get_currency()
for acc in accounts:
......
......@@ -143,7 +143,7 @@ class JsonBalances2(LoggedPage, JsonPage):
class CurrencyPage(LoggedPage, JsonPage):
def get_currency(self):
return self.doc['currency']
return self.doc['localeSettings']['currency_code']
class JsonPeriods(LoggedPage, JsonPage):
......
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