parent
b8627813be
commit
53654b3622
@ -102,8 +102,6 @@ export interface ConfirmReserveRequest {
|
|||||||
|
|
||||||
|
|
||||||
export interface ConfirmReserveResponse {
|
export interface ConfirmReserveResponse {
|
||||||
backlink: string;
|
backlink?: string;
|
||||||
success: boolean;
|
success: boolean;
|
||||||
status: number;
|
|
||||||
text: string;
|
|
||||||
}
|
}
|
@ -456,11 +456,16 @@ export class Wallet {
|
|||||||
|
|
||||||
return this.http.postForm(req.post_url, form)
|
return this.http.postForm(req.post_url, form)
|
||||||
.then((hresp) => {
|
.then((hresp) => {
|
||||||
|
// TODO: look at response status code and handle errors appropriately
|
||||||
|
let json = JSON.parse(hresp.responseText);
|
||||||
|
if (!json) {
|
||||||
|
return {
|
||||||
|
success: false
|
||||||
|
};
|
||||||
|
}
|
||||||
let resp: ConfirmReserveResponse = {
|
let resp: ConfirmReserveResponse = {
|
||||||
status: hresp.status,
|
|
||||||
text: hresp.responseText,
|
|
||||||
success: undefined,
|
success: undefined,
|
||||||
backlink: undefined
|
backlink: json.redirect_url,
|
||||||
};
|
};
|
||||||
let reserveRecord = {
|
let reserveRecord = {
|
||||||
reserve_pub: reservePub.toCrock(),
|
reserve_pub: reservePub.toCrock(),
|
||||||
@ -488,9 +493,7 @@ export class Wallet {
|
|||||||
};
|
};
|
||||||
|
|
||||||
resp.success = true;
|
resp.success = true;
|
||||||
// We can't show the page directly, so
|
|
||||||
// we show some generic page from the wallet.
|
|
||||||
resp.backlink = null;
|
|
||||||
return Query(this.db)
|
return Query(this.db)
|
||||||
.put("reserves", reserveRecord)
|
.put("reserves", reserveRecord)
|
||||||
.put("history", historyEntry)
|
.put("history", historyEntry)
|
||||||
|
@ -55,12 +55,10 @@ System.register(["./wallet", "./db", "./http"], function(exports_1) {
|
|||||||
};
|
};
|
||||||
wallet.confirmReserve(req)
|
wallet.confirmReserve(req)
|
||||||
.then(function (resp) {
|
.then(function (resp) {
|
||||||
if (resp.success) {
|
|
||||||
resp.backlink = chrome.extension.getURL("pages/reserve-success.html");
|
|
||||||
}
|
|
||||||
sendResponse(resp);
|
sendResponse(resp);
|
||||||
})
|
})
|
||||||
.catch(function (e) {
|
.catch(function (e) {
|
||||||
|
sendResponse({ success: false });
|
||||||
console.error("exception during 'confirm-reserve'");
|
console.error("exception during 'confirm-reserve'");
|
||||||
console.error(e.stack);
|
console.error(e.stack);
|
||||||
});
|
});
|
||||||
|
@ -72,13 +72,10 @@ function makeHandlers(wallet) {
|
|||||||
};
|
};
|
||||||
wallet.confirmReserve(req)
|
wallet.confirmReserve(req)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
if (resp.success) {
|
|
||||||
resp.backlink = chrome.extension.getURL(
|
|
||||||
"pages/reserve-success.html");
|
|
||||||
}
|
|
||||||
sendResponse(resp);
|
sendResponse(resp);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
sendResponse({success: false});
|
||||||
console.error("exception during 'confirm-reserve'");
|
console.error("exception during 'confirm-reserve'");
|
||||||
console.error(e.stack);
|
console.error(e.stack);
|
||||||
});
|
});
|
||||||
|
@ -28,14 +28,10 @@ var ConfirmCreateReserve;
|
|||||||
}
|
}
|
||||||
showAmount.textContent = s;
|
showAmount.textContent = s;
|
||||||
}
|
}
|
||||||
function clone(obj) {
|
|
||||||
// This is faster than it looks ...
|
|
||||||
return JSON.parse(JSON.stringify(obj));
|
|
||||||
}
|
|
||||||
document.addEventListener("DOMContentLoaded", function (e) {
|
document.addEventListener("DOMContentLoaded", function (e) {
|
||||||
updateAmount();
|
updateAmount();
|
||||||
document.getElementById("confirm").addEventListener("click", function (e) {
|
document.getElementById("confirm").addEventListener("click", function (e) {
|
||||||
var d = clone(query);
|
var d = Object.assign({}, query);
|
||||||
d.mint = document.getElementById('mint-url').value;
|
d.mint = document.getElementById('mint-url').value;
|
||||||
chrome.runtime.sendMessage({ type: 'confirm-reserve', detail: d }, function (resp) {
|
chrome.runtime.sendMessage({ type: 'confirm-reserve', detail: d }, function (resp) {
|
||||||
if (resp.success === true) {
|
if (resp.success === true) {
|
||||||
@ -43,7 +39,7 @@ var ConfirmCreateReserve;
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.body.innerHTML =
|
document.body.innerHTML =
|
||||||
"\n Oops, something went wrong.\n The bank responded with HTTP status code " + resp.status + ".\n Here is some more info:\n <pre>" + resp.text + "</pre>\n </div>";
|
"Oops, something went wrong. It looks like the bank could not\n transfer funds to the mint. Please go back to your bank's website\n to check what happened.";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -32,16 +32,12 @@ namespace ConfirmCreateReserve {
|
|||||||
showAmount.textContent = s;
|
showAmount.textContent = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clone(obj) {
|
|
||||||
// This is faster than it looks ...
|
|
||||||
return JSON.parse(JSON.stringify(obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", (e) => {
|
document.addEventListener("DOMContentLoaded", (e) => {
|
||||||
updateAmount();
|
updateAmount();
|
||||||
|
|
||||||
document.getElementById("confirm").addEventListener("click", (e) => {
|
document.getElementById("confirm").addEventListener("click", (e) => {
|
||||||
let d = clone(query);
|
let d = Object.assign({}, query);
|
||||||
d.mint = (document.getElementById('mint-url') as HTMLInputElement).value;
|
d.mint = (document.getElementById('mint-url') as HTMLInputElement).value;
|
||||||
chrome.runtime.sendMessage({type:'confirm-reserve', detail: d},
|
chrome.runtime.sendMessage({type:'confirm-reserve', detail: d},
|
||||||
(resp) => {
|
(resp) => {
|
||||||
@ -49,12 +45,9 @@ namespace ConfirmCreateReserve {
|
|||||||
document.location.href = resp.backlink;
|
document.location.href = resp.backlink;
|
||||||
} else {
|
} else {
|
||||||
document.body.innerHTML =
|
document.body.innerHTML =
|
||||||
`
|
`Oops, something went wrong. It looks like the bank could not
|
||||||
Oops, something went wrong.
|
transfer funds to the mint. Please go back to your bank's website
|
||||||
The bank responded with HTTP status code ${resp.status}.
|
to check what happened.`;
|
||||||
Here is some more info:
|
|
||||||
<pre>${resp.text}</pre>
|
|
||||||
</div>`;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Taler Wallet: Withdraw operation initiated</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="../style/wallet.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<header>
|
|
||||||
<div id="logo"></div>
|
|
||||||
<h1>Withdraw operation initiated</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<aside class="sidebar" id="left">
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<section id="main">
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<h1>Success!</h1>
|
|
||||||
|
|
||||||
<p>We have started the process of withdrawing electronic coins. This process may take a bit, but will happen in the background. So you can now continue to browse.</p>
|
|
||||||
<p>You can click on the Taler logo in your navigation bar to check on the progress of the withdrawal operation and your current balance.</p>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user