~singpolyma/jmp-pay

1acc55b40956794e1f0cb963d3793b62141b8ff6 — Stephen Paul Weber 3 years ago 0846f6d
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.
2 files changed, 17 insertions(+), 0 deletions(-)

M config.ru
M views/activate.slim
M config.ru => config.ru +6 -0
@@ 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

M views/activate.slim => views/activate.slim +11 -0
@@ 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"