@@ 253,10 253,8 @@ class Registration
protected
def sold(tx)
- tx.insert.then {
- @customer.bill_plan
- }.then do
- @finish.new(@customer, @tel).write
+ tx.insert.then do
+ BillPlan.new(@customer, @tel, finish: @finish).write
end
end
@@ 407,6 405,20 @@ class Registration
end
end
+ class BillPlan
+ def initialize(customer, tel, finish: Finish)
+ @customer = customer
+ @tel = tel
+ @finish = finish
+ end
+
+ def write
+ @customer.bill_plan.then do
+ @finish.new(@customer, @tel).write
+ end
+ end
+ end
+
class Finish
def initialize(customer, tel)
@customer = customer