Skip to content

Commit dd75cd7

Browse files
Removed extra pciu migration flippers (#21108)
* Removed extra pciu migration flippers * fixed failing specs * fixed update spec * fixed mdot spec * fixed swagger spec * rubo and bgs service spec fixed * fixed form prefill spec
1 parent 33b9173 commit dd75cd7

File tree

62 files changed

+123
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+123
-302
lines changed

app/controllers/concerns/vet360/transactionable.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def check_transaction_status!
2323
private
2424

2525
def service
26-
if Flipper.enabled?(:va_v3_contact_information_service, @current_user)
26+
if Flipper.enabled?(:remove_pciu, @current_user)
2727
VAProfile::V2::ContactInformation::Service.new @current_user
2828
else
2929
VAProfile::ContactInformation::Service.new @current_user

app/controllers/concerns/vet360/writeable.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def write_to_vet360_and_render_transaction!(type, params, http_verb: 'post')
2727
end
2828

2929
def invalidate_cache
30-
if Flipper.enabled?(:va_v3_contact_information_service, @current_user)
30+
if Flipper.enabled?(:remove_pciu, @current_user)
3131
VAProfileRedis::V2::Cache.invalidate(@current_user)
3232
else
3333
VAProfileRedis::Cache.invalidate(@current_user)
@@ -38,7 +38,7 @@ def invalidate_cache
3838

3939
def build_record(type, params)
4040
# This needs to be refactored after V2 upgrade is complete
41-
if type == 'address' && Flipper.enabled?(:va_v3_contact_information_service, @current_user)
41+
if type == 'address' && Flipper.enabled?(:remove_pciu, @current_user)
4242
model = 'VAProfile::Models::V3::Address'
4343
# Ensures the address_pou is valid
4444
params[:address_pou] = 'RESIDENCE' if params[:address_pou] == 'RESIDENCE/CHOICE'
@@ -61,7 +61,7 @@ def validate!(record)
6161
end
6262

6363
def service
64-
if Flipper.enabled?(:va_v3_contact_information_service, @current_user)
64+
if Flipper.enabled?(:remove_pciu, @current_user)
6565
VAProfile::V2::ContactInformation::Service.new @current_user
6666
else
6767
VAProfile::ContactInformation::Service.new @current_user

app/controllers/v0/profile/address_validation_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AddressValidationController < ApplicationController
1313
skip_before_action :authenticate, only: [:create]
1414

1515
def create
16-
address = if Flipper.enabled?(:va_v3_contact_information_service)
16+
address = if Flipper.enabled?(:remove_pciu)
1717
VAProfile::Models::V3::ValidationAddress.new(address_params)
1818
else
1919
VAProfile::Models::ValidationAddress.new(address_params)
@@ -49,7 +49,7 @@ def address_params
4949
end
5050

5151
def service
52-
@service ||= if Flipper.enabled?(:va_v3_contact_information_service)
52+
@service ||= if Flipper.enabled?(:remove_pciu)
5353
VAProfile::V3::AddressValidation::Service.new
5454
else
5555
VAProfile::AddressValidation::Service.new

app/controllers/v0/profile/persons_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PersonsController < ApplicationController
1212
after_action :invalidate_mpi_cache
1313

1414
def initialize_vet360_id
15-
response = if Flipper.enabled?(:va_v3_contact_information_service, @current_user)
15+
response = if Flipper.enabled?(:remove_pciu, @current_user)
1616
VAProfile::V2::Person::Service.new(@current_user).init_vet360_id
1717
else
1818
VAProfile::Person::Service.new(@current_user).init_vet360_id

app/controllers/v0/profile/transactions_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def transaction_params
2929
end
3030

3131
def service
32-
if Flipper.enabled?(:va_v3_contact_information_service, @current_user)
32+
if Flipper.enabled?(:remove_pciu, @current_user)
3333
VAProfile::V2::ContactInformation::Service.new @current_user
3434
else
3535
VAProfile::ContactInformation::Service.new @current_user

app/controllers/v0/veteran_readiness_employment_claims_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def encrypted_user
4646
uuid: current_user.uuid,
4747
icn: current_user.icn,
4848
first_name: current_user.first_name,
49-
va_profile_email: current_user.va_profile_email || current_user.va_profile_v2_email
49+
va_profile_email: current_user.va_profile_email
5050
)
5151
KmsEncrypted::Box.new.encrypt(user_struct.to_h.to_json)
5252
end

