Module: DecisionReviewV1::Appeals::Helpers
Constant Summary
collapse
- DR_LOCKBOX =
Lockbox.new(key: Settings.lockbox.master_key, encode: true)
Instance Method Summary
collapse
#benchmark?, #benchmark_to_log_data_hash, #extract_uuid_from_central_mail_message, #log_formatted, #parse_form412_response_to_log_msg, #parse_lighthouse_response_to_log_msg, #run_and_benchmark_if_enabled
Instance Method Details
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/decision_review_v1/utilities/helpers.rb', line 49
def (user)
= {
'X-VA-SSN' => user.ssn.to_s.strip.presence,
'X-VA-ICN' => user.icn.presence,
'X-VA-First-Name' => user.first_name.to_s.strip.first(12),
'X-VA-Middle-Initial' => middle_initial(user),
'X-VA-Last-Name' => user.last_name.to_s.strip.first(18).presence,
'X-VA-Birth-Date' => user.birth_date.to_s.strip.presence
}.compact
missing_required_fields = SC_REQUIRED_CREATE_HEADERS - .keys
if missing_required_fields.present?
e = Common::Exceptions::Forbidden.new(
source: "#{self.class}##{__method__}",
detail: { missing_required_fields: }
)
raise e
end
end
|
#get_and_rejigger_required_info(request_body:, form4142:, user:) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/decision_review_v1/utilities/helpers.rb', line 26
def get_and_rejigger_required_info(request_body:, form4142:, user:)
data = request_body['data']
attrs = data['attributes']
vet = attrs['veteran']
x = {
"vaFileNumber": user.ssn.to_s.strip.presence,
"veteranSocialSecurityNumber": user.ssn.to_s.strip.presence,
"veteranFullName": {
"first": user.first_name.to_s,
"middle": middle_initial(user),
"last": user.last_name.to_s.presence
},
"veteranDateOfBirth": user.birth_date.to_s.strip.presence,
"veteranAddress": vet['address'].merge(
'country' => vet['address']['countryCodeISO2'],
'postalCode' => vet['address']['zipCode5']
),
"email": vet['email'],
"veteranPhone": "#{vet['phone']['areaCode']}#{vet['phone']['phoneNumber']}"
}
x.merge(form4142).deep_stringify_keys
end
|
#middle_initial(user) ⇒ Object
16
17
18
|
# File 'lib/decision_review_v1/utilities/helpers.rb', line 16
def middle_initial(user)
user.middle_name.to_s.strip.presence&.first&.upcase
end
|
#payload_encrypted_string(payload) ⇒ Object
Takes original payload (or anything that responds to to_json) Then encrypts it so that there is no PII in the sidekiq args
22
23
24
|
# File 'lib/decision_review_v1/utilities/helpers.rb', line 22
def payload_encrypted_string(payload)
DR_LOCKBOX.encrypt(payload.to_json)
end
|