~singpolyma/sgx-jmp

c2d2a7d7e79013d10e035708005c13bad7469742 — Stephen Paul Weber 2 years ago e83bb8a
Actually send parent id to child instance
1 files changed, 8 insertions(+), 2 deletions(-)

M lib/customer.rb
M lib/customer.rb => lib/customer.rb +8 -2
@@ 35,10 35,16 @@ class Customer
	               :transactions

	def self.extract(customer_id, jid, **kwargs)
		(kwargs[:parent_customer_id] ? ChildCustomer : Customer).new(
		klass, *keys = if kwargs[:parent_customer_id]
			[ChildCustomer, :parent_customer_id]
		else
			[Customer]
		end

		klass.new(
			customer_id, jid,
			plan: CustomerPlan.extract(customer_id, kwargs),
			**kwargs.slice(:balance, :sgx, :tndetails)
			**kwargs.slice(:balance, :sgx, :tndetails, *keys)
		)
	end