Class: Trizetto::Api::Eligibility::WebService::DoInquiryResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb

Overview

The parsed response from an eligibility check

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ DoInquiryResponse

Returns a new instance of DoInquiryResponse.



68
69
70
71
72
73
74
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 68

def initialize(response)
  response = response.to_hash.dig(:do_inquiry_response, :do_inquiry_result) || {}

  self.success_code    = response[:success_code]
  self.response_as_xml = response[:response_as_xml]
  self.extra_processing_info = ExtraProcessingInfo.new(response[:extra_processing_info])
end

Instance Attribute Details

#dependentObject

The Dependent in the eligibility XML.



55
56
57
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 55

def dependent
  @dependent
end

#eligibility_response_as_hashObject

The eligibility response xml parsed into a hash.



45
46
47
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 45

def eligibility_response_as_hash
  @eligibility_response_as_hash
end

#extra_processing_infoObject

Any validation error or messages provided in the response

Example

client.extra_processing_info.messages                                  # => ["Invalid InsuredFirstName Length."]
client.extra_processing_info.validation_failures.first.affected_fields # => ["InsuredFirstName"]
client.extra_processing_info.validation_failures.first.message         # => "Invalid InsuredFirstName Length."


42
43
44
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 42

def extra_processing_info
  @extra_processing_info
end

#info_receiverObject

The inforeceiver in the eligibilty XML

See Also:



65
66
67
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 65

def info_receiver
  @info_receiver
end

#info_sourceObject

The infosource in the eligibilty XML

See Also:



60
61
62
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 60

def info_source
  @info_source
end

#payer_idObject

For a successful request, the identifier of the payer (insurance company)



31
32
33
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 31

def payer_id
  @payer_id
end

#payer_nameObject

For a successful request, the name of the payer (insurance company)



28
29
30
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 28

def payer_name
  @payer_name
end

#subscriberObject

The Subscriber in the eligibility XML.

See Also:



50
51
52
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 50

def subscriber
  @subscriber
end

#success_codeObject

The SuccessCode in the XML response from the eligibility request.

Takes on one of these values

  • Success - The request was well formed and not missing any fields

  • ValidationFailure - The request was not valid. Maybe a field was formatted incorrectly or omitted.

  • PayerTimeout - ?

  • PayerNotSupported - ?

  • SystemError - ?

  • PayerEnrollmentRequired - ?

  • ProviderEnrollmentRequired - ?

  • ProductRequired - ?



20
21
22
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 20

def success_code
  @success_code
end

#transaction_idObject

For a successful request that returned an eligibility response, the transaction identifier from Trizetto. Seems to be 30 random alpha numeric characters



25
26
27
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 25

def transaction_id
  @transaction_id
end

Instance Method Details

#active_coverage_for?(service_type_code) ⇒ Boolean

Does the patient we asked about have active insurance coverage for this service type code? Service type codes are strings and the most common is 30, general health benefits coverage.

Example

response.active_coverage_for?("30")  #=> true

References

Returns:

  • (Boolean)


159
160
161
162
163
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 159

def active_coverage_for?(service_type_code)
  !!(patient && patient.benefits.any? do |benefit|
    benefit.active_coverage? && benefit.service_type_codes.include?(service_type_code.to_s)
  end)
end

#errorsObject

Validation errors handled at Trizetto’s level

Returns:

  • ExtraProcessingInfo



144
145
146
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 144

def errors
  self.extra_processing_info
end

#patientObject

The dependent or the subscriber - the best guess at who is the patient



119
120
121
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 119

def patient
  dependent || subscriber
end

#rejected?Boolean

Was the eligibility check rejected. Eligibility checks may be rejected because they have expired, they don’t exist, the payer service is unable to response, or there were errors with the request handled at the payer level instead of through Trizetto. There can be multiple rejections on a single request

Returns:

  • (Boolean)

See Also:



130
131
132
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 130

def rejected?
  !rejections.empty?
end

#rejectionsObject

Rejections can appear in the subscriber, info source, info receiver, and possibly in the dependent. Additionaly, there can be multiple rejections in any one of those. This collects them all



137
138
139
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 137

def rejections
  [subscriber, dependent, info_receiver, info_source].compact.map(&:rejections).flatten.compact
end

#success?Boolean

Did we successfully get back an eligibility response from the payer.

This does not mean the patient has active coverage.

Returns:

  • (Boolean)

    Boolean



114
115
116
# File 'lib/trizetto/api/eligibility/web_service/do_inquiry_response.rb', line 114

def success?
  success_code == 'Success' && [transaction_id, payer_name, payer_id].none?(&:blank?)
end