~singpolyma/sgx-jmp

b1cee59357a15811df08c1f60c4c834f1f6331c1 — Stephen Paul Weber 1 year, 6 months ago f5cf445
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.
1 files changed, 42 insertions(+), 4 deletions(-)

M lib/registration.rb
M lib/registration.rb => lib/registration.rb +42 -4
@@ 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"


@@ 67,16 68,20 @@ class Registration
				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