A forms/plan_settings.rb => forms/plan_settings.rb +22 -0
@@ 0,0 1,22 @@
+form!
+
+title "Plan Settings"
+
+instructions(
+ "Your plan includes #{@customer.message_limit} and " \
+ "#{@customer.minute_limit}. JMP will always prompt for your explicit " \
+ "consent before allowing any action which would incur more overage in a " \
+ "calendar month than your configured limit below.\n\n" \
+ "JMP is not yet billing for overages, but will be soon."
+)
+
+field(
+ var: "monthly_overage_limit",
+ type: "text-single",
+ datatype: "xs:integer",
+ label: "Dollars of overage to allow each month",
+ description:
+ "0 means you will never be automatically charged more " \
+ "than your monthly fee",
+ value: @customer.monthly_overage_limit.to_s
+)
M sgx_jmp.rb => sgx_jmp.rb +18 -0
@@ 578,6 578,24 @@ Command.new(
}.register(self).then(&CommandList.method(:register))
Command.new(
+ "plan settings",
+ "Manage your plan, including overage limits",
+ list_for: ->(customer:, **) { !!customer&.currency }
+) {
+ Command.customer.then do |customer|
+ Command.reply { |reply|
+ reply.allowed_actions = [:next]
+ reply.command << FormTemplate.render("plan_settings", customer: customer)
+ }.then { |iq|
+ Command.execution.customer_repo.put_monthly_overage_limit(
+ customer,
+ iq.form.field("monthly_overage_limit")&.value.to_i
+ )
+ }.then { Command.finish("Configuration saved!") }
+ end
+}.register(self).then(&CommandList.method(:register))
+
+Command.new(
"referral codes",
"Refer a friend for free credit"
) {