From 938e2d7a1a3f27c34baac60a6debcd55cff1bcf7 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 30 Jun 2021 13:19:06 -0500 Subject: [PATCH] Command to get to the credit card settings page --- lib/command_list.rb | 4 ++++ sgx_jmp.rb | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/command_list.rb b/lib/command_list.rb index 473cae0..4e69b47 100644 --- a/lib/command_list.rb +++ b/lib/command_list.rb @@ -35,6 +35,10 @@ class CommandList yield node: "configure-calls", name: "Configure Calls" yield node: "usage", name: "Show Monthly Usage" yield node: "reset sip account", name: "Create or Reset SIP Account" + yield( + node: "credit cards", + name: "Credit Card Settings and Management" + ) end end diff --git a/sgx_jmp.rb b/sgx_jmp.rb index f5a56e8..2272983 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -324,6 +324,26 @@ command node: [ }.catch { |e| panic(e, sentry_hub) } end +command :execute?, node: "credit cards", sessionid: nil do |iq| + sentry_hub = new_sentry_hub(iq, name: iq.node) + reply = iq.reply + reply.status = :completed + + Customer.for_jid(iq.from.stripped).then { |customer| + oob = OOB.find_or_create(reply.command) + oob.url = CONFIG[:credit_card_url].call( + reply.to.stripped.to_s.gsub("\\", "%5C"), + customer.customer_id + ) + oob.desc = "Manage credits cards and settings" + + reply.note_type = :info + reply.note_text = "#{oob.desc}: #{oob.url}" + + self << reply + }.catch { |e| panic(e, sentry_hub) } +end + command :execute?, node: "buy credit", sessionid: nil do |iq| sentry_hub = new_sentry_hub(iq, name: iq.node) reply = iq.reply -- 2.34.5