~singpolyma/sgx-jmp

2e7f0c4807f5ae451138ded0e1254ef32d256bbc — Stephen Paul Weber 8 months ago 8fd61ce
Move credit_to lookup into relevant class
1 files changed, 6 insertions(+), 2 deletions(-)

M lib/registration.rb
M lib/registration.rb => lib/registration.rb +6 -2
@@ 39,8 39,7 @@ class Registration
			if customer.active?
				Finish.new(customer, tel)
			elsif CONFIG[:approved_domains].key?(jid.domain.to_sym)
				credit_to = CONFIG[:approved_domains][jid.domain.to_sym]
				Allow.new(customer, tel, credit_to)
				Allow.for(customer, tel, jid)
			else
				new(customer, tel)
			end


@@ 86,6 85,11 @@ class Registration
		end

		class Allow < Activation
			def self.for(customer, tel, jid)
				credit_to = CONFIG[:approved_domains][jid.domain.to_sym]
				new(customer, tel, credit_to)
			end

			def initialize(customer, tel, credit_to)
				super(customer, tel)
				@credit_to = credit_to