I think the first patch will work. Second I'm less sure I'm going down the right path for a couple reasons. I don't like that I had to modify test/test_porting_step.rb, but I couldn't find another instance of AdminInfo.new(...) so maybe that's fine. Second I'm getting an error with rake test
/home/peanut/jmp/sgx-jmp/lib/customer_info.rb:118:in `block in <class:AdminInfo>': uninitialized constant ParentCodeRepo (NameError)
Did you mean? AreaCodeRepo
rake aborted!
financial_info.rb does
value_semanticsdo
transactionsArrayOf(CustomerFinancials::TransactionInfo)
declinesInteger
btc_addressesArrayOf(String)
payment_methodsPaymentMethods
end
without issue and I'm not sure what I'm doing different.
>---> lib/customer_info.rb | 7 +++++--> lib/parent_code_repo.rb | 17 +++++++++++++++++> test/test_customer_info.rb | 20 ++++++++++++++++++++> test/test_porting_step.rb | 3 ++-> 4 files changed, 44 insertions(+), 3 deletions(-)>>diff --git a/lib/customer_info.rb b/lib/customer_info.rb>index faba4a3..1481e14 100644>--- a/lib/customer_info.rb>+++ b/lib/customer_info.rb>@@ -115,13 +115,15 @@ class AdminInfo> call_info String> trust_level String> backend_jid String>+ subaccounts Either(ArrayOf(ParentCodeRepo::Subaccount), nil)
I think probably no reason to allow nil here? Empty array would be correct,
right?
>diff --git a/lib/parent_code_repo.rb b/lib/parent_code_repo.rb>index 4d348ae..5e171ee 100644>--- a/lib/parent_code_repo.rb>+++ b/lib/parent_code_repo.rb>@@ -43,6 +43,13 @@ class ParentCodeRepo> SQL> end>>+ def get_subaccounts(parent_id)>+ @db.query_one(<<~SQL, parent_id)>+ SELECT customer_id FROM customer_plans WHERE parent_customer_id=$1>+ SQL>+ .then { |rows| rows.map { |customer_id| Subaccount.new(customer_id) } }>+ end>+
I don't see that this really belongs in parent_code_repo, which is a repo
for getting your special referral code to make a new subaccount.
I think it could be a wholly new repo honestly, I don't think any part of
the code knows about subaccounts right now.
>diff --git a/test/test_porting_step.rb b/test/test_porting_step.rb>index 940110d..eb51fd9 100644>--- a/test/test_porting_step.rb>+++ b/test/test_porting_step.rb>@@ -70,7 +70,8 @@ def admin_info(customer_id, tel)> api: API::V2.new,> call_info: "",> trust_level: "",>- backend_jid: "customer_#{customer_id}@example.com">+ backend_jid: "customer_#{customer_id}@example.com",>+ subaccounts: nil
Could avoid this by doing above:
subaccounts ArrayOf(Subaccount), default: []