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.ts | |
| parent | 0d5c37a49e688503dc2933d379c68541dd432248 (diff) | |
Payment "works".
Diffstat (limited to 'extension/background/wallet.ts')
| -rw-r--r-- | extension/background/wallet.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/extension/background/wallet.ts b/extension/background/wallet.ts index a2ac45dfa..9a9971f8d 100644 --- a/extension/background/wallet.ts +++ b/extension/background/wallet.ts @@ -231,9 +231,14 @@ function executePay(db, 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); + } } }); }); @@ -262,6 +267,9 @@ function confirmPay(db, detail: ConfirmPayRequest, 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; } |
