Command to get to the credit card settings page

Stephen Paul Weber created

Change summary

lib/command_list.rb |  4 ++++
sgx_jmp.rb          | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+)

Detailed changes

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
 

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