From b1cee59357a15811df08c1f60c4c834f1f6331c1 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 19 Jul 2021 14:15:34 -0500 Subject: [PATCH] Allow using pay-by-mail or eTransfer during register Just gives them the information and we're done. Support has to manually process these payments anyway. --- lib/registration.rb | 46 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/lib/registration.rb b/lib/registration.rb index 3a4af82..4ea301e 100644 --- a/lib/registration.rb +++ b/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 -- 2.38.4