diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-12 04:40:28 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-12 04:40:28 +0100 |
commit | 04aad590fb9e6141982a3d0a5aec7c29356e9c76 (patch) | |
tree | 58d96c8176dcc1e8ea32be658cd4caa397b68747 /src | |
parent | e61aae74d7551582d2eaa498665a96c012a16019 (diff) | |
download | wallet-core-04aad590fb9e6141982a3d0a5aec7c29356e9c76.tar.xz |
accept exchange URL suggestion from bank
Diffstat (limited to 'src')
-rw-r--r-- | src/content_scripts/notify.ts | 1 | ||||
-rw-r--r-- | src/pages/confirm-create-reserve.tsx | 6 | ||||
-rw-r--r-- | src/wxBackend.ts | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/content_scripts/notify.ts b/src/content_scripts/notify.ts index 022eada07..ef3a3ed62 100644 --- a/src/content_scripts/notify.ts +++ b/src/content_scripts/notify.ts @@ -209,6 +209,7 @@ namespace TalerNotify { .absoluteTo(document.location.href), bank_url: document.location.href, wt_types: JSON.stringify(msg.wt_types), + suggested_exchange_url: msg.suggested_exchange_url, }; let uri = URI(chrome.extension.getURL("/src/pages/confirm-create-reserve.html")); let redirectUrl = uri.query(params).href(); diff --git a/src/pages/confirm-create-reserve.tsx b/src/pages/confirm-create-reserve.tsx index da86729d3..44dd60d95 100644 --- a/src/pages/confirm-create-reserve.tsx +++ b/src/pages/confirm-create-reserve.tsx @@ -396,7 +396,11 @@ export async function main() { throw Error(i18n.str`Can't parse wire_types: ${e.message}`); } - const suggestedExchangeUrl = await getSuggestedExchange(amount.currency); + let suggestedExchangeUrl = await getSuggestedExchange(amount.currency); + if (!suggestedExchangeUrl && query.suggested_exchange_url) { + suggestedExchangeUrl = query.suggested_exchange_url; + } + let args = { wt_types, suggestedExchangeUrl, diff --git a/src/wxBackend.ts b/src/wxBackend.ts index b519cd33a..6bcedafcd 100644 --- a/src/wxBackend.ts +++ b/src/wxBackend.ts @@ -90,6 +90,7 @@ function makeHandlers(db: IDBDatabase, const d = { exchange: detail.exchange, amount: detail.amount, + suggested_exchange_url: detail.suggested_exchange_url }; const req = CreateReserveRequest.checked(d); return wallet.createReserve(req); @@ -403,6 +404,7 @@ function handleBankRequest(wallet: Wallet, headerList: chrome.webRequest.HttpHea .absoluteTo(url), bank_url: url, wt_types: wtTypes, + suggested_exchange_url: headers["x-taler-suggested-exchange"], }; let uri = URI(chrome.extension.getURL("/src/pages/confirm-create-reserve.html")); let redirectUrl = uri.query(params).href(); |