listCatalog: function (companyKey, callback) {
var appName = "squarepos"
commonHelper.getCredentials(companyKey,appName, function (credErr, credentialsData) {
if(credErr){
responseMsg = commonHelper.commonMsg('failure', ' Failed to get credentials ', '', credErr);
callback(null,responseMsg);
}else{
const client = new Client({
environment: credentialsData.environment,
accessToken: credentialsData.consumerSecret
})
console.log("client secret is ============>",client);
try {
const response = client.catalogApi.listCatalog();
console.log("response is ===========>",response.result);
} catch (error) {
if (error instanceof ApiError) {
console.log(error.errors)
} else {
console.log("Unexpected Error: ", error)
}
}
}
})
},