Include customer id when onboarding

Stephen Paul Weber created

They don't really know their throwaway onboarding JID anyway.

NOTE: they have a customer ID but not a cheogram route, so contact from support
must still go via whisper to their JID and not direct to this customer ID!

Change summary

config-schema.dhall                 |  1 +
config.dhall.sample                 |  1 +
forms/alt_top_up/interac.rb         |  2 +-
forms/alt_top_up/mailing_address.rb |  2 +-
forms/registration/mail.rb          |  8 ++++++++
lib/registration.rb                 | 13 ++++++++++++-
6 files changed, 24 insertions(+), 3 deletions(-)

Detailed changes

config-schema.dhall 🔗

@@ -27,6 +27,7 @@
 , notify_from : Text
 , ogm_path : Text
 , ogm_web_root : Text
+, onboarding_domain : Text
 , oxr_app_id : Text
 , payable : Text
 , plans :

config.dhall.sample 🔗

@@ -82,6 +82,7 @@ in
 	keep_area_codes = ["555"],
 	keep_area_codes_in = { account = "", site_id = "", sip_peer_id = "" },
 	snikket_hosting_api = "",
+	onboarding_domain = "",
 	rev_ai_token = "",
 	upstream_domain = "example.net",
 	approved_domains = toMap { `example.com` = Some "customer_id" },

forms/alt_top_up/interac.rb 🔗

@@ -2,6 +2,6 @@ field(
 	var: "interac_email",
 	type: "fixed",
 	label: "Interac e-Transfer Address",
-	description: "Please include your Jabber ID in the note",
+	description: "Please include your #{@in_note || 'Jabber ID'} in the note",
 	value: CONFIG[:interac]
 )

forms/alt_top_up/mailing_address.rb 🔗

@@ -4,6 +4,6 @@ field(
 	label: "Mailing Address",
 	description:
 		"Make payable to #{CONFIG[:payable]} and include your " \
-		"Jabber ID in the mailing somewhere.",
+		"#{@in_note || 'Jabber ID'} in the mailing somewhere.",
 	value: CONFIG[:adr]
 )

forms/registration/mail.rb 🔗

@@ -9,5 +9,13 @@ instructions(
 	"#{@final_message}"
 )
 
+if @customer_id
+	field(
+		label: "Customer ID",
+		var: "customer_id",
+		value: @customer_id
+	)
+end
+
 render "alt_top_up/mailing_address"
 render "alt_top_up/interac" if @currency == :CAD

lib/registration.rb 🔗

@@ -417,10 +417,21 @@ class Registration
 				FormTemplate.render(
 					"registration/mail",
 					currency: @customer.currency,
-					final_message: @final_message
+					final_message: @final_message,
+					**onboarding_extras
 				)
 			end
 
+			def onboarding_extras
+				jid = ProxiedJID.new(@customer.jid).unproxied
+				return {} unless jid.domain == CONFIG[:onboarding_domain]
+
+				{
+					customer_id: @customer.customer_id,
+					in_note: "Customer ID"
+				}
+			end
+
 			def write
 				Command.reply { |reply|
 					reply.allowed_actions = [:prev]