From 0873ccee907d6ffd6833db759322abe83322cecf Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 22 Sep 2021 00:34:54 -0600 Subject: [PATCH] Show warning on Drop and Send page if user doesn't have a linked card --- www/assets/js/account.js | 28 +++++++++++++++++++++++++++- www/pages/dropandsend.html | 7 ++++++- www/routes.js | 9 +++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) 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 @@
    -
  • +
  • Use one of our Drop and Send package drop boxes for easier shipping, and say goodbye to standing in line at the post office. Use your choice of USPS, UPS, or FedEx (or let us pick the cheapest), purchase shipping insurance, and more!
  • +