app/models/async_transaction/va_profile/base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def self.last_requested_for_user(user)
4343
#
4444
def self.start(user, response)
4545
# vet360_id is no longer required for Contact Information API V2
46-
source_id = if Flipper.enabled?(:va_v3_contact_information_service,
46+
source_id = if Flipper.enabled?(:remove_pciu,
4747
user)
4848
user.vet360_id || user.uuid
4949
else

app/models/form_profiles/va_21686c.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def metadata
108108
end
109109

110110
def prefill
111-
if Flipper.enabled?(:va_v3_contact_information_service, user)
111+
if Flipper.enabled?(:remove_pciu, user)
112112
return {} unless user.authorize :va_profile, :access_to_v2?
113113
else
114114
return {} unless user.authorize :evss, :access?

app/models/form_profiles/va_526ez.rb

+5-6
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def initialize_vets360_contact_info
186186
end
187187

188188
def initialize_veteran_contact_information
189-
if Flipper.enabled?(:disability_compensation_remove_pciu, user)
189+
if Flipper.enabled?(:remove_pciu, user)
190190
return {} unless user.authorize :va_profile, :access_to_v2?
191191

192192
contact_info = initialize_vets360_contact_info
@@ -202,11 +202,10 @@ def initialize_veteran_contact_information
202202
end
203203
# Logging was added below to contrast/compare completeness of contact information returned
204204
# from VA Profile alone versus VA Profile + PCIU. This logging will be removed when the Flipper flag is.
205-
Rails.logger.info("disability_compensation_remove_pciu=#{Flipper.enabled?(:disability_compensation_remove_pciu,
206-
user)}," \
207-
"mailing_address=#{contact_info[:mailing_address].present?}," \
208-
"email_address=#{contact_info[:email_address].present?}," \
209-
"primary_phone=#{contact_info[:primary_phone].present?}")
205+
Rails.logger.info("remove_pciu=#{Flipper.enabled?(:remove_pciu, user)}," \
206+
"mailing_address=#{contact_info[:mailing_address].present?}," \
207+
"email_address=#{contact_info[:email_address].present?}," \
208+
"primary_phone=#{contact_info[:primary_phone].present?}")
210209

211210
contact_info = VA526ez::FormContactInformation.new(contact_info)
212211

app/models/user.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,15 @@ def onboarding
410410
delegate :show_onboarding_flow_on_login, to: :onboarding, allow_nil: true
411411

412412
def vet360_contact_info
413-
return nil unless VAProfile::Configuration::SETTINGS.contact_information.enabled && vet360_id.present?
413+
return nil unless VAProfile::Configuration::SETTINGS.contact_information.enabled &&
414+
(
415+
(!Flipper.enabled?(:remove_pciu, self) && vet360_id.present?) ||
416+
(Flipper.enabled?(:remove_pciu, self) && icn.present?)
417+
)
414418

415-
@vet360_contact_info ||= if Flipper.enabled?(:remove_pciu, self)
419+
@vet360_contact_info ||= if Flipper.enabled?(:remove_pciu, self) && icn.present?
416420
VAProfileRedis::V2::ContactInformation.for_user(self)
417-
else
421+
elsif !Flipper.enabled?(:remove_pciu, self) && vet360_id.present?
418422
VAProfileRedis::ContactInformation.for_user(self)
419423
end
420424
end

app/policies/va_profile_policy.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def access?
66
end
77

88
def access_to_v2?
9-
if Flipper.enabled?(:va_v3_contact_information_service, user)
9+
if Flipper.enabled?(:remove_pciu, user)
1010
user.icn.present?
1111
else
1212
user.vet360_id.present?

app/services/users/profile.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ def form_526_required_identifiers
119119
end
120120

121121
def vet360_contact_information
122-
contact_info_v2_enabled = Flipper.enabled?(:va_v3_contact_information_service, user)
123-
person = contact_info_v2_enabled ? user.vaprofile_contact_info : user.vet360_contact_info
122+
person = user.vet360_contact_info
124123
return {} if person.blank?
125124

