Add money order verification

master
Skylar Ittner 2 years ago
parent a1c176986d
commit 325099841a

@ -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
+ "<br>Issued: " + resp.issued_date + " UTC"
+ (resp.mo_status == "" ? "" : "<br>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");
});
}

@ -69,6 +69,7 @@
<script src="assets/js/home.js"></script>
<script src="assets/js/crypto.js"></script>
<script src="assets/js/serviceareamap.js"></script>
<script src="assets/js/moneyorder.js"></script>
<script src="routes.js"></script>
<script src="assets/js/main.js"></script>

@ -0,0 +1,42 @@
<!-- 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/. -->
<div class="page" data-name="money">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link back hapticbtn" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Money</div>
</div>
</div>
<div class="page-content noselect">
<div class="row justify-content-center margin-top">
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="row justify-content-center">
{{#each pages}}
<div class="col-100 small-50 large-33 no-margin-vertical">
<div class="card hapticbtn pointercursor" onclick="router.navigate('{{href}}');">
<div class="card-content text-align-center padding">
<h1 class="no-margin"><i class="{{icon}}"></i></h1>
<br />
<span style="font-weight: 700;">{{title}}</span>
<br />
<span>{{text}}</span>
</div>
</div>
</div>
{{/each}}
</div>
</div>
</div>
</div>
</div>

@ -0,0 +1,48 @@
<!-- 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/. -->
<div class="page" data-name="moneyorder">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link back" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Verify Money Order</div>
</div>
</div>
<div class="page-content">
<div class="row justify-content-center">
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="card margin">
<form class="card-content padding-vertical" id="moneyorderForm">
<div class="list media-list">
<ul>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Serial Number</div>
<div class="item-input-wrap">
<input type="text" id="moneyorderserial" placeholder="12345" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="padding">
<div class="button hapticbtn button-fill" onclick="verifyMoneyOrder($('#moneyorderserial').val())"><i class="fa-solid fa-magnifying-glass-dollar"></i> Verify</div>
</li>
</ul>
</div>
</form>
</div>
</div>
</div>
</div>
</div>

@ -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(),

@ -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: {

Loading…
Cancel
Save