Show warning on Drop and Send page if user doesn't have a linked card

master
Skylar Ittner 3 years ago
parent f90195672e
commit 0873ccee90

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

@ -23,12 +23,17 @@
<div class="col-100 medium-60 large-50 xlarge-40">
<div class="list transparent no-hairlines no-margin-top-sm tablet-inset elevation-tablet media-list">
<ul>
<li class="padding">
<li class="padding text-align-center">
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!
</li>
<li class="padding text-align-center" id="addPaymentMethodNag" style="display: none;">
<i class="fad fa-exclamation-circle fa-2x text-color-orange"></i><br>
You need an account with a linked credit card to send packages with Drop and Send. <span class="taptext">Tap</span><span class="clicktext">Click</span> the button to update your account.
<a class="button hapticbtn button-fill margin" href="/account"><i class="fas fa-user-circle"></i> My Account</a>
</li>
<li>
<div class="item-content item-link hapticbtn popup-open" data-popup="#dasHowItWorksPopup">
<div class="item-inner">

@ -132,6 +132,15 @@ var routes = [
name: 'dropandsend',
templateUrl: './pages/dropandsend.html',
on: {
pageBeforeIn: function () {
checkIfAccountGoodWithPaymentMethod(function (ok) {
if (!ok) {
$("#addPaymentMethodNag").css("display", "");
}
}, function (error) {
$("#addPaymentMethodNag").css("display", "");
});
},
pageAfterOut: function () {
dropboxMap = null;
}

Loading…
Cancel
Save