From a59f116193f7986e146de4b8a60c6391c6d3fd30 Mon Sep 17 00:00:00 2001 From: Kevin Duensing Date: Fri, 26 Apr 2024 12:05:12 -0400 Subject: [PATCH] Fixes token access path. (#16519) Related to department-of-veterans-affairs/va.gov-team#73503 The BTSSS API token response structure has changed. This PR updates the way we get the token from the repsonse accordingly. --- modules/travel_pay/app/services/travel_pay/client.rb | 3 ++- modules/travel_pay/spec/services/client_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/travel_pay/app/services/travel_pay/client.rb b/modules/travel_pay/app/services/travel_pay/client.rb index 9d9114a7e17..4a0e8244741 100644 --- a/modules/travel_pay/app/services/travel_pay/client.rb +++ b/modules/travel_pay/app/services/travel_pay/client.rb @@ -37,7 +37,8 @@ def request_btsss_token(veis_token, sts_token) req.headers['BTSSS-API-Client-Number'] = client_number.to_s req.body = { authJwt: sts_token } end - response.body['access_token'] + + response.body['data']['accessToken'] end ## diff --git a/modules/travel_pay/spec/services/client_spec.rb b/modules/travel_pay/spec/services/client_spec.rb index 4bf986b5ce3..efb6c5dcd9d 100644 --- a/modules/travel_pay/spec/services/client_spec.rb +++ b/modules/travel_pay/spec/services/client_spec.rb @@ -44,7 +44,7 @@ [ 200, { 'Content-Type': 'application/json' }, - '{"access_token": "fake_btsss_token"}' + '{"data": {"accessToken": "fake_btsss_token"}}' ] end