2bdfe1f2f49af644c53aa5d1057d4cc4b2387ca0
[motion2.git] / server / api / intServicenowAccount / intServicenowAccount.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xe983=['ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','ShowServicenowAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe983,0x18f));var _0x3e98=function(_0xfa3657,_0xff272b){_0xfa3657=_0xfa3657-0x0;var _0x23ab4e=_0xe983[_0xfa3657];return _0x23ab4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e98('0x0'));var BPromise=require('bluebird');var rs=require(_0x3e98('0x1'));var fs=require('fs');var Redis=require(_0x3e98('0x2'));var db=require(_0x3e98('0x3'))['db'];var utils=require(_0x3e98('0x4'));var logger=require(_0x3e98('0x5'))('rpc');var config=require(_0x3e98('0x6'));var jayson=require(_0x3e98('0x7'));var client=jayson[_0x3e98('0x8')][_0x3e98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d2d55,_0x5326b1,_0x1f3ffc){return new BPromise(function(_0x38e5ab,_0xaa0184){return client[_0x3e98('0xa')](_0x5d2d55,_0x1f3ffc)[_0x3e98('0xb')](function(_0x8b06f2){logger['info'](_0x3e98('0xc'),_0x5326b1,_0x3e98('0xd'));logger['debug'](_0x3e98('0xe'),_0x5326b1,'request\x20sent',JSON[_0x3e98('0xf')](_0x8b06f2));if(_0x8b06f2[_0x3e98('0x10')]){if(_0x8b06f2[_0x3e98('0x10')][_0x3e98('0x11')]===0x1f4){logger['error'](_0x3e98('0xc'),_0x5326b1,_0x8b06f2[_0x3e98('0x10')][_0x3e98('0x12')]);return _0xaa0184(_0x8b06f2[_0x3e98('0x10')][_0x3e98('0x12')]);}logger[_0x3e98('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x5326b1,_0x8b06f2[_0x3e98('0x10')]['message']);return _0x38e5ab(_0x8b06f2[_0x3e98('0x10')][_0x3e98('0x12')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x5326b1,_0x3e98('0xd'));_0x38e5ab(_0x8b06f2['result'][_0x3e98('0x12')]);}})[_0x3e98('0x13')](function(_0x5b57d9){logger[_0x3e98('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x5326b1,_0x5b57d9);_0xaa0184(_0x5b57d9);});});}exports[_0x3e98('0x14')]=function(_0x194fdf){var _0x4c8076=this;return new Promise(function(_0x198b47,_0x231873){return db[_0x3e98('0x15')][_0x3e98('0x16')]({'raw':_0x194fdf[_0x3e98('0x17')]?_0x194fdf[_0x3e98('0x17')][_0x3e98('0x18')]===undefined?!![]:![]:!![],'where':_0x194fdf[_0x3e98('0x17')]?_0x194fdf[_0x3e98('0x17')][_0x3e98('0x19')]||null:null,'attributes':_0x194fdf[_0x3e98('0x17')]?_0x194fdf[_0x3e98('0x17')][_0x3e98('0x1a')]||null:null,'limit':_0x194fdf[_0x3e98('0x17')]?_0x194fdf[_0x3e98('0x17')][_0x3e98('0x1b')]||null:null,'include':_0x194fdf[_0x3e98('0x17')]?_0x194fdf['options'][_0x3e98('0x1c')]?_[_0x3e98('0x1d')](_0x194fdf[_0x3e98('0x17')]['include'],function(_0x2a200d){return{'model':db[_0x2a200d[_0x3e98('0x1e')]],'as':_0x2a200d['as'],'attributes':_0x2a200d[_0x3e98('0x1a')],'include':_0x2a200d['include']?_[_0x3e98('0x1d')](_0x2a200d['include'],function(_0x3cb57b){return{'model':db[_0x3cb57b[_0x3e98('0x1e')]],'as':_0x3cb57b['as'],'attributes':_0x3cb57b[_0x3e98('0x1a')],'include':_0x3cb57b['include']?_[_0x3e98('0x1d')](_0x3cb57b[_0x3e98('0x1c')],function(_0x105b25){return{'model':db[_0x105b25[_0x3e98('0x1e')]],'as':_0x105b25['as'],'attributes':_0x105b25[_0x3e98('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3e98('0xb')](function(_0x31385a){logger[_0x3e98('0x1f')](_0x3e98('0x14'),_0x194fdf);logger[_0x3e98('0x20')](_0x3e98('0x14'),_0x194fdf,JSON[_0x3e98('0xf')](_0x31385a));_0x198b47(_0x31385a);})[_0x3e98('0x13')](function(_0x4d5769){logger[_0x3e98('0x10')](_0x3e98('0x14'),_0x4d5769[_0x3e98('0x12')],_0x194fdf);_0x231873(_0x4c8076[_0x3e98('0x10')](0x1f4,_0x4d5769[_0x3e98('0x12')]));});});};exports[_0x3e98('0x21')]=function(_0x50c7c4){var _0x3a4b52=this;return new Promise(function(_0x48cd02,_0x331be6){return db['ServicenowAccount'][_0x3e98('0x22')]({'raw':_0x50c7c4[_0x3e98('0x17')]?_0x50c7c4[_0x3e98('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x50c7c4[_0x3e98('0x17')]?_0x50c7c4[_0x3e98('0x17')][_0x3e98('0x19')]||null:null,'attributes':_0x50c7c4[_0x3e98('0x17')]?_0x50c7c4[_0x3e98('0x17')][_0x3e98('0x1a')]||null:null,'include':_0x50c7c4[_0x3e98('0x17')]?_0x50c7c4[_0x3e98('0x17')]['include']?_[_0x3e98('0x1d')](_0x50c7c4['options']['include'],function(_0x2acae2){return{'model':db[_0x2acae2[_0x3e98('0x1e')]],'as':_0x2acae2['as'],'attributes':_0x2acae2['attributes'],'include':_0x2acae2[_0x3e98('0x1c')]?_[_0x3e98('0x1d')](_0x2acae2[_0x3e98('0x1c')],function(_0x4644ec){return{'model':db[_0x4644ec[_0x3e98('0x1e')]],'as':_0x4644ec['as'],'attributes':_0x4644ec[_0x3e98('0x1a')],'include':_0x4644ec['include']?_[_0x3e98('0x1d')](_0x4644ec['include'],function(_0x297db7){return{'model':db[_0x297db7[_0x3e98('0x1e')]],'as':_0x297db7['as'],'attributes':_0x297db7[_0x3e98('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3e98('0xb')](function(_0x1854e6){logger[_0x3e98('0x1f')](_0x3e98('0x21'),_0x50c7c4);logger[_0x3e98('0x20')](_0x3e98('0x21'),_0x50c7c4,JSON[_0x3e98('0xf')](_0x1854e6));_0x48cd02(_0x1854e6);})[_0x3e98('0x13')](function(_0x5f1821){logger[_0x3e98('0x10')](_0x3e98('0x21'),_0x5f1821['message'],_0x50c7c4);_0x331be6(_0x3a4b52[_0x3e98('0x10')](0x1f4,_0x5f1821[_0x3e98('0x12')]));});});};