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

Ats - Identity Link - add additional logging events #5442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions modules/identityLinkIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export const identityLinkSubmodule = {
// Check ats during callback so it has a chance to initialise.
// If ats library is available, use it to retrieve envelope. If not use standard third party endpoint
if (window.ats) {
utils.logInfo('ATS exists!');
window.ats.retrieveEnvelope(function (envelope) {
if (envelope) {
utils.logInfo('An envelope can be retrieved from ATS!');
callback(JSON.parse(envelope).envelope);
} else {
getEnvelope(url, callback);
Expand All @@ -63,20 +65,21 @@ export const identityLinkSubmodule = {
};
// return envelope from third party endpoint
function getEnvelope(url, callback) {
utils.logInfo('A 3P retrieval is attempted!');
const callbacks = {
success: response => {
let responseObj;
if (response) {
try {
responseObj = JSON.parse(response);
} catch (error) {
utils.logError(error);
utils.logInfo(error);
}
}
callback((responseObj && responseObj.envelope) ? responseObj.envelope : '');
},
error: error => {
utils.logError(`identityLink: ID fetch encountered an error`, error);
utils.logInfo(`identityLink: ID fetch encountered an error`, error);
callback();
}
};
Expand Down
1 change: 0 additions & 1 deletion test/spec/modules/identityLinkIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ describe('IdentityLinkId tests', function () {
responseHeader,
'Unavailable'
);
expect(logErrorStub.calledOnce).to.be.true;
expect(callBackSpy.calledOnce).to.be.true;
});
});