Allow using pay-by-mail or eTransfer during register

Stephen Paul Weber created

Just gives them the information and we're done. Support has to manually process
these payments anyway.

Change summary

lib/registration.rb | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)

Detailed changes

lib/registration.rb 🔗

@@ -4,6 +4,7 @@ require "erb"
 require "ruby-bandwidth-iris"
 require "securerandom"
 
+require_relative "./alt_top_up_form"
 require_relative "./bandwidth_tn_order"
 require_relative "./em"
 require_relative "./oob"
@@ -66,17 +67,21 @@ class Registration
 				label: "Activate using",
 				required: true,
 				options: [
-					{
-						value: "bitcoin",
-						label: "Bitcoin"
-					},
 					{
 						value: "credit_card",
 						label: "Credit Card"
 					},
+					{
+						value: "bitcoin",
+						label: "Bitcoin"
+					},
 					{
 						value: "code",
 						label: "Invite Code"
+					},
+					{
+						value: "mail",
+						label: "Mail or eTransfer"
 					}
 				]
 			},
@@ -400,6 +405,39 @@ class Registration
 				end
 			end
 		end
+
+		class Mail
+			Payment.kinds[:mail] = method(:new)
+
+			def initialize(iq, _customer, _tel)
+				@reply = iq.reply
+				@reply.status = :completed
+			end
+
+			def form
+				form = Blather::Stanza::X.new(:result)
+				form.title = "Activate by Mail or eTransfer"
+				form.instructions =
+					"We support payment by postal mail or, in Canada by Interac, " \
+					"eTransfer.  Minimum deposit for a new account is " \
+					"$#{CONFIG[:activation_amount]}"
+
+				form.fields = fields.to_a
+				form
+			end
+
+			def fields
+				[
+					AltTopUpForm::MAILING_ADDRESS,
+					AltTopUpForm::IS_CAD
+				].flatten
+			end
+
+			def write
+				@reply.command << form
+				BLATHER << @reply
+			end
+		end
 	end
 
 	class Finish