app/domain/operations/transformers/family_to/cv3_family.rb
# Constructs cv3 payload including family and FA Application
Constructs cv3 payload including family and FA Application
Constructs cv3 payload including family and FA Application
def transform_applications(family)
          return unless EnrollRegistry.feature_enabled?(:financial_assistance)
          member_hbx_ids = family.active_family_members.collect {|family_member| family_member.person.hbx_id}
          applications = ::FinancialAssistance::Application.where(family_id: family.id).where(:aasm_state.in => ["submitted", "determined"])
          transformed_applications = applications.collect do |application|
            applicant_person_hbx_ids = application.active_applicants.pluck(:person_hbx_id)
            next unless member_hbx_ids.to_set == applicant_person_hbx_ids.to_set
            ::FinancialAssistance::Operations::Applications::Transformers::ApplicationTo::Cv3Application.new.call(application)
          end.compact
          return Failure("Could not transform applications for family with hbx_id #{family.hbx_assigned_id}: #{transformed_applications.select(&:failure?).map(&:failure)}") unless transformed_applications.all?(&:success?)
          transformed_applications.map(&:value!)
        end
def transform_applications ( family ) return unless EnrollRegistry . feature_enabled? ( :financial_assistance ) member_hbx_ids = family . active_family_members . collect { | family_member | family_member . person . hbx_id } applications = :: FinancialAssistance :: Application . where ( family_id : family . id ) . where ( :aasm_state . in => [ "submitted" , "determined" ] ) transformed_applications = applications . collect do | application | applicant_person_hbx_ids = application . active_applicants . pluck ( :person_hbx_id ) next unless member_hbx_ids . to_set == applicant_person_hbx_ids . to_set :: FinancialAssistance :: Operations :: Applications :: Transformers :: ApplicationTo :: Cv3Application . new . call ( application ) end . compact return Failure ( "Could not transform applications for family with hbx_id #{family.hbx_assigned_id}: #{transformed_applications.select(&:failure?).map(&:failure)}" ) unless transformed_applications . all? ( & :success? ) transformed_applications . map ( & :value! ) end
Constructs cv3 payload including family and FA Application
Constructs cv3 payload including family and FA Application
family