diff --git a/lib/command_list.rb b/lib/command_list.rb index 473cae0a862cfa94ba102bd02d03a02076343e05..4e69b47eeb2ee1efc5da3e41e10a7356106d0dd8 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 f5a56e8d504442dda00ff405037909e9779f7531..227298332045eb29234c72b8c9ad20f46e7c523b 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