Skip to content

Commit

Permalink
ATS-identityLinkId - add additional info logging events (#5442)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamatic authored Jul 2, 2020
1 parent 86ddf58 commit 2bb347f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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;
});
});

0 comments on commit 2bb347f

Please sign in to comment.