126125
{

config/features.yml

-14
Original file line numberDiff line numberDiff line change
@@ -1602,14 +1602,6 @@ features:
16021602
actor_type: user
16031603
enable_in_development: true
16041604
description: Toggle for warning user of appointment conflicts on the direct scheduling calendar during booking.
1605-
va_v2_person_service:
1606-
actor_type: user
1607-
description: When enabled, the VAProfile::V2::Person::Service will be enabled
1608-
enable_in_development: true
1609-
va_v3_contact_information_service:
1610-
actor_type: user
1611-
description: When enabled, the VAProfile::V3::ContactInformation will be enabled
1612-
enable_in_development: true
16131605
veteran_onboarding_beta_flow:
16141606
actor_type: user
16151607
description: Conditionally display the new veteran onboarding flow to user
@@ -1749,9 +1741,6 @@ features:
17491741
disability_compensation_prevent_submission_job:
17501742
actor_type: user
17511743
description: If enabled, the submission form526 record will be created, but there will be submission job
1752-
disability_compensation_remove_pciu:
1753-
actor_type: user
1754-
description: If enabled, VA Profile is used to populate contact information- without PCIU calls (status quo)
17551744
disability_compensation_use_api_provider_for_bdd_instructions:
17561745
actor_type: user
17571746
description: Provide a temporary killswitch for using the ApiProviderFactory to select an API for uploading BDD instructions
@@ -1979,9 +1968,6 @@ features:
19791968
remove_pciu:
19801969
actor_type: user
19811970
description: If enabled, VA Profile is used to populate contact information with PCIU backup calls
1982-
remove_pciu_2:
1983-
actor_type: user
1984-
description: If enabled, removes all PCIU requests in form pre-fill.
19851971
show_yellow_ribbon_table:
19861972
actor_type: user
19871973
description: Used to show yellow ribbon table in Comparison Tool

lib/va_profile/v2/contact_information/service.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def post_email(email)
137137
def put_email(email)
138138
old_email =
139139
begin
140-
@user.va_profile_v2_email
140+
@user.va_profile_email
141141
rescue
142142
nil
143143
end
@@ -238,7 +238,7 @@ def send_contact_change_notification(transaction_status, personalisation)
238238
transaction_id = transaction.id
239239
return if TransactionNotification.find(transaction_id).present?
240240

241-
email = @user.va_profile_v2_email
241+
email = @user.va_profile_email
242242
return if email.blank?
243243

244244
VANotifyEmailJob.perform_async(

modules/ask_va_api/app/controllers/ask_va_api/v0/address_validation_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class AddressValidationController < ApplicationController
1313
service_tag 'profile'
1414

1515
def create
16-
address = if Flipper.enabled?(:va_v3_contact_information_service)
16+
address = if Flipper.enabled?(:remove_pciu)
1717
VAProfile::Models::V3::ValidationAddress.new(address_params)
1818
else
1919
VAProfile::Models::ValidationAddress.new(address_params)
@@ -47,7 +47,7 @@ def address_params
4747
end
4848

4949
def service
50-
@service ||= if Flipper.enabled?(:va_v3_contact_information_service)
50+
@service ||= if Flipper.enabled?(:remove_pciu)
5151
VAProfile::V3::AddressValidation::Service.new
5252
else
5353
VAProfile::AddressValidation::Service.new

modules/ask_va_api/spec/requests/ask_va_api/v0/address_validation_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
let(:incorrect_address_pou) { build(:va_profile_v3_address, :incorrect_address_pou) }
121121

122122
before do
123-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service).and_return(true)
123+
allow(Flipper).to receive(:enabled?).with(:remove_pciu).and_return(true)
124124
end
125125

126126
shared_examples 'invalid address' do

modules/burials/spec/lib/burials/form_profiles/va_21p530ez_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
let(:address) { instance_double(Address, country: 'USA') }
1111

1212
before do
13+
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1314
allow(FormProfile).to receive(:prefill_enabled_forms).and_return([form_id])
1415
end
1516

modules/mobile/app/models/mobile/v0/user_accessible_services.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def service_auth_map
3838
prescriptions: access?(mhv_prescriptions: :access?),
3939
scheduleAppointments: access?(schedule_appointment: :access?),
4040
secureMessaging: access?(mhv_messaging: :mobile_access?),
41-
userProfileUpdate: access?(vet360: :access?)
41+
userProfileUpdate: access?(va_profile: :access_to_v2?)
4242
}
4343
end
4444
# rubocop:enable Metrics/MethodLength

modules/mobile/spec/requests/mobile/v0/community_care_providers_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
let(:json_body_headers) { { 'Content-Type' => 'application/json', 'Accept' => 'application/json' } }
1212

1313
before do
14-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(false)
1514
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(false)
1615
end
1716

modules/mobile/spec/requests/mobile/v0/user/addresses_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
before do
1111
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info, instance_of(User)).and_return(true)
1212
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info).and_return(true)
13-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(true)
1413
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1514
Timecop.freeze(Time.zone.parse('2024-08-27T18:51:06.012Z'))
1615
end

modules/mobile/spec/requests/mobile/v0/user/contact_info_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require_relative '../../../../support/helpers/rails_helper'
44
RSpec.describe 'Mobile::V0::User::ContactInfo', type: :request do
55
before do
6-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(false)
76
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(false)
87
end
98

modules/mobile/spec/requests/mobile/v0/user/emails_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
before do
1111
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info, instance_of(User)).and_return(true)
12-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(true)
1312
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1413
Timecop.freeze(Time.zone.parse('2024-08-27T18:51:06.000Z'))
1514
end

modules/mobile/spec/requests/mobile/v0/user/phones_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
before do
1515
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info, instance_of(User)).and_return(true)
16-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(true)
1716
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1817
Timecop.freeze(Time.zone.parse('2024-08-27T18:51:06.012Z'))
1918
end

