Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add case for SGID MyInfo when field value is missing #6874

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/app/modules/myinfo/myinfo.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,24 @@ export const logIfFieldValueNotInMyinfoList = (
const isFieldValueInMyinfoList = myInfoList.includes(fieldValue)
const myInfoSource =
myInfoData instanceof MyInfoData ? 'Singpass MyInfo' : 'SGID MyInfo'
// SGID returns NA instead of empty field values, we don't need this to be logged
// as this is expected behaviour
const isNAFromSgid = myInfoAttr === 'SGID MyInfo' && fieldValue === 'NA'
if (!isNAFromSgid || !isFieldValueInMyinfoList) {

if (myInfoSource === 'Singpass MyInfo' && !isFieldValueInMyinfoList) {
wanlingt marked this conversation as resolved.
Show resolved Hide resolved
logger.error({
message: 'Myinfo field value not found in existing Myinfo constants list',
meta: {
action: 'prefillAndSaveMyInfoFields',
myInfoFieldValue: fieldValue,
myInfoAttr,
myInfoSource,
},
})
} else if (
// SGID returns NA instead of empty field values, we don't need this to be logged
// as this is expected behaviour
myInfoSource === 'SGID MyInfo' &&
fieldValue !== 'NA' &&
!isFieldValueInMyinfoList
) {
logger.error({
message: 'Myinfo field value not found in existing Myinfo constants list',
meta: {
Expand Down