Skip to content

Commit

Permalink
Record results of no SSNs (#56)
Browse files Browse the repository at this point in the history
* mec checks without ssn recording details

* rubocop

* remove random puts
  • Loading branch information
kristinmerbach authored Oct 27, 2021
1 parent 5413344 commit 8504337
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
8 changes: 7 additions & 1 deletion app/operations/aces/applicant_mec_check_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ def call(person_payload)

def decrypt_ssn(payload)
ssn = payload["identifying_information"]["encrypted_ssn"]
AcaEntities::Operations::Encryption::Decrypt.new.call({ value: ssn })
if ssn.blank?
Failure("No SSN")
else
AcaEntities::Operations::Encryption::Decrypt.new.call({ value: ssn })
end
rescue StandardError => e
Failure("Failed to Decrypt SSN #{e}")
end

def map_to_person(payload, ssn)
Expand Down
20 changes: 8 additions & 12 deletions app/operations/aces/initiate_mec_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def call(payload)
return Failure({ error: "MEC Check feature not enabled." }) unless MedicaidGatewayRegistry[:mec_check].enabled?
json = JSON.parse(payload)
mec_check = yield create_mec_check(json)
checks = yield get_applicant_checks(mec_check, json)
checks = yield get_applicant_checks(json)
_results = yield update_mec_check(mec_check, checks)

publish_to_enroll(mec_check, checks)
Expand All @@ -38,7 +38,7 @@ def create_mec_check(json)
Failure({ error: "Failed to save MEC check: #{results.failure}" })
end

def get_applicant_checks(mec_check, json)
def get_applicant_checks(json)
results = {}
people = json["applicants"]
people.each do |person|
Expand All @@ -47,16 +47,13 @@ def get_applicant_checks(mec_check, json)
if evidence
mc_response = mec_check(person)
if mc_response.failure?
error_result = {
mc_id: mec_check.id,
error: "#{mc_response.failure} on Person}"
}
return Failure(error_result)
results[hbx_id] = mc_response.failure
else
response = mc_response.value!
results[hbx_id] = response[:code_description]
evidence["eligibility_results"] = [response]
evidence["eligibility_status"] = response[:mec_verification_code] == "Y" ? :outstanding : :attested
end
response = mc_response.value!
results[hbx_id] = response[:code_description]
evidence["eligibility_results"] = [response]
evidence["eligibility_status"] = response[:mec_verification_code] == "Y" ? :outstanding : :attested
else
results[hbx_id] = "not MEC checked"
end
Expand All @@ -78,7 +75,6 @@ def serialize_response(response)
body = xml.at_xpath("//xml_ns:VerifyNonESIMECResponse", "xml_ns" => "http://gov.hhs.cms.hix.dsh.ee.nonesi_mec.ext")
Success(AcaEntities::Medicaid::MecCheck::Operations::GenerateResult.new.call(body.to_xml))
rescue StandardError => e
p e.backtrace
Failure("Serializing response error => #{e}")
end

Expand Down

0 comments on commit 8504337

Please sign in to comment.