aboutsummaryrefslogtreecommitdiff
path: root/extension/pages/confirm-contract.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-02-15 15:53:59 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-02-15 15:53:59 +0100
commit0c760bc2a1459cc7ec7fd22ae39ca0a8201df9b5 (patch)
tree5f36206aff29a0204527550ebeebe0c8eaafbb6b /extension/pages/confirm-contract.js
parent526e88695f6c8a2b3dea4b9befeb2a85ba00b66b (diff)
UI improvements and error handling
Diffstat (limited to 'extension/pages/confirm-contract.js')
-rw-r--r--extension/pages/confirm-contract.js21
1 files changed, 13 insertions, 8 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;
}