From 604cb2f80473c23f76afd37670a1a7249ae170a3 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Sun, 20 Dec 2015 20:34:20 +0100
Subject: Missing files, payment

---
 extension/pages/confirm-create-reserve.tsx | 48 ++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 extension/pages/confirm-create-reserve.tsx

(limited to 'extension/pages/confirm-create-reserve.tsx')

diff --git a/extension/pages/confirm-create-reserve.tsx b/extension/pages/confirm-create-reserve.tsx
new file mode 100644
index 000000000..380f769b1
--- /dev/null
+++ b/extension/pages/confirm-create-reserve.tsx
@@ -0,0 +1,48 @@
+"use strict";
+
+namespace ConfirmCreateReserve {
+
+  let url = URI(document.location.href);
+  let query: any = URI.parseQuery(url.query());
+
+  function updateAmount() {
+    let showAmount = document.getElementById("show-amount");
+    console.log("Query is " + JSON.stringify(query));
+    let s = query.amount_str;
+    if (!s) {
+      document.body.innerHTML = "Oops, something went wrong.";
+      return;
+    }
+    showAmount.textContent = s;
+  }
+
+  function clone(obj) {
+    // This is faster than it looks ...
+    return JSON.parse(JSON.stringify(obj));
+  }
+
+  document.addEventListener("DOMContentLoaded", (e) => {
+    updateAmount();
+
+    document.getElementById("confirm").addEventListener("click", (e) => {
+      let d = clone(query);
+      d.mint = (document.getElementById('mint-url') as HTMLInputElement).value;
+      chrome.runtime.sendMessage({type:'confirm-reserve', detail: d},
+                                 (resp) => {
+        if (resp.success === true) {
+          document.location.href = resp.backlink;
+        } else {
+          document.body.innerHTML =
+            `
+              Oops, something went wrong.
+             The bank responded with HTTP status code ${resp.status}.
+             Here is some more info:
+              <pre>${resp.text}</pre>
+            </div>`;
+        }
+      });
+
+    });
+  });
+
+}
\ No newline at end of file
-- 
cgit v1.2.3

