From 2e7f0c4807f5ae451138ded0e1254ef32d256bbc Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 29 Mar 2022 14:06:40 -0500 Subject: [PATCH] Move credit_to lookup into relevant class --- lib/registration.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/registration.rb b/lib/registration.rb index 849d28e..56044a8 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -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 -- 2.34.5