Skip to content

Commit

Permalink
only check ip country == document country if ipCountry exists in docu…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
calebtuttle committed May 10, 2024
1 parent 4b85052 commit e088fe7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/services/idenfy/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ function validateSession(metaSession, statusData, verificationData, scanRef) {
},
};
}
if (countryCode != countryCodeToPrime[metaSession.ipCountry]) {
// if !metaSession.ipCountry, then the session was created before we added
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// we can ignore this check for such sessions.
if (metaSession.ipCountry && (countryCode != countryCodeToPrime[metaSession.ipCountry])) {
return {
error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${country}'. scanRef: ${scanRef}`,
log: {
Expand Down
5 changes: 4 additions & 1 deletion src/services/onfido/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ function validateReports(reports, metaSession) {
},
};
}
if (countryCodeToPrime[report.properties.issuing_country] != countryCodeToPrime[metaSession.ipCountry]) {
// if !metaSession.ipCountry, then the session was created before we added
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// we can ignore this check for such sessions.
if (metaSession.ipCountry && (countryCodeToPrime[report.properties.issuing_country] != countryCodeToPrime[metaSession.ipCountry])) {
return {
error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${report.properties.issuing_country}'.`,
log: {
Expand Down
5 changes: 4 additions & 1 deletion src/services/veriff/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ function validateSession(session, metaSession) {
},
};
}
if (countryCode != countryCodeToPrime[metaSession.ipCountry]) {
// if !metaSession.ipCountry, then the session was created before we added
// the ipCountry attribute. Because this is only ~3k sessions and to reduce tickets,
// we can ignore this check for such sessions.
if (metaSession.ipCountry && (countryCode != countryCodeToPrime[metaSession.ipCountry])) {
return {
error: `Country code mismatch. Session country is '${metaSession.ipCountry}', but document country is '${session?.verification?.document?.country}'.`,
log: {
Expand Down

0 comments on commit e088fe7

Please sign in to comment.