diff --git a/app/controllers/v0/profile/direct_deposits/disability_compensations_controller.rb b/app/controllers/v0/profile/direct_deposits/disability_compensations_controller.rb index ddd422014f3..f6ed8e38c6f 100644 --- a/app/controllers/v0/profile/direct_deposits/disability_compensations_controller.rb +++ b/app/controllers/v0/profile/direct_deposits/disability_compensations_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true +require 'lighthouse/service_exception' require 'lighthouse/direct_deposit/client' +require 'lighthouse/direct_deposit/error_parser' require 'lighthouse/direct_deposit/payment_account' module V0 @@ -10,6 +12,13 @@ class DisabilityCompensationsController < ApplicationController before_action :controller_enabled? before_action { authorize :lighthouse, :access_disability_compensations? } + rescue_from(*Lighthouse::ServiceException::ERROR_MAP.values) do |exception| + error = { status: exception.status_code, body: exception.errors.first } + response = Lighthouse::DirectDeposit::ErrorParser.parse(error) + + render status: response.status, json: response.body + end + def show response = client.get_payment_info @@ -18,6 +27,15 @@ def show serializer: DisabilityCompensationsSerializer end + def update + response = client.update_payment_info(payment_account) + send_confirmation_email + + render status: response.status, + json: response.body, + serializer: DisabilityCompensationsSerializer + end + private def controller_enabled? diff --git a/app/swagger/swagger/requests/profile.rb b/app/swagger/swagger/requests/profile.rb index 273ea21fa87..4578fd9ae36 100644 --- a/app/swagger/swagger/requests/profile.rb +++ b/app/swagger/swagger/requests/profile.rb @@ -74,14 +74,14 @@ class Profile end response 400 do - key :description, ' Bad Request' + key :description, 'Bad Request' schema do key :required, [:errors] property :errors do key :type, :array items do - key :required, %i[title detail code status] + key :required, %i[title detail code source] property :title, type: :string, example: 'Invalid field value', description: 'Error title' @@ -89,11 +89,11 @@ class Profile example: 'getDirectDeposit.icn size must be between 17 and 17, getDirectDeposit.icn must match \"^\\d{10}V\\d{6}$\"', description: 'Description of error (optional)' property :code, type: :string, - example: 'LIGHTHOUSE_DIRECT_DEPOSIT400', + example: 'cnp.payment.icn.invalid', description: 'Service name with code appended' - property :status, type: :string, - example: '400', - description: 'http status code' + property :source, type: %i[string object], + example: 'Lighthouse Direct Deposit', + description: 'Service name' end end end @@ -107,12 +107,13 @@ class Profile property :errors do key :type, :array items do - key :required, %i[title detail code status] + key :required, %i[title detail code source] property :title, type: :string, example: 'Invalid token.', description: 'Error title' property :detail, type: %i[string null], description: 'Description of error (optional)' - property :code, type: :string, example: 'LIGHTHOUSE_DIRECT_DEPOSIT401', - description: 'Service name with code appended' - property :status, type: :string, example: '401', description: 'http status code' + property :code, type: :string, example: 'cnp.payment.invalid.token', + description: 'Error code' + property :source, type: %i[string object], example: 'Lighthouse Direct Deposit', + description: 'Service name' end end end @@ -126,31 +127,110 @@ class Profile property :errors do key :type, :array items do - key :required, %i[title detail code status] + key :required, %i[title detail code source] property :title, type: :string, example: 'Person for ICN not found', description: 'Error title' property :detail, type: :string, example: 'No data found for ICN', description: 'Description of error (optional)' - property :code, type: :string, example: 'LIGHTHOUSE_DIRECT_DEPOSIT404', + property :code, type: :string, example: 'cnp.payment.icn.not.found', description: 'Service name with code appended' - property :status, type: :string, example: '404', description: 'http status code' + property :source, type: %i[string object], example: 'Lighthouse Direct Deposit', + description: 'Service name' end end end end + end - response 502 do - key :description, 'Bad Gateway' + operation :put do + key :produces, ['application/json'] + key :consumes, ['application/json'] + key :description, 'Update a veterans direct deposit information for compensation and pension benefits' + key :tags, %w[ + profile + ] + + parameter :authorization + + parameter do + key :name, :body + key :in, :body + key :description, 'Attributes to update a payment account.' + key :required, true + + schema do + property :account_number, type: :string, example: '1234567890' + property :account_type, type: :string, example: 'Checking' + property :routing_number, type: :string, example: '031000503' + end + end + + response 200 do + key :description, 'Direct deposit information for a users compensation and pension benefits.' + schema do + key :type, :object + property(:data) do + key :type, :object + property :id, type: :string + property :type, type: :string + property :attributes do + key :type, :object + + property :control_information do + key :required, %i[ + can_update_direct_deposit + is_corp_available + is_corp_rec_found + has_no_bdn_payments + has_identity + has_index + is_competent + has_mailing_address + has_no_fiduciary_assigned + is_not_deceased + has_payment_address + ] + property :can_update_direct_deposit, type: :boolean, example: true, description: 'Must be true to view payment account information' + property :is_corp_available, type: :boolean, example: true, description: '' + property :is_corp_rec_found, type: :boolean, example: true, description: '' + property :has_no_bdn_payments, type: :boolean, example: true, description: '' + property :has_identity, type: :boolean, example: true, description: '' + property :has_index, type: :boolean, example: true, description: '' + property :is_competent, type: :boolean, example: true, description: '' + property :has_mailing_addres, type: :boolean, example: true, description: '' + property :has_no_fiduciary_assigne, type: :boolean, example: true, description: '' + property :is_not_decease, type: :boolean, example: true, description: '' + property :has_payment_address, type: :boolean, example: true, description: '' + end + + property :payment_account do + key :required, %i[ + name + account_type + account_number + routing_number + ] + property :name, type: :string, example: 'WELLS FARGO BANK', description: 'Bank name' + property :account_type, type: :string, enum: %w[CHECKING SAVINGS], example: 'CHECKING', description: 'Bank account type' + property :account_number, type: :string, example: '******7890', description: 'Bank account number (masked)' + property :routing_number, type: :string, example: '*****0503', description: 'Bank routing number (masked)' + end + end + end + end + end + + response 400 do + key :description, 'Routing number related to fraud' schema do key :required, [:errors] property :errors do key :type, :array items do - key :required, %i[title detail code status] - property :title, type: :string, example: 'Required Backend Connection Error', description: 'Error title' - property :detail, type: :string, example: 'e9e04329-b211-11ed-9449-732003342465', description: 'Description of error (optional)' - property :code, type: :string, example: 'LIGHTHOUSE_DIRECT_DEPOSIT502', - description: 'Service name with code appended' - property :status, type: :string, example: '502', description: 'http status code' + key :required, %i[title detail code source] + property :title, type: :string, example: 'Bad Request', description: 'Error title' + property :detail, type: :string, example: 'Routing number related to potential fraud', description: 'Description of error (optional)' + property :code, type: :string, example: 'cnp.payment.routing.number.fraud.message', description: 'Service name with code appended' + property :source, type: %i[string object], example: 'Lighthouse Direct Deposit', description: 'Service name' end end end diff --git a/lib/common/exceptions/forbidden.rb b/lib/common/exceptions/forbidden.rb index d0755ad0c6b..827e884967d 100644 --- a/lib/common/exceptions/forbidden.rb +++ b/lib/common/exceptions/forbidden.rb @@ -10,9 +10,12 @@ class Forbidden < BaseError def initialize(options = {}) @detail = options[:detail] @source = options[:source] + @errors = options[:errors] end def errors + return @errors if @errors.present? + Array(SerializableError.new(i18n_data.merge(detail: @detail, source: @source))) end end diff --git a/lib/common/exceptions/unauthorized.rb b/lib/common/exceptions/unauthorized.rb index 74678515e3c..45cd1d8fc00 100644 --- a/lib/common/exceptions/unauthorized.rb +++ b/lib/common/exceptions/unauthorized.rb @@ -10,9 +10,12 @@ class Unauthorized < BaseError def initialize(options = {}) @detail = options[:detail] @source = options[:source] + @errors = options[:errors] end def errors + return @errors if @errors.present? + Array(SerializableError.new(i18n_data.merge(detail: @detail, source: @source))) end end diff --git a/lib/lighthouse/direct_deposit/client.rb b/lib/lighthouse/direct_deposit/client.rb index 47ccfc86e9f..778a56ea699 100644 --- a/lib/lighthouse/direct_deposit/client.rb +++ b/lib/lighthouse/direct_deposit/client.rb @@ -24,6 +24,15 @@ def get_payment_info handle_error(e, config.settings.client_id, config.base_path) end + def update_payment_info(params) + body = build_request_body(params) + + response = config.put("?icn=#{@icn}", body) + handle_response(response) + rescue Faraday::ClientError, Faraday::ServerError => e + handle_error(e, config.settings.client_id, config.base_path) + end + private def handle_response(response) @@ -38,5 +47,16 @@ def handle_error(error, lighthouse_client_id, base_path) base_path ) end + + def build_request_body(payment_account) + { + 'paymentAccount' => + { + 'accountNumber' => payment_account.account_number, + 'accountType' => payment_account.account_type, + 'financialInstitutionRoutingNumber' => payment_account.routing_number + } + }.to_json + end end end diff --git a/lib/lighthouse/direct_deposit/error_parser.rb b/lib/lighthouse/direct_deposit/error_parser.rb new file mode 100644 index 00000000000..c1d3fd9ac3e --- /dev/null +++ b/lib/lighthouse/direct_deposit/error_parser.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +require 'lighthouse/direct_deposit/error_response' + +module Lighthouse + module DirectDeposit + class ErrorParser + def self.parse(response) + status = response[:status] + body = response[:body].with_indifferent_access + detail = parse_detail(body) + + errors = [ + { + title: parse_title(body), + detail:, + code: parse_code(detail), + source: data_source + } + ] + + Lighthouse::DirectDeposit::ErrorResponse.new(status, errors) + end + + def self.parse_title(body) + body[:error] || body[:title] || status_message_from(body[:status]) || 'Unknown error' + end + + def self.parse_detail(body) + return parse_first_error_code(body) if error_codes?(body) + + body[:error_description] || body[:error] || body[:detail] || body[:message] || 'Unknown error' + end + + def self.parse_code(detail) + return 'cnp.payment.api.rate.limit.exceeded' if detail.include? 'API rate limit exceeded' + return 'cnp.payment.invalid.authentication.creds' if detail.include? 'Invalid authentication credentials' + return 'cnp.payment.invalid.token' if detail.include? 'Invalid token' + return 'cnp.payment.invalid.scopes' if detail.include? 'scopes are not configured' + return 'cnp.payment.icn.not.found' if detail.include? 'No data found for ICN' + return 'cnp.payment.icn.invalid' if detail.include? 'getDirectDeposit.icn size' + return 'cnp.payment.account.number.invalid' if detail.include? 'payment.accountNumber.invalid' + return 'cnp.payment.routing.number.invalid' if detail.include? 'payment.accountRoutingNumber.invalid' + return 'cnp.payment.account.type.invalid' if detail.include? 'payment.accountType.invalid' + return 'cnp.payment.routing.number.invalid.checksum' if detail.include? 'accountRoutingNumber.invalidCheckSum' + return 'cnp.payment.restriction.indicators.present' if detail.include? 'restriction.indicators.present' + return 'cnp.payment.routing.number.fraud' if detail.include? 'Routing number related to potential fraud' + return 'cnp.payment.accounting.number.fraud' if detail.include? 'Flashes on record' + return 'cnp.payment.unspecified.error' if detail.include? 'GUIE50022' + + 'cnp.payment.generic.error' + end + + def self.data_source + 'Lighthouse Direct Deposit' + end + + def self.parse_first_error_code(body) + body[:error_codes][0][:error_code] + end + + def self.parse_first_error_detail(body) + body[:error_codes][0][:detail] + end + + def self.error_codes?(body) + body[:error_codes].present? + end + + def self.status_message_from(code) + case code + when 401 + 'Not Authorized' + when 403 + 'Forbidden' + when 413 + 'Payload too large' + when 429 + 'Too many requests' + end + end + end + end +end diff --git a/lib/lighthouse/direct_deposit/error_response.rb b/lib/lighthouse/direct_deposit/error_response.rb new file mode 100644 index 00000000000..7775634210e --- /dev/null +++ b/lib/lighthouse/direct_deposit/error_response.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +module Lighthouse + module DirectDeposit + class ErrorResponse + attr_accessor :status, :errors + + def initialize(status, errors) + @status = status + @errors = errors || [] + end + + def response + { + status: @status, + body: + } + end + + def body + { errors: @errors } + end + + def code + errors.first[:code] + end + + def title + errors.first[:title] + end + + def detail + errors.first[:detail] + end + + def message + "#{code}: #{title} - #{detail}" + end + + def error? + true + end + end + end +end diff --git a/lib/lighthouse/service_exception.rb b/lib/lighthouse/service_exception.rb index 6d3082dfe3c..3f9c3e8456a 100644 --- a/lib/lighthouse/service_exception.rb +++ b/lib/lighthouse/service_exception.rb @@ -73,7 +73,12 @@ def self.get_errors_from_response(error, error_status = nil) def self.error_object_details(error_body, error_status) status = error_status&.to_s title = error_body['title'] || error_class(status.to_sym).to_s - detail = error_body['detail'] || error_body['message'] || error_body['error'] || 'No details provided' + detail = error_body['detail'] || + error_body['message'] || + error_body['error'] || + error_body['error_description'] || + 'No details provided' + code = error_body['code'] || error_status&.to_s [status, title, detail, code] diff --git a/spec/controllers/v0/profile/direct_deposits/disability_compensations_controller_spec.rb b/spec/controllers/v0/profile/direct_deposits/disability_compensations_controller_spec.rb index dfc546de963..1ab513ca83e 100644 --- a/spec/controllers/v0/profile/direct_deposits/disability_compensations_controller_spec.rb +++ b/spec/controllers/v0/profile/direct_deposits/disability_compensations_controller_spec.rb @@ -14,7 +14,7 @@ describe '#show' do context 'when successful' do it 'returns a status of 200' do - VCR.use_cassette('lighthouse/direct_deposit/show/200_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/200_valid') do get(:show) end @@ -22,14 +22,13 @@ end it 'returns a payment account' do - VCR.use_cassette('lighthouse/direct_deposit/show/200_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/200_valid') do get(:show) end json = JSON.parse(response.body) payment_account = json['data']['attributes']['payment_account'] - expect(payment_account).not_to be_nil expect(payment_account['name']).to eq('WELLS FARGO BANK') expect(payment_account['account_type']).to eq('CHECKING') expect(payment_account['account_number']).to eq('******7890') @@ -37,45 +36,106 @@ end it 'returns control information' do - VCR.use_cassette('lighthouse/direct_deposit/show/200_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/200_valid') do get(:show) end json = JSON.parse(response.body) control_info = json['data']['attributes']['control_information'] - expect(json['errors']).to be_nil expect(control_info['can_update_direct_deposit']).to be(true) end + + it 'does not return errors' do + VCR.use_cassette('lighthouse/direct_deposit/show/200_valid') do + get(:show) + end + + json = JSON.parse(response.body) + expect(json['errors']).to be_nil + end + end + + context 'when has restrictions' do + it 'control info has flags set to false' do + VCR.use_cassette('lighthouse/direct_deposit/show/200_has_restrictions') do + get(:show) + end + + json = JSON.parse(response.body)['data']['attributes'] + expect(json['control_information']['can_update_direct_deposit']).to be(false) + expect(json['control_information']['has_payment_address']).to be(false) + end + end + + context 'when invalid scopes are provided' do + it 'returns a 400' do + VCR.use_cassette('lighthouse/direct_deposit/show/400_invalid_scopes') do + get(:show) + end + + json = JSON.parse(response.body) + e = json['errors'].first + + expect(response).to have_http_status(:bad_request) + expect(e['code']).to eq('cnp.payment.invalid.scopes') + end end context 'when not authorized' do it 'returns a status of 401' do - VCR.use_cassette('lighthouse/direct_deposit/show/401_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/401_invalid_token') do get(:show) end + json = JSON.parse(response.body) + e = json['errors'].first + expect(response).to have_http_status(:unauthorized) + expect(e['code']).to eq('cnp.payment.invalid.token') end end context 'when ICN not found' do it 'returns a status of 404' do - VCR.use_cassette('lighthouse/direct_deposit/show/404_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/404_icn_not_found') do get(:show) end + json = JSON.parse(response.body) + e = json['errors'].first + expect(response).to have_http_status(:not_found) + expect(e['code']).to eq('cnp.payment.icn.not.found') end end - context 'when bad gateway' do - it 'returns a status of 502' do - VCR.use_cassette('lighthouse/direct_deposit/show/502_response') do + context 'when lighthouse direct deposit feature flag is disabled' do + before do + allow(Flipper).to receive(:enabled?).with(:profile_lighthouse_direct_deposit, instance_of(User)) + .and_return(false) + end + + it 'returns routing error' do + VCR.use_cassette('lighthouse/direct_deposit/show/200_valid') do get(:show) end - expect(response).to have_http_status(:bad_gateway) + expect(response).to have_http_status(:not_found) + end + end + end + + describe '#update' do + context 'when successful' do + it 'returns a status of 200' do + params = { account_number: '1234567890', account_type: 'CHECKING', routing_number: '031000503' } + + VCR.use_cassette('lighthouse/direct_deposit/update/200_valid') do + put(:update, params:) + end + + expect(response).to have_http_status(:ok) end end @@ -86,12 +146,128 @@ end it 'returns routing error' do - VCR.use_cassette('lighthouse/direct_deposit/show/200_response') do - get(:show) + params = { account_number: '1234567890', account_type: 'CHECKING', routing_number: '031000503' } + + VCR.use_cassette('lighthouse/direct_deposit/update/200_valid') do + put(:update, params:) end expect(response).to have_http_status(:not_found) end end + + context 'when missing account type' do + let(:params) do + { + routing_number: '031000503', + account_number: '12345678' + } + end + + it 'returns a validation error' do + VCR.use_cassette('lighthouse/direct_deposit/update/400_invalid_account_type') do + put(:update, params:) + end + + expect(response).to have_http_status(:bad_request) + + json = JSON.parse(response.body) + e = json['errors'].first + + expect(e).not_to be_nil + expect(e['title']).to eq('Bad Request') + expect(e['code']).to eq('cnp.payment.account.type.invalid') + end + end + + context 'when missing account number' do + let(:params) do + { + account_type: 'CHECKING', + routing_number: '031000503' + } + end + + it 'returns a validation error' do + VCR.use_cassette('lighthouse/direct_deposit/update/400_invalid_account_number') do + put(:update, params:) + end + + expect(response).to have_http_status(:bad_request) + + json = JSON.parse(response.body) + e = json['errors'].first + + expect(e).not_to be_nil + expect(e['title']).to eq('Bad Request') + expect(e['code']).to eq('cnp.payment.account.number.invalid') + end + end + + context 'when missing routing number' do + let(:params) do + { + account_type: 'CHECKING', + account_number: '12345678' + } + end + + it 'returns a validation error' do + VCR.use_cassette('lighthouse/direct_deposit/update/400_invalid_routing_number') do + put(:update, params:) + end + + expect(response).to have_http_status(:bad_request) + + json = JSON.parse(response.body) + e = json['errors'].first + + expect(e).not_to be_nil + expect(e['title']).to eq('Bad Request') + expect(e['code']).to eq('cnp.payment.routing.number.invalid') + end + end + + context 'when fraud flag is present' do + let(:params) do + { + account_type: 'CHECKING', + account_number: '1234567890', + routing_number: '031000503' + } + end + + it 'returns a routing number fraud error' do + VCR.use_cassette('lighthouse/direct_deposit/update/400_routing_number_fraud') do + put(:update, params:) + end + + expect(response).to have_http_status(:bad_request) + + json = JSON.parse(response.body) + e = json['errors'].first + + expect(e).not_to be_nil + expect(e['title']).to eq('Bad Request') + expect(e['code']).to eq('cnp.payment.routing.number.fraud') + expect(e['source']).to eq('Lighthouse Direct Deposit') + end + + it 'returns an account number fraud error' do + VCR.use_cassette('lighthouse/direct_deposit/update/400_account_number_fraud') do + put(:update, params:) + end + + expect(response).to have_http_status(:bad_request) + + json = JSON.parse(response.body) + e = json['errors'].first + + expect(e).not_to be_nil + expect(e['title']).to eq('Bad Request') + expect(e['code']).to eq('cnp.payment.accounting.number.fraud') + expect(e['source']).to eq('Lighthouse Direct Deposit') + end + end end end diff --git a/spec/requests/swagger_spec.rb b/spec/requests/swagger_spec.rb index 1c0ce0d0c32..64ca98a1073 100644 --- a/spec/requests/swagger_spec.rb +++ b/spec/requests/swagger_spec.rb @@ -2246,36 +2246,53 @@ context 'GET' do it 'returns a 200' do headers = { '_headers' => { 'Cookie' => sign_in(user, nil, true) } } - VCR.use_cassette('lighthouse/direct_deposit/show/200_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/200_valid') do expect(subject).to validate(:get, '/v0/profile/direct_deposits/disability_compensations', 200, headers) end end it 'returns a 400' do headers = { '_headers' => { 'Cookie' => sign_in(user, nil, true) } } - VCR.use_cassette('lighthouse/direct_deposit/show/400_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/400_invalid_icn') do expect(subject).to validate(:get, '/v0/profile/direct_deposits/disability_compensations', 400, headers) end end it 'returns a 401' do headers = { '_headers' => { 'Cookie' => sign_in(user, nil, true) } } - VCR.use_cassette('lighthouse/direct_deposit/show/401_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/401_invalid_token') do expect(subject).to validate(:get, '/v0/profile/direct_deposits/disability_compensations', 401, headers) end end it 'returns a 404' do headers = { '_headers' => { 'Cookie' => sign_in(user, nil, true) } } - VCR.use_cassette('lighthouse/direct_deposit/show/404_response') do + VCR.use_cassette('lighthouse/direct_deposit/show/404_icn_not_found') do expect(subject).to validate(:get, '/v0/profile/direct_deposits/disability_compensations', 404, headers) end end + end - it 'returns a 502' do + context 'PUT' do + it 'returns a 200' do + headers = { '_headers' => { 'Cookie' => sign_in(user, nil, true) } } + params = { account_number: '1234567890', account_type: 'CHECKING', routing_number: '031000503' } + VCR.use_cassette('lighthouse/direct_deposit/update/200_valid') do + expect(subject).to validate(:put, + '/v0/profile/direct_deposits/disability_compensations', + 200, + headers.merge('_data' => params)) + end + end + + it 'returns a 400' do headers = { '_headers' => { 'Cookie' => sign_in(user, nil, true) } } - VCR.use_cassette('lighthouse/direct_deposit/show/502_response') do - expect(subject).to validate(:get, '/v0/profile/direct_deposits/disability_compensations', 502, headers) + params = { account_number: '1234567890', account_type: 'CHECKING', routing_number: '031000503' } + VCR.use_cassette('lighthouse/direct_deposit/update/400_routing_number_fraud') do + expect(subject).to validate(:put, + '/v0/profile/direct_deposits/disability_compensations', + 400, + headers.merge('_data' => params)) end end end diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/200_has_restrictions.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/200_has_restrictions.yml new file mode 100644 index 00000000000..44cec0895ac --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/200_has_restrictions.yml @@ -0,0 +1,65 @@ +--- +http_interactions: +- request: + method: get + uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: + - Bearer abcdefghijklmnop + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: '' + headers: + Date: + - Thu, 23 Feb 2023 21:47:59 GMT + Content-Type: + - application/json;charset=UTF-8 + Connection: + - keep-alive + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '58' + Ratelimit-Reset: + - '7' + Ratelimit-Limit: + - '60' + X-Ratelimit-Remaining-Minute: + - '58' + Content-Language: + - en-US + Pragma: + - no-cache + - no-cache + X-Kong-Upstream-Latency: + - '5345' + X-Kong-Proxy-Latency: + - '2' + Via: + - kong/3.0.2 + Access-Control-Allow-Origin: + - "*" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cache-Control: + - no-cache, no-store + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"paymentAccount":{"accountType":"CHECKING","accountNumber":"1234567890","financialInstitutionRoutingNumber":"031000503","financialInstitutionName":"WELLS + FARGO BANK"},"controlInformation":{"canUpdateDirectDeposit":false,"isCorpAvailable":true,"isCorpRecFound":true,"hasNoBdnPayments":true,"hasIndentity":true,"hasIndex":true,"isCompetent":true,"hasMailingAddress":true,"hasNoFiduciaryAssigned":true,"isNotDeceased":true,"hasPaymentAddress":false}}' + recorded_at: Thu, 23 Feb 2023 21:47:59 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/200_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/200_valid.yml similarity index 100% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/show/200_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/show/200_valid.yml diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/400_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/400_invalid_icn.yml similarity index 100% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/show/400_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/show/400_invalid_icn.yml diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/422_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/400_unspecified_error.yml similarity index 78% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/update/422_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/show/400_unspecified_error.yml index 1935b1d874c..5805da79d94 100644 --- a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/422_response.yml +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/400_unspecified_error.yml @@ -1,12 +1,11 @@ --- http_interactions: - request: - method: put + method: get uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 body: - encoding: UTF-8 - string: '"{\"account_type\"=>\"CHECKING\", \"account_number\"=>\"1234567890\", - \"routing_number\"=>\"031000503\"}"' + encoding: US-ASCII + string: '' headers: Accept: - application/json @@ -20,38 +19,34 @@ http_interactions: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: status: - code: 401 + code: 400 message: Unauthorized headers: Date: - - Tue, 04 Apr 2023 03:39:48 GMT + - Fri, 19 May 2023 20:51:01 GMT Content-Type: - application/json Connection: - keep-alive - X-Ratelimit-Remaining-Minute: - - '59' X-Ratelimit-Limit-Minute: - '60' Ratelimit-Remaining: - '59' Ratelimit-Reset: - - '12' + - '59' Ratelimit-Limit: - '60' + X-Ratelimit-Remaining-Minute: + - '59' Www-Authenticate: - Bearer X-Kong-Response-Latency: - - '257' + - '111' Strict-Transport-Security: - max-age=16000000; includeSubDomains; preload; - max-age=31536000; includeSubDomains; preload Access-Control-Allow-Origin: - "*" - X-Kong-Upstream-Latency: - - '265' - X-Kong-Proxy-Latency: - - '0' Cache-Control: - '' X-Frame-Options: @@ -62,5 +57,5 @@ http_interactions: encoding: UTF-8 string: "{ \n \"status\": 401,\n \"error\": \"Invalid token.\",\n \"path\": \"/direct-deposit-management/v1/direct-deposit\"\n}\n" - recorded_at: Tue, 04 Apr 2023 03:39:48 GMT + recorded_at: Fri, 19 May 2023 20:51:01 GMT recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/401_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/401_invalid_token.yml similarity index 100% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/show/401_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/show/401_invalid_token.yml diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/404_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/404_icn_not_found.yml similarity index 100% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/show/404_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/show/404_icn_not_found.yml diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/200_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/200_response.yml index acfc4ca93aa..43a225638d8 100644 --- a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/200_response.yml +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/200_response.yml @@ -4,64 +4,58 @@ http_interactions: method: put uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 body: - encoding: US-ASCII - string: '{"paymentAccount":{"accountType":"CHECKING","accountNumber":"1234567890","financialInstitutionRoutingNumber":"031000503"}}' + encoding: UTF-8 + string: '{"paymentAccount":{"accountNumber":"1234567890","accountType":"CHECKING","financialInstitutionRoutingNumber":"031000503"}}' headers: - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: - - "*/*" + - application/json + Content-Type: + - application/json User-Agent: - - Ruby - Host: - - sandbox-api.va.gov + - Vets.gov Agent Authorization: - Bearer abcdefghijklmnop - Content-Type: - - application/json + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: status: - code: 200 - message: '' + code: 401 + message: Unauthorized headers: Date: - - Thu, 23 Feb 2023 21:47:59 GMT + - Fri, 19 May 2023 20:51:03 GMT Content-Type: - - application/json;charset=UTF-8 + - application/json Connection: - keep-alive X-Ratelimit-Limit-Minute: - '60' Ratelimit-Remaining: - - '58' + - '57' Ratelimit-Reset: - - '7' + - '58' Ratelimit-Limit: - '60' X-Ratelimit-Remaining-Minute: - - '58' - Content-Language: - - en-US - Pragma: - - no-cache - - no-cache - X-Kong-Upstream-Latency: - - '5345' - X-Kong-Proxy-Latency: - - '2' - Via: - - kong/3.0.2 - Access-Control-Allow-Origin: - - "*" + - '57' + Www-Authenticate: + - Bearer + X-Kong-Response-Latency: + - '86' Strict-Transport-Security: + - max-age=16000000; includeSubDomains; preload; - max-age=31536000; includeSubDomains; preload + Access-Control-Allow-Origin: + - "*" Cache-Control: - - no-cache, no-store + - '' + X-Frame-Options: + - SAMEORIGIN Transfer-Encoding: - chunked body: - encoding: ASCII-8BIT - string: '{"paymentAccount":{"accountType":"CHECKING","accountNumber":"1234567890","financialInstitutionRoutingNumber":"031000503","financialInstitutionName":"WELLS - FARGO BANK"},"controlInformation":{"canUpdateDirectDeposit":true,"isCorpAvailable":true,"isCorpRecFound":true,"hasNoBdnPayments":true,"hasIndentity":true,"hasIndex":true,"isCompetent":true,"hasMailingAddress":true,"hasNoFiduciaryAssigned":true,"isNotDeceased":true,"hasPaymentAddress":true}}' - recorded_at: Thu, 23 Feb 2023 21:47:59 GMT + encoding: UTF-8 + string: "{ \n \"status\": 401,\n \"error\": \"Invalid token.\",\n \"path\": + \"/direct-deposit-management/v1/direct-deposit\"\n}\n" + recorded_at: Fri, 19 May 2023 20:51:03 GMT recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/200_valid.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/200_valid.yml new file mode 100644 index 00000000000..acfc4ca93aa --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/200_valid.yml @@ -0,0 +1,67 @@ +--- +http_interactions: +- request: + method: put + uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 + body: + encoding: US-ASCII + string: '{"paymentAccount":{"accountType":"CHECKING","accountNumber":"1234567890","financialInstitutionRoutingNumber":"031000503"}}' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - sandbox-api.va.gov + Authorization: + - Bearer abcdefghijklmnop + Content-Type: + - application/json + response: + status: + code: 200 + message: '' + headers: + Date: + - Thu, 23 Feb 2023 21:47:59 GMT + Content-Type: + - application/json;charset=UTF-8 + Connection: + - keep-alive + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '58' + Ratelimit-Reset: + - '7' + Ratelimit-Limit: + - '60' + X-Ratelimit-Remaining-Minute: + - '58' + Content-Language: + - en-US + Pragma: + - no-cache + - no-cache + X-Kong-Upstream-Latency: + - '5345' + X-Kong-Proxy-Latency: + - '2' + Via: + - kong/3.0.2 + Access-Control-Allow-Origin: + - "*" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cache-Control: + - no-cache, no-store + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{"paymentAccount":{"accountType":"CHECKING","accountNumber":"1234567890","financialInstitutionRoutingNumber":"031000503","financialInstitutionName":"WELLS + FARGO BANK"},"controlInformation":{"canUpdateDirectDeposit":true,"isCorpAvailable":true,"isCorpRecFound":true,"hasNoBdnPayments":true,"hasIndentity":true,"hasIndex":true,"isCompetent":true,"hasMailingAddress":true,"hasNoFiduciaryAssigned":true,"isNotDeceased":true,"hasPaymentAddress":true}}' + recorded_at: Thu, 23 Feb 2023 21:47:59 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/201_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_account_number_fraud.yml similarity index 70% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/update/201_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_account_number_fraud.yml index cfb665ea677..b888ebcc779 100644 --- a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/201_response.yml +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_account_number_fraud.yml @@ -19,11 +19,11 @@ http_interactions: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: status: - code: 401 + code: 400 message: Unauthorized headers: Date: - - Wed, 05 Apr 2023 23:52:42 GMT + - Fri, 19 May 2023 19:13:30 GMT Content-Type: - application/json Connection: @@ -34,23 +34,19 @@ http_interactions: - '60' Ratelimit-Remaining: - '59' - Ratelimit-Reset: - - '18' Ratelimit-Limit: - '60' + Ratelimit-Reset: + - '30' Www-Authenticate: - Bearer X-Kong-Response-Latency: - - '305' + - '80' Strict-Transport-Security: - max-age=16000000; includeSubDomains; preload; - max-age=31536000; includeSubDomains; preload Access-Control-Allow-Origin: - "*" - X-Kong-Upstream-Latency: - - '312' - X-Kong-Proxy-Latency: - - '1' Cache-Control: - '' X-Frame-Options: @@ -59,7 +55,12 @@ http_interactions: - chunked body: encoding: UTF-8 - string: "{ \n \"status\": 401,\n \"error\": \"Invalid token.\",\n \"path\": - \"/direct-deposit-management/v1/direct-deposit\"\n}\n" - recorded_at: Wed, 05 Apr 2023 23:52:42 GMT + string: '{ + "type": "https://api.va.gov/direct-deposit-management/errors/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "No changes were made. Request was sent to Benefits Gateway Service (BGS), but BGS update failed. Unknown issue(s). Raw response from BGS: Failed to update Address/Bank Info. Flashes on record.", + "instance": "e48e3aeb-f312-11ec-88e8-f55e56a472a2" + }' + recorded_at: Fri, 19 May 2023 19:13:30 GMT recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/502_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_generic_error.yml similarity index 58% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/show/502_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_generic_error.yml index 85cd320396b..34432286cc1 100644 --- a/spec/support/vcr_cassettes/lighthouse/direct_deposit/show/502_response.yml +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_generic_error.yml @@ -1,11 +1,11 @@ --- http_interactions: - request: - method: get + method: put uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 body: encoding: US-ASCII - string: '' + string: '{"paymentAccount":{"accountType":"CHECKING","accountNumber":"1234567890","financialInstitutionRoutingNumber":"031000503"}}' headers: Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 @@ -17,47 +17,56 @@ http_interactions: - sandbox-api.va.gov Authorization: - Bearer abcdefghijklmnop + Content-Type: + - application/json response: status: - code: 502 + code: 400 message: '' headers: Date: - - Tue, 21 Feb 2023 18:02:36 GMT + - Thu, 23 Feb 2023 21:47:59 GMT Content-Type: - application/json;charset=UTF-8 Connection: - keep-alive - Ratelimit-Reset: - - '29' X-Ratelimit-Limit-Minute: - '60' - X-Ratelimit-Remaining-Minute: - - '59' + Ratelimit-Remaining: + - '58' + Ratelimit-Reset: + - '7' Ratelimit-Limit: - '60' - Ratelimit-Remaining: - - '59' + X-Ratelimit-Remaining-Minute: + - '58' Content-Language: - en-US + Pragma: + - no-cache + - no-cache X-Kong-Upstream-Latency: - - '4450' + - '5345' X-Kong-Proxy-Latency: - - '9' + - '2' Via: - kong/3.0.2 Access-Control-Allow-Origin: - "*" - Cache-Control: - - '' Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload + Cache-Control: + - no-cache, no-store Transfer-Encoding: - chunked body: - encoding: UTF-8 - string: '{"type":"https://api.va.gov/services/direct-deposit-management/errors/required-connection-exception","title":"Required - Backend Connection Error","status":502,"detail":"e9e04329-b211-11ed-9449-732003342465","instance":"Backend - Connection Error - Failed to retrieve data from MPI","debuggingPayload":"kiosrLjDAAIH8t/GfzCb1tQ+YT0ivptTY4u8gmkhZyr6KOzoSWZ6yaqh9u/9xpLsPEbTG2cHqdcHKjIe6Gcf+R/7ea+HR41Fk4dzeEHQAtYS3+RXg1SkWDVpz7xVPdsBZkiJM5KvA968ynE2RaNDEv0nIQtUR+nG8SQC61TNWaYiVNMA4C6gwgvJi8Ne0h3Vh7bDCbmLmRDBfa6QtYd9CQ=="}' - recorded_at: Tue, 21 Feb 2023 18:02:36 GMT + encoding: ASCII-8BIT + string: '{ + "type": "https://api.va.gov/direct-deposit-management/errors/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "Something unknown went wrong. Please try again later.", + "instance": "06ef48e9-f0c2-11ed-8091-578ca955e798", + "errorCodes": []}' + recorded_at: Thu, 23 Feb 2023 21:47:59 GMT recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_account_number.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_account_number.yml new file mode 100644 index 00000000000..3cc42c47f40 --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_account_number.yml @@ -0,0 +1,72 @@ +--- +http_interactions: +- request: + method: put + uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 + body: + encoding: UTF-8 + string: '{"paymentAccount":{"accountNumber":"1234567890","accountType":"CHECKING","financialInstitutionRoutingNumber":"031000503"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: + - Bearer abcdefghijklmnop + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: '' + headers: + Date: + - Mon, 20 Feb 2023 18:45:14 GMT + Content-Type: + - application/json + Connection: + - keep-alive + X-Ratelimit-Remaining-Minute: + - '59' + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '59' + Ratelimit-Limit: + - '60' + Ratelimit-Reset: + - '47' + Content-Language: + - en-US + X-Kong-Upstream-Latency: + - '735' + X-Kong-Proxy-Latency: + - '0' + Via: + - kong/3.0.2 + Access-Control-Allow-Origin: + - "*" + Cache-Control: + - '' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: '{ + "type": "https://api.va.gov/direct-deposit-management/errors/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "accountNumber invalid. It must match ^[a-zA-Z\\d]{1,17}$", + "instance": "f9750380-7905-4d67-a17f-967b5c7dfc60", + "errorCodes": [ + { + "errorCode": "payment.accountNumber.invalid" + } + ] + }' + recorded_at: Mon, 20 Feb 2023 18:45:14 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_account_type.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_account_type.yml new file mode 100644 index 00000000000..83afc9b490e --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_account_type.yml @@ -0,0 +1,72 @@ +--- +http_interactions: +- request: + method: put + uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 + body: + encoding: UTF-8 + string: '{"paymentAccount":{"accountNumber":"1234567890","accountType":"CHECKING","financialInstitutionRoutingNumber":"031000503"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: + - Bearer abcdefghijklmnop + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: '' + headers: + Date: + - Mon, 20 Feb 2023 18:45:14 GMT + Content-Type: + - application/json + Connection: + - keep-alive + X-Ratelimit-Remaining-Minute: + - '59' + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '59' + Ratelimit-Limit: + - '60' + Ratelimit-Reset: + - '47' + Content-Language: + - en-US + X-Kong-Upstream-Latency: + - '735' + X-Kong-Proxy-Latency: + - '0' + Via: + - kong/3.0.2 + Access-Control-Allow-Origin: + - "*" + Cache-Control: + - '' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: '{ + "type": "https://api.va.gov/direct-deposit-management/errors/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "accountType must be defined as either checking or savings", + "instance": "984d674e-b969-496c-8db9-1266d3ec5454", + "errorCodes": [ + { + "errorCode": "payment.accountType.invalid" + } + ] + }' + recorded_at: Mon, 20 Feb 2023 18:45:14 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_routing_number.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_routing_number.yml new file mode 100644 index 00000000000..6e7dc53db67 --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_invalid_routing_number.yml @@ -0,0 +1,72 @@ +--- +http_interactions: +- request: + method: put + uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 + body: + encoding: UTF-8 + string: '{"paymentAccount":{"accountNumber":"1234567890","accountType":"CHECKING","financialInstitutionRoutingNumber":"031000503"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Vets.gov Agent + Authorization: + - Bearer abcdefghijklmnop + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 400 + message: '' + headers: + Date: + - Mon, 20 Feb 2023 18:45:14 GMT + Content-Type: + - application/json + Connection: + - keep-alive + X-Ratelimit-Remaining-Minute: + - '59' + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '59' + Ratelimit-Limit: + - '60' + Ratelimit-Reset: + - '47' + Content-Language: + - en-US + X-Kong-Upstream-Latency: + - '735' + X-Kong-Proxy-Latency: + - '0' + Via: + - kong/3.0.2 + Access-Control-Allow-Origin: + - "*" + Cache-Control: + - '' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: '{ + "type": "https://api.va.gov/direct-deposit-management/errors/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "financialInstitutionRoutingNumber invalid. It must match ^\\d{9}$", + "instance": "61b45dc6-058d-4449-862c-567dbb9290d9", + "errorCodes": [ + { + "errorCode": "payment.accountRoutingNumber.invalid" + } + ] + }' + recorded_at: Mon, 20 Feb 2023 18:45:14 GMT +recorded_with: VCR 6.1.0 diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_response.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_routing_number_fraud.yml similarity index 100% rename from spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_response.yml rename to spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_routing_number_fraud.yml diff --git a/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_unspecified_error.yml b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_unspecified_error.yml new file mode 100644 index 00000000000..d2c39106ab0 --- /dev/null +++ b/spec/support/vcr_cassettes/lighthouse/direct_deposit/update/400_unspecified_error.yml @@ -0,0 +1,72 @@ +--- +http_interactions: +- request: + method: put + uri: https://sandbox-api.va.gov/services/direct-deposit-management/v1/direct-deposit?icn=1012666073V986297 + body: + encoding: US-ASCII + string: '{"paymentAccount":{"accountType":"CHECKING","accountNumber":"1234567890","financialInstitutionRoutingNumber":"031000503"}}' + headers: + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + User-Agent: + - Ruby + Host: + - sandbox-api.va.gov + Authorization: + - Bearer abcdefghijklmnop + Content-Type: + - application/json + response: + status: + code: 400 + message: '' + headers: + Date: + - Thu, 23 Feb 2023 21:47:59 GMT + Content-Type: + - application/json;charset=UTF-8 + Connection: + - keep-alive + X-Ratelimit-Limit-Minute: + - '60' + Ratelimit-Remaining: + - '58' + Ratelimit-Reset: + - '7' + Ratelimit-Limit: + - '60' + X-Ratelimit-Remaining-Minute: + - '58' + Content-Language: + - en-US + Pragma: + - no-cache + - no-cache + X-Kong-Upstream-Latency: + - '5345' + X-Kong-Proxy-Latency: + - '2' + Via: + - kong/3.0.2 + Access-Control-Allow-Origin: + - "*" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Cache-Control: + - no-cache, no-store + Transfer-Encoding: + - chunked + body: + encoding: ASCII-8BIT + string: '{ + "type": "https://api.va.gov/direct-deposit-management/errors/bad-request", + "title": "Bad Request", + "status": 400, + "detail": "No changes were made. Request was sent to Benefits Gateway Service (BGS), but BGS update failed. Unknown issue(s). Raw response from BGS: Update Failed: GUIE50041&FABusnsTranRule(CFABUSNS_TRAN) Failed with Exception!! FILE: FABTInterfaceCreator.cpp LINE: 350This update is being elevated for additional review due to an Incident Flash associated with this Beneficiary: - An unexpected error was encountered. Please contact the System Administrator. Error is: GUIE50041&FABusnsTranRule(CFABUSNS_TRAN) Failed with Exception!! FILE: FABTInterfaceCreator.cpp LINE: 350This update is being elevated for additional review due to an Incident Flash associated with this Beneficiary:", + "instance": "06ef48e9-f0c2-11ed-8091-578ca955e798", + "errorCodes": []}' + recorded_at: Thu, 23 Feb 2023 21:47:59 GMT +recorded_with: VCR 6.1.0