diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-02-01 15:10:20 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-02-01 15:10:20 +0100 |
commit | 42a0076f5951d303635b2e544aa66112cdb9abfe (patch) | |
tree | 432874ec0e7dbe6c831992f70a468bc1b6719901 /extension/pages | |
parent | b150470eb60017b4ccdf56351428f9452a207fc8 (diff) |
new fulfillment protocol
Diffstat (limited to 'extension/pages')
-rw-r--r-- | extension/pages/confirm-contract.html | 17 | ||||
-rw-r--r-- | extension/pages/confirm-contract.js | 6 | ||||
-rw-r--r-- | extension/pages/confirm-contract.tsx | 6 |
3 files changed, 10 insertions, 19 deletions
diff --git a/extension/pages/confirm-contract.html b/extension/pages/confirm-contract.html index 2a2166888..d2245a9fb 100644 --- a/extension/pages/confirm-contract.html +++ b/extension/pages/confirm-contract.html @@ -11,23 +11,6 @@ <script src="../lib/module-trampoline.js"></script> <link rel="stylesheet" type="text/css" href="../style/wallet.css"> - <script id="contract-template" type="text/x-handlebars-template"> - - Your contract includes these products: - <ul> - {{#each products}} - <li>{{description}}: {{prettyAmount price}}</li> - {{/each}} - </ul> - - <p /> - </script> - - <script id="error-template" type="text/x-handlebars-template"> - Payment was not successful: {{error}} - </script> - </head> - <body> <header> <div id="logo"></div> diff --git a/extension/pages/confirm-contract.js b/extension/pages/confirm-contract.js index ec6985805..70ecff399 100644 --- a/extension/pages/confirm-contract.js +++ b/extension/pages/confirm-contract.js @@ -27,13 +27,15 @@ System.register(["../lib/web-common"], function(exports_1) { var offer = JSON.parse(query.offer); console.dir(offer); var contract = offer.contract; + var error = null; 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('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", { onclick: doPayment }, (_c = ["Confirm Payment"], _c.raw = ["Confirm Payment"], i18n(_c))), + m("p", error ? error : []), ]; var _a, _b, _c; } @@ -46,6 +48,8 @@ System.register(["../lib/web-common"], function(exports_1) { chrome.runtime.sendMessage({ type: 'confirm-pay', detail: d }, function (resp) { if (!resp.success) { console.log("confirm-pay error", JSON.stringify(resp)); + error = resp.message; + m.redraw(); return; } var c = d.offer.contract; diff --git a/extension/pages/confirm-contract.tsx b/extension/pages/confirm-contract.tsx index fc5dfdece..35d050c19 100644 --- a/extension/pages/confirm-contract.tsx +++ b/extension/pages/confirm-contract.tsx @@ -33,6 +33,7 @@ export function main() { let offer = JSON.parse(query.offer); console.dir(offer); let contract = offer.contract; + let error = null; var Contract = { view(ctrl) { @@ -47,7 +48,8 @@ export function main() { _.map(contract.products, (p: any) => m("li", `${p.description}: ${prettyAmount(p.price)}`))), - m("button", {onclick: doPayment}, i18n`Confirm Payment`) + m("button", {onclick: doPayment}, i18n`Confirm Payment`), + m("p", error ? error : []), ]; } }; @@ -62,6 +64,8 @@ export function main() { chrome.runtime.sendMessage({type: 'confirm-pay', detail: d}, (resp) => { if (!resp.success) { console.log("confirm-pay error", JSON.stringify(resp)); + error = resp.message; + m.redraw(); return; } let c = d.offer.contract; |