Skip to content

Commit c944312

Browse files
author
JAMES FUQIAN
committed
fix issue per feedback.
1 parent 8246d35 commit c944312

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

server/src/routes/Authorize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import AuthorizationToken from '../entities/AuthorizationToken';
55
import Settings from '../entities/Settings';
66
import db from '../utils/db';
77
import { getAccessToken, generateAuthorizeUrl } from '../utils/bb2';
8-
import { getBenefitData } from './Data';
8+
import { getBenefitReturnData } from './Data';
99

1010
const BENE_DENIED_ACCESS = 'access_denied';
1111

@@ -58,7 +58,7 @@ export async function authorizationCallback(req: Request, res: Response) {
5858
* You could also request data for the Patient endpoint and/or the Coverage endpoint here
5959
* using similar functionality
6060
*/
61-
const eobData = await getBenefitData(req, res);
61+
const eobData = await getBenefitReturnData(req, res);
6262
loggedInUser.eobData = eobData;
6363
} else {
6464
// send generic error message to FE

server/src/routes/Data.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,21 @@ function getURL(path: string): string {
1818

1919
// this function is used to query eob data for the authenticated Medicare.gov
2020
// user and returned - we are then storing in a mocked DB
21-
export async function getBenefitData(req: Request, res: Response) {
21+
export async function getBenefitReturnData(req: Request, res: Response) {
2222
const loggedInUser = getLoggedInUser(db);
2323
// get EOB end point
2424
const response = await get(getURL('fhir/ExplanationOfBenefit/'),
2525
req.query,
2626
`${loggedInUser.authToken?.accessToken || 'no access token'}`);
27-
res.json(response.data);
27+
return response.data as Record<string, unknown>;
2828
}
2929

30+
// for bene-direct call
31+
export async function getBenefitData(req: Request, res: Response) {
32+
const eob_data = await getBenefitReturnData(req, res);
33+
res.json(eob_data);
34+
}
35+
3036
/*
3137
* DEVELOPER NOTES:
3238
* this function is used directly by the front-end to

0 commit comments

Comments
 (0)