From 4ef20f6ed01692549f624c8adce74bf5d4c957a4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 29 Mar 2022 14:10:59 -0500 Subject: [PATCH] New BillPay registration step Assumes they have enough balance (anyone using this step must be sure of this) and then does the billing before proceeding to finish. --- lib/registration.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/registration.rb b/lib/registration.rb index e3416d4..8195975 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -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 -- 2.38.5