~singpolyma/sgx-jmp

4ef20f6ed01692549f624c8adce74bf5d4c957a4 — Stephen Paul Weber 1 year, 8 months ago 27be78a
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.
1 files changed, 16 insertions(+), 4 deletions(-)

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