From c2d2a7d7e79013d10e035708005c13bad7469742 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 22 Aug 2022 15:38:29 -0500 Subject: [PATCH] Actually send parent id to child instance --- lib/customer.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/customer.rb b/lib/customer.rb index b29f74dbde0bcf0486cb50aff246f64860681d81..8ed9c6db230915bf95686c82fc0cd588f7887194 100644 --- a/lib/customer.rb +++ b/lib/customer.rb @@ -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