From 1173bfced04049b536c06d4ba485b353f9db75f0 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 14 Mar 2023 12:53:09 -0500 Subject: [PATCH] Include customer id when onboarding 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! --- 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(-) diff --git a/config-schema.dhall b/config-schema.dhall index 82fe73c61c5561ceea3c95453ea80b212858edee..1b3aa07a4f6dcb5f95d733e9894c59d28f6ce9f1 100644 --- a/config-schema.dhall +++ b/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 : diff --git a/config.dhall.sample b/config.dhall.sample index 52686a7fbe41dbc8c173715de26d35fba85621e2..839f07a5f25110ed86cf1de8e9444fbd6f54cd69 100644 --- a/config.dhall.sample +++ b/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" }, diff --git a/forms/alt_top_up/interac.rb b/forms/alt_top_up/interac.rb index 18fb7666b74434d7388f807ece2715ccc8761cf3..9b7c7063893f0808b0f24c32ab821d44d08674da 100644 --- a/forms/alt_top_up/interac.rb +++ b/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] ) diff --git a/forms/alt_top_up/mailing_address.rb b/forms/alt_top_up/mailing_address.rb index 1feb7e6767c9aa64426bf8ee67d7b11073b6d3f2..c2f596d9619acd2dd9e638436a77e082a06dbdc9 100644 --- a/forms/alt_top_up/mailing_address.rb +++ b/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] ) diff --git a/forms/registration/mail.rb b/forms/registration/mail.rb index eef0dfd28ea09a3d43ba8dff616bf117ef1dde30..f801b0fd76f8622f11759dfbcab596ab1655d695 100644 --- a/forms/registration/mail.rb +++ b/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 diff --git a/lib/registration.rb b/lib/registration.rb index a5cc16ce3489f95a698e6256eee7959c2d4c0082..e540884d905f01963e93ff7ee48e019aa4e7bc37 100644 --- a/lib/registration.rb +++ b/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]