aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/confirm-contract.tsx47
-rw-r--r--pages/confirm-create-reserve.html5
-rw-r--r--pages/confirm-create-reserve.tsx62
-rw-r--r--pages/show-db.ts6
4 files changed, 86 insertions, 34 deletions
diff --git a/pages/confirm-contract.tsx b/pages/confirm-contract.tsx
index ff6ffba64..0c7419c6c 100644
--- a/pages/confirm-contract.tsx
+++ b/pages/confirm-contract.tsx
@@ -14,12 +14,21 @@
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/
-/// <reference path="../lib/decl/handlebars/handlebars.d.ts" />
-"use strict";
+/**
+ * Page shown to the user to confirm entering
+ * a contract.
+ *
+ * @author Florian Dold
+ */
+
+/// <reference path="../lib/decl/handlebars/handlebars.d.ts" />
+import MithrilComponent = _mithril.MithrilComponent;
import {substituteFulfillmentUrl} from "../lib/wallet/helpers";
+import m from "mithril";
+import {Contract} from "../lib/wallet/types";
+"use strict";
-declare var m: any;
function prettyAmount(amount) {
let v = amount.value + amount.fraction / 1e6;
@@ -27,6 +36,35 @@ function prettyAmount(amount) {
}
+const Details = {
+ controller() {
+ return {collapsed: m.prop(true)};
+ },
+ view(ctrl, contract: Contract) {
+ if (ctrl.collapsed()) {
+ return m("div", [
+ m("button.linky", {
+ onclick: () => {
+ ctrl.collapsed(false);
+ }
+ }, "show more details")
+ ]);
+ } else {
+ return m("div", [
+ m("button.linky", {
+ onclick: () => {
+ ctrl.collapsed(true);
+ }
+ }, "show less details"),
+ m("div", [
+ "Accepted exchanges:",
+ m("ul", contract.exchanges.map(e => m("li", `${e.url}: ${e.master_pub}`)))
+ ])
+ ]);
+ }
+ }
+};
+
export function main() {
let url = URI(document.location.href);
let query: any = URI.parseQuery(url.query());
@@ -51,6 +89,7 @@ export function main() {
`${p.description}: ${prettyAmount(p.price)}`))),
m("button.confirm-pay", {onclick: doPayment}, i18n`Confirm Payment`),
m("p", error ? error : []),
+ m(Details, contract)
];
}
};
@@ -79,4 +118,4 @@ export function main() {
offer);
});
}
-} \ No newline at end of file
+}
diff --git a/pages/confirm-create-reserve.html b/pages/confirm-create-reserve.html
index 9893a7a3d..88d01d2b1 100644
--- a/pages/confirm-create-reserve.html
+++ b/pages/confirm-create-reserve.html
@@ -4,8 +4,7 @@
<head>
<title>Taler Wallet: Select Taler Provider</title>
- <link rel="stylesheet" type="text/css" href="../style/lang.css">
- <link rel="stylesheet" type="text/css" href="popup.css">
+ <link rel="stylesheet" type="text/css" href="../style/wallet.css">
<script src="../lib/vendor/URI.js"></script>
<script src="../lib/vendor/mithril.js"></script>
@@ -27,7 +26,7 @@
<section id="main">
<article>
- <div class="fade" id="mint-selection"></div>
+ <div class="fade" id="exchange-selection"></div>
</article>
</section>
</body>
diff --git a/pages/confirm-create-reserve.tsx b/pages/confirm-create-reserve.tsx
index 224a3e895..5ed97db04 100644
--- a/pages/confirm-create-reserve.tsx
+++ b/pages/confirm-create-reserve.tsx
@@ -14,12 +14,20 @@
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/
+
+/**
+ * Page shown to the user to confirm creation
+ * of a reserve, usually requested by the bank.
+ *
+ * @author Florian Dold
+ */
+
/// <reference path="../lib/decl/mithril.d.ts" />
import {amountToPretty, canonicalizeBaseUrl} from "../lib/wallet/helpers";
import {AmountJson, CreateReserveResponse} from "../lib/wallet/types";
import m from "mithril";
-import {IMintInfo} from "../lib/wallet/types";
+import {IExchangeInfo} from "../lib/wallet/types";
import {ReserveCreationInfo, Amounts} from "../lib/wallet/types";
import MithrilComponent = _mithril.MithrilComponent;
import {Denomination} from "../lib/wallet/types";
@@ -60,7 +68,7 @@ class DelayTimer {
class Controller {
url = m.prop<string>();
statusString = null;
- isValidMint = false;
+ isValidExchange = false;
reserveCreationInfo: ReserveCreationInfo = null;
private timer: DelayTimer;
private request: XMLHttpRequest;
@@ -68,12 +76,12 @@ class Controller {
callbackUrl: string;
detailCollapsed = m.prop<boolean>(true);
- constructor(initialMintUrl: string, amount: AmountJson, callbackUrl: string) {
+ constructor(initialExchangeUrl: string, amount: AmountJson, callbackUrl: string) {
console.log("creating main controller");
this.amount = amount;
this.callbackUrl = callbackUrl;
this.timer = new DelayTimer(800, () => this.update());
- this.url(initialMintUrl);
+ this.url(initialExchangeUrl);
this.update();
}
@@ -93,19 +101,19 @@ class Controller {
m.redraw(true);
- console.log("doing get mint info");
+ console.log("doing get exchange info");
getReserveCreationInfo(this.url(), this.amount)
.then((r: ReserveCreationInfo) => {
- console.log("get mint info resolved");
- this.isValidMint = true;
+ console.log("get exchange info resolved");
+ this.isValidExchange = true;
this.reserveCreationInfo = r;
console.dir(r);
- this.statusString = "The mint base URL is valid!";
+ this.statusString = "The exchange base URL is valid!";
m.endComputation();
})
.catch((e) => {
- console.log("get mint info rejected");
+ console.log("get exchange info rejected");
if (e.hasOwnProperty("httpStatus")) {
this.statusString = `request failed with status ${this.request.status}`;
} else {
@@ -122,7 +130,7 @@ class Controller {
}
reset() {
- this.isValidMint = false;
+ this.isValidExchange = false;
this.statusString = null;
this.reserveCreationInfo = null;
if (this.request) {
@@ -131,8 +139,8 @@ class Controller {
}
}
- confirmReserve(mint: string, amount: AmountJson, callback_url: string) {
- const d = {mint, amount};
+ confirmReserve(exchange: string, amount: AmountJson, callback_url: string) {
+ const d = {exchange, amount};
const cb = (rawResp) => {
if (!rawResp) {
throw Error("empty response");
@@ -140,7 +148,7 @@ class Controller {
if (!rawResp.error) {
const resp = CreateReserveResponse.checked(rawResp);
let q = {
- mint: resp.mint,
+ exchange: resp.exchange,
reserve_pub: resp.reservePub,
amount_value: amount.value,
amount_fraction: amount.fraction,
@@ -190,7 +198,7 @@ function view(ctrl: Controller) {
onclick: () => ctrl.confirmReserve(ctrl.url(),
ctrl.amount,
ctrl.callbackUrl),
- disabled: !ctrl.isValidMint
+ disabled: !ctrl.isValidExchange
},
"Confirm exchange selection");
@@ -256,30 +264,30 @@ function renderReserveCreationDetails(rci: ReserveCreationInfo) {
}
-interface MintProbeResult {
+interface ExchangeProbeResult {
keyInfo?: any;
}
-function probeMint(mintBaseUrl: string): Promise<MintProbeResult> {
+function probeExchange(exchangeBaseUrl: string): Promise<ExchangeProbeResult> {
throw Error("not implemented");
}
-function getSuggestedMint(currency: string): Promise<string> {
+function getSuggestedExchange(currency: string): Promise<string> {
// TODO: make this request go to the wallet backend
// Right now, this is a stub.
- const defaultMint = {
+ const defaultExchange = {
"KUDOS": "http://exchange.demo.taler.net",
"PUDOS": "http://exchange.test.taler.net",
};
- let mint = defaultMint[currency];
+ let exchange = defaultExchange[currency];
- if (!mint) {
- mint = ""
+ if (!exchange) {
+ exchange = ""
}
- return Promise.resolve(mint);
+ return Promise.resolve(exchange);
}
@@ -290,11 +298,11 @@ export function main() {
const callback_url = query.callback_url;
const bank_url = query.bank_url;
- getSuggestedMint(amount.currency)
- .then((suggestedMintUrl) => {
- const controller = () => new Controller(suggestedMintUrl, amount, callback_url);
- var MintSelection = {controller, view};
- m.mount(document.getElementById("mint-selection"), MintSelection);
+ getSuggestedExchange(amount.currency)
+ .then((suggestedExchangeUrl) => {
+ const controller = () => new Controller(suggestedExchangeUrl, amount, callback_url);
+ var ExchangeSelection = {controller, view};
+ m.mount(document.getElementById("exchange-selection"), ExchangeSelection);
})
.catch((e) => {
// TODO: provide more context information, maybe factor it out into a
diff --git a/pages/show-db.ts b/pages/show-db.ts
index 1c414dde7..c99d2f2b3 100644
--- a/pages/show-db.ts
+++ b/pages/show-db.ts
@@ -15,6 +15,12 @@
*/
+/**
+ * Wallet database dump for debugging.
+ *
+ * @author Florian Dold
+ */
+
function replacer(match, pIndent, pKey, pVal, pEnd) {
var key = '<span class=json-key>';
var val = '<span class=json-value>';