diff --git a/www/assets/js/account.js b/www/assets/js/account.js index e2763cb..0b09365 100644 --- a/www/assets/js/account.js +++ b/www/assets/js/account.js @@ -39,6 +39,29 @@ function checkAccountStatus(callback) { } } +function checkIfAccountGoodWithPaymentMethod(successcb, errorcb) { + if (!inStorage("phonenumber") || !inStorage("accountkey")) { + successcb(false); + return; + } + apirequest(SETTINGS.apis.getaccountinfo, { + phone: getStorage("phonenumber"), + accountkey: getStorage("accountkey") + }, function (success) { + if (success.status == "OK") { + if (success.payments_setup === false) { + successcb(false); + } else { + successcb(true); + } + } else { + errorcb(success.msg); + } + }, function (error) { + errorcb("Couldn't get your account info. Try again later."); + }, "GET"); +} + function openAccountVerify(verifymsg) { app.dialog.prompt(verifymsg, "Verify Your Account", function (val) { verifyCode(val); @@ -253,7 +276,10 @@ function initAccountPage() { }); } -function openCheckoutWindowToSaveCard() { +function openCheckoutWindowToSaveCard(onaccountpage) { + if (typeof onaccountpage == "undefined") { + onaccountpage = true; + } openBrowser(SETTINGS.apis.redirecttopaymentsetup + "?phone=" + getStorage("phonenumber") + "&accountkey=" + getStorage("accountkey"), diff --git a/www/pages/dropandsend.html b/www/pages/dropandsend.html index 8781cc1..be794b5 100644 --- a/www/pages/dropandsend.html +++ b/www/pages/dropandsend.html @@ -23,12 +23,17 @@