Skip to content

Commit

Permalink
Added set apiResponse for external module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eswar2103 committed Jul 24, 2024
1 parent 16dec1c commit 541ca88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pubsub/handlers/setApiResponseHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export default class SetApiResponseHandler extends BaseHandler {
return this.setResponseAckChallenge(message);
case 'userinterest':
return this.setResponseUserInterestChallenge(message);
case 'external':
return this.setExternalResponse(message);
default:
const defaultIdString = JSON.stringify({
report: 'Selected module provider is not available',
Expand Down Expand Up @@ -102,4 +104,13 @@ export default class SetApiResponseHandler extends BaseHandler {
const reportIdString = JSON.stringify({ report: 'Received UserInterest apiResponse parameters' });
return reportIdString;
}

setExternalResponse(message) {
try {
const externalFunction = require('../../../plugins/setExternalApiResponse');
return externalFunction.setExternalApiResponse(message);
} catch (err) {
return JSON.stringify({ report: 'Unable to import and set the data for external module' });
}
}
}

0 comments on commit 541ca88

Please sign in to comment.