diff options
Diffstat (limited to 'extension/pages')
-rw-r--r-- | extension/pages/confirm-contract.js | 21 | ||||
-rw-r--r-- | extension/pages/confirm-contract.tsx | 30 | ||||
-rw-r--r-- | extension/pages/confirm-create-reserve.js | 3 | ||||
-rw-r--r-- | extension/pages/confirm-create-reserve.tsx | 3 |
4 files changed, 35 insertions, 22 deletions
diff --git a/extension/pages/confirm-contract.js b/extension/pages/confirm-contract.js index 5e7d82f98..296b51f26 100644 --- a/extension/pages/confirm-contract.js +++ b/extension/pages/confirm-contract.js @@ -32,10 +32,10 @@ System.register(["../lib/wallet/helpers"], function(exports_1, context_1) { var Contract = { view: function (ctrl) { return [ - m("p", (_a = ["Hello, this is the wallet. The merchant \"", "\"\n wants to enter a contract over ", "\n with you."], _a.raw = ["Hello, this is the wallet. The merchant \"", "\"\n wants to enter a contract over ", "\n with you."], i18n(_a, contract.merchant.name, prettyAmount(contract.amount)))), - m("p", (_b = ["The contract contains the following products:"], _b.raw = ["The contract contains the following products:"], i18n(_b))), + m("p", (_a = ["", "\n wants to enter a contract over ", "\n with you."], _a.raw = ["", "\n wants to enter a contract over ", "\n with you."], i18n.parts(_a, m("strong", contract.merchant.name), m("strong", prettyAmount(contract.amount))))), + m("p", (_b = ["You are about to purchase:"], _b.raw = ["You are about to purchase:"], i18n(_b))), m('ul', _.map(contract.products, function (p) { return m("li", p.description + ": " + prettyAmount(p.price)); })), - m("button", { onclick: doPayment }, (_c = ["Confirm Payment"], _c.raw = ["Confirm Payment"], i18n(_c))), + m("button.confirm-pay", { onclick: doPayment }, (_c = ["Confirm Payment"], _c.raw = ["Confirm Payment"], i18n(_c))), m("p", error ? error : []), ]; var _a, _b, _c; @@ -43,13 +43,18 @@ System.register(["../lib/wallet/helpers"], function(exports_1, context_1) { }; m.mount(document.getElementById("contract"), Contract); function doPayment() { - var d = { - offer: offer - }; + var d = { offer: offer }; chrome.runtime.sendMessage({ type: 'confirm-pay', detail: d }, function (resp) { - if (!resp.success) { + if (resp.error) { console.log("confirm-pay error", JSON.stringify(resp)); - error = resp.message; + switch (resp.error) { + case "coins-insufficient": + error = "You do not have enough coins of the requested currency."; + break; + default: + error = "Error: " + resp.error; + break; + } m.redraw(); return; } diff --git a/extension/pages/confirm-contract.tsx b/extension/pages/confirm-contract.tsx index 055490175..ff6ffba64 100644 --- a/extension/pages/confirm-contract.tsx +++ b/extension/pages/confirm-contract.tsx @@ -39,16 +39,17 @@ export function main() { view(ctrl) { return [ m("p", - i18n`Hello, this is the wallet. The merchant "${contract.merchant.name}" - wants to enter a contract over ${prettyAmount(contract.amount)} + i18n.parts`${m("strong", contract.merchant.name)} + wants to enter a contract over ${m("strong", + prettyAmount(contract.amount))} with you.`), m("p", - i18n`The contract contains the following products:`), + i18n`You are about to purchase:`), m('ul', _.map(contract.products, (p: any) => m("li", `${p.description}: ${prettyAmount(p.price)}`))), - m("button", {onclick: doPayment}, i18n`Confirm Payment`), + m("button.confirm-pay", {onclick: doPayment}, i18n`Confirm Payment`), m("p", error ? error : []), ]; } @@ -56,21 +57,26 @@ export function main() { m.mount(document.getElementById("contract"), Contract); - function doPayment() { - let d = { - offer - }; + let d = {offer}; chrome.runtime.sendMessage({type: 'confirm-pay', detail: d}, (resp) => { - if (!resp.success) { + if (resp.error) { console.log("confirm-pay error", JSON.stringify(resp)); - error = resp.message; + switch (resp.error) { + case "coins-insufficient": + error = "You do not have enough coins of the requested currency."; + break; + default: + error = `Error: ${resp.error}`; + break; + } m.redraw(); return; } let c = d.offer.contract; console.log("contract", c); - document.location.href = substituteFulfillmentUrl(c.fulfillment_url, offer); + document.location.href = substituteFulfillmentUrl(c.fulfillment_url, + offer); }); } -} +}
\ No newline at end of file diff --git a/extension/pages/confirm-create-reserve.js b/extension/pages/confirm-create-reserve.js index d49e709c2..0ca5fc236 100644 --- a/extension/pages/confirm-create-reserve.js +++ b/extension/pages/confirm-create-reserve.js @@ -52,7 +52,8 @@ System.register(["../lib/wallet/helpers", "../lib/wallet/types", "mithril"], fun // TODO: make this request go to the wallet backend // Right now, this is a stub. var defaultMint = { - "KUDOS": "http://mint.test.taler.net" + "KUDOS": "http://mint.demo.taler.net", + "PUDOS": "http://mint.test.taler.net", }; var mint = defaultMint[currency]; if (!mint) { diff --git a/extension/pages/confirm-create-reserve.tsx b/extension/pages/confirm-create-reserve.tsx index 0effc752c..b3086c63e 100644 --- a/extension/pages/confirm-create-reserve.tsx +++ b/extension/pages/confirm-create-reserve.tsx @@ -204,7 +204,8 @@ function getSuggestedMint(currency: string): Promise<string> { // TODO: make this request go to the wallet backend // Right now, this is a stub. const defaultMint = { - "KUDOS": "http://mint.test.taler.net" + "KUDOS": "http://mint.demo.taler.net", + "PUDOS": "http://mint.test.taler.net", }; let mint = defaultMint[currency]; |