-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created PersonV2 Service and enabled ContactInformationV2 for StatementIdentifierService and McpNotificationEmailJob #18514
base: master
Are you sure you want to change the base?
Changes from all commits
ddc43d9
a3ad085
78044af
3b964f6
a7230d6
92e073b
60536f7
f47c2b5
4184779
924af4e
8042477
a61cc00
102afaa
9bcf8ae
62b06dc
b9f7e8a
bc2ba23
b121369
3056c63
9be612b
4fa31bc
3eb52d7
c8e7aae
910a34d
11eae4c
05a2783
3a2287c
7f5ef03
b177faf
74ffca9
cebb103
2c07fb0
3d7b5c3
5baec05
18b6907
20db378
493f030
33cfeaf
aed60e2
b2d1a21
eaa0f0d
bda2142
f82794b
fe68e62
bfe7175
7083569
3f55056
3fcda93
c13c08a
d1b2ce4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,11 +35,11 @@ class Service < VAProfile::Service | |
def get_person | ||
with_monitoring do | ||
vet360_id_present! | ||
raw_response = perform(:get, "#{MPI::Constants::VA_ROOT_OID}/#{ERB::Util.url_encode(icn_with_aaid)}") | ||
raw_response = perform(:get, "#{MPI::Constants::VA_ROOT_OID}/#{ERB::Util.url_encode(uuid_with_aaid)}") | ||
PersonResponse.from(raw_response) | ||
end | ||
rescue Common::Client::Errors::ClientError => e | ||
if e.status == 400 | ||
if e.status == 404 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to still cover the 400 status code here? |
||
log_exception_to_sentry( | ||
e, | ||
{ vet360_id: }, | ||
|
@@ -213,9 +213,10 @@ def get_person_transaction_status(transaction_id) | |
|
||
private | ||
|
||
def icn_with_aaid | ||
def uuid_with_aaid | ||
return "#{@user.idme_uuid}^PN^200VIDM^USDVA" if @user.idme_uuid | ||
bosawt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return "#{@user.logingov_uuid}^PN^200VLGN^USDVA" if @user.logingov_uuid | ||
return "#{vet360_id}^PI^200VETS^USDVA" if @user.idme_uuid.blank? && @user.logingov_uuid.blank? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you use |
||
|
||
nil | ||
end | ||
|
@@ -289,7 +290,7 @@ def vet360_id_present! | |
def post_or_put_data(method, model, path, response_class) | ||
with_monitoring do | ||
vet360_id_present! | ||
request_path = "#{MPI::Constants::VA_ROOT_OID}/#{ERB::Util.url_encode(icn_with_aaid)}" + "/#{path}" | ||
request_path = "#{MPI::Constants::VA_ROOT_OID}/#{ERB::Util.url_encode(uuid_with_aaid)}" + "/#{path}" | ||
raw_response = perform(method, request_path, model.in_json) | ||
response_class.from(raw_response) | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'common/client/base' | ||
require 'common/client/concerns/monitoring' | ||
require 'va_profile/v2/contact_information/configuration' | ||
require 'va_profile/v2/contact_information/transaction_response' | ||
require 'va_profile/service' | ||
require 'va_profile/stats' | ||
require 'identity/parsers/gc_ids_constants' | ||
|
||
module VAProfile | ||
module V2 | ||
module Person | ||
class Service < VAProfile::Service | ||
include Common::Client::Concerns::Monitoring | ||
include ERB::Util | ||
|
||
STATSD_KEY_PREFIX = "#{VAProfile::Service::STATSD_KEY_PREFIX}.person".freeze | ||
configuration VAProfile::V2::ContactInformation::Configuration | ||
|
||
# Initializes a vet360_id for a user that does not have one. Can be used when a current user | ||
# is present, or through a rake task when no user is present (through passing in their ICN). | ||
# This is an asynchronous process for VAProfile, so it returns VAProfile transaction information. | ||
# | ||
# @return [VAProfile::V2::ContactInformation::PersonTransactionResponse] | ||
# response wrapper around a transaction object | ||
# | ||
def init_vet360_id | ||
with_monitoring do | ||
raw_response = perform(:post, "#{MPI::Constants::VA_ROOT_OID}/#{ERB::Util.url_encode(uuid_with_aaid)}", | ||
empty_body) | ||
VAProfile::V2::ContactInformation::PersonTransactionResponse.from(raw_response, @user) | ||
end | ||
rescue => e | ||
handle_error(e) | ||
end | ||
|
||
private | ||
|
||
# @see https://ruby-doc.org/stdlib-2.3.0/libdoc/erb/rdoc/ERB/Util.html | ||
# | ||
def uuid_with_aaid | ||
return "#{@user.idme_uuid}^PN^200VIDM^USDVA" if @user.idme_uuid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There aren't ICN There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I know. I kept the icn_with_aaid method for the moment. We will be refactoring a lot of code after we make sure the upgrade is successful. I can update the method name now though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Contact Service is not using the ICN to make requests, I changed the method from icn_with_aaid with uuid_with_aaid to avoid confusion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah ok, that makes more sense |
||
return "#{@user.logingov_uuid}^PN^200VLGN^USDVA" if @user.logingov_uuid | ||
return "#{@user.vet360_id}^PI^200VETS^USDVA" if @user.idme_uuid.blank? && @user.logingov_uuid.blank? | ||
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious, where do these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these are given to us from VA Profile |
||
|
||
nil | ||
end | ||
|
||
def empty_body | ||
{ | ||
bio: { | ||
sourceDate: Time.zone.now.iso8601 | ||
} | ||
}.to_json | ||
end | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,8 +165,8 @@ | |
loa do | ||
{ current: LOA::THREE, highest: LOA::THREE } | ||
end | ||
|
||
idme_uuid { '6767671' } | ||
vet360_id { '6767671' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think instead of having this trait :error in the user factory, it probably just makes sense to define the attribute combination to cause the error for your specific service in the spec file itself. This isn't generally a user error in any other situation so it's difficult for any other spec to leverage this, which is what would be the reason to put a trait in the factory There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idme uuid also has to be null. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the user model is generally fine without an |
||
idme_uuid { nil } | ||
end | ||
|
||
trait :accountable do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the changes in this file intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
➕