Class: DaVinciPASTestKit::ClaimEndpoint
- Inherits:
-
Inferno::DSL::SuiteEndpoint
- Object
- Inferno::DSL::SuiteEndpoint
- DaVinciPASTestKit::ClaimEndpoint
show all
- Includes:
- ResponseGenerator, URLs, SubscriptionsTestKit::SubscriptionsR5BackportR4Client::SubscriptionSimulationUtils
- Defined in:
- lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb
Constant Summary
collapse
- WORKFLOW_TAG_MAP =
{
pended: PENDED_WORKFLOW_TAG,
denial: DENIAL_WORKFLOW_TAG,
approval: APPROVAL_WORKFLOW_TAG
}.freeze
Instance Method Summary
collapse
Methods included from URLs
#base_url, #fhir_subscription_url, #inquire_url, #resume_fail_url, #resume_pass_url, #submit_url, #token_url
#mock_full_resource_notification_bundle, #mock_id_only_notification_bundle, #mock_response_bundle, #update_tester_provided_notification, #update_tester_provided_response
Instance Method Details
#make_response ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb', line 48
def make_response
response.status = 200
response.format = :json
req_bundle = FHIR.from_contents(request.body.string)
claim_entry = req_bundle&.entry&.find { |e| e&.resource&.resourceType == 'Claim' }
claim_full_url = claim_entry&.fullUrl
if claim_entry.blank? || claim_full_url.blank?
handle_missing_required_elements(claim_entry, response)
return
end
user_inputted_response = UserInputResponse.user_inputted_response(test, operation, result)
if user_inputted_response.present?
generated_claim_response_uuid = nil
response_bundle_json = update_tester_provided_response(user_inputted_response, claim_full_url)
else
decision = if operation == 'inquire' && workflow == :pended
:approval
else
workflow
end
generated_claim_response_uuid = SecureRandom.uuid
response_bundle_json = mock_response_bundle(req_bundle, operation, decision, generated_claim_response_uuid)
end
response.body = response_bundle_json
return unless workflow == :pended && operation == 'submit'
start_notification_job(response_bundle_json, :approval, generated_claim_response_uuid)
end
|
#suite_id ⇒ Object
override the one from URLs
14
15
16
|
# File 'lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb', line 14
def suite_id
request.path.split('/custom/')[1].split('/')[0] end
|
22
23
24
25
26
27
28
29
|
# File 'lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb', line 22
def tags
operation_tag = operation == 'submit' ? SUBMIT_TAG : INQUIRE_TAG
workflow_tag = WORKFLOW_TAG_MAP[workflow]
return [operation_tag, workflow_tag] if workflow_tag.present?
[operation_tag]
end
|
#test_run_identifier ⇒ Object
18
19
20
|
# File 'lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb', line 18
def test_run_identifier
request.['authorization']&.delete_prefix('Bearer ')
end
|
#update_result ⇒ Object
82
83
84
|
# File 'lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb', line 82
def update_result
results_repo.update_result(result.id, 'pass') unless test.config.options[:accepts_multiple_requests]
end
|
#workflow ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb', line 31
def workflow
case test.id
when /.*pended.*/
:pended
when /.*denial.*/
:denial
when /.*approval.*/
:approval
end
end
|