modules/mobile/spec/requests/mobile/v0/user_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
before do
1414
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info, instance_of(User)).and_return(true)
15-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(true)
1615
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1716
allow(Flipper).to receive(:enabled?).with(:mobile_lighthouse_letters, instance_of(User)).and_return(false)
1817
allow(Flipper).to receive(:enabled?).with(:mobile_lighthouse_claims, instance_of(User)).and_return(false)

modules/mobile/spec/requests/mobile/v1/user_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
before do
1010
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info, instance_of(User)).and_return(true)
11-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(true)
1211
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1312
allow(Flipper).to receive(:enabled?).with(:mobile_lighthouse_letters, instance_of(User)).and_return(false)
1413
allow(Flipper).to receive(:enabled?).with(:mobile_lighthouse_claims, instance_of(User)).and_return(false)

modules/mobile/spec/services/sync_update_service_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
before do
1010
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info, instance_of(User)).and_return(true)
11-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(true)
1211
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1312
Timecop.freeze(Time.zone.parse('2024-09-16T16:09:37.000Z'))
1413
end

modules/mobile/spec/sidekiq/vet360_linking_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
before do
99
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info, instance_of(User)).and_return(true)
1010
allow(Flipper).to receive(:enabled?).with(:mobile_v2_contact_info).and_return(true)
11-
allow(Flipper).to receive(:enabled?).with(:va_v3_contact_information_service, instance_of(User)).and_return(true)
1211
allow(Flipper).to receive(:enabled?).with(:remove_pciu, instance_of(User)).and_return(true)
1312
end
1413

modules/veteran/app/sidekiq/organizations/update.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def record_can_be_updated?(org_data)
7474
# @param address [Hash] A hash containing the details of the organization's address.
7575
# @return [VAProfile::Models::ValidationAddress] A validation address object ready for address validation service.
7676
def build_validation_address(address)
77-
validation_model = if Flipper.enabled?(:va_v3_contact_information_service)
77+
validation_model = if Flipper.enabled?(:remove_pciu)
7878
VAProfile::Models::V3::ValidationAddress
7979
else
8080
VAProfile::Models::ValidationAddress
@@ -97,7 +97,7 @@ def build_validation_address(address)
9797
# @param candidate_address [VAProfile::Models::ValidationAddress] The address to be validated.
9898
# @return [Hash] The response from the address validation service.
9999
def validate_address(candidate_address)
100-
validation_service = if Flipper.enabled?(:va_v3_contact_information_service)
100+
validation_service = if Flipper.enabled?(:remove_pciu)
101101
VAProfile::V3::AddressValidation::Service.new
102102
else
103103
VAProfile::AddressValidation::Service.new
@@ -131,7 +131,7 @@ def update_org_record(org_data, api_response)
131131
# @param org_data [Hash] Original org_data containing the address and other details.
132132
# @param api_response [Hash] The response from the address validation service.
133133
def build_address_attributes(org_data, api_response)
134-
if Flipper.enabled?(:va_v3_contact_information_service)
134+
if Flipper.enabled?(:remove_pciu)
135135
build_v3_address(api_response['candidate_addresses'].first)
136136
else
137137
address = api_response['candidate_addresses'].first['address']

modules/veteran/app/sidekiq/representatives/update.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def record_can_be_updated?(rep_data)
7777
# @param address [Hash] A hash containing the details of the representative's address.
7878
# @return [VAProfile::Models::ValidationAddress] A validation address object ready for address validation service.
7979
def build_validation_address(address)
80-
validation_model = if Flipper.enabled?(:va_v3_contact_information_service)
80+
validation_model = if Flipper.enabled?(:remove_pciu)
8181
VAProfile::Models::V3::ValidationAddress
8282
else
8383
VAProfile::Models::ValidationAddress
@@ -100,7 +100,7 @@ def build_validation_address(address)
100100
# @param candidate_address [VAProfile::Models::ValidationAddress] The address to be validated.
101101
# @return [Hash] The response from the address validation service.
102102
def validate_address(candidate_address)
103-
validation_service = if Flipper.enabled?(:va_v3_contact_information_service)
103+
validation_service = if Flipper.enabled?(:remove_pciu)
104104
VAProfile::V3::AddressValidation::Service.new
105105
else
106106
VAProfile::AddressValidation::Service.new
@@ -157,7 +157,7 @@ def update_flags(representative_id, flag_type)
157157
# @param rep_data [Hash] Original rep_data containing the address and other details.
158158
# @param api_response [Hash] The response from the address validation service.
159159
def build_address_attributes(rep_data, api_response)
160-
if Flipper.enabled?(:va_v3_contact_information_service)
160+
if Flipper.enabled?(:remove_pciu)
161161
build_v3_address(api_response['candidate_addresses'].first)
162162
else
163163
address = api_response['candidate_addresses'].first['address']

0 commit comments

Comments
 (0)