Class: VAProfile::ContactInformation::PersonTransactionResponse

Inherits:
TransactionResponse show all
Defined in:
lib/va_profile/contact_information/transaction_response.rb

Constant Summary collapse

NOT_FOUND_IN_MPI_CODE =
'MVI201'

Constants inherited from TransactionResponse

TransactionResponse::ERROR_STATUS

Constants included from Common::Client::Concerns::ServiceStatus

Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS

Instance Attribute Summary

Attributes inherited from TransactionResponse

#response_body

Attributes inherited from Common::Base

#errors_hash, #metadata

Class Method Summary collapse

Methods inherited from TransactionResponse

error?

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Methods inherited from Response

#cache?, #initialize, #metadata, #ok?, #response_status

Methods inherited from Common::Base

#changed, #changed?, #changes, default_sort, filterable_attributes, #initialize, max_per_page, per_page, sortable_attributes

Constructor Details

This class inherits a constructor from VAProfile::Response

Class Method Details

.from(raw_response, user) ⇒ Object



91
92
93
94
95
96
97
98
# File 'lib/va_profile/contact_information/transaction_response.rb', line 91

def self.from(raw_response, user)
  return_val = super(raw_response)
  @user = user

  log_mpi_error if @user.mpi_status == :ok

  return_val
end

.log_mpi_errorObject



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/va_profile/contact_information/transaction_response.rb', line 100

def self.log_mpi_error
  if error?
    @response_body['tx_messages'].each do |tx_message|
      if tx_message['code'] == NOT_FOUND_IN_MPI_CODE
        return log_message_to_sentry(
          'va profile mpi not found',
          :error,
          {
            icn: @user.icn,
            edipi: @user.edipi,
            response_body: @response_body
          },
          error: :va_profile
        )
      end
    end
  end
rescue => e
  log_exception_to_sentry(e)
end