diff --git a/README.md b/README.md index 7b69d16..0563a6a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -Helping Helena App +Helping Helena Merchant App ============ -This is a cross-platform app for Helping Helena. It can be +This is a cross-platform app for Helping Helena. It enables merchants to accept Helping Helena as a payment method. It can be built for most platforms by using either [Apache Cordova](https://cordova.apache.org) or [NW.js](https://nwjs.io). diff --git a/config.xml b/config.xml index 22404fc..49b97a0 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + Helping Helena diff --git a/nbproject/project.properties b/nbproject/project.properties index 214989d..355a661 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -3,11 +3,11 @@ auxiliary.org-netbeans-modules-cordova.phonegap=true auxiliary.org-netbeans-modules-javascript-nodejs.enabled=false auxiliary.org-netbeans-modules-javascript-nodejs.node_2e_default=true auxiliary.org-netbeans-modules-javascript-nodejs.sync_2e_enabled=true -file.reference.HelpingHelena-test=test -file.reference.HelpingHelena-www=www +file.reference.HelpingHelenaMerchant-test=test +file.reference.HelpingHelenaMerchant-www=www files.encoding=UTF-8 project.license=mpl project.licensePath=./nbproject/license-mpl.txt project.organization=Netsyms Technologies -site.root.folder=${file.reference.HelpingHelena-www} -test.folder=${file.reference.HelpingHelena-test} +site.root.folder=${file.reference.HelpingHelenaMerchant-www} +test.folder=${file.reference.HelpingHelenaMerchant-test} diff --git a/nbproject/project.xml b/nbproject/project.xml index 9a28e1b..f1dcf0f 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,7 +3,7 @@ org.netbeans.modules.web.clientproject - HelpingHelena + HelpingHelena Merchant diff --git a/package.json b/package.json index d4fd589..7d17b24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "com.netsyms.HelpingHelena", - "displayName": "HelpingHelena", + "name": "com.netsyms.HelpingHelenaMerchant", + "displayName": "HelpingHelena Merchant", "version": "1.0.0", "description": "", "main": "index.js", @@ -35,4 +35,4 @@ "android" ] } -} \ No newline at end of file +} diff --git a/www/css/styles.css b/www/css/styles.css index 2dbe520..e7566c5 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -76,104 +76,7 @@ html.md .navbar .link { color: white; } -.card-expandable .card-header { - min-height: var(--f7-card-header-min-height); - color: var(--f7-card-header-text-color); - font-size: var(--f7-card-header-font-size); - font-weight: var(--f7-card-header-font-weight); - padding: var(--f7-card-header-padding-vertical) var(--f7-card-header-padding-horizontal); -} - -.card-expandable .card-header:after { - display: block !important; -} - -.card-opened .card-header { - display: none; -} - -#qrcode, .card-closing #qrcode { - width: auto; +#qrcode { + max-height: calc(100% - var(--f7-navbar-height)); max-width: 100%; - height: 12em; - transition: height 0.3s ease-in-out; -} - -.card-opening #qrcode, .card-opened #qrcode { - height: 55em; - max-height: 55vh; -} - -#map-card { - background-color: hsl(47, 26%, 88%); -} - -#map { - position: absolute; - top: 0; - left: 0; - height: 25em; - width: 100%; - opacity: 1; - transition: opacity 0.5s linear, top 0.25s linear; - background-color: hsl(47, 26%, 88%); -} - -.card-expandable.card-closing, .card-expandable.card-opened, .card-expandable.card-opening { - z-index: 9999999; -} - -.card-opening #map, .card-closing #map { - opacity: 0; -} - -.card-opened #map { - opacity: 1; - top: var(--f7-navbar-height); - height: calc(100% - var(--f7-navbar-height)); -} - -.card-backdrop { - z-index: 999999; -} - -#map .leaflet-control { - opacity: 0; - visibility: hidden; - transition: visibility 0s, opacity 0.5s; -} - -.card-opened #map .leaflet-control { - opacity: 1; - visibility: visible; -} - -.card-expandable .navbar { - display: none; -} - -.card-opened .navbar { - display: block; -} - -#person-name { - overflow-wrap: break-word; -} - -#person-bio { - border-top: 1px solid var(--f7-card-footer-border-color); - padding-top: var(--f7-card-footer-padding-vertical); - overflow-wrap: break-word; -} - -.fa-map-icon { - padding: 2px; - color: white; - background-color: var(--f7-theme-color); - border: 2px solid var(--f7-theme-color-shade); - border-radius: 50%; -} - -.fa-map-icon i { - margin-top: 0.4em; } \ No newline at end of file diff --git a/www/index.html b/www/index.html index 63e208f..81fccca 100644 --- a/www/index.html +++ b/www/index.html @@ -15,7 +15,7 @@ -Helping Helena +Helping Helena Merchant
@@ -30,9 +30,6 @@ - - - diff --git a/www/js/addfunds.js b/www/js/addfunds.js deleted file mode 100644 index 5d378c4..0000000 --- a/www/js/addfunds.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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/. - */ - -var stripe = null; -var elements = null; -var card = null; - -function initPaymentPage() { - $("#tx-off-percent").text(+(SETTINGS["addfunds_percent"] * 100).toFixed(2)); - initStripe(); -} - -function initStripe() { - // Wait for Stripe to be loaded - if (typeof Stripe == 'undefined') { - setTimeout(initStripe, 500); - return; - } - stripe = Stripe(SETTINGS["stripe_pubkey"]); - elements = stripe.elements(); - - card = elements.create('card', {}); - - card.mount('#card-element'); - - card.addEventListener('change', function (event) { - var displayError = document.getElementById('card-errors'); - if (event.error) { - displayError.textContent = event.error.message; - } else { - displayError.textContent = ''; - } - }); -} - -function addFeesToAmount() { - if ($("#funds-amount").val() == "") { - return; - } - var amount = $("#funds-amount").val() * 1.0; - - var stripefees = 0.30 + (amount * 0.029); - var totalfees = amount * SETTINGS["addfunds_percent"]; - - amount = (amount + (stripefees > totalfees ? 0.30 : 0)) / - (1 - (stripefees > totalfees ? 0.029 : SETTINGS["addfunds_percent"])); - - $("#funds-amount").val(amount.toFixed(2)); -} - - -function chargeCard() { - if ($("#funds-amount").val() == "") { - return; - } - if (stripe == null) { - return; - } - app.preloader.show(); - stripe.createToken(card).then(function (result) { - if (result.error) { - // Inform the customer that there was an error. - app.preloader.hide(); - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - callAPI("addfunds", { - key: localStorage.getItem("key"), - amount: $("#funds-amount").val(), - token: result.token.id - }, function (response) { - app.preloader.hide(); - router.navigate("/fundsadded/" + response.charged_amount.toFixed(2) + "/" + response.final_amount.toFixed(2)); - }, function (error) { - app.preloader.hide(); - app.dialog.alert(error, "Error"); - }); - } - }); -} - -$(".preset-amount-button").click(function () { - $($(this).data("target")).val($(this).data("amount")); -}); \ No newline at end of file diff --git a/www/js/giver_map.js b/www/js/giver_map.js deleted file mode 100644 index 1b57410..0000000 --- a/www/js/giver_map.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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/. - */ - - - -var leafletnearbylayer = L.geoJson( - { - name: "Nearby People", - type: "FeatureCollection", - features: [ - { - type: "Feature", - geometry: { - type: "Point", - coordinates: [0, 0] - }, - properties: { - id: "", - name: "", - username: "", - verified: false - } - } - ] - }, - { - onEachFeature: function (feature, layer) { - if (feature.properties && feature.properties.popupContent) { - layer.bindPopup(feature.properties.popupContent); - } - }, - pointToLayer: function (feature, latlng) { - var marker = L.marker(latlng, { - icon: L.icon({ - iconUrl: "img/mapmarker.svg", - iconSize: [25, 41], - iconAnchor: [12.5, 40], - popupAnchor: [0, -28] - }) - }); - return marker; - } - } -); - -function updateMap() { - var diagonalMeters = leafletmap.getBounds().getNorthWest().distanceTo(leafletmap.getBounds().getSouthEast()); - var radius = (diagonalMeters / 2.0) / 1609.344; - callAPIRawResponse("getnearby", { - key: localStorage.getItem("key"), - latitude: leafletmap.getCenter().lat, - longitude: leafletmap.getCenter().lng, - radius: radius, - format: "geojson" - }, function (data) { - if (data.type == "FeatureCollection") { - leafletnearbylayer.clearLayers(); - data.features.forEach(function (item) { - item.properties.popupContent = " " + (item.properties.name.length > 50 ? item.properties.name.substring(0, 50) + "..." : item.properties.name) + "

Send Money"; - leafletnearbylayer.addData(item); - }); - leafletmap.addLayer(leafletnearbylayer); - $(".leaflet-marker-icon").addClass("card-prevent-open"); - } - }); -} \ No newline at end of file diff --git a/www/js/home.js b/www/js/home.js index f5ea07a..7516b1a 100644 --- a/www/js/home.js +++ b/www/js/home.js @@ -4,64 +4,42 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var accountBalance = 0.0; +// Set to true to stop pinging the server for tx status +var stopPaymentCheck = false; -$(".view-main").on("ptr:refresh", ".ptr-content", function () { - loadHomePage(function () { - setTimeout(app.ptr.done, 500); - }); -}); - - -$(".view-main").on("card:open", ".card-expandable", function () { - $(".ptr-preloader").addClass("display-none"); +$("#payment-popup").on("popup:close", function () { + stopPaymentCheck = true; }); -$("#map-card").on("card:closed card:opened", function () { - leafletmap.invalidateSize(); -}); - -$("#map-card").on("card:open", function () { - leafletgllayer._glMap.setPitch(20); -}); -$("#map-card").on("card:close", function () { - leafletgllayer._glMap.setPitch(0); -}); - -$(".view-main").on("card:closed", ".card-expandable", function () { - $(".ptr-preloader").removeClass("display-none"); -}); - -function loadBalance(callback) { - $("#balance-error-icon").addClass("display-none"); - $("#balance-loading").removeClass("display-none"); - callAPI("checkbalance", { - key: localStorage.getItem("key") - }, function (data) { - accountBalance = data.balance; - $("#balance-amount").text(data.balance); - $("#balance-loading").addClass("display-none"); - $("#balance-error").text(""); - callback(true); - }, function (msg) { - $("#balance-loading").addClass("display-none"); - $("#balance-error-icon").css("display", ""); - $("#balance-error").text(msg); - callback(false, msg); +$("#showcodebtn").click(function () { + var amount = $("#amount-box").val() * 1.0; + if (amount <= 0) { + app.dialog.alert("Please specify an amount.", "Error"); + return; + } else if (amount > 999.99) { + app.dialog.alert("Please specify an amount less than $999.99.", "Error"); + return; + } + app.preloader.show(); + makeQrCode(amount, function (ok, msg) { + app.preloader.hide(); + if (!ok) { + app.dialog.alert(msg, "Error"); + } else { + app.popup.open($("#payment-popup")); + } }); -} +}); -function loadQrCode(callback) { - $("#receive-loading").removeClass("display-none"); - callAPI("getprofile", { +function makeQrCode(amount, callback) { + callAPI("gettxcode", { key: localStorage.getItem("key"), + amount: amount }, function (data) { - app.preloader.hide(); - //if (data.profile.type * 1 > 1) { var typeNumber = 4; var errorCorrectionLevel = 'L'; var qr = qrcode(typeNumber, errorCorrectionLevel); - qr.addData(SETTINGS['webapp_url'] + '?sendto=' + data.profile.publicid); + qr.addData(SETTINGS['webapp_url'] + '?sendto=' + data.txcode + "&amount=" + data.amount); qr.make(); var svg = qr.createSvgTag({ margin: 6, @@ -69,48 +47,36 @@ function loadQrCode(callback) { }); var base64 = window.btoa(svg); $("#qrcode").attr("src", 'data:image/svg+xml;base64,' + base64); - $("#qrcode-label").text(data.profile.publicid); - $("#receive-loading").addClass("display-none"); + $("#pay-amount").text(data.amount); + $("#paid-amount").text(data.amount); + app.preloader.hide(); + checkPaymentStatus(data.txcode); callback(true); - //} }, function (msg) { - $("#receive-loading").addClass("display-none"); callback(false, msg); }); } -function broadcastLocation() { - getLocation(function (position) { - callAPI("broadcast", { - key: localStorage.getItem("key"), - latitude: position.coords.latitude, - longitude: position.coords.longitude - }, function (success) { - app.toast.create({ - text: " Location sent!", - closeTimeout: 2000 - }).open(); - }, function (error) { - app.dialog.alert(error, "Error"); - }); - }, function (error) { - app.dialog.alert(error, "Location Error"); - }); -} - -function loadHomePage(callback) { - var done = 0; - var total = 2; - loadBalance(function () { - done++; - if (done >= total) { - callback(); - } - }); - loadQrCode(function () { - done++; - if (done >= total) { - callback(); +function checkPaymentStatus(txcode) { + if (stopPaymentCheck) { + stopPaymentCheck = false; + return; + } + callAPI("gettxstatus", { + key: localStorage.getItem("key"), + txcode: txcode + }, function (data) { + if (data.complete == true) { + app.popup.close($("#payment-popup")); + app.popup.open($("#paid-popup")); + } else { + setTimeout(function () { + checkPaymentStatus(txcode); + }, 15 * 100); } + }, function (msg) { + app.popup.close($("#payment-popup")); + app.popup.close($("#paid-popup")); + app.dialog.alert(msg, "Error"); }); } \ No newline at end of file diff --git a/www/js/login.js b/www/js/login.js new file mode 100644 index 0000000..4fccdbc --- /dev/null +++ b/www/js/login.js @@ -0,0 +1,49 @@ +/* + * 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/. + */ + +$('#username').on("keyup", function () { + $('#username').val($('#username').val().toLowerCase()); +}); + +function checkAndSave(username, password) { + app.preloader.show(); + + callAPI("getkey", { + username: username, + password: password + }, function (data) { + app.preloader.hide(); + callAPI("getprofile", { + key: data.key + }, function (profile) { + if (profile.profile.type != 3) { + app.preloader.hide(); + app.dialog.alert("You downloaded the merchant app but you aren't a merchant. Go to helpinghelena.org to get the correct app.", "Error"); + return; + } + localStorage.setItem("key", data.key); + localStorage.setItem("username", username); + localStorage.setItem("password", password); + localStorage.setItem("configured", true); + // Restart the app to re-read the config + restartApplication(); + }, function (msg) { + app.preloader.hide(); + app.dialog.alert(msg, "Error"); + }); + }, function (msg) { + app.preloader.hide(); + app.dialog.alert(msg, "Error"); + }); +} + +function doLogin() { + var type = 3; + var username = $("#username").val(); + var password = $("#password").val(); + + checkAndSave(username, password, type); +} \ No newline at end of file diff --git a/www/js/main.js b/www/js/main.js index 57e9fd2..af5934e 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -121,39 +121,19 @@ function setupKeyRefresh() { if (localStorage.getItem("configured") == null) { // Open the setup page - router.navigate("/setup/0"); + router.navigate("/login"); } else { checkKey(function (valid) { if (valid) { - try { - var url = new URL(window.location.href); - if (typeof url.searchParams.get("sendto") == "string") { - router.navigate("/sendmoney/" + url.searchParams.get("sendto")); - } else { - router.navigate("/home"); - } - } catch (ex) { - router.navigate("/home"); - } - + router.navigate("/home"); setupKeyRefresh(); } else { refreshKey(function (ok) { if (ok) { - try { - var url = new URL(window.location.href); - if (typeof url.searchParams.get("sendto") == "string") { - router.navigate("/sendmoney/" + url.searchParams.get("sendto")); - } else { - router.navigate("/home"); - } - } catch (ex) { - router.navigate("/home"); - } - + router.navigate("/home"); setupKeyRefresh(); } else { - router.navigate("/setup/0"); + router.navigate("/login"); } }); } diff --git a/www/js/map.js b/www/js/map.js deleted file mode 100644 index eee75d8..0000000 --- a/www/js/map.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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/. - */ - -var userPositionIsReal = false; -var userposition = { - coords: { - latitude: 46.595, - longitude: -112.019, - accuracy: 10000 - } -}; - -var leafletmap = L.map('map', { - minZoom: 12, - maxZoom: 20 -}); - -leafletmap.attributionControl.setPrefix(""); -var leafletgllayer = L.mapboxGL({ - attribution: "© OpenMapTiles © OpenStreetMap contributors", - accessToken: 'none', - style: SETTINGS["map_style_json"], - pitch: 0 -}); - -leafletgllayer.addTo(leafletmap); - - -function recenterMapPosition() { - var zoom = 13; - if (userposition.coords.accuracy < 1000) { - zoom = 15; - } - leafletmap.setView([userposition.coords.latitude, userposition.coords.longitude], zoom); -} - -function recenterMapToUserPosition() { - if (userPositionIsReal == false) { - getLocation(function (position) { - userposition = position; - userPositionIsReal = true; - recenterMapPosition(); - }); - } else { - recenterMapPosition(); - } -} - -// Attempt to get user location -watchLocation(function (position) { - userposition = position; - if (userPositionIsReal == false) { - recenterMapPosition(); - userPositionIsReal = true; - } -}); - -// Set map to default position -recenterMapPosition(); -// Load nearby -updateMap(); -// Watch for map moving -leafletmap.on("moveend", function () { - updateMap(); -}); \ No newline at end of file diff --git a/www/js/receiver_map.js b/www/js/receiver_map.js deleted file mode 100644 index d5578e8..0000000 --- a/www/js/receiver_map.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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/. - */ - - - -var leafletnearbylayer = L.geoJson( - { - name: "Nearby Merchants", - type: "FeatureCollection", - features: [ - { - type: "Feature", - geometry: { - type: "Point", - coordinates: [0, 0] - }, - properties: { - id: "", - name: "", - address: "", - types: {} - } - } - ] - }, - { - onEachFeature: function (feature, layer) { - if (feature.properties && feature.properties.popupContent) { - layer.bindPopup(feature.properties.popupContent); - } - }, - pointToLayer: function (feature, latlng) { - var icon = "fas fa-store"; - if (feature.properties.types.length > 0) { - icon = feature.properties.types[0].icon; - } - var marker = L.marker(latlng, { - icon: (new L.divIcon({ - html: '', - iconSize: [20, 20], - className: 'fa-map-icon' - })) - }); - return marker; - } - } -); - -function updateMap() { - var diagonalMeters = leafletmap.getBounds().getNorthWest().distanceTo(leafletmap.getBounds().getSouthEast()); - var radius = (diagonalMeters / 2.0) / 1609.344; - callAPIRawResponse("getmerchants", { - key: localStorage.getItem("key"), - latitude: leafletmap.getCenter().lat, - longitude: leafletmap.getCenter().lng, - radius: radius, - format: "geojson" - }, function (data) { - if (data.type == "FeatureCollection") { - leafletnearbylayer.clearLayers(); - data.features.forEach(function (item) { - var icons = ""; - item.properties.types.forEach(function (type) { - icons += " " + type.name + "
"; - }); - item.properties.popupContent = (item.properties.name.length > 50 ? item.properties.name.substring(0, 50) + "..." : item.properties.name) + "

" + icons; - leafletnearbylayer.addData(item); - }); - leafletmap.addLayer(leafletnearbylayer); - $(".leaflet-marker-icon").addClass("card-prevent-open"); - } - }); -} \ No newline at end of file diff --git a/www/js/sendmoney.js b/www/js/sendmoney.js deleted file mode 100644 index 5f76202..0000000 --- a/www/js/sendmoney.js +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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/. - */ - - -$("#typecodebtn").on("click", function () { - app.dialog.prompt('Enter the recipient\'s code', 'Send Money', function (code) { - if (code != "") { - app.preloader.show(); - callAPI("getprofile", { - key: localStorage.getItem("key"), - id: code - }, function (data) { - $("#publicid").val(code); - loadSendMoneyPage(); - }, function (msg) { - app.preloader.hide(); - app.dialog.alert(msg, "Error"); - }); - } - }); -}); - -$("#scanqrcodebtn").on("click", function () { - cordova.plugins.barcodeScanner.scan( - function (result) { - if (!result.cancelled) { - console.log("Barcode: ", result); - if (result.format == "QR_CODE" && result.text.startsWith(SETTINGS['webapp_url'])) { - var url = new URL(result.text); - if (typeof url.searchParams.get("sendto") == "string") { - $("#publicid").val(url.searchParams.get("sendto")); - loadSendMoneyPage(); - } else { - app.dialog.alert("Not a valid payment code.", "Scan Error"); - } - } else { - app.dialog.alert("Not a valid payment code.", "Scan Error"); - } - } - }, - function (error) { - app.dialog.alert(error, "Scan Error"); - }, - { - showTorchButton: true, - prompt: "Scan a code to send money", - resultDisplayDuration: 0, - disableSuccessBeep: true - } - ); -}); - -function sendMoney(id, amount, name) { - if (id == "0") { - return; - } - if (amount <= 0) { - app.dialog.alert("Please specify an amount.", "Error"); - } else if (amount > 999.99) { - app.dialog.alert("Please specify an amount less than $999.99.", "Error"); - } - app.preloader.show(); - callAPI("sendmoney", { - key: localStorage.getItem("key"), - to: id, - amount: amount - }, function (data) { - app.preloader.hide(); - router.navigate("/moneysent/" + (amount * 1.0).toFixed(2) + "/" + name); - }, function (msg) { - app.preloader.hide(); - app.dialog.alert(msg, "Error"); - }); -} - -function loadSendMoneyPage() { - app.preloader.show(); - if ($("#publicid").val() == "0") { - app.preloader.hide(); - $("#step1").removeClass("display-none"); - $("#step2").addClass("display-none"); - } else { - $("#step1").addClass("display-none"); - $("#step2").removeClass("display-none"); - callAPI("getprofile", { - key: localStorage.getItem("key"), - id: $("#publicid").val() - }, function (data) { - app.preloader.hide(); - console.log("Profile", data.profile); - $("#person-name").text(data.profile.name); - if (data.profile.bio != "") { - $("#person-bio").text(data.profile.bio); - $("#person-bio").removeClass("display-none"); - } - if (data.profile.verified) { - $("#verified-badge").removeClass("display-none"); - } else { - $("#unverified-badge").removeClass("display-none"); - } - }, function (msg) { - app.preloader.hide(); - app.dialog.alert(msg, "Error"); - }); - } -} - -$(".preset-amount-button").click(function () { - $($(this).data("target")).val($(this).data("amount")); -}); - -$("#sendbtn").click(function () { - sendMoney($("#publicid").val(), $("#amount-box").val(), $("#person-name").text()); -}); \ No newline at end of file diff --git a/www/js/setup1.js b/www/js/setup1.js deleted file mode 100644 index c160b1b..0000000 --- a/www/js/setup1.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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/. - */ - -$('#username').on("keyup", function () { - $('#username').val($('#username').val().toLowerCase()); -}); - -function checkAndSave(username, password) { - app.preloader.show(); - - callAPI("getkey", { - username: username, - password: password - }, function (data) { - app.preloader.hide(); - localStorage.setItem("key", data.key); - localStorage.setItem("username", username); - localStorage.setItem("password", password); - callAPI("getprofile", { - key: data.key - }, function (profile) { - if (profile.profile.type == 1) { - localStorage.setItem("accttype", "giver"); - } else if (profile.profile.type == 2) { - localStorage.setItem("accttype", "receiver"); - } else if (profile.profile.type == 3) { - app.preloader.hide(); - app.dialog.alert("You need to download the merchant app instead. Visit ntsm.co/contact if you need help.", "Error"); - return; - } else { - app.preloader.hide(); - app.dialog.alert("Server replied with unknown account type. You might need to update this app.", "Error"); - return; - } - localStorage.setItem("configured", true); - // Restart the app to re-read the config - restartApplication(); - }, function (msg) { - app.preloader.hide(); - app.dialog.alert(msg, "Error"); - }); - }, function (msg) { - app.preloader.hide(); - app.dialog.alert(msg, "Error"); - }); -} - -function setupAccount() { - var type = $("#accttype").val(); - var username = $("#username").val(); - var password = $("#password").val(); - - checkAndSave(username, password, type); -} - -function createAccount() { - var type = $("#accttype").val(); - var username = $("#username").val(); - var password = $("#password").val(); - - if (username.length < 1) { - app.dialog.alert("Enter a username.", "Error"); - return; - } - if (password.length < SETTINGS["min_password_length"]) { - app.dialog.alert("Password must be at least " + SETTINGS["min_password_length"] + " characters long.", "Error"); - return; - } - - app.dialog.create({ - text: "I agree to the terms of service and privacy policy.", - buttons: [ - { - text: "No", - onClick: function () { - restartApplication(); - } - }, - { - text: "Yes", - onClick: function () { - app.preloader.show(); - callAPI("signup", { - username: username, - password: password, - accttype: type - }, function (data) { - app.preloader.hide(); - checkAndSave(username, password, type); - }, function (msg) { - app.preloader.hide(); - app.dialog.alert(msg, "Error"); - }); - } - }, - { - text: "Show", - onClick: function () { - openBrowser(SETTINGS["terms_of_service_url"]); - } - }, - ] - }).open(); -} \ No newline at end of file diff --git a/www/package.json b/www/package.json index 63ca007..38a6c57 100644 --- a/www/package.json +++ b/www/package.json @@ -1,6 +1,6 @@ { - "name": "com.netsyms.HelpingHelena", - "displayName": "HelpingHelena", + "name": "com.netsyms.HelpingHelenaMerchant", + "displayName": "Helping Helena Merchant", "version": "1.0.0", "description": "", "author": "Netsyms Technologies", diff --git a/www/pages/addfunds.html b/www/pages/addfunds.html deleted file mode 100644 index 7880b43..0000000 --- a/www/pages/addfunds.html +++ /dev/null @@ -1,67 +0,0 @@ - - -
- - - - -
-
-
- -
-
-
-
-
$
- -
- -

- - - -

- -
-
- Loading secure card form... -
- -
- -

- We don't see your card number; it's sent directly and securely to our payment processor. -

- Your account balance won't gain the entire amount you choose. - 7% (or the card fees, whichever is greater) is subtracted to - cover fees and maintenance costs. Tap here to add - the fees to your total. -

- -
-
- -
-
-
- - - - -
\ No newline at end of file diff --git a/www/pages/fundsadded.html b/www/pages/fundsadded.html deleted file mode 100644 index 81a2877..0000000 --- a/www/pages/fundsadded.html +++ /dev/null @@ -1,40 +0,0 @@ - - -
- - - - -
- -
- -
-
-
-
- Checkmark - -

You paid ${{this.$route.params.amount}} total and added ${{this.$route.params.final_amount}} to your balance.

- - Close -
-
-
-
-
- -
- -
\ No newline at end of file diff --git a/www/pages/home.html b/www/pages/home.html index 8aa7ad7..bd60e89 100644 --- a/www/pages/home.html +++ b/www/pages/home.html @@ -18,167 +18,75 @@
-
- -
-
-
-
+
-
+
-
-
- Balance -
-
- - +
+
+
$
+
-
-
-

$0.00

-
- {{#if receiver}} - - {{else}} -
- {{#if receiver}} -
-
- -
- -
-
- Receive Money -
-
- -
-
+
- -
+ -
-
+ +
-
-
- Broadcast Location -
-
+