From b12ef93ff806aa9355542a0640e31c798c5547d5 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 7 Nov 2024 10:15:36 -0700
Subject: [PATCH 01/17] Adds flipper feature.
---
config/features.yml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/config/features.yml b/config/features.yml
index 402ae07f610..327ecea5160 100644
--- a/config/features.yml
+++ b/config/features.yml
@@ -220,6 +220,10 @@ features:
actor_type: user
description: When enabled, sends ews forms to BD via the refactored logic
enable_in_development: true
+ claims_api_poa_updater_enables_local_bgs:
+ actor_type: user
+ description: Uses local_bgs rather than bgs-ext
+ enable_in_development: true
claims_api_poa_uploads_bd_refactor:
actor_type: user
description: When enabled, sends poa forms to BD via the refactored logic
From f0a1f1a7558e5cf323d4d0a9fe6d535f5924cae0 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 7 Nov 2024 10:16:30 -0700
Subject: [PATCH 02/17] Moves the find_by_ssn call to PersonWebService from
LocalBgs.
---
modules/claims_api/lib/bgs_service/local_bgs.rb | 13 -------------
.../lib/bgs_service/person_web_service.rb | 13 +++++++++++++
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/modules/claims_api/lib/bgs_service/local_bgs.rb b/modules/claims_api/lib/bgs_service/local_bgs.rb
index c3995179880..85cbc16b9fe 100644
--- a/modules/claims_api/lib/bgs_service/local_bgs.rb
+++ b/modules/claims_api/lib/bgs_service/local_bgs.rb
@@ -89,19 +89,6 @@ def find_poa_by_participant_id(id)
key: 'return')
end
- def find_by_ssn(ssn)
- body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
-
- EOXML
-
- { ssn: }.each do |k, v|
- body.xpath("./*[local-name()='#{k}']")[0].content = v
- end
-
- make_request(endpoint: 'PersonWebServiceBean/PersonWebService', action: 'findPersonBySSN', body:,
- key: 'PersonDTO')
- end
-
def find_poa_history_by_ptcpnt_id(id)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
diff --git a/modules/claims_api/lib/bgs_service/person_web_service.rb b/modules/claims_api/lib/bgs_service/person_web_service.rb
index b8a9971f535..ba4ad534e63 100644
--- a/modules/claims_api/lib/bgs_service/person_web_service.rb
+++ b/modules/claims_api/lib/bgs_service/person_web_service.rb
@@ -35,5 +35,18 @@ def manage_ptcpnt_rlnshp_poa(**options)
make_request(endpoint: bean_name, action: 'managePtcpntRlnshpPoa', body:, key: 'PtcpntRlnshpDTO')
end
+
+ # finds a PERSON row by SSN
+ def find_by_ssn(ssn)
+ body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
+
+ EOXML
+
+ { ssn: }.each do |k, v|
+ body.xpath("./*[local-name()='#{k}']")[0].content = v
+ end
+
+ make_request(endpoint: bean_name, action: 'findPersonBySSN', body:, key: 'PersonDTO')
+ end
end
end
From a90687bb76970d00aad6b0f0fc02b59bf0e50e6a Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 7 Nov 2024 10:17:25 -0700
Subject: [PATCH 03/17] Adds VetRecordService to LocalBgs.
---
.../lib/bgs_service/vet_record_service.rb | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 modules/claims_api/lib/bgs_service/vet_record_service.rb
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_service.rb
new file mode 100644
index 00000000000..60a25d9e299
--- /dev/null
+++ b/modules/claims_api/lib/bgs_service/vet_record_service.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module ClaimsApi
+ class VetRecordService < ClaimsApi::LocalBGS
+ def bean_name
+ 'VetRecordServiceBean/VetRecordWebService'
+ end
+
+ def update_birls_record(**options)
+ builder = Nokogiri::XML::Builder.new(
+ birlsUpdateInput do
+ CLAIM_NUMBER options[:file_number] if options[:file_number]
+ SOC_SEC_NUM options[:ssn] if options[:ssn]
+ POWER_OF_ATTY_CODE1 options[:poa_code][0] if options[:poa_code][0]
+ POWER_OF_ATTY_CODE2 options[:poa_code][1] if options[:poa_code][1]
+ end
+ )
+ body = builder_to_xml(builder)
+ make_request(endpoint: bean_name, body:, action: 'updateBirlsRecord', key: 'return')
+ # 'update_birls_record_response'
+ end
+ end
+end
From f0ee6f426bd3a7eddcfd1fdf10504d8eb8a76945 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 7 Nov 2024 10:20:48 -0700
Subject: [PATCH 04/17] Adds ability to switch between bgs-ext & local_bgs for
vet_record & person_web_service.
---
.../app/sidekiq/claims_api/poa_updater.rb | 63 +++++++++++++++----
1 file changed, 50 insertions(+), 13 deletions(-)
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index b1516dd201c..7bb6f3f3fa8 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -4,22 +4,14 @@
module ClaimsApi
class PoaUpdater < ClaimsApi::ServiceBase
- def perform(power_of_attorney_id, rep = nil) # rubocop:disable Metrics/MethodLength
- poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
- service = BGS::Services.new(
- external_uid: poa_form.external_uid,
- external_key: poa_form.external_key
- )
+ def perform(power_of_attorney_id, rep = nil)
+ @poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
ssn = poa_form.auth_headers['va_eauth_pnid']
- file_number = service.people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
- poa_code = extract_poa_code(poa_form.form_data)
+ file_number = get_file_number(ssn)
+ poa_code = extract_poa_code(@poa_form.form_data)
- response = service.vet_record.update_birls_record(
- file_number:,
- ssn:,
- poa_code:
- )
+ response = get_response(file_number, ssn, poa_code)
if response[:return_code] == 'BMOD0001'
poa_form.status = ClaimsApi::PowerOfAttorney::UPDATED
@@ -49,5 +41,50 @@ def vanotify?(auth_headers, rep)
false
end
end
+
+ def bgs_ext_service
+ BGS::Services.new(
+ external_uid: @poa_form.external_uid,
+ external_key: @poa_form.external_key
+ )
+ end
+
+ def person_web_service
+ ClaimsApi::PersonWebService.new(
+ external_uid: @poa_form.external_uid,
+ external_key: @poa_form.external_key
+ )
+ end
+
+ def vet_record_service
+ ClaimsApi::VetRecordService.new(
+ external_uid: @poa_form.external_uid,
+ external_key: @poa_form.external_key
+ )
+ end
+
+ def get_file_number(ssn)
+ if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
+ person_web_service.find_by_ssn(ssn) # rubocop:disable Rails/DynamicFindBy
+ else
+ bgs_service.people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
+ end
+ end
+
+ def get_response(file_number, ssn, poa_code)
+ if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
+ vet_record_service.update_birls_record(
+ file_number:,
+ ssn:,
+ poa_code:
+ )
+ else
+ bgs_service.vet_record.update_birls_record(
+ file_number:,
+ ssn:,
+ poa_code:
+ )
+ end
+ end
end
end
From ea0459094ac4ed54ca8a7efbf6b425aed60e4e2b Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 7 Nov 2024 11:49:01 -0700
Subject: [PATCH 05/17] Getting successful responses, but getting 'BGS Error:
update_birls_record failed with code BPNQ0100'
---
.../app/sidekiq/claims_api/poa_updater.rb | 22 +-
.../lib/bgs_service/vet_record_service.rb | 18 +-
.../spec/sidekiq/poa_updater_spec.rb | 2 +-
.../bgs/person_web_service/poa_updater.yml | 711 ++++++++++++++++++
4 files changed, 733 insertions(+), 20 deletions(-)
create mode 100644 spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index 7bb6f3f3fa8..fdfcad1aeaa 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -1,35 +1,37 @@
# frozen_string_literal: true
require 'bgs'
+require 'bgs_service/person_web_service'
+require 'bgs_service/vet_record_service'
module ClaimsApi
class PoaUpdater < ClaimsApi::ServiceBase
def perform(power_of_attorney_id, rep = nil)
@poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
- ssn = poa_form.auth_headers['va_eauth_pnid']
+ ssn = @poa_form.auth_headers['va_eauth_pnid']
file_number = get_file_number(ssn)
poa_code = extract_poa_code(@poa_form.form_data)
response = get_response(file_number, ssn, poa_code)
if response[:return_code] == 'BMOD0001'
- poa_form.status = ClaimsApi::PowerOfAttorney::UPDATED
+ @poa_form.status = ClaimsApi::PowerOfAttorney::UPDATED
# Clear out the error message if there were previous failures
- poa_form.vbms_error_message = nil if poa_form.vbms_error_message.present?
+ @poa_form.vbms_error_message = nil if @poa_form.vbms_error_message.present?
- ClaimsApi::Logger.log('poa', poa_id: poa_form.id, detail: 'BIRLS Success')
+ ClaimsApi::Logger.log('poa', poa_id: @poa_form.id, detail: 'BIRLS Success')
- ClaimsApi::VANotifyJob.perform_async(poa_form.id, rep) if vanotify?(poa_form.auth_headers, rep)
+ ClaimsApi::VANotifyJob.perform_async(@poa_form.id, rep) if vanotify?(@poa_form.auth_headers, rep)
- ClaimsApi::PoaVBMSUpdater.perform_async(poa_form.id) if enable_vbms_access?(poa_form:)
+ ClaimsApi::PoaVBMSUpdater.perform_async(@poa_form.id) if enable_vbms_access?(poa_form: @poa_form)
else
- poa_form.status = ClaimsApi::PowerOfAttorney::ERRORED
- poa_form.vbms_error_message = "BGS Error: update_birls_record failed with code #{response[:return_code]}"
- ClaimsApi::Logger.log('poa', poa_id: poa_form.id, detail: 'BIRLS Failed', error: response[:return_code])
+ @poa_form.status = ClaimsApi::PowerOfAttorney::ERRORED
+ @poa_form.vbms_error_message = "BGS Error: update_birls_record failed with code #{response[:return_code]}"
+ ClaimsApi::Logger.log('poa', poa_id: @poa_form.id, detail: 'BIRLS Failed', error: response[:return_code])
end
- poa_form.save
+ @poa_form.save
end
private
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_service.rb
index 60a25d9e299..ccaf7867c5f 100644
--- a/modules/claims_api/lib/bgs_service/vet_record_service.rb
+++ b/modules/claims_api/lib/bgs_service/vet_record_service.rb
@@ -7,15 +7,15 @@ def bean_name
end
def update_birls_record(**options)
- builder = Nokogiri::XML::Builder.new(
- birlsUpdateInput do
- CLAIM_NUMBER options[:file_number] if options[:file_number]
- SOC_SEC_NUM options[:ssn] if options[:ssn]
- POWER_OF_ATTY_CODE1 options[:poa_code][0] if options[:poa_code][0]
- POWER_OF_ATTY_CODE2 options[:poa_code][1] if options[:poa_code][1]
- end
- )
- body = builder_to_xml(builder)
+ body = Nokogiri::XML::DocumentFragment.parse <<~EOML
+
+ #{options[:file_number][:file_nbr]}
+ #{options[:ssn]}
+ #{options[:poa_code]}
+ ?
+
+ EOML
+
make_request(endpoint: bean_name, body:, action: 'updateBirlsRecord', key: 'return')
# 'update_birls_record_response'
end
diff --git a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
index 4bbed181432..9fc729a0441 100644
--- a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
+++ b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
@@ -2,7 +2,7 @@
require 'rails_helper'
-RSpec.describe ClaimsApi::PoaUpdater, type: :job do
+RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: 'bgs/person_web_service/poa_updater' do
subject { described_class }
before do
diff --git a/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml b/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
new file mode 100644
index 00000000000..427da49fb7f
--- /dev/null
+++ b/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
@@ -0,0 +1,711 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: "/PersonWebServiceBean/PersonWebService"
+ body:
+ encoding: UTF-8
+ string: |
+
+
+
+
+
+ VAgovAPI
+
+
+ 127.0.0.1
+ 281
+ VAgovAPI
+ 123
+ 1@2.com
+
+
+
+
+
+ 796104437
+
+
+
+ headers:
+ User-Agent:
+ - ""
+ Content-Type:
+ - text/xml;charset=UTF-8
+ Host:
+ - ".vba.va.gov"
+ Soapaction:
+ - '"findPersonBySSN"'
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Thu, 07 Nov 2024 18:29:43 GMT
+ Server:
+ - Apache
+ X-Frame-Options:
+ - SAMEORIGIN
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml; charset=utf-8
+ Strict-Transport-Security:
+ - max-age=16000000; includeSubDomains; preload;
+ body:
+ encoding: UTF-8
+ string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=TAMPAFL1950-10-04T00:00:00-06:002022-01-01T00:00:00-06:002022-09-16T12:24:00-05:002022-09-16T12:24:00-05:00YCORPuser228@gmail.comN796104437MARK-2M2024-10-18T07:21:26-05:00328CRMUD -
+ FNOD218861501U281TUSER06POLARBEAR-2YUnknownNUU13367440Person13367440N796104437431737Y
+ recorded_at: Thu, 07 Nov 2024 18:29:43 GMT
+- request:
+ method: get
+ uri: "/VetRecordServiceBean/VetRecordWebService?WSDL"
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - ""
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Thu, 07 Nov 2024 18:29:43 GMT
+ Server:
+ - Apache
+ X-Frame-Options:
+ - SAMEORIGIN
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml;charset=utf-8
+ Strict-Transport-Security:
+ - max-age=16000000; includeSubDomains; preload;
+ body:
+ encoding: UTF-8
+ string: |-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ recorded_at: Thu, 07 Nov 2024 18:29:44 GMT
+- request:
+ method: post
+ uri: "/VetRecordServiceBean/VetRecordWebService"
+ body:
+ encoding: UTF-8
+ string: |
+
+
+
+
+
+ VAgovAPI
+
+
+ 127.0.0.1
+ 281
+ VAgovAPI
+ 123
+ 1@2.com
+
+
+
+
+
+
+ 796104437
+ 796104437
+ 074
+ ?
+
+
+
+
+ headers:
+ User-Agent:
+ - ""
+ Content-Type:
+ - text/xml;charset=UTF-8
+ Host:
+ - ".vba.va.gov"
+ Soapaction:
+ - '"updateBirlsRecord"'
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Thu, 07 Nov 2024 18:29:44 GMT
+ Server:
+ - Apache
+ X-Frame-Options:
+ - SAMEORIGIN
+ X-Oracle-Dms-Ecid:
+ - 3fae8a70-61f7-4431-9861-8dcc4330b2c3-000153ef
+ X-Oracle-Dms-Rid:
+ - '0'
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml; charset=utf-8
+ Strict-Transport-Security:
+ - max-age=16000000; includeSubDomains; preload;
+ body:
+ encoding: UTF-8
+ string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=BPNQ0100No
+ BIRLS record found
+ recorded_at: Thu, 07 Nov 2024 18:29:44 GMT
+recorded_with: VCR 6.3.1
From 2f24fc0ae400628f0c96ae85003b1cf860fb860a Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 7 Nov 2024 13:12:11 -0700
Subject: [PATCH 06/17] Reverts instance variable. Adds definition. Adds
PAYEE_NUMBER value.
---
.../claims_api/bgs_client/definitions.rb | 22 ++++++++
.../app/sidekiq/claims_api/poa_updater.rb | 54 +++++++++----------
.../lib/bgs_service/vet_record_service.rb | 2 +-
3 files changed, 50 insertions(+), 28 deletions(-)
diff --git a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
index 72c488e7156..a467bf6fce5 100644
--- a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
+++ b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
@@ -368,6 +368,28 @@ module CreateVeteranRepresentative
end
##
+ # VetRecordService
+ ##
+ module VetRecordService
+ DEFINITION =
+ Bean.new(
+ path: 'VetRecordService',
+ namespaces: Namespaces.new(
+ target: 'http://services.share.benefits.vba.va.gov/',
+ data: nil
+ )
+ )
+ end
+
+ module UpdateBirlsRecord
+ DEFINITION =
+ Action.new(
+ service: VetRecordService::DEFINITION,
+ name: 'updateBirlsRecord',
+ key: 'return'
+ )
+ end
+
# VnpAtchmsWebServiceBean
#
module VnpAtchmsWebServiceBean
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index fdfcad1aeaa..b39e21d025b 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -7,31 +7,31 @@
module ClaimsApi
class PoaUpdater < ClaimsApi::ServiceBase
def perform(power_of_attorney_id, rep = nil)
- @poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
+ poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
- ssn = @poa_form.auth_headers['va_eauth_pnid']
- file_number = get_file_number(ssn)
- poa_code = extract_poa_code(@poa_form.form_data)
+ ssn = poa_form.auth_headers['va_eauth_pnid']
+ file_number = get_file_number(ssn, poa_form)
+ poa_code = extract_poa_code(poa_form.form_data)
- response = get_response(file_number, ssn, poa_code)
+ response = get_response(file_number, ssn, poa_code, poa_form)
if response[:return_code] == 'BMOD0001'
- @poa_form.status = ClaimsApi::PowerOfAttorney::UPDATED
+ poa_form.status = ClaimsApi::PowerOfAttorney::UPDATED
# Clear out the error message if there were previous failures
- @poa_form.vbms_error_message = nil if @poa_form.vbms_error_message.present?
+ poa_form.vbms_error_message = nil if poa_form.vbms_error_message.present?
- ClaimsApi::Logger.log('poa', poa_id: @poa_form.id, detail: 'BIRLS Success')
+ ClaimsApi::Logger.log('poa', poa_id: poa_form.id, detail: 'BIRLS Success')
- ClaimsApi::VANotifyJob.perform_async(@poa_form.id, rep) if vanotify?(@poa_form.auth_headers, rep)
+ ClaimsApi::VANotifyJob.perform_async(poa_form.id, rep) if vanotify?(poa_form.auth_headers, rep)
- ClaimsApi::PoaVBMSUpdater.perform_async(@poa_form.id) if enable_vbms_access?(poa_form: @poa_form)
+ ClaimsApi::PoaVBMSUpdater.perform_async(poa_form.id) if enable_vbms_access?(poa_form: poa_form)
else
- @poa_form.status = ClaimsApi::PowerOfAttorney::ERRORED
- @poa_form.vbms_error_message = "BGS Error: update_birls_record failed with code #{response[:return_code]}"
- ClaimsApi::Logger.log('poa', poa_id: @poa_form.id, detail: 'BIRLS Failed', error: response[:return_code])
+ poa_form.status = ClaimsApi::PowerOfAttorney::ERRORED
+ poa_form.vbms_error_message = "BGS Error: update_birls_record failed with code #{response[:return_code]}"
+ ClaimsApi::Logger.log('poa', poa_id: poa_form.id, detail: 'BIRLS Failed', error: response[:return_code])
end
- @poa_form.save
+ poa_form.save
end
private
@@ -44,38 +44,38 @@ def vanotify?(auth_headers, rep)
end
end
- def bgs_ext_service
+ def bgs_ext_service(poa_form)
BGS::Services.new(
- external_uid: @poa_form.external_uid,
- external_key: @poa_form.external_key
+ external_uid: poa_form.external_uid,
+ external_key: poa_form.external_key
)
end
- def person_web_service
+ def person_web_service(poa_form)
ClaimsApi::PersonWebService.new(
- external_uid: @poa_form.external_uid,
- external_key: @poa_form.external_key
+ external_uid: poa_form.external_uid,
+ external_key: poa_form.external_key
)
end
- def vet_record_service
+ def vet_record_service(poa_form)
ClaimsApi::VetRecordService.new(
- external_uid: @poa_form.external_uid,
- external_key: @poa_form.external_key
+ external_uid: poa_form.external_uid,
+ external_key: poa_form.external_key
)
end
- def get_file_number(ssn)
+ def get_file_number(ssn, poa_form)
if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
- person_web_service.find_by_ssn(ssn) # rubocop:disable Rails/DynamicFindBy
+ person_web_service(poa_form).find_by_ssn(ssn) # rubocop:disable Rails/DynamicFindBy
else
bgs_service.people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
end
end
- def get_response(file_number, ssn, poa_code)
+ def get_response(file_number, ssn, poa_code, poa_form)
if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
- vet_record_service.update_birls_record(
+ vet_record_service(poa_form).update_birls_record(
file_number:,
ssn:,
poa_code:
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_service.rb
index ccaf7867c5f..d17aa056c28 100644
--- a/modules/claims_api/lib/bgs_service/vet_record_service.rb
+++ b/modules/claims_api/lib/bgs_service/vet_record_service.rb
@@ -12,7 +12,7 @@ def update_birls_record(**options)
#{options[:file_number][:file_nbr]}
#{options[:ssn]}
#{options[:poa_code]}
- ?
+ '00'
EOML
From 293079f26a3bac4af42d066c1f59da53a4dd1e42 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Tue, 12 Nov 2024 14:25:00 -0700
Subject: [PATCH 07/17] Refactors poa_updater. Replaces find_by_ssn in
local_bgs due to many failing tests. Created a ticket to remove that method
from local_bgs since it exists in two places.
---
.../app/sidekiq/claims_api/poa_updater.rb | 10 +++++-----
modules/claims_api/lib/bgs_service/local_bgs.rb | 13 +++++++++++++
.../lib/bgs_service/vet_record_service.rb | 3 +--
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index b39e21d025b..e778edf6ee0 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -10,10 +10,10 @@ def perform(power_of_attorney_id, rep = nil)
poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
ssn = poa_form.auth_headers['va_eauth_pnid']
- file_number = get_file_number(ssn, poa_form)
+ file_number = find_by_ssn(ssn, poa_form)
poa_code = extract_poa_code(poa_form.form_data)
- response = get_response(file_number, ssn, poa_code, poa_form)
+ response = update_birls_record(file_number, ssn, poa_code, poa_form)
if response[:return_code] == 'BMOD0001'
poa_form.status = ClaimsApi::PowerOfAttorney::UPDATED
@@ -65,15 +65,15 @@ def vet_record_service(poa_form)
)
end
- def get_file_number(ssn, poa_form)
+ def find_by_ssn(ssn, poa_form)
if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
- person_web_service(poa_form).find_by_ssn(ssn) # rubocop:disable Rails/DynamicFindBy
+ person_web_service(poa_form).find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
else
bgs_service.people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
end
end
- def get_response(file_number, ssn, poa_code, poa_form)
+ def update_birls_record(file_number, ssn, poa_code, poa_form)
if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
vet_record_service(poa_form).update_birls_record(
file_number:,
diff --git a/modules/claims_api/lib/bgs_service/local_bgs.rb b/modules/claims_api/lib/bgs_service/local_bgs.rb
index 85cbc16b9fe..c3995179880 100644
--- a/modules/claims_api/lib/bgs_service/local_bgs.rb
+++ b/modules/claims_api/lib/bgs_service/local_bgs.rb
@@ -89,6 +89,19 @@ def find_poa_by_participant_id(id)
key: 'return')
end
+ def find_by_ssn(ssn)
+ body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
+
+ EOXML
+
+ { ssn: }.each do |k, v|
+ body.xpath("./*[local-name()='#{k}']")[0].content = v
+ end
+
+ make_request(endpoint: 'PersonWebServiceBean/PersonWebService', action: 'findPersonBySSN', body:,
+ key: 'PersonDTO')
+ end
+
def find_poa_history_by_ptcpnt_id(id)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_service.rb
index d17aa056c28..fb07e0cd76a 100644
--- a/modules/claims_api/lib/bgs_service/vet_record_service.rb
+++ b/modules/claims_api/lib/bgs_service/vet_record_service.rb
@@ -9,7 +9,7 @@ def bean_name
def update_birls_record(**options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOML
- #{options[:file_number][:file_nbr]}
+ #{options[:file_number]}
#{options[:ssn]}
#{options[:poa_code]}
'00'
@@ -17,7 +17,6 @@ def update_birls_record(**options)
EOML
make_request(endpoint: bean_name, body:, action: 'updateBirlsRecord', key: 'return')
- # 'update_birls_record_response'
end
end
end
From ce86efac6cf0b8bcfea2436993a1086d08e935a4 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 14 Nov 2024 07:24:33 -0700
Subject: [PATCH 08/17] WIP: switching branches.
---
.../app/sidekiq/claims_api/poa_updater.rb | 8 +++--
.../lib/bgs_service/vet_record_service.rb | 34 +++++++++++++++++++
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index e778edf6ee0..654c9e4ed35 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -9,8 +9,11 @@ class PoaUpdater < ClaimsApi::ServiceBase
def perform(power_of_attorney_id, rep = nil)
poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
+ # first_name = poa_form.auth_headers['va_eauth_firstName']
+ # last_name = poa_form.auth_headers['va_eauth_lastName']
ssn = poa_form.auth_headers['va_eauth_pnid']
- file_number = find_by_ssn(ssn, poa_form)
+
+ file_number = find_by_ssn(ssn, poa_form) # , first_name, last_name)
poa_code = extract_poa_code(poa_form.form_data)
response = update_birls_record(file_number, ssn, poa_code, poa_form)
@@ -65,9 +68,10 @@ def vet_record_service(poa_form)
)
end
- def find_by_ssn(ssn, poa_form)
+ def find_by_ssn(ssn, poa_form) # , first_name, last_name)
if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
person_web_service(poa_form).find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
+ # vet_record_service(poa_form).find_birls_record(ssn:, first_name:, last_name:)
else
bgs_service.people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
end
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_service.rb
index fb07e0cd76a..af3e443edff 100644
--- a/modules/claims_api/lib/bgs_service/vet_record_service.rb
+++ b/modules/claims_api/lib/bgs_service/vet_record_service.rb
@@ -18,5 +18,39 @@ def update_birls_record(**options)
make_request(endpoint: bean_name, body:, action: 'updateBirlsRecord', key: 'return')
end
+
+ def find_birls_record(**options)
+ body = Nokogiri::XML::DocumentFragment.parse <<~EOML
+
+
+ #{options[:ssn]}
+ #{options[:last_name]}
+ #{options[:first_name]}
+ " "
+ #{options[:ssn]}
+ " "
+ " "
+ " "
+ " "
+ " "
+ BIRLS Inquiry
+
+
+ EOML
+
+ make_request(endpoint: bean_name, body:, action: 'findBirlsRecord', key: 'return')
+
+ # response = request(
+ # :find_corporate_record,
+ # {
+ # ptcpntSearchPSNInput: {
+ # firstName: first_name,
+ # lastName: last_name
+ # }
+ # },
+ # "#{first_name}_#{last_name}".downcase
+ # )
+ # response.body[:find_corporate_record_response][:return]
+ end
end
end
From c34f23cf56cdba983feee55c21413314ffe83be2 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Fri, 15 Nov 2024 14:04:19 -0700
Subject: [PATCH 09/17] Cleans up poa_updater. Adds definitions. Updates vcr
cassette.
---
.../claims_api/bgs_client/definitions.rb | 30 +-
.../app/sidekiq/claims_api/poa_updater.rb | 11 +-
.../bgs/person_web_service/poa_updater.yml | 264 +++++++++---------
3 files changed, 159 insertions(+), 146 deletions(-)
diff --git a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
index a467bf6fce5..404d49e2ddf 100644
--- a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
+++ b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
@@ -370,10 +370,10 @@ module CreateVeteranRepresentative
##
# VetRecordService
##
- module VetRecordService
+ module VetRecordServiceBean
DEFINITION =
Bean.new(
- path: 'VetRecordService',
+ path: 'VetRecordServiceBean',
namespaces: Namespaces.new(
target: 'http://services.share.benefits.vba.va.gov/',
data: nil
@@ -381,13 +381,29 @@ module VetRecordService
)
end
- module UpdateBirlsRecord
+ module VetRecordWebService
DEFINITION =
- Action.new(
- service: VetRecordService::DEFINITION,
- name: 'updateBirlsRecord',
- key: 'return'
+ Service.new(
+ bean: VetRecordServiceBean::DEFINITION,
+ path: 'VetRecordServiceBean'
)
+ module UpdateBirlsRecord
+ DEFINITION =
+ Action.new(
+ service: VetRecordWebService::DEFINITION,
+ name: 'updateBirlsRecord',
+ key: 'return'
+ )
+ end
+
+ module FindBirlsRecord
+ DEFINITION =
+ Action.new(
+ service: VetRecordWebService::DEFINITION,
+ name: 'findBirlsRecord',
+ key: 'return'
+ )
+ end
end
# VnpAtchmsWebServiceBean
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index 654c9e4ed35..bd80d09ce00 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -9,11 +9,9 @@ class PoaUpdater < ClaimsApi::ServiceBase
def perform(power_of_attorney_id, rep = nil)
poa_form = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
- # first_name = poa_form.auth_headers['va_eauth_firstName']
- # last_name = poa_form.auth_headers['va_eauth_lastName']
ssn = poa_form.auth_headers['va_eauth_pnid']
- file_number = find_by_ssn(ssn, poa_form) # , first_name, last_name)
+ file_number = find_by_ssn(ssn, poa_form)
poa_code = extract_poa_code(poa_form.form_data)
response = update_birls_record(file_number, ssn, poa_code, poa_form)
@@ -68,12 +66,11 @@ def vet_record_service(poa_form)
)
end
- def find_by_ssn(ssn, poa_form) # , first_name, last_name)
+ def find_by_ssn(ssn, poa_form)
if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
person_web_service(poa_form).find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
- # vet_record_service(poa_form).find_birls_record(ssn:, first_name:, last_name:)
else
- bgs_service.people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
+ bgs_ext_service(poa_form).people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
end
end
@@ -85,7 +82,7 @@ def update_birls_record(file_number, ssn, poa_code, poa_form)
poa_code:
)
else
- bgs_service.vet_record.update_birls_record(
+ bgs_ext_service(poa_form).vet_record.update_birls_record(
file_number:,
ssn:,
poa_code:
diff --git a/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml b/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
index 427da49fb7f..37435e2237a 100644
--- a/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
+++ b/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
@@ -47,7 +47,7 @@ http_interactions:
message: OK
headers:
Date:
- - Thu, 07 Nov 2024 18:29:43 GMT
+ - Fri, 15 Nov 2024 20:27:23 GMT
Server:
- Apache
X-Frame-Options:
@@ -65,7 +65,7 @@ http_interactions:
xmlns:work="http://oracle.com/weblogic/soap/workarea/">rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=TAMPAFL1950-10-04T00:00:00-06:002022-01-01T00:00:00-06:002022-09-16T12:24:00-05:002022-09-16T12:24:00-05:00YCORPuser228@gmail.comN796104437MARK-2M2024-10-18T07:21:26-05:00328CRMUD -
FNOD218861501U281TUSER06POLARBEAR-2YUnknownNUU13367440Person13367440N796104437431737Y
- recorded_at: Thu, 07 Nov 2024 18:29:43 GMT
+ recorded_at: Fri, 15 Nov 2024 20:27:23 GMT
- request:
method: get
uri: "/VetRecordServiceBean/VetRecordWebService?WSDL"
@@ -85,7 +85,7 @@ http_interactions:
message: OK
headers:
Date:
- - Thu, 07 Nov 2024 18:29:43 GMT
+ - Fri, 15 Nov 2024 20:27:24 GMT
Server:
- Apache
X-Frame-Options:
@@ -114,47 +114,35 @@ http_interactions:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -162,12 +150,6 @@ http_interactions:
-
-
-
-
-
-
@@ -180,29 +162,23 @@ http_interactions:
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -210,57 +186,66 @@ http_interactions:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
@@ -271,31 +256,46 @@ http_interactions:
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -311,7 +311,7 @@ http_interactions:
-
+
@@ -323,7 +323,7 @@ http_interactions:
-
+
@@ -335,7 +335,7 @@ http_interactions:
-
+
@@ -347,7 +347,7 @@ http_interactions:
-
+
@@ -359,7 +359,7 @@ http_interactions:
-
+
@@ -371,7 +371,7 @@ http_interactions:
-
+
@@ -383,7 +383,7 @@ http_interactions:
-
+
@@ -395,7 +395,7 @@ http_interactions:
-
+
@@ -407,7 +407,7 @@ http_interactions:
-
+
@@ -419,7 +419,7 @@ http_interactions:
-
+
@@ -431,7 +431,7 @@ http_interactions:
-
+
@@ -443,7 +443,7 @@ http_interactions:
-
+
@@ -455,7 +455,7 @@ http_interactions:
-
+
@@ -467,7 +467,7 @@ http_interactions:
-
+
@@ -479,7 +479,7 @@ http_interactions:
-
+
@@ -491,7 +491,7 @@ http_interactions:
-
+
@@ -510,7 +510,7 @@ http_interactions:
- recorded_at: Thu, 07 Nov 2024 18:29:44 GMT
+ recorded_at: Fri, 15 Nov 2024 20:27:24 GMT
- request:
method: post
uri: "/VetRecordServiceBean/VetRecordWebService"
@@ -539,7 +539,7 @@ http_interactions:
796104437
796104437
074
- ?
+ '00'
@@ -563,13 +563,13 @@ http_interactions:
message: OK
headers:
Date:
- - Thu, 07 Nov 2024 18:29:44 GMT
+ - Fri, 15 Nov 2024 20:27:24 GMT
Server:
- Apache
X-Frame-Options:
- SAMEORIGIN
X-Oracle-Dms-Ecid:
- - 3fae8a70-61f7-4431-9861-8dcc4330b2c3-000153ef
+ - 3fae8a70-61f7-4431-9861-8dcc4330b2c3-0003f53d
X-Oracle-Dms-Rid:
- '0'
Transfer-Encoding:
@@ -707,5 +707,5 @@ http_interactions:
xsi:nil="true"/>
- recorded_at: Thu, 07 Nov 2024 18:29:44 GMT
+ recorded_at: Fri, 15 Nov 2024 20:27:25 GMT
recorded_with: VCR 6.3.1
From 04755e0ff3b4430fb39816be270450d58a5de3a2 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Fri, 15 Nov 2024 14:57:10 -0700
Subject: [PATCH 10/17] Removes find_birls_record
---
.../claims_api/bgs_client/definitions.rb | 9 -----
.../lib/bgs_service/vet_record_service.rb | 36 ++-----------------
2 files changed, 2 insertions(+), 43 deletions(-)
diff --git a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
index 404d49e2ddf..5f4256c60b7 100644
--- a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
+++ b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
@@ -395,15 +395,6 @@ module UpdateBirlsRecord
key: 'return'
)
end
-
- module FindBirlsRecord
- DEFINITION =
- Action.new(
- service: VetRecordWebService::DEFINITION,
- name: 'findBirlsRecord',
- key: 'return'
- )
- end
end
# VnpAtchmsWebServiceBean
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_service.rb
index af3e443edff..2a8255ce41d 100644
--- a/modules/claims_api/lib/bgs_service/vet_record_service.rb
+++ b/modules/claims_api/lib/bgs_service/vet_record_service.rb
@@ -7,50 +7,18 @@ def bean_name
end
def update_birls_record(**options)
+ poa_code_two = options[:poa_code].is_a?(Array) ? options[:poa_code][1] : '00'
body = Nokogiri::XML::DocumentFragment.parse <<~EOML
#{options[:file_number]}
#{options[:ssn]}
#{options[:poa_code]}
+ #{poa_code_two}
'00'
EOML
make_request(endpoint: bean_name, body:, action: 'updateBirlsRecord', key: 'return')
end
-
- def find_birls_record(**options)
- body = Nokogiri::XML::DocumentFragment.parse <<~EOML
-
-
- #{options[:ssn]}
- #{options[:last_name]}
- #{options[:first_name]}
- " "
- #{options[:ssn]}
- " "
- " "
- " "
- " "
- " "
- BIRLS Inquiry
-
-
- EOML
-
- make_request(endpoint: bean_name, body:, action: 'findBirlsRecord', key: 'return')
-
- # response = request(
- # :find_corporate_record,
- # {
- # ptcpntSearchPSNInput: {
- # firstName: first_name,
- # lastName: last_name
- # }
- # },
- # "#{first_name}_#{last_name}".downcase
- # )
- # response.body[:find_corporate_record_response][:return]
- end
end
end
From 8f94b9f75494faaa20f9561d03dfd2cd8f06b0b8 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Mon, 18 Nov 2024 07:55:14 -0700
Subject: [PATCH 11/17] Corrects vet record service. Updates tests with flipper
feature, and replaces vcr cassette.
---
.../lib/bgs_service/vet_record_service.rb | 8 +-
.../spec/sidekiq/poa_updater_spec.rb | 30 ++-
.../bgs/person_web_service/poa_updater.yml | 247 ++++++++----------
3 files changed, 138 insertions(+), 147 deletions(-)
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_service.rb
index 2a8255ce41d..2d96defbb4c 100644
--- a/modules/claims_api/lib/bgs_service/vet_record_service.rb
+++ b/modules/claims_api/lib/bgs_service/vet_record_service.rb
@@ -7,14 +7,14 @@ def bean_name
end
def update_birls_record(**options)
- poa_code_two = options[:poa_code].is_a?(Array) ? options[:poa_code][1] : '00'
+ poa_code = options[:poa_code]
body = Nokogiri::XML::DocumentFragment.parse <<~EOML
#{options[:file_number]}
#{options[:ssn]}
- #{options[:poa_code]}
- #{poa_code_two}
- '00'
+ #{poa_code[0]}
+ #{poa_code[1]}#{poa_code[2]}
+ 00
EOML
diff --git a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
index 9fc729a0441..0a4ea7cc7ed 100644
--- a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
+++ b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
@@ -19,7 +19,7 @@
context "when call to BGS 'update_birls_record' is successful" do
context 'and the poaCode is retrieved successfully from the V2 2122a form data' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
- create_mock_lighthouse_service
+ mock_service_by_flipper
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -49,7 +49,7 @@
context 'and record consent is granted' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
- create_mock_lighthouse_service
+ mock_service_by_flipper
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -65,7 +65,7 @@
context 'and record consent is not granted' do
context "because 'recordConsent' is false" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- create_mock_lighthouse_service
+ mock_service_by_flipper
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -80,7 +80,7 @@
context "because a limitation exists in 'consentLimits'" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- create_mock_lighthouse_service
+ mock_service_by_flipper
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -97,8 +97,8 @@
context "when call to BGS 'update_birls_record' fails" do
it "updates the form's status and does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- create_mock_lighthouse_service
- allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record).and_return(
+ mock_service_by_flipper
+ allow_any_instance_of(ClaimsApi::VetRecordService).to receive(:update_birls_record).and_return(
return_code: 'some error code'
)
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
@@ -113,7 +113,7 @@
context 'deciding to send a VA Notify email' do
before do
- create_mock_lighthouse_service
+ mock_service_by_flipper
end
let(:poa) { create_poa }
@@ -195,9 +195,23 @@ def create_poa
poa
end
- def create_mock_lighthouse_service
+ def mock_service_by_flipper
+ if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
+ create_mock_local_bgs_service
+ else
+ create_mock_bgs_ext_service
+ end
+ end
+
+ def create_mock_bgs_ext_service
allow_any_instance_of(BGS::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record)
.and_return({ return_code: 'BMOD0001' })
end
+
+ def create_mock_local_bgs_service
+ allow_any_instance_of(ClaimsApi::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
+ allow_any_instance_of(ClaimsApi::VetRecordService).to receive(:update_birls_record)
+ .and_return({ return_code: 'BMOD0001' })
+ end
end
diff --git a/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml b/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
index 37435e2237a..0d6a46f32c6 100644
--- a/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
+++ b/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
@@ -47,7 +47,7 @@ http_interactions:
message: OK
headers:
Date:
- - Fri, 15 Nov 2024 20:27:23 GMT
+ - Mon, 18 Nov 2024 14:18:35 GMT
Server:
- Apache
X-Frame-Options:
@@ -63,9 +63,9 @@ http_interactions:
string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=TAMPAFL1950-10-04T00:00:00-06:002022-01-01T00:00:00-06:002022-09-16T12:24:00-05:002022-09-16T12:24:00-05:00YCORPuser228@gmail.comN796104437MARK-2M2024-10-18T07:21:26-05:00328CRMUD -
- FNOD218861501U281TUSER06POLARBEAR-2YUnknownNUU13367440Person13367440N796104437431737Y
- recorded_at: Fri, 15 Nov 2024 20:27:23 GMT
+ xmlns:ns0="http://person.services.vetsnet.vba.va.gov/">TAMPAFL1950-10-04T00:00:00-06:002022-01-01T00:00:00-06:002022-09-16T12:24:00-05:002022-09-16T12:24:00-05:00YCORPuser228@gmail.comN796104437MARK-2M2024-11-15T15:59:32-06:00VAgovAPItesttest281VAGOVAPI -
+ BUPD218917465UVAGOVAPIPOLARBEAR-2T-1YUnknownNUU13367440Person13367440N7961044374317JR-137Y
+ recorded_at: Mon, 18 Nov 2024 14:18:35 GMT
- request:
method: get
uri: "/VetRecordServiceBean/VetRecordWebService?WSDL"
@@ -85,7 +85,7 @@ http_interactions:
message: OK
headers:
Date:
- - Fri, 15 Nov 2024 20:27:24 GMT
+ - Mon, 18 Nov 2024 14:18:36 GMT
Server:
- Apache
X-Frame-Options:
@@ -510,7 +510,7 @@ http_interactions:
- recorded_at: Fri, 15 Nov 2024 20:27:24 GMT
+ recorded_at: Mon, 18 Nov 2024 14:18:36 GMT
- request:
method: post
uri: "/VetRecordServiceBean/VetRecordWebService"
@@ -538,8 +538,9 @@ http_interactions:
796104437
796104437
- 074
- '00'
+ 0
+ 72
+ 00
@@ -563,13 +564,13 @@ http_interactions:
message: OK
headers:
Date:
- - Fri, 15 Nov 2024 20:27:24 GMT
+ - Mon, 18 Nov 2024 14:18:37 GMT
Server:
- Apache
X-Frame-Options:
- SAMEORIGIN
X-Oracle-Dms-Ecid:
- - 3fae8a70-61f7-4431-9861-8dcc4330b2c3-0003f53d
+ - 3fae8a70-61f7-4431-9861-8dcc4330b2c3-0004d410
X-Oracle-Dms-Rid:
- '0'
Transfer-Encoding:
@@ -583,129 +584,105 @@ http_interactions:
string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=BPNQ0100No
- BIRLS record found
- recorded_at: Fri, 15 Nov 2024 20:27:25 GMT
+ xmlns:ns0="http://services.share.benefits.vba.va.gov/">BMOD0001BIRLS
+ Update successful796104437796104437
+ ARMY0101196510011972SAT E6
+ HON
+ ARMY1002197201012005SAT E6
+ UHC
+ POLARBEARMARKTJRERRORSCAUSESTUXJRERRORSCAUSESTUXJRWEBBMARKJR1004195010/04/19500101202201/01/20220CLAIM3171123201011/23/2010
+
+
+ EDU 3511119201011/19/2010
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 317YMDYNNUNKNOWN074
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 000VAGOVAPI2811115202411/15/2024 1
+ recorded_at: Mon, 18 Nov 2024 14:18:38 GMT
recorded_with: VCR 6.3.1
From 0c55339cb36e5055eeef0a4251ff51ef63d7ca5f Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Tue, 19 Nov 2024 11:07:50 -0700
Subject: [PATCH 12/17] Updates person web service
---
modules/claims_api/lib/bgs_service/person_web_service.rb | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/modules/claims_api/lib/bgs_service/person_web_service.rb b/modules/claims_api/lib/bgs_service/person_web_service.rb
index ba4ad534e63..0c3ac728b04 100644
--- a/modules/claims_api/lib/bgs_service/person_web_service.rb
+++ b/modules/claims_api/lib/bgs_service/person_web_service.rb
@@ -39,13 +39,9 @@ def manage_ptcpnt_rlnshp_poa(**options)
# finds a PERSON row by SSN
def find_by_ssn(ssn)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
-
+ #{ssn}
EOXML
- { ssn: }.each do |k, v|
- body.xpath("./*[local-name()='#{k}']")[0].content = v
- end
-
make_request(endpoint: bean_name, action: 'findPersonBySSN', body:, key: 'PersonDTO')
end
end
From d94268fb9be79044f3e6c16a088bbceb3bb1631b Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 21 Nov 2024 09:16:04 -0700
Subject: [PATCH 13/17] Removes method definitions.
---
.../app/clients/claims_api/bgs_client/definitions.rb | 10 +---------
.../claims_api/app/sidekiq/claims_api/poa_updater.rb | 2 +-
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
index 5f4256c60b7..fa2ec3b6aa2 100644
--- a/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
+++ b/modules/claims_api/app/clients/claims_api/bgs_client/definitions.rb
@@ -385,16 +385,8 @@ module VetRecordWebService
DEFINITION =
Service.new(
bean: VetRecordServiceBean::DEFINITION,
- path: 'VetRecordServiceBean'
+ path: 'VetRecordWebService'
)
- module UpdateBirlsRecord
- DEFINITION =
- Action.new(
- service: VetRecordWebService::DEFINITION,
- name: 'updateBirlsRecord',
- key: 'return'
- )
- end
end
# VnpAtchmsWebServiceBean
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index 5d9f3d6a335..353d059be8c 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -25,7 +25,7 @@ def perform(power_of_attorney_id, rep = nil)
ClaimsApi::VANotifyAcceptedJob.perform_async(poa_form.id, rep) if vanotify?(poa_form.auth_headers, rep)
- ClaimsApi::PoaVBMSUpdater.perform_async(poa_form.id) if enable_vbms_access?(poa_form: poa_form)
+ ClaimsApi::PoaVBMSUpdater.perform_async(poa_form.id) if enable_vbms_access?(poa_form:)
else
poa_form.status = ClaimsApi::PowerOfAttorney::ERRORED
poa_form.vbms_error_message = "BGS Error: update_birls_record failed with code #{response[:return_code]}"
From 107e6c39c68e5fdba2bb8c3a2bdd884824a7431a Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Thu, 21 Nov 2024 11:23:19 -0700
Subject: [PATCH 14/17] Renames flippers, separates features into two flippers.
Adds two tests. Need to re-record vcr cassette.
---
config/features.yml | 12 ++--
.../app/sidekiq/claims_api/poa_updater.rb | 8 +--
...d_service.rb => vet_record_web_service.rb} | 2 +-
.../spec/sidekiq/poa_updater_spec.rb | 66 +++++++++++++++++--
4 files changed, 74 insertions(+), 14 deletions(-)
rename modules/claims_api/lib/bgs_service/{vet_record_service.rb => vet_record_web_service.rb} (93%)
diff --git a/config/features.yml b/config/features.yml
index 322ac0de243..7c2ee0d9ff5 100644
--- a/config/features.yml
+++ b/config/features.yml
@@ -233,14 +233,18 @@ features:
actor_type: user
description: When enabled, sends ews forms to BD via the refactored logic
enable_in_development: true
- claims_api_poa_updater_enables_local_bgs:
- actor_type: user
- description: Uses local_bgs rather than bgs-ext
- enable_in_development: true
claims_api_poa_uploads_bd_refactor:
actor_type: user
description: When enabled, sends poa forms to BD via the refactored logic
enable_in_development: true
+ claims_api_use_person_web_service:
+ actor_type: user
+ description: Uses person web service rather than local bgs
+ enable_in_development: true
+ claims_api_use_vet_record_service:
+ actor_type: user
+ description: Uses local_bgs rather than bgs-ext
+ enable_in_development: true
claims_api_526_v2_uploads_bd_refactor:
actor_type: user
description: When enabled, sends 526 forms to BD via the refactored logic
diff --git a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
index 353d059be8c..292fc50c824 100644
--- a/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
+++ b/modules/claims_api/app/sidekiq/claims_api/poa_updater.rb
@@ -2,7 +2,7 @@
require 'bgs'
require 'bgs_service/person_web_service'
-require 'bgs_service/vet_record_service'
+require 'bgs_service/vet_record_web_service'
module ClaimsApi
class PoaUpdater < ClaimsApi::ServiceBase
@@ -60,14 +60,14 @@ def person_web_service(poa_form)
end
def vet_record_service(poa_form)
- ClaimsApi::VetRecordService.new(
+ ClaimsApi::VetRecordWebService.new(
external_uid: poa_form.external_uid,
external_key: poa_form.external_key
)
end
def find_by_ssn(ssn, poa_form)
- if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
+ if Flipper.enabled? :claims_api_use_person_web_service
person_web_service(poa_form).find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
else
bgs_ext_service(poa_form).people.find_by_ssn(ssn)[:file_nbr] # rubocop:disable Rails/DynamicFindBy
@@ -75,7 +75,7 @@ def find_by_ssn(ssn, poa_form)
end
def update_birls_record(file_number, ssn, poa_code, poa_form)
- if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
+ if Flipper.enabled? :claims_api_use_vet_record_service
vet_record_service(poa_form).update_birls_record(
file_number:,
ssn:,
diff --git a/modules/claims_api/lib/bgs_service/vet_record_service.rb b/modules/claims_api/lib/bgs_service/vet_record_web_service.rb
similarity index 93%
rename from modules/claims_api/lib/bgs_service/vet_record_service.rb
rename to modules/claims_api/lib/bgs_service/vet_record_web_service.rb
index 2d96defbb4c..a378029a916 100644
--- a/modules/claims_api/lib/bgs_service/vet_record_service.rb
+++ b/modules/claims_api/lib/bgs_service/vet_record_web_service.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module ClaimsApi
- class VetRecordService < ClaimsApi::LocalBGS
+ class VetRecordWebService < ClaimsApi::LocalBGS
def bean_name
'VetRecordServiceBean/VetRecordWebService'
end
diff --git a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
index 02db1d36712..1a29c92b9b1 100644
--- a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
+++ b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
@@ -1,12 +1,16 @@
# frozen_string_literal: true
require 'rails_helper'
+require 'bgs_service/person_web_service'
+require 'bgs_service/vet_record_web_service'
RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: 'bgs/person_web_service/poa_updater' do
subject { described_class }
before do
Sidekiq::Job.clear_all
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return false
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_person_web_service).and_return false
end
let(:user) { FactoryBot.create(:user, :loa3) }
@@ -20,6 +24,7 @@
context 'and the poaCode is retrieved successfully from the V2 2122a form data' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
mock_service_by_flipper
+ use_person_web_service_flipper_service
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -50,6 +55,7 @@
context 'and record consent is granted' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
mock_service_by_flipper
+ use_person_web_service_flipper_service
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -66,6 +72,7 @@
context "because 'recordConsent' is false" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
mock_service_by_flipper
+ use_person_web_service_flipper_service
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -81,6 +88,7 @@
context "because a limitation exists in 'consentLimits'" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
mock_service_by_flipper
+ use_person_web_service_flipper_service
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -98,7 +106,8 @@
context "when call to BGS 'update_birls_record' fails" do
it "updates the form's status and does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
mock_service_by_flipper
- allow_any_instance_of(ClaimsApi::VetRecordService).to receive(:update_birls_record).and_return(
+ use_person_web_service_flipper_service
+ allow_any_instance_of(ClaimsApi::VetRecordWebService).to receive(:update_birls_record).and_return(
return_code: 'some error code'
)
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
@@ -114,6 +123,7 @@
context 'deciding to send a VA Notify email' do
before do
mock_service_by_flipper
+ use_person_web_service_flipper_service
end
let(:poa) { create_poa }
@@ -186,6 +196,46 @@
end
end
+ context 'when the claims_api_use_person_web_service flipper is on' do
+ let(:person_web_service) { instance_double(ClaimsApi::PersonWebService) }
+
+ before do
+ allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return false
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return true
+ allow(ClaimsApi::PersonWebService).to receive(:new).with(external_uid: anything,
+ external_key: anything)
+ .and_return(person_web_service)
+ allow(person_web_service).to receive(:find_by_ssn).and_return({ file_nbr: '796111863' })
+ end
+
+ it 'calls local bgs services instead of bgs-ext' do
+ poa = create_poa
+
+ subject.new.perform(poa.id)
+ expect(person_web_service).to have_received(:find_by_ssn)
+ end
+ end
+
+ context 'when the claims_api_use_vet_record_service flipper is on' do
+ let(:vet_record_web_service) { instance_double(ClaimsApi::VetRecordWebService) }
+
+ before do
+ allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return false
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return true
+ allow(ClaimsApi::PersonWebService).to receive(:new).with(external_uid: anything,
+ external_key: anything)
+ .and_return(vet_record_web_service)
+ allow(vet_record_web_service).to receive(:update_birls_record).and_return({ return_code: 'BMOD0001' })
+ end
+
+ it 'calls local bgs services instead of bgs-ext' do
+ poa = create_poa
+
+ subject.new.perform(poa.id)
+ expect(vet_record_web_service).to have_received(:update_birls_record)
+ end
+ end
+
private
def create_poa
@@ -196,22 +246,28 @@ def create_poa
end
def mock_service_by_flipper
- if Flipper.enabled? :claims_api_poa_updater_enables_local_bgs
+ if Flipper.enabled? :claims_api_use_vet_record_service
create_mock_local_bgs_service
else
create_mock_bgs_ext_service
end
end
+ def use_person_web_service_flipper_service
+ if Flipper.enabled? :claims_api_use_person_web_service
+ allow_any_instance_of(ClaimsApi::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
+ else
+ allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
+ end
+ end
+
def create_mock_bgs_ext_service
- allow_any_instance_of(BGS::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record)
.and_return({ return_code: 'BMOD0001' })
end
def create_mock_local_bgs_service
- allow_any_instance_of(ClaimsApi::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
- allow_any_instance_of(ClaimsApi::VetRecordService).to receive(:update_birls_record)
+ allow_any_instance_of(ClaimsApi::VetRecordWebService).to receive(:update_birls_record)
.and_return({ return_code: 'BMOD0001' })
end
end
From 384dfa715c175bbb15eaf17e138f2f5d15c9f24a Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Fri, 22 Nov 2024 13:09:36 -0700
Subject: [PATCH 15/17] Updates test and shared vcr cassette.
---
.../spec/sidekiq/poa_updater_spec.rb | 89 +-
.../bgs/person_web_service/find_by_ssn.yml | 900 ++++++++++++++++++
.../bgs/person_web_service/poa_updater.yml | 688 -------------
3 files changed, 922 insertions(+), 755 deletions(-)
create mode 100644 spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml
delete mode 100644 spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
diff --git a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
index 1a29c92b9b1..1e2994f0314 100644
--- a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
+++ b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
@@ -4,13 +4,14 @@
require 'bgs_service/person_web_service'
require 'bgs_service/vet_record_web_service'
-RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: 'bgs/person_web_service/poa_updater' do
+RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: 'bgs/person_web_service/find_by_ssn' do
subject { described_class }
before do
Sidekiq::Job.clear_all
allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return false
allow(Flipper).to receive(:enabled?).with(:claims_api_use_person_web_service).and_return false
+ allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return false
end
let(:user) { FactoryBot.create(:user, :loa3) }
@@ -23,8 +24,8 @@
context "when call to BGS 'update_birls_record' is successful" do
context 'and the poaCode is retrieved successfully from the V2 2122a form data' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
- mock_service_by_flipper
- use_person_web_service_flipper_service
+ use_vet_record_web_service_flipper
+ use_person_web_service_flipper
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -54,8 +55,8 @@
context 'and record consent is granted' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
- mock_service_by_flipper
- use_person_web_service_flipper_service
+ use_vet_record_web_service_flipper
+ use_person_web_service_flipper
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -71,8 +72,8 @@
context 'and record consent is not granted' do
context "because 'recordConsent' is false" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- mock_service_by_flipper
- use_person_web_service_flipper_service
+ use_vet_record_web_service_flipper
+ use_person_web_service_flipper
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -87,8 +88,8 @@
context "because a limitation exists in 'consentLimits'" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- mock_service_by_flipper
- use_person_web_service_flipper_service
+ use_vet_record_web_service_flipper
+ use_person_web_service_flipper
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -105,8 +106,8 @@
context "when call to BGS 'update_birls_record' fails" do
it "updates the form's status and does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- mock_service_by_flipper
- use_person_web_service_flipper_service
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return true
+
allow_any_instance_of(ClaimsApi::VetRecordWebService).to receive(:update_birls_record).and_return(
return_code: 'some error code'
)
@@ -122,8 +123,8 @@
context 'deciding to send a VA Notify email' do
before do
- mock_service_by_flipper
- use_person_web_service_flipper_service
+ use_vet_record_web_service_flipper
+ use_person_web_service_flipper
end
let(:poa) { create_poa }
@@ -131,6 +132,8 @@
context 'when the header key and rep are present' do
it 'sends the vanotify job' do
+ allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return true
+
poa.auth_headers.merge!({
header_key => 'this_value'
})
@@ -196,46 +199,6 @@
end
end
- context 'when the claims_api_use_person_web_service flipper is on' do
- let(:person_web_service) { instance_double(ClaimsApi::PersonWebService) }
-
- before do
- allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return false
- allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return true
- allow(ClaimsApi::PersonWebService).to receive(:new).with(external_uid: anything,
- external_key: anything)
- .and_return(person_web_service)
- allow(person_web_service).to receive(:find_by_ssn).and_return({ file_nbr: '796111863' })
- end
-
- it 'calls local bgs services instead of bgs-ext' do
- poa = create_poa
-
- subject.new.perform(poa.id)
- expect(person_web_service).to have_received(:find_by_ssn)
- end
- end
-
- context 'when the claims_api_use_vet_record_service flipper is on' do
- let(:vet_record_web_service) { instance_double(ClaimsApi::VetRecordWebService) }
-
- before do
- allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return false
- allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return true
- allow(ClaimsApi::PersonWebService).to receive(:new).with(external_uid: anything,
- external_key: anything)
- .and_return(vet_record_web_service)
- allow(vet_record_web_service).to receive(:update_birls_record).and_return({ return_code: 'BMOD0001' })
- end
-
- it 'calls local bgs services instead of bgs-ext' do
- poa = create_poa
-
- subject.new.perform(poa.id)
- expect(vet_record_web_service).to have_received(:update_birls_record)
- end
- end
-
private
def create_poa
@@ -245,29 +208,21 @@ def create_poa
poa
end
- def mock_service_by_flipper
+ def use_vet_record_web_service_flipper
if Flipper.enabled? :claims_api_use_vet_record_service
- create_mock_local_bgs_service
+ allow_any_instance_of(ClaimsApi::VetRecordWebService).to receive(:update_birls_record)
+ .and_return({ return_code: 'BMOD0001' })
else
- create_mock_bgs_ext_service
+ allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record)
+ .and_return({ return_code: 'BMOD0001' })
end
end
- def use_person_web_service_flipper_service
+ def use_person_web_service_flipper
if Flipper.enabled? :claims_api_use_person_web_service
allow_any_instance_of(ClaimsApi::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
else
allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
end
end
-
- def create_mock_bgs_ext_service
- allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record)
- .and_return({ return_code: 'BMOD0001' })
- end
-
- def create_mock_local_bgs_service
- allow_any_instance_of(ClaimsApi::VetRecordWebService).to receive(:update_birls_record)
- .and_return({ return_code: 'BMOD0001' })
- end
end
diff --git a/spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml b/spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml
new file mode 100644
index 00000000000..c3c63595be6
--- /dev/null
+++ b/spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml
@@ -0,0 +1,900 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: "/PersonWebServiceBean/PersonWebService?WSDL"
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Host:
+ - ".vba.va.gov"
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Fri, 22 Nov 2024 18:45:14 GMT
+ Server:
+ - Apache
+ X-Frame-Options:
+ - SAMEORIGIN
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml;charset=utf-8
+ Strict-Transport-Security:
+ - max-age=16000000; includeSubDomains; preload;
+ body:
+ encoding: UTF-8
+ string: |-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ recorded_at: Fri, 22 Nov 2024 18:45:14 GMT
+- request:
+ method: post
+ uri: "/PersonWebServiceBean/PersonWebService"
+ body:
+ encoding: UTF-8
+ string: |-
+
+
+ VAgovAPI
+
+
+ 10.0.0.205
+ 281
+ VAgovAPI
+ 123
+ 1@2.com
+
+
+ 796104437
+ headers:
+ Host:
+ - ".vba.va.gov"
+ Soapaction:
+ - '"findPersonBySSN"'
+ Content-Type:
+ - text/xml;charset=UTF-8
+ Content-Length:
+ - '1261'
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Fri, 22 Nov 2024 18:45:14 GMT
+ Server:
+ - Apache
+ X-Frame-Options:
+ - SAMEORIGIN
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml; charset=utf-8
+ Strict-Transport-Security:
+ - max-age=16000000; includeSubDomains; preload;
+ body:
+ encoding: UTF-8
+ string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=TAMPAFL1950-10-04T00:00:00-06:002022-01-01T00:00:00-06:002022-09-16T12:24:00-05:002022-09-16T12:24:00-05:00YCORPuser228@gmail.comN796104437MARK-2M2024-11-18T08:18:37-06:00VAgovAPI1@2.com123281VAGOVAPI -
+ BUPD218919619UVAGOVAPIPOLARBEAR-2T-1YUnknownNUU13367440Person13367440N7961044374317JR-137Y
+ recorded_at: Fri, 22 Nov 2024 18:45:14 GMT
+recorded_with: VCR 6.3.1
diff --git a/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml b/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
deleted file mode 100644
index 0d6a46f32c6..00000000000
--- a/spec/support/vcr_cassettes/bgs/person_web_service/poa_updater.yml
+++ /dev/null
@@ -1,688 +0,0 @@
----
-http_interactions:
-- request:
- method: post
- uri: "/PersonWebServiceBean/PersonWebService"
- body:
- encoding: UTF-8
- string: |
-
-
-
-
-
- VAgovAPI
-
-
- 127.0.0.1
- 281
- VAgovAPI
- 123
- 1@2.com
-
-
-
-
-
- 796104437
-
-
-
- headers:
- User-Agent:
- - ""
- Content-Type:
- - text/xml;charset=UTF-8
- Host:
- - ".vba.va.gov"
- Soapaction:
- - '"findPersonBySSN"'
- Accept-Encoding:
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
- Accept:
- - "*/*"
- response:
- status:
- code: 200
- message: OK
- headers:
- Date:
- - Mon, 18 Nov 2024 14:18:35 GMT
- Server:
- - Apache
- X-Frame-Options:
- - SAMEORIGIN
- Transfer-Encoding:
- - chunked
- Content-Type:
- - text/xml; charset=utf-8
- Strict-Transport-Security:
- - max-age=16000000; includeSubDomains; preload;
- body:
- encoding: UTF-8
- string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=TAMPAFL1950-10-04T00:00:00-06:002022-01-01T00:00:00-06:002022-09-16T12:24:00-05:002022-09-16T12:24:00-05:00YCORPuser228@gmail.comN796104437MARK-2M2024-11-15T15:59:32-06:00VAgovAPItesttest281VAGOVAPI -
- BUPD218917465UVAGOVAPIPOLARBEAR-2T-1YUnknownNUU13367440Person13367440N7961044374317JR-137Y
- recorded_at: Mon, 18 Nov 2024 14:18:35 GMT
-- request:
- method: get
- uri: "/VetRecordServiceBean/VetRecordWebService?WSDL"
- body:
- encoding: US-ASCII
- string: ''
- headers:
- User-Agent:
- - ""
- Accept-Encoding:
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
- Accept:
- - "*/*"
- response:
- status:
- code: 200
- message: OK
- headers:
- Date:
- - Mon, 18 Nov 2024 14:18:36 GMT
- Server:
- - Apache
- X-Frame-Options:
- - SAMEORIGIN
- Transfer-Encoding:
- - chunked
- Content-Type:
- - text/xml;charset=utf-8
- Strict-Transport-Security:
- - max-age=16000000; includeSubDomains; preload;
- body:
- encoding: UTF-8
- string: |-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- recorded_at: Mon, 18 Nov 2024 14:18:36 GMT
-- request:
- method: post
- uri: "/VetRecordServiceBean/VetRecordWebService"
- body:
- encoding: UTF-8
- string: |
-
-
-
-
-
- VAgovAPI
-
-
- 127.0.0.1
- 281
- VAgovAPI
- 123
- 1@2.com
-
-
-
-
-
-
- 796104437
- 796104437
- 0
- 72
- 00
-
-
-
-
- headers:
- User-Agent:
- - ""
- Content-Type:
- - text/xml;charset=UTF-8
- Host:
- - ".vba.va.gov"
- Soapaction:
- - '"updateBirlsRecord"'
- Accept-Encoding:
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
- Accept:
- - "*/*"
- response:
- status:
- code: 200
- message: OK
- headers:
- Date:
- - Mon, 18 Nov 2024 14:18:37 GMT
- Server:
- - Apache
- X-Frame-Options:
- - SAMEORIGIN
- X-Oracle-Dms-Ecid:
- - 3fae8a70-61f7-4431-9861-8dcc4330b2c3-0004d410
- X-Oracle-Dms-Rid:
- - '0'
- Transfer-Encoding:
- - chunked
- Content-Type:
- - text/xml; charset=utf-8
- Strict-Transport-Security:
- - max-age=16000000; includeSubDomains; preload;
- body:
- encoding: UTF-8
- string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=BMOD0001BIRLS
- Update successful796104437796104437
- ARMY0101196510011972SAT E6
- HON
- ARMY1002197201012005SAT E6
- UHC
- POLARBEARMARKTJRERRORSCAUSESTUXJRERRORSCAUSESTUXJRWEBBMARKJR1004195010/04/19500101202201/01/20220CLAIM3171123201011/23/2010
-
-
- EDU 3511119201011/19/2010
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 317YMDYNNUNKNOWN074
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 000VAGOVAPI2811115202411/15/2024 1
- recorded_at: Mon, 18 Nov 2024 14:18:38 GMT
-recorded_with: VCR 6.3.1
From 8736614aa6b2996e2891ba448f49c828c6e5b944 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Fri, 22 Nov 2024 14:01:07 -0700
Subject: [PATCH 16/17] Adds flipper test.
---
.../spec/sidekiq/poa_updater_spec.rb | 29 ++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
index 1e2994f0314..ec7bc44cfed 100644
--- a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
+++ b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
@@ -4,7 +4,8 @@
require 'bgs_service/person_web_service'
require 'bgs_service/vet_record_web_service'
-RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: 'bgs/person_web_service/find_by_ssn' do
+RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: ['bgs/person_web_service/find_by_ssn',
+ 'bgs/vet_record_service/update_birls_record'] do
subject { described_class }
before do
@@ -199,6 +200,32 @@
end
end
+ describe 'when the claims_api_use_person_web_service flipper is on' do
+ let(:person_web_service) { instance_double(ClaimsApi::PersonWebService) }
+ let(:vet_record_web_service) { instance_double(ClaimsApi::VetRecordWebService) }
+
+ before do
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_person_web_service).and_return true
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_web_service).and_return true
+ allow(ClaimsApi::PersonWebService).to receive(:new).with(external_uid: anything,
+ external_key: anything)
+ .and_return(person_web_service)
+ allow(ClaimsApi::VetRecordWebService).to receive(:new).with(external_uid: anything,
+ external_key: anything)
+ .and_return(person_web_service)
+ allow(person_web_service).to receive(:find_by_ssn).and_return({ file_nbr: '796111863' })
+ allow(vet_record_web_service).to receive(:update_birls_record).and_return({ return_code: 'BMOD0001' })
+ end
+
+ it 'calls local bgs services instead of bgs-ext' do
+ poa = create_poa
+ subject.new.perform(poa.id)
+
+ expect(person_web_service).to have_received(:find_by_ssn)
+ expect(vet_record_web_service).to have_received(:update_birls_record)
+ end
+ end
+
private
def create_poa
From 62ecd17047d3aa1e60b5c73091c6b304e16e82b0 Mon Sep 17 00:00:00 2001
From: Jennica Stiehl <25069483+stiehlrod@users.noreply.github.com>
Date: Tue, 26 Nov 2024 15:02:02 -0700
Subject: [PATCH 17/17] Adds tests for flipper.
---
.../spec/sidekiq/poa_updater_spec.rb | 74 +-
.../bgs/person_web_service/find_by_ssn.yml | 1155 +++++++++++++----
2 files changed, 914 insertions(+), 315 deletions(-)
diff --git a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
index ec7bc44cfed..ae3fdec4c8a 100644
--- a/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
+++ b/modules/claims_api/spec/sidekiq/poa_updater_spec.rb
@@ -1,11 +1,8 @@
# frozen_string_literal: true
require 'rails_helper'
-require 'bgs_service/person_web_service'
-require 'bgs_service/vet_record_web_service'
-RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: ['bgs/person_web_service/find_by_ssn',
- 'bgs/vet_record_service/update_birls_record'] do
+RSpec.describe ClaimsApi::PoaUpdater, type: :job, vcr: 'bgs/person_web_service/find_by_ssn' do
subject { described_class }
before do
@@ -25,8 +22,8 @@
context "when call to BGS 'update_birls_record' is successful" do
context 'and the poaCode is retrieved successfully from the V2 2122a form data' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
- use_vet_record_web_service_flipper
- use_person_web_service_flipper
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_person_web_service).and_return false
+ create_mock_lighthouse_service
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -56,8 +53,7 @@
context 'and record consent is granted' do
it "updates the form's status and creates 'ClaimsApi::PoaVBMSUpdater' job" do
- use_vet_record_web_service_flipper
- use_person_web_service_flipper
+ create_mock_lighthouse_service
expect(ClaimsApi::PoaVBMSUpdater).to receive(:perform_async)
poa = create_poa
@@ -73,8 +69,7 @@
context 'and record consent is not granted' do
context "because 'recordConsent' is false" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- use_vet_record_web_service_flipper
- use_person_web_service_flipper
+ create_mock_lighthouse_service
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -89,8 +84,7 @@
context "because a limitation exists in 'consentLimits'" do
it "updates the form's status but does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- use_vet_record_web_service_flipper
- use_person_web_service_flipper
+ create_mock_lighthouse_service
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
poa = create_poa
@@ -107,9 +101,8 @@
context "when call to BGS 'update_birls_record' fails" do
it "updates the form's status and does not create a 'ClaimsApi::PoaVBMSUpdater' job" do
- allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return true
-
- allow_any_instance_of(ClaimsApi::VetRecordWebService).to receive(:update_birls_record).and_return(
+ create_mock_lighthouse_service
+ allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record).and_return(
return_code: 'some error code'
)
expect(ClaimsApi::PoaVBMSUpdater).not_to receive(:perform_async)
@@ -124,8 +117,8 @@
context 'deciding to send a VA Notify email' do
before do
- use_vet_record_web_service_flipper
- use_person_web_service_flipper
+ create_mock_lighthouse_service
+ allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return true
end
let(:poa) { create_poa }
@@ -133,8 +126,6 @@
context 'when the header key and rep are present' do
it 'sends the vanotify job' do
- allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return true
-
poa.auth_headers.merge!({
header_key => 'this_value'
})
@@ -148,6 +139,7 @@
context 'when the flipper is on' do
it 'does not send the vanotify job' do
+ allow(Flipper).to receive(:enabled?).with(:lighthouse_claims_api_v2_poa_va_notify).and_return false
Flipper.disable(:lighthouse_claims_api_v2_poa_va_notify)
poa.auth_headers.merge!({
@@ -202,26 +194,38 @@
describe 'when the claims_api_use_person_web_service flipper is on' do
let(:person_web_service) { instance_double(ClaimsApi::PersonWebService) }
- let(:vet_record_web_service) { instance_double(ClaimsApi::VetRecordWebService) }
before do
allow(Flipper).to receive(:enabled?).with(:claims_api_use_person_web_service).and_return true
- allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_web_service).and_return true
allow(ClaimsApi::PersonWebService).to receive(:new).with(external_uid: anything,
external_key: anything)
.and_return(person_web_service)
+ allow(person_web_service).to receive(:find_by_ssn).and_return({ file_nbr: '796111863' })
+ end
+
+ it 'calls local bgs person web service instead of bgs-ext' do
+ poa = create_poa
+ subject.new.perform(poa.id)
+
+ expect(person_web_service).to have_received(:find_by_ssn)
+ end
+ end
+
+ describe 'when the claims_api_use_vet_record_service flipper is on' do
+ let(:vet_record_web_service) { instance_double(ClaimsApi::VetRecordWebService) }
+
+ before do
+ allow(Flipper).to receive(:enabled?).with(:claims_api_use_vet_record_service).and_return true
allow(ClaimsApi::VetRecordWebService).to receive(:new).with(external_uid: anything,
external_key: anything)
- .and_return(person_web_service)
- allow(person_web_service).to receive(:find_by_ssn).and_return({ file_nbr: '796111863' })
+ .and_return(vet_record_web_service)
allow(vet_record_web_service).to receive(:update_birls_record).and_return({ return_code: 'BMOD0001' })
end
- it 'calls local bgs services instead of bgs-ext' do
+ it 'calls local bgs vet record service instead of bgs-ext' do
poa = create_poa
subject.new.perform(poa.id)
- expect(person_web_service).to have_received(:find_by_ssn)
expect(vet_record_web_service).to have_received(:update_birls_record)
end
end
@@ -235,21 +239,9 @@ def create_poa
poa
end
- def use_vet_record_web_service_flipper
- if Flipper.enabled? :claims_api_use_vet_record_service
- allow_any_instance_of(ClaimsApi::VetRecordWebService).to receive(:update_birls_record)
- .and_return({ return_code: 'BMOD0001' })
- else
- allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record)
- .and_return({ return_code: 'BMOD0001' })
- end
- end
-
- def use_person_web_service_flipper
- if Flipper.enabled? :claims_api_use_person_web_service
- allow_any_instance_of(ClaimsApi::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
- else
- allow_any_instance_of(ClaimsApi::LocalBGS).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
- end
+ def create_mock_lighthouse_service
+ allow_any_instance_of(BGS::PersonWebService).to receive(:find_by_ssn).and_return({ file_nbr: '123456789' })
+ allow_any_instance_of(BGS::VetRecordWebService).to receive(:update_birls_record)
+ .and_return({ return_code: 'BMOD0001' })
end
end
diff --git a/spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml b/spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml
index b98b1161b6b..f8ee36c91bc 100644
--- a/spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml
+++ b/spec/support/vcr_cassettes/bgs/person_web_service/find_by_ssn.yml
@@ -21,7 +21,7 @@ http_interactions:
message: OK
headers:
Date:
- - Thu, 21 Nov 2024 21:19:08 GMT
+ - Tue, 26 Nov 2024 21:56:34 GMT
Server:
- Apache
X-Frame-Options:
@@ -41,20 +41,74 @@ http_interactions:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -62,11 +116,11 @@ http_interactions:
-
-
+
+
-
-
+
+
@@ -74,11 +128,11 @@ http_interactions:
-
-
+
+
-
-
+
+
@@ -86,23 +140,11 @@ http_interactions:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
@@ -110,12 +152,30 @@ http_interactions:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -128,23 +188,17 @@ http_interactions:
-
-
-
-
-
-
-
-
+
+
-
-
+
+
@@ -158,77 +212,29 @@ http_interactions:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -236,79 +242,123 @@ http_interactions:
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -319,20 +369,15 @@ http_interactions:
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -344,85 +389,220 @@ http_interactions:
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
@@ -446,7 +626,7 @@ http_interactions:
-
+
@@ -458,7 +638,7 @@ http_interactions:
-
+
@@ -470,7 +650,7 @@ http_interactions:
-
+
@@ -482,7 +662,7 @@ http_interactions:
-
+
@@ -494,7 +674,7 @@ http_interactions:
-
+
@@ -506,7 +686,7 @@ http_interactions:
-
+
@@ -518,7 +698,7 @@ http_interactions:
-
+
@@ -530,7 +710,7 @@ http_interactions:
-
+
@@ -542,7 +722,7 @@ http_interactions:
-
+
@@ -554,7 +734,7 @@ http_interactions:
-
+
@@ -566,7 +746,7 @@ http_interactions:
-
+
@@ -578,7 +758,7 @@ http_interactions:
-
+
@@ -590,7 +770,7 @@ http_interactions:
-
+
@@ -602,7 +782,7 @@ http_interactions:
-
+
@@ -614,7 +794,7 @@ http_interactions:
-
+
@@ -626,7 +806,7 @@ http_interactions:
-
+
@@ -638,7 +818,7 @@ http_interactions:
-
+
@@ -650,7 +830,309 @@ http_interactions:
-
+
+
+
+
+
+
+
+ recorded_at: Tue, 26 Nov 2024 21:56:34 GMT
+- request:
+ method: post
+ uri: "/PersonWebServiceBean/PersonWebService"
+ body:
+ encoding: UTF-8
+ string: |-
+
+
+ VAgovAPI
+
+
+ 10.0.0.205
+ 281
+ VAgovAPI
+ 123
+ 1@2.com
+
+
+ 796104437
+ headers:
+ Host:
+ - ".vba.va.gov"
+ Soapaction:
+ - '"findPersonBySSN"'
+ Content-Type:
+ - text/xml;charset=UTF-8
+ Content-Length:
+ - '1261'
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Tue, 26 Nov 2024 21:56:35 GMT
+ Server:
+ - Apache
+ X-Frame-Options:
+ - SAMEORIGIN
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml; charset=utf-8
+ Strict-Transport-Security:
+ - max-age=16000000; includeSubDomains; preload;
+ body:
+ encoding: UTF-8
+ string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=TAMPAFL1950-10-04T00:00:00-06:002022-01-01T00:00:00-06:002022-09-16T12:24:00-05:002022-09-16T12:24:00-05:00YCORPuser228@gmail.comN796104437MARK-2M2024-11-26T15:36:00-06:00VAgovAPI1@2.com123281VAGOVAPI -
+ BUPD218942542UVAGOVAPIPOLARBEAR-2T-1YUnknownNUU13367440Person13367440N7961044374317JR-137Y
+ recorded_at: Tue, 26 Nov 2024 21:56:35 GMT
+- request:
+ method: get
+ uri: "/VetRecordServiceBean/VetRecordWebService?WSDL"
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Host:
+ - ".vba.va.gov"
+ Accept-Encoding:
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ Accept:
+ - "*/*"
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Tue, 26 Nov 2024 21:56:35 GMT
+ Server:
+ - Apache
+ X-Frame-Options:
+ - SAMEORIGIN
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml;charset=utf-8
+ Strict-Transport-Security:
+ - max-age=16000000; includeSubDomains; preload;
+ body:
+ encoding: UTF-8
+ string: |-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -658,11 +1140,11 @@ http_interactions:
-
-
+
+
-
+
@@ -670,11 +1152,11 @@ http_interactions:
-
-
+
+
-
+
@@ -682,11 +1164,11 @@ http_interactions:
-
-
+
+
-
+
@@ -694,11 +1176,11 @@ http_interactions:
-
-
+
+
-
+
@@ -706,11 +1188,11 @@ http_interactions:
-
-
+
+
-
+
@@ -718,11 +1200,11 @@ http_interactions:
-
-
+
+
-
+
@@ -730,11 +1212,11 @@ http_interactions:
-
-
+
+
-
+
@@ -742,11 +1224,11 @@ http_interactions:
-
-
+
+
-
+
@@ -754,11 +1236,11 @@ http_interactions:
-
-
+
+
-
+
@@ -766,11 +1248,11 @@ http_interactions:
-
-
+
+
-
+
@@ -778,11 +1260,11 @@ http_interactions:
-
-
+
+
-
+
@@ -790,11 +1272,11 @@ http_interactions:
-
-
+
+
-
+
@@ -802,11 +1284,11 @@ http_interactions:
-
-
+
+
-
+
@@ -814,11 +1296,11 @@ http_interactions:
-
-
+
+
-
+
@@ -826,25 +1308,49 @@ http_interactions:
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
- recorded_at: Thu, 21 Nov 2024 21:19:08 GMT
+ recorded_at: Tue, 26 Nov 2024 21:56:35 GMT
- request:
method: post
- uri: "/PersonWebServiceBean/PersonWebService"
+ uri: "/VetRecordServiceBean/VetRecordWebService"
body:
encoding: UTF-8
string: |-
-
+
VAgovAPI
@@ -852,21 +1358,20 @@ http_interactions:
10.0.0.205
281
VAgovAPI
-
- 796378881
- 796378881
+ 123
+ 1@2.com
- 796378881
+ 79610443779610443700074
headers:
Host:
- ".vba.va.gov"
Soapaction:
- - '"findPersonBySSN"'
+ - '"updateBirlsRecord"'
Content-Type:
- text/xml;charset=UTF-8
Content-Length:
- - '1269'
+ - '1476'
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
@@ -879,11 +1384,15 @@ http_interactions:
message: OK
headers:
Date:
- - Thu, 21 Nov 2024 21:19:08 GMT
+ - Tue, 26 Nov 2024 21:56:36 GMT
Server:
- Apache
X-Frame-Options:
- SAMEORIGIN
+ X-Oracle-Dms-Ecid:
+ - fdfca44e-78a2-4e38-9b9e-cb506638b894-0001e406
+ X-Oracle-Dms-Rid:
+ - '0'
Transfer-Encoding:
- chunked
Content-Type:
@@ -894,8 +1403,106 @@ http_interactions:
encoding: UTF-8
string: rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=SALINASKS1954-12-15T00:00:00-06:002022-10-03T15:35:53-05:002022-10-03T15:35:53-05:00YCORP0valid@somedomain.comN796378881JESSE-2M2024-11-21T15:18:35-06:00VAgovAPIlighthouse-vets-apilighthouse-vets-api281VAGOVAPI -
- BUPD218935360UVAGOVAPIGRAY-1ADSUSEONLY-1YNUU600045026Person600045026NN796378881031781Y
- recorded_at: Thu, 21 Nov 2024 21:19:08 GMT
+ xmlns:work="http://oracle.com/weblogic/soap/workarea/">rO0ABXdTAB13ZWJsb2dpYy5hcHAuQ29ycG9yYXRlRGF0YUVBUgAAANYAAAAjd2VibG9naWMud29ya2FyZWEuU3RyaW5nV29ya0NvbnRleHQABTMuNS4wAAA=BMOD0001BIRLS
+ Update successful796104437796104437
+ ARMY0101196510011972SAT E6
+ HON
+ ARMY1002197201012005SAT E6
+ UHC
+ POLARBEARMARKTJRERRORSCAUSESTUXJRERRORSCAUSESTUXJRWEBBMARKJR1004195010/04/19500101202201/01/20220CLAIM3171123201011/23/2010
+
+
+ EDU 3511119201011/19/2010
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 317YMDYNNUNKNOWN074
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 000VAGOVAPI2811126202411/26/2024 1
+ recorded_at: Tue, 26 Nov 2024 21:56:37 GMT
recorded_with: VCR 6.3.1