Skip to content

Commit

Permalink
AP-4359: Update following review
Browse files Browse the repository at this point in the history
Remove some commented out code, revert all tests
to use eq and clarify vehicle submissions for partners
by extending the comments
  • Loading branch information
colinbruce committed Oct 25, 2023
1 parent dc90718 commit 5a6b2f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
17 changes: 9 additions & 8 deletions app/services/cfe_civil/components/partner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ def call
return {}.to_json if partner.blank?

result = base_partner
result.merge! JSON.parse(Components::CashTransactions.new(@legal_aid_application, "Partner").call) # so far... all other models are stored as Applicant/Partner
result.merge! JSON.parse(Components::IrregularIncomes.new(@legal_aid_application, "Partner").call) # so far... all other models are stored as Applicant/Partner
result.merge! JSON.parse(Components::Vehicles.new(@legal_aid_application, "partner").call) # this is stored as client/partner
result.merge! JSON.parse(Components::Employments.new(@legal_aid_application, "Partner").call) # this is stored as Applicant/Partner
result.merge! JSON.parse(Components::RegularTransactions.new(@legal_aid_application, "Partner").call) # this is stored as Applicant/Partner
result.merge! JSON.parse(Components::Capitals.new(@legal_aid_application, "Partner").call) # this is stored as Applicant/Partner
# employment_details # skipping this is a ccq datatype, we don't use it
# self_employment_details # skipping this is a ccq datatype, we don't use it
# Most records are stored with an Owner field that is tied to Applicant or Partner models, using their IDs
# Vehicles are stored with the, optional, output of a radio button as client or partner (lower cased)
# For this reason the call to Components::Vehicles.new is slightly different from the rest of the generators
result.merge! JSON.parse(Components::CashTransactions.new(@legal_aid_application, "Partner").call)
result.merge! JSON.parse(Components::IrregularIncomes.new(@legal_aid_application, "Partner").call)
result.merge! JSON.parse(Components::Vehicles.new(@legal_aid_application, "partner").call)
result.merge! JSON.parse(Components::Employments.new(@legal_aid_application, "Partner").call)
result.merge! JSON.parse(Components::RegularTransactions.new(@legal_aid_application, "Partner").call)
result.merge! JSON.parse(Components::Capitals.new(@legal_aid_application, "Partner").call)
# Outgoings # skipped, these are generated from Truelayer and that is not currently supported by the partner flow
# state_benefits # skipped, these are generated from Truelayer and that is not currently supported by the partner flow
# other_incomes # skipped, these are generated from Truelayer and that is not currently supported by the partner flow
Expand Down
4 changes: 2 additions & 2 deletions spec/services/cfe_civil/components/capitals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
subject(:call) { described_class.call(legal_aid_application, "Partner") }

it "returns json in the expected format with the partner and joint bank values merged" do
expect(call).to match_json_expression({
expect(call).to eq({
capitals: {
bank_accounts: [
{ description: "Partner current accounts", value: offline_partner_current_balance.to_s },
Expand All @@ -71,7 +71,7 @@
],
non_liquid_capital: [],
},
})
}.to_json)
end
end
end
Expand Down
4 changes: 0 additions & 4 deletions spec/services/cfe_civil/components/irregular_incomes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
context "when both applicant and partner record student finance" do
let(:applicant) { create(:applicant, student_finance: true, student_finance_amount: 3628.07) }
let(:partner) { create(:partner, student_finance: true, student_finance_amount: 1234.56) }
# before do
# create(:applicant, student_finance: true, student_finance_amount: 3628.07)
# create(:partner, student_finance: true, student_finance_amount: 1234.56)
# end

context "when no owner type is specified" do
it "returns the expected JSON block with only the applicant data" do
Expand Down

0 comments on commit 5a6b2f8

Please sign in to comment.