Class: DaVinciPASTestKit::DaVinciPASV221::PASClientClaimUpdateChangedEntriesTest

Inherits:
Inferno::Test
  • Object
show all
Includes:
ClaimUpdateValidationUtils
Defined in:
lib/davinci_pas_test_kit/client/v2.2.1/workflows/pas_client_claim_update_changed_entries_test.rb

Overview

spec-71 and spec-72

Constant Summary

Constants included from ClaimUpdateValidationUtils

ClaimUpdateValidationUtils::CERTIFICATION_TYPE_CANCEL_CODE, ClaimUpdateValidationUtils::CERTIFICATION_TYPE_EXTENSION_URL, ClaimUpdateValidationUtils::INFO_CANCELLED_EXTENSION_URL, ClaimUpdateValidationUtils::INFO_CHANGED_EXTENSION_URL, ClaimUpdateValidationUtils::INFO_CHANGE_MODE_CODES

Instance Method Summary collapse

Methods included from ClaimUpdateValidationUtils

#bundle_entry_for_reference, #cancellation_marked?, #certification_type_cancel?, #claim_update_bundle, #claim_update_detail_chain, #claim_update_detail_comparisons, #claim_update_steps, #claim_update_updates, #entry_kind, #entry_modified?, #entry_sequences, #first_claim, #index_by_sequence, #info_cancelled?, #info_cancelled_extension, #info_changed_extension, #newly_cancelled?, #normalized_entry_hash, #received_claim_update_steps, #related_claim_references

Instance Method Details

#check_changed_entries_marked(current_entries, prior_entries, kind, comparison) ⇒ Object



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
# File 'lib/davinci_pas_test_kit/client/v2.2.1/workflows/pas_client_claim_update_changed_entries_test.rb', line 50

def check_changed_entries_marked(current_entries, prior_entries, kind, comparison)
  prior_by_sequence = index_by_sequence(prior_entries)

  Array(current_entries).each do |entry|
    prior_entry = prior_by_sequence[entry.sequence]
    change_type =
      if prior_entry.nil?
        'added'
      elsif newly_cancelled?(entry, prior_entry)
        'canceled'
      elsif entry_modified?(entry, prior_entry)
        'modified'
      end
    next if change_type.nil?

    extension = info_changed_extension(entry)
    if extension.nil?
      add_message('error',
                  "The #{change_type} #{kind} (sequence #{entry.sequence}) in the " \
                  "#{comparison[:current_label]} must contain an infoChanged extension (it changed " \
                  "relative to the #{comparison[:prior_label]}).")
      next
    end

    check_info_changed_code(extension.valueCode, change_type, kind, entry, comparison)
  end
end

#check_info_changed_code(code, change_type, kind, entry, comparison) ⇒ Object

Newly added entries SHALL use added; modified or canceled entries SHALL use changed.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/davinci_pas_test_kit/client/v2.2.1/workflows/pas_client_claim_update_changed_entries_test.rb', line 79

def check_info_changed_code(code, change_type, kind, entry, comparison)
  unless INFO_CHANGE_MODE_CODES.include?(code)
    add_message('error',
                "The infoChanged extension on the #{kind} (sequence #{entry.sequence}) in the " \
                "#{comparison[:current_label]} has valueCode '#{code}', which is not in the PAS Information " \
                "Change Mode value set (allowed: #{INFO_CHANGE_MODE_CODES.join(', ')}).")
    return
  end

  expected_code = change_type == 'added' ? 'added' : 'changed'
  return if code == expected_code

  descriptor = change_type == 'added' ? 'newly added' : 'modified or canceled'
  add_message('error',
              "The infoChanged extension on the #{kind} (sequence #{entry.sequence}) in the " \
              "#{comparison[:current_label]} has valueCode '#{code}', but an entry that was #{descriptor} " \
              "relative to the #{comparison[:prior_label]} SHALL use valueCode '#{expected_code}' per the " \
              'value set definitions.')
end