diff --git a/www/assets/js/moneyorder.js b/www/assets/js/moneyorder.js new file mode 100644 index 0000000..c48ea4d --- /dev/null +++ b/www/assets/js/moneyorder.js @@ -0,0 +1,36 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +$("#app").on("submit", "#moneyorderForm", function (e) { + e.preventDefault(); + verifyMoneyOrder($('#moneyorderserial').val()); + return false; +}); + +function verifyMoneyOrder(serial) { + if (typeof serial != "string" || serial == "" || /^[0-9]{3,8}$/.test(serial) == false) { + app.dialog.alert("Enter a valid Helena Express money order serial number.", "Whoops!"); + return; + } + app.dialog.preloader("Working..."); + apirequest(SETTINGS.apis.moneyorderverify, { + serial: serial + }, function (resp) { + app.dialog.close(); + if (resp.status == "OK") { + app.dialog.alert("Amount: $" + resp.amount + + "
Issued: " + resp.issued_date + " UTC" + + (resp.mo_status == "" ? "" : "
Status: " + resp.mo_status), + "Money Order #" + resp.serial); + } else { + app.dialog.alert(resp.msg, "Error"); + } + }, function (error) { + app.dialog.close(); + app.dialog.alert("Connection or server error. Try again later.", "Whoops!"); + sendErrorReport("Money Order", "Verification"); + }); +} \ No newline at end of file diff --git a/www/index.html b/www/index.html index bc1fef7..5f2bdf3 100644 --- a/www/index.html +++ b/www/index.html @@ -69,6 +69,7 @@ + diff --git a/www/pages/money.html b/www/pages/money.html new file mode 100644 index 0000000..8f21de4 --- /dev/null +++ b/www/pages/money.html @@ -0,0 +1,42 @@ + + +
+ + + +
+
+
+
+ {{#each pages}} +
+
+
+

+
+ {{title}} +
+ {{text}} +
+
+
+ {{/each}} +
+
+
+
+ +
\ No newline at end of file diff --git a/www/pages/moneyorder.html b/www/pages/moneyorder.html new file mode 100644 index 0000000..ea7bb6f --- /dev/null +++ b/www/pages/moneyorder.html @@ -0,0 +1,48 @@ + + +
+ + + + +
+
+
+
+
+
+
    +
  • +
    +
    Serial Number
    +
    + + +
    +
    +
  • +
  • +
    Verify
    +
  • +
+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/www/routes.js b/www/routes.js index 323f70c..8262ae4 100644 --- a/www/routes.js +++ b/www/routes.js @@ -23,7 +23,9 @@ var pagesToCompile = [ "trackresult", "settings", "receipts", - "trailer" + "trailer", + "money", + "moneyorder" ]; console.log("Compiling page templates..."); for (var i = 0; i < pagesToCompile.length; i++) { @@ -173,10 +175,10 @@ var routes = [ text: "Get boxes, labels, and shipping supplies delivered to your door." }, { - title: "Crypto Wallet", - href: "/crypto", - icon: "fa-duotone fa-wallet", - text: "Check your crypto wallet balance and pay people with cryptocurrency." + title: "Money Services", + href: "/money", + icon: "fa-duotone fa-money-bill-wave", + text: "Manage cryptocurrency and verify money orders." }, { title: "My Account", @@ -225,6 +227,35 @@ var routes = [ }, {}); } }, + { + path: '/money', + name: 'money', + async: function ( { resolve, reject }) { + resolve({ + content: compiledPages.money({ + pages: [ + { + title: "Verify Money Order", + href: "/moneyorder", + icon: "fa-duotone fa-money-check-dollar", + text: "Check and verify a Helena Express money order." + }, + { + title: "Crypto Wallet", + href: "/crypto", + icon: "fa-duotone fa-wallet", + text: "Check your crypto wallet balance and pay people with cryptocurrency." + } + ] + }) + }, {}); + } + }, + { + path: '/moneyorder', + content: compiledPages.moneyorder(), + name: 'moneyorder' + }, { path: '/notary', content: compiledPages.notary(), diff --git a/www/settings.js b/www/settings.js index 920c6df..9d0bd74 100644 --- a/www/settings.js +++ b/www/settings.js @@ -47,7 +47,10 @@ var SETTINGS = { cryptofees: "http://localhost/helena.express/apis/crypto/fees", // Service area map servicearea: "http://localhost/helena.express/apis/servicearea", - trailerschedule: "https://helena.express/mobile/schedule.json" + // Trailer schedule/dates/times/locations + trailerschedule: "https://helena.express/mobile/schedule.json", + // Money order verification + moneyorderverify: "http://localhost/helena.express/apis/moneyorder/verify" }, stripe_pubkey: "pk_test_51J6qFXCa1Fboir5UzPO3LCiMsVNiFP2lq4wR0dEcjJJVzAaJ3uRggDekZPB3qeYpMD3ayIYHKyD5sSn0IFLlEXMW001LqrvGSH", branding: {