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 construct_payload(family)
          payload = {
            hbx_id: family.hbx_assigned_id.to_s,
            family_members: transform_family_members(family.family_members),
            renewal_consent_through_year: family.renewal_consent_through_year,
            special_enrollment_periods: transform_special_enrollment_periods(family.special_enrollment_periods),
            payment_transactions: transform_payment_transactions(family.payment_transactions),
            magi_medicaid_applications: transform_applications(family),
            documents: transform_documents(family.documents),
            timestamp: {created_at: family.created_at.to_datetime, modified_at: family.updated_at.to_datetime} 
          }
          payload.merge!(min_verification_due_date: family.min_verification_due_date) if family.min_verification_due_date.present?
          payload.merge!(irs_groups: transform_irs_groups(family.irs_groups)) if family.irs_groups.present?
          payload.merge!(households: transform_households(family.households)) if family.households.present?
          failed_payloads = payload.values.select { |value| value.is_a?(Dry::Monads::Result::Failure) }
          return Failure("Unable to transform payload values: #{failed_payloads}") if failed_payloads.present?
          Success(payload)
        end
def construct_payload ( family ) payload = { hbx_id : family . hbx_assigned_id . to_s , family_members : transform_family_members ( family . family_members ) , renewal_consent_through_year : family . renewal_consent_through_year , special_enrollment_periods : transform_special_enrollment_periods ( family . special_enrollment_periods ) , payment_transactions : transform_payment_transactions ( family . payment_transactions ) , magi_medicaid_applications : transform_applications ( family ) , documents : transform_documents ( family . documents ) , timestamp : { created_at : family . created_at . to_datetime , modified_at : family . updated_at . to_datetime } } payload . merge! ( min_verification_due_date : family . min_verification_due_date ) if family . min_verification_due_date . present? payload . merge! ( irs_groups : transform_irs_groups ( family . irs_groups ) ) if family . irs_groups . present? payload . merge! ( households : transform_households ( family . households ) ) if family . households . present? failed_payloads = payload . values . select { | value | value . is_a? ( Dry :: Monads :: Result :: Failure ) } return Failure ( "Unable to transform payload values: #{failed_payloads}" ) if failed_payloads . present? Success ( payload ) end
Constructs cv3 payload including family and FA Application
Constructs cv3 payload including family and FA Application
# , # foreign_keys TO DO ?? # general_agency_accounts = transform_general_agency_accounts(family.general_agency_accounts), #TO DO # broker_accounts = transform_broker_accounts(family.broker_accounts), #TO DO # updated_by: construct_updated_by(updated_by)
family