diff --git a/.docker/base/Dockerfile b/.docker/base/Dockerfile index b310f14a..cb2e9b00 100644 --- a/.docker/base/Dockerfile +++ b/.docker/base/Dockerfile @@ -2,7 +2,7 @@ ### app/rails config ### ######################## -FROM ruby:2.7.2 AS app +FROM ruby:2.7.3 AS app LABEL author="IdeaCrew" diff --git a/.docker/base_build.sh b/.docker/base_build.sh index e24b41d9..93447df2 100755 --- a/.docker/base_build.sh +++ b/.docker/base_build.sh @@ -1,4 +1,4 @@ -docker build --build-arg BUNDLER_VERSION_OVERRIDE='2.2.10' \ +docker build --build-arg BUNDLER_VERSION_OVERRIDE='2.2.24' \ --build-arg NODE_MAJOR='12' \ --build-arg YARN_VERSION='1.22.4' \ -f .docker/base/Dockerfile --target app -t $1:base . diff --git a/.docker/build.sh b/.docker/build.sh index bea4fa9b..d539803c 100755 --- a/.docker/build.sh +++ b/.docker/build.sh @@ -8,7 +8,7 @@ cp .docker/config/production.rb config/environments/ cp .docker/config/credentials.yml.enc config/ cp .docker/config/master.key config/ -docker build --build-arg BUNDLER_VERSION_OVERRIDE='2.2.10' \ +docker build --build-arg BUNDLER_VERSION_OVERRIDE='2.2.24' \ --build-arg NODE_MAJOR='12' \ --build-arg YARN_VERSION='1.22.4' \ -f .docker/production/Dockerfile --target app -t $2:$1 . diff --git a/Gemfile b/Gemfile index 86fc9b9c..ed79f3f9 100644 --- a/Gemfile +++ b/Gemfile @@ -45,6 +45,8 @@ gem 'turbolinks', '~> 5' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 5.0' +gem 'rubyzip' + group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] diff --git a/Gemfile.lock b/Gemfile.lock index 0509c752..7db2ad16 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/ideacrew/aca_entities.git - revision: 3d3985fc09f3f183d3c8b89e9687c9c7949760f8 + revision: e047cacbb7077d2cdf262784d87b5e55af40396b branch: trunk specs: - aca_entities (0.4.0) + aca_entities (0.6.0) deep_merge dry-monads (~> 1.2) dry-struct (~> 1.0) @@ -384,6 +384,7 @@ GEM rubocop-ast (>= 1.1.0) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) + rubyzip (2.3.2) rufus-scheduler (3.8.0) fugit (~> 1.1, >= 1.1.6) sass-rails (6.0.0) @@ -481,6 +482,7 @@ DEPENDENCIES rubocop-rails rubocop-rake rubocop-rspec + rubyzip sass-rails (>= 6) shoulda-matchers turbolinks (~> 5) diff --git a/app/event_source/subscribers/fdsh/determination_requests/rrv_medicare_determination_subscriber.rb b/app/event_source/subscribers/fdsh/determination_requests/rrv_medicare_determination_subscriber.rb new file mode 100644 index 00000000..39e3df73 --- /dev/null +++ b/app/event_source/subscribers/fdsh/determination_requests/rrv_medicare_determination_subscriber.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module Subscribers + module Fdsh + module DeterminationRequests + # Publish events for FDSH RRV requests + class RrvMedicareDeterminationSubscriber + include ::EventSource::Subscriber[amqp: 'enroll.fdsh.verifications'] + + # rubocop:disable Lint/RescueException + # rubocop:disable Style/LineEndConcatenation + # rubocop:disable Style/StringConcatenation + subscribe(:on_magi_medicaid_application_determined) do |delivery_info, properties, payload| + # Sequence of steps that are executed as single operation + correlation_id = properties.correlation_id + + determination_result = Operations::Fdsh::Rrv::Medicare::RequestRrvMedicareDetermination.new.call({ + payload: payload, + correlation_id: correlation_id + }) + + if determination_result.success? + logger.info( + "OK: :on_fdsh_rrv_medicare_eligibility_determination_subscriber successful and acked" + ) + ack(delivery_info.delivery_tag) + else + logger.error( + "Error: :on_fdsh_rrv_medicare_eligibility_determination_subscriber; nacked due to:#{determination_result.inspect}" + ) + nack(delivery_info.delivery_tag) + end + + rescue Exception => e + logger.error( + "Exception: :on_fdsh_rrv_medicare_eligibility_determination_subscriber\n Exception: #{e.inspect}" + + "\n Backtrace:\n" + e.backtrace.join("\n") + ) + nack(delivery_info.delivery_tag) + end + # rubocop:enable Lint/RescueException + # rubocop:enable Style/LineEndConcatenation + # rubocop:enable Style/StringConcatenation + end + end + end +end diff --git a/app/operations/fdsh/rrv/medicare/build_medicare_request_xml.rb b/app/operations/fdsh/rrv/medicare/build_medicare_request_xml.rb new file mode 100644 index 00000000..17011199 --- /dev/null +++ b/app/operations/fdsh/rrv/medicare/build_medicare_request_xml.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'dry/monads' +require 'dry/monads/do' + +module Fdsh + module Rrv + module Medicare + # This class takes happy mapper hash as input and returns + class BuildMedicareRequestXml + include Dry::Monads[:result, :do, :try] + include EventSource::Command + + # PublishEventStruct = Struct.new(:name, :payload, :headers) + # + # PUBLISH_EVENT = "fdsh_determine_esi_mec_eligibility" + + # @return [Dry::Monads::Result] + def call(applications) + rrv_medicare_request = yield Fdsh::Rrv::Medicare::TransformApplicationToRrvMedicareRequest.new.call(applications) + xml_string = yield encode_xml_and_schema_validate(rrv_medicare_request) + # TODO: STORE Request + # _updated_transaction = yield create_or_update_transaction('request', xml_string, params) + rrv_medicare_xml = yield encode_request_xml(xml_string) + + Success(rrv_medicare_xml) + end + + protected + + def encode_xml_and_schema_validate(esi_request) + AcaEntities::Serializers::Xml::Fdsh::Rrv::Medicare::Operations::MedicareRequestToXml.new.call(esi_request) + end + + def encode_request_xml(xml_string) + encoding_result = Try do + xml_doc = Nokogiri::XML(xml_string) + xml_doc.to_xml(:indent => 2, :encoding => 'UTF-8') + end + + encoding_result.or do |e| + Failure(e) + end + end + end + end + end +end diff --git a/app/operations/fdsh/rrv/medicare/create_request_manifest_file.rb b/app/operations/fdsh/rrv/medicare/create_request_manifest_file.rb new file mode 100644 index 00000000..f1f0225f --- /dev/null +++ b/app/operations/fdsh/rrv/medicare/create_request_manifest_file.rb @@ -0,0 +1,147 @@ +# frozen_string_literal: true + +require 'dry/monads' +require 'dry/monads/do' +require 'digest' +require 'zip' + +module Fdsh + module Rrv + module Medicare + # This class create a rrv medicare request manifest file + class CreateRequestManifestFile + include Dry::Monads[:result, :do, :try] + include EventSource::Command + + def call(applications) + @applicants_count = applications.flat_map(&:applicants).count + medicare_payload = yield BuildMedicareRequestXml.new.call(applications) + @medicare_file = yield create_medicare_xml_file(medicare_payload) + manifest_request = yield construct_manifest_request + validated_manifest_request = yield validate_manifest_request(manifest_request) + manifest_entity = yield transform_request_to_entity(validated_manifest_request) + xml_string = yield encode_xml_and_schema_validate(manifest_entity) + rrv_manifest_medicare_xml = yield encode_manifest_request_xml(xml_string) + @manifest_file = yield create_manifest_file(rrv_manifest_medicare_xml) + generate_batch_zip + Success("Zip generated succesfully") + end + + private + + def create_medicare_xml_file(rrv_medicare_xml) + folder = "#{Rails.root}/rrv_request_outbound" + @outbound_folder = FileUtils.mkdir_p(folder).first + file_name = @outbound_folder + "/MDCR_Request_00001_#{Time.now.gmtime.strftime('%Y%m%dT%H%M%S%LZ')}.xml" + file = File.open(file_name, "w") + file.write(rrv_medicare_xml.to_s) + file.close + Success(file) + end + + def create_manifest_file(rrv_manifest_medicare_xml) + file = File.new("#{@outbound_folder}/manifest.xml", "w") + file.write(rrv_manifest_medicare_xml.to_s) + file.close + Success(file) + end + + def validate_manifest_request(manifest_request) + result = AcaEntities::Fdsh::Rrv::H79::BatchHandlingServiceRequestContract.new.call(manifest_request) + result.success? ? Success(result) : Failure("Invalid Rrv Manifest request due to #{result.errors.to_h}") + end + + def transform_request_to_entity(manifest_request) + Success(AcaEntities::Fdsh::Rrv::H79::BatchHandlingServiceRequest.new(manifest_request.to_h)) + end + + def encode_xml_and_schema_validate(esi_request) + AcaEntities::Serializers::Xml::Fdsh::Rrv::H79::Operations::RrvRequestToXml.new.call(esi_request) + end + + def generate_batch_zip + input_files = [File.basename(@medicare_file), File.basename(@manifest_file)] + @zip_name = @outbound_folder + "/SBE00ME.DSH.RRVIN.D#{Time.now.strftime('%y%m%d.T%H%M%S%L.T')}.IN.zip" + + Zip::File.open(@zip_name, create: true) do |zipfile| + input_files.each do |filename| + zipfile.add(filename, File.join(@outbound_folder, filename)) + end + end + FileUtils.rm_rf(File.join(@outbound_folder, File.basename(@medicare_file))) + FileUtils.rm_rf(File.join(@outbound_folder, File.basename(@manifest_file))) + end + + def encode_manifest_request_xml(xml_string) + encoding_result = Try do + xml_doc = Nokogiri::XML(xml_string) + xml_doc.to_xml(:indent => 2, :encoding => 'UTF-8') + end + + encoding_result.or do |e| + Failure(e) + end + end + + def construct_manifest_request + manifest_request = { + BatchMetadata: construct_batch_metadata, + TransmissionMetadata: construct_transmission_metadata, + ServiceSpecificData: construct_service_specific_data + } + + Success(manifest_request) + end + + def construct_batch_metadata + { + BatchID: Time.now.gmtime.strftime("%Y-%m-%dT%H:%M:%SZ"), + BatchPartnerID: "02.ME*.SBE.001.001", + BatchAttachmentTotalQuantity: 1, + BatchCategoryCode: "RRV_REQ", + BatchTransmissionQuantity: 1 + } + end + + def construct_transmission_metadata + { + TransmissionAttachmentQuantity: 1, + TransmissionSequenceID: 1 + } + end + + def construct_service_specific_data + { + MedicareFileMetadata: { + MedicareDocumentAttachmentQuantity: 1, + Attachment: construct_attachment + } + } + end + + def construct_attachment + { + DocumentBinary: construct_document_binary, + DocumentFileName: File.basename(@medicare_file.path), + DocumentSequenceID: "00001", + DocumentRecordCount: @applicants_count + } + end + + def construct_document_binary + { + ChecksumAugmentation: { + SHA256HashValueText: generate_checksum_hexdigest + }, + BinarySizeValue: File.size(@medicare_file.path).to_s + } + end + + def generate_checksum_hexdigest + sha256 = Digest::SHA256.file(@medicare_file.path) + sha256.hexdigest + end + end + end + end +end diff --git a/app/operations/fdsh/rrv/medicare/response/construct_medicare_response.rb b/app/operations/fdsh/rrv/medicare/response/construct_medicare_response.rb new file mode 100644 index 00000000..638fa357 --- /dev/null +++ b/app/operations/fdsh/rrv/medicare/response/construct_medicare_response.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +require 'dry/monads' +require 'dry/monads/do' +require 'digest' +require 'zip' + +module Fdsh + module Rrv + module Medicare + module Response + # This class create a rrv medicare request manifest file + class ConstructMedicareResponse + include Dry::Monads[:result, :do, :try] + include EventSource::Command + + def call(payload) + response_hash = yield construct_params(payload) + valid_response = yield validate_rrv_medicare_response(response_hash) + medicare_response = yield create_rrv_medicare_response(valid_response) + + Success(medicare_response) + end + + private + + def construct_params(payload) + if payload.IndividualResponses.present? + result_hash = { + IndividualResponses: construct_individual_response(payload.IndividualResponses.IndividualResponses) + } + end + + Success(result_hash) + end + + def validate_rrv_medicare_response(response_hash) + result = ::AcaEntities::Fdsh::Rrv::Medicare::EesDshBatchResponseDataContract.new.call(response_hash) + + if result.success? + Success(result) + else + Failure("Invalid response, #{result.errors.to_h}") + end + end + + def create_rrv_medicare_response(value) + Success(::AcaEntities::Fdsh::Rrv::Medicare::EesDshBatchResponseData.new(value.to_h)) + end + + def construct_individual_response(individual_responses) + individual_responses.collect do |response| + { + PersonSSNIdentification: response.PersonSSNIdentification, + Insurances: construct_insurances(response.Insurances), + OrganizationResponseCode: response.OrganizationResponseCode, + OrganizationResponseCodeText: response.OrganizationResponseCodeText + } + + end + end + + def construct_insurances(insurances) + insurances.collect do |insurance| + insurance_hash = {} + + insurance_hash.merge!(InsuranceEffectiveDate: insurance.InsuranceEffectiveDate) if insurance.InsuranceEffectiveDate.present? + insurance_hash.merge!(InsuranceEndDate: insurance.InsuranceEndDate) if insurance.InsuranceEndDate.present? + + insurance_hash + end + end + end + end + end + end +end diff --git a/app/operations/fdsh/rrv/medicare/response/parse_rrv_medicare_response.rb b/app/operations/fdsh/rrv/medicare/response/parse_rrv_medicare_response.rb new file mode 100644 index 00000000..3661b3e2 --- /dev/null +++ b/app/operations/fdsh/rrv/medicare/response/parse_rrv_medicare_response.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +require 'dry/monads' +require 'dry/monads/do' +require 'digest' +require 'zip' + +module Fdsh + module Rrv + module Medicare + module Response + # This class create a rrv medicare request manifest file + class ParseRrvMedicareResponse + include Dry::Monads[:result, :do, :try] + include EventSource::Command + + def call(file_path) + unzip_medicare_response(file_path) + processed_manifest_xml = yield parse_manifest_response_xml + processed_medicare_xml = yield parse_medicare_response_xml + _status = yield verify_checksum(processed_manifest_xml) + response_entity = yield ConstructMedicareResponse.new.call(processed_medicare_xml) + Success(response_entity) + end + + private + + def unzip_medicare_response(file_path) + # file-path: "{Rails.root}/rrv_medicare_response.zip" + path = File.join(file_path) + Zip::File.open(path) do |zip_file| + zip_file.each do |f| + f_path = File.join("#{Rails.root}/", f.name) + FileUtils.mkdir_p(File.dirname(f_path)) + zip_file.extract(f, f_path) unless File.exist?(f_path) + end + end + end + + def parse_manifest_response_xml + manifest_response_xml = File.read("#{Rails.root}/manifest.xml") + valid_xml = remove_xml_node(manifest_response_xml) + Success(AcaEntities::Serializers::Xml::Fdsh::Rrv::H79::Response::BatchHandlingServiceResponse.parse(valid_xml, :single => true)) + end + + def parse_medicare_response_xml + file_name = Dir.glob('MDCR_Response_*.xml').first + rrv_response_xml = File.read(file_name) + valid_xml = remove_xml_node(rrv_response_xml) + Success(AcaEntities::Serializers::Xml::Fdsh::Rrv::Medicare::EesDshBatchResponseData.parse(valid_xml, :single => true)) + end + + def remove_xml_node(response_xml) + xml_doc = Nokogiri::XML(response_xml) + child_node = xml_doc.children.detect(&:element?) + child_node.canonicalize + end + + def verify_checksum(manifest_xml) + checksum = manifest_xml.Attachments.first.DocumentBinary.ChecksumAugmentation + file_name = Dir.glob('MDCR_Response_*.xml').first + rrv_response_xml_checksum = generate_checksum_hexdigest(File.join(file_name)) + checksum.SHA256HashValueText == rrv_response_xml_checksum ? Success(true) : Failure("Checksum did not match") + end + + def generate_checksum_hexdigest(file_path) + sha256 = Digest::SHA256.file(file_path) + sha256.hexdigest + end + + def remove_unziped_dir + FileUtils.rm_rf("#{Rails.root}/rrv_medicare_response") + end + end + end + end + end +end diff --git a/app/operations/fdsh/rrv/medicare/transform_application_to_rrv_medicare_request.rb b/app/operations/fdsh/rrv/medicare/transform_application_to_rrv_medicare_request.rb new file mode 100644 index 00000000..ca753547 --- /dev/null +++ b/app/operations/fdsh/rrv/medicare/transform_application_to_rrv_medicare_request.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module Fdsh + module Rrv + module Medicare + # This class takes AcaEntities::MagiMedicaid::Application as input and returns the Esi Mec request hash. + class TransformApplicationToRrvMedicareRequest + include Dry::Monads[:result, :do, :try] + include EventSource::Command + + # @param params [Hash] The params to execute an FDSH SSA Composite Verification Request + # @option params [AcaEntities::MagiMedicaid::Application] :Applicattion + # @return [Dry::Monads::Result] + def call(applications) + _validated_application = yield validate_application(applications) + request_entity = yield build_request_entity(applications) + + Success(request_entity) + end + + # Validate input object + def validate_application(applications) + results = applications.collect do |application| + next if application.is_a?(::AcaEntities::MagiMedicaid::Application) + Failure( + "Invalid application, given value is not a ::AcaEntities::MagiMedicaid::Application, input_value:#{application}" + ) + end + results.compact.present? ? Failure("Invalid applications present") : Success(true) + end + + # Transform application params To BuildMedicareRequest Contract params + def build_request_entity(applications) + ::AcaEntities::Fdsh::Rrv::Medicare::Operations::BuildMedicareRequest.new.call(applications) + end + end + end + end +end diff --git a/spec/medicare_metadata_setup.rb b/spec/medicare_metadata_setup.rb new file mode 100644 index 00000000..03f02bb4 --- /dev/null +++ b/spec/medicare_metadata_setup.rb @@ -0,0 +1,1488 @@ +# frozen_string_literal: true + +TEST_APPLICATION_1 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "A", + :middle_name => "GEORGE", + :last_name => "PRESTEDIGITAGITATORS", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "011789802" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1944, 11, 0o4), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_2 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "JOHN", + :middle_name => "JACOB", + :last_name => "SMITH", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "415094007" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1946, 0o7, 13), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_3 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "RANDOLPH", + :middle_name => "MICHAEL", + :last_name => "RUDOLPH", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "153842503" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1991, 10, 22), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_4 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "VERONICA", + :middle_name => nil, + :last_name => "POWERS", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "068745108" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1952, 0o6, 0o5), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_5 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "CHARLES", + :middle_name => "F", + :last_name => "DIXON", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "007643003" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1947, 0o1, 16), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_6 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "MAY", + :middle_name => nil, + :last_name => "FEATHER", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "272132305" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1949, 0o3, 0o2), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_7 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "SUSAN", + :middle_name => "N", + :last_name => "HEDGE", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "010280307" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1953, 12, 30), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_8 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "MARIAN", + :middle_name => "LOVE", + :last_name => "GIANTS", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "003748403" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1995, 9, 24), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :foster_care => { + :is_former_foster_care => false, + :age_left_foster_care => nil, + :foster_care_us_state => nil, + :had_medicaid_during_foster_care => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_9 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "VINCENT", + :middle_name => "VON", + :last_name => "RUPERT", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "396528005" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1951, 0o7, 18), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_10 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "BARBIE", + :middle_name => "B", + :last_name => "BROWN", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "010668703" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1950, 0o5, 14), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_11 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "CHRIS", + :middle_name => nil, + :last_name => "HOPE", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "367182506" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1991, 0o7, 8), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_12 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "BESS", + :middle_name => "MARGITE", + :last_name => "EL TORO", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "018406808" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1994, 0o1, 25), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_13 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "HELEN", + :middle_name => nil, + :last_name => "DECOSTA", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "078668805" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1980, 0o2, 9), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_14 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "DOUGLAS", + :middle_name => "SON", + :last_name => "OFAGUN", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "321948606" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1950, 0o4, 17), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_15 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "MARY", + :middle_name => "WHAT", + :last_name => "CHADOIN", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "004608407" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1950, 0o5, 14), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_16 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "MONIQUE", + :middle_name => "CURLY", + :last_name => "LACET", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "220164605" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1943, 0o4, 10), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + +TEST_APPLICATION_17 = { + :family_reference => { :hbx_id => "10205" }, + :assistance_year => 2021, + :aptc_effective_date => Date.new(2021, 10, 0o1), + :years_to_renew => nil, + :renewal_consent_through_year => 5, + :is_ridp_verified => true, + :is_renewal_authorized => true, + :applicants => [ + { + :name => { + :first_name => "MATILDA", + :middle_name => "B", + :last_name => "BOTTOM", + :name_sfx => nil, + :name_pfx => nil + }, + :identifying_information => { + :has_ssn => "0", + :encrypted_ssn => "3sO2LBAb5OGkrkPQixhf5w==\n", + :ssn => "295682407" + }, + :demographic => { + :gender => "Male", + :dob => Date.new(1950, 0o4, 17), + :is_veteran_or_active_military => true + }, + :attestation => { + :is_incarcerated => false, + :is_self_attested_disabled => false, + :is_self_attested_blind => false, + :is_self_attested_long_term_care => false + }, + :is_primary_applicant => true, + :citizenship_immigration_status_information => { + :citizen_status => "us_citizen", + :is_lawful_presence_self_attested => false, + :is_resident_post_092296 => false + }, + :is_applying_coverage => true, + :is_consent_applicant => false, + :vlp_document => nil, + :family_member_reference => { :family_member_hbx_id => "98765432" }, + :person_hbx_id => "98765432", + :is_required_to_file_taxes => false, + :tax_filer_kind => "non_filer", + :pregnancy_information => { + :is_pregnant => false, + :is_enrolled_on_medicaid => false, + :is_post_partum_period => false, + :expected_children_count => nil, + :pregnancy_due_on => nil, + :pregnancy_end_on => nil + }, + :is_subject_to_five_year_bar => false, + :is_five_year_bar_met => false, + :is_forty_quarters => false, + :is_ssn_applied => false, + :non_ssn_apply_reason => nil, + :moved_on_or_after_welfare_reformed_law => false, + :is_currently_enrolled_in_health_plan => false, + :has_daily_living_help => false, + :need_help_paying_bills => false, + :has_job_income => false, + :has_self_employment_income => false, + :has_unemployment_income => false, + :has_other_income => false, + :has_deductions => false, + :has_enrolled_health_coverage => false, + :has_eligible_health_coverage => false, + :age_of_applicant => 33, + :is_homeless => false, + :benchmark_premium => { + :health_only_lcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }], + :health_only_slcsp_premiums => [{ :member_identifier => "98765432", :monthly_premium => 310.5 }] + } + } + ], + :us_state => "DC", + :hbx_id => "111222333", + :oe_start_on => Date.new(2020, 10, 0o1), + :notice_options => { + :send_eligibility_notices => true, + :send_open_enrollment_notices => false + } +}.freeze + + diff --git a/spec/operations/fdsh/rrv/medicare/create_request_manifest_file_spec.rb b/spec/operations/fdsh/rrv/medicare/create_request_manifest_file_spec.rb new file mode 100644 index 00000000..dea61f87 --- /dev/null +++ b/spec/operations/fdsh/rrv/medicare/create_request_manifest_file_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'spec_helper' +require 'medicare_metadata_setup' + +RSpec.describe Fdsh::Rrv::Medicare::CreateRequestManifestFile do + + applications = [TEST_APPLICATION_1, TEST_APPLICATION_2, TEST_APPLICATION_3, TEST_APPLICATION_4, TEST_APPLICATION_5, + TEST_APPLICATION_6, TEST_APPLICATION_7, TEST_APPLICATION_8, TEST_APPLICATION_9, TEST_APPLICATION_10, + TEST_APPLICATION_11, TEST_APPLICATION_12, TEST_APPLICATION_13, TEST_APPLICATION_14, + TEST_APPLICATION_15, TEST_APPLICATION_16, TEST_APPLICATION_17].collect do |payload| + AcaEntities::MagiMedicaid::Operations::InitializeApplication.new.call(payload).value! + end + + subject do + described_class.new.call(applications) + end + + it "success" do + expect(subject.success?).to be_truthy + end +end \ No newline at end of file diff --git a/spec/operations/fdsh/rrv/medicare/response/parse_rrv_medicare_response_spec.rb b/spec/operations/fdsh/rrv/medicare/response/parse_rrv_medicare_response_spec.rb new file mode 100644 index 00000000..fda78e34 --- /dev/null +++ b/spec/operations/fdsh/rrv/medicare/response/parse_rrv_medicare_response_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Fdsh::Rrv::Medicare::Response::ParseRrvMedicareResponse do + + let(:file_path) { "#{Rails.root}/spec/reference/rrv_medicare_response.zip" } + + subject do + described_class.new.call(file_path) + end + + it "success" do + expect(subject.success?).to be_truthy + end +end \ No newline at end of file diff --git a/spec/reference/rrv_medicare_response.zip b/spec/reference/rrv_medicare_response.zip new file mode 100644 index 00000000..b1cb8fef Binary files /dev/null and b/spec/reference/rrv_medicare_response.zip differ