From 1acc55b40956794e1f0cb963d3793b62141b8ff6 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 26 Apr 2021 10:50:09 -0500 Subject: [PATCH] Allow new users to opt-in to balance auto-top-up We don't have auto top up built yet, but once we do they will be able to start getting it right away instead of needing to manually turn it on later. --- config.ru | 6 ++++++ views/activate.slim | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/config.ru b/config.ru index 8a65945da9901ef0bfa98288e87ffe2cfa4ebe4b..8f625991916c4406ee6841e0e6411be11793b29b 100644 --- a/config.ru +++ b/config.ru @@ -291,6 +291,12 @@ class JmpPay < Roda request.ip ) end + if request.params["auto_top_up_amount"].to_i >= 15 + REDIS.set( + "jmp_customer_auto_top_up_amount-#{gateway.customer_id}", + request.params["auto_top_up_amount"].to_i + ) + end if result r.redirect request.params["return_to"], 303 else diff --git a/views/activate.slim b/views/activate.slim index 4c5119455e6dbb43ff7878ba7958bc34c21c86fd..8b74ef5ecaaf580ac004f492e49b0af320fdf6a1 100644 --- a/views/activate.slim +++ b/views/activate.slim @@ -16,6 +16,11 @@ scss: } } + details { + margin: 2em auto; + input { max-width: 3em; } + } + button { display: block; width: 10em; @@ -56,6 +61,12 @@ form method="post" action="" ' $17.95 CAD input type="radio" name="plan_name" value="cad_beta_unlimited-v20210223" required="required" + details + summary Auto top-up when account balance is low? + label + | When balance drops below $5, add $ + input type="number" name="auto_top_up_amount" min="15" value="" + input type="hidden" name="customer_id" value=customer_id input type="hidden" name="braintree_nonce"