diff options
author | Florian Dold <florian.dold@gmail.com> | 2015-12-18 01:30:22 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2015-12-18 01:30:22 +0100 |
commit | 3ddfad19739f0f3ce2d93a507a3f6abff9b7fe7e (patch) | |
tree | be0eb759d7216d31bff4633ebf7e60d617787836 /extension/background/wallet.js | |
parent | 0d5c37a49e688503dc2933d379c68541dd432248 (diff) |
Payment "works".
Diffstat (limited to 'extension/background/wallet.js')
-rw-r--r-- | extension/background/wallet.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/extension/background/wallet.js b/extension/background/wallet.js index 422e60ca5..a24ee372b 100644 --- a/extension/background/wallet.js +++ b/extension/background/wallet.js @@ -148,9 +148,15 @@ function executePay(db, offer, payCoinInfo, merchantBaseUrl, chosenMint) { let req = new XMLHttpRequest(); req.open('post', payUrl.href()); req.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); + req.send(JSON.stringify(reqData)); req.addEventListener('readystatechange', (e) => { if (req.readyState == XMLHttpRequest.DONE) { - resolve(); + if (req.status == 200) { + resolve(); + } + else { + throw Error("bad status " + req.status); + } } }); }); @@ -173,6 +179,9 @@ function confirmPay(db, detail, sendResponse) { let mintUrl = Object.keys(mcs)[0]; let ds = signDeposit(db, offer, mcs[mintUrl]); return executePay(db, offer, ds, detail.merchantPageUrl, mintUrl); + }) + .then(() => { + sendResponse({ success: true }); }); return true; } |