Skip to content

Commit

Permalink
[OTE-438] Allow users to read data if they are in FIRST_STRIKE_CLOSE_…
Browse files Browse the repository at this point in the history
…ONLY
  • Loading branch information
Christopher-Li committed Jun 18, 2024
1 parent 2bafa9a commit c596696
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,26 @@ describe('compliance-check', () => {
});
});

it.each([
['query', `/v4/check-compliance-query?address=${testConstants.defaultAddress}`],
['param', `/v4/check-compliance-param/${testConstants.defaultAddress}`],
])('does not return 403 if address in request is in FIRST_STRIKE_CLOSE_ONLY and from restricted country (%s)', async (
_name: string,
path: string,
) => {
isRestrictedCountrySpy.mockReturnValueOnce(true);
await ComplianceStatusTable.create({
...testConstants.compliantStatusData,
status: ComplianceStatus.FIRST_STRIKE_CLOSE_ONLY,
});
await sendRequestToApp({
type: RequestMethod.GET,
path,
expressApp: complianceCheckApp,
expectedStatus: 200,
});
});

it.each([
['query', `/v4/check-compliance-query?address=${testConstants.defaultAddress}`],
['param', `/v4/check-compliance-param/${testConstants.defaultAddress}`],
Expand Down
1 change: 1 addition & 0 deletions indexer/services/comlink/public/api-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3575,6 +3575,7 @@ This operation does not require authentication
|*anonymous*|MANUAL|
|*anonymous*|US_GEO|
|*anonymous*|CA_GEO|
|*anonymous*|GB_GEO|
|*anonymous*|SANCTIONED_GEO|
|*anonymous*|COMPLIANCE_PROVIDER|

Expand Down
1 change: 1 addition & 0 deletions indexer/services/comlink/public/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
"MANUAL",
"US_GEO",
"CA_GEO",
"GB_GEO",
"SANCTIONED_GEO",
"COMPLIANCE_PROVIDER"
],
Expand Down
4 changes: 3 additions & 1 deletion indexer/services/comlink/src/lib/compliance-and-geo-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export async function complianceAndGeoCheck(
{ readReplica: true },
);
if (updatedStatus.length > 0) {
if (updatedStatus[0].status === ComplianceStatus.CLOSE_ONLY) {
if (updatedStatus[0].status === ComplianceStatus.CLOSE_ONLY ||
updatedStatus[0].status === ComplianceStatus.FIRST_STRIKE_CLOSE_ONLY
) {
return next();
} else if (updatedStatus[0].status === ComplianceStatus.BLOCKED) {
return create4xxResponse(
Expand Down

0 comments on commit c596696

Please sign in to comment.