~singpolyma/sgx-jmp

938e2d7a1a3f27c34baac60a6debcd55cff1bcf7 — Stephen Paul Weber 2 years ago 2ae7839
Command to get to the credit card settings page
2 files changed, 24 insertions(+), 0 deletions(-)

M lib/command_list.rb
M sgx_jmp.rb
M lib/command_list.rb => lib/command_list.rb +4 -0
@@ 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


M sgx_jmp.rb => sgx_jmp.rb +20 -0
@@ 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