Built motion from commit 64a6f4bc.|2.6.26
[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 _0x5c18=['request','then','info','request\x20sent','debug','stringify','error','message','ServicenowAccount,\x20%s,\x20%s','result','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2eafb1,_0x161dbf){var _0x5dda1f=function(_0x4535e0){while(--_0x4535e0){_0x2eafb1['push'](_0x2eafb1['shift']());}};_0x5dda1f(++_0x161dbf);}(_0x5c18,0xef));var _0x85c1=function(_0x407270,_0x2ac8ff){_0x407270=_0x407270-0x0;var _0x10918a=_0x5c18[_0x407270];return _0x10918a;};'use strict';var _=require(_0x85c1('0x0'));var util=require(_0x85c1('0x1'));var moment=require(_0x85c1('0x2'));var BPromise=require(_0x85c1('0x3'));var rs=require(_0x85c1('0x4'));var fs=require('fs');var Redis=require(_0x85c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x85c1('0x6'));var logger=require(_0x85c1('0x7'))(_0x85c1('0x8'));var config=require(_0x85c1('0x9'));var jayson=require(_0x85c1('0xa'));var client=jayson[_0x85c1('0xb')][_0x85c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30bb58,_0x351a5e,_0x9545ba){return new BPromise(function(_0x7ea22a,_0x1fcf3b){return client[_0x85c1('0xd')](_0x30bb58,_0x9545ba)[_0x85c1('0xe')](function(_0x2e1123){logger[_0x85c1('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x351a5e,_0x85c1('0x10'));logger[_0x85c1('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x351a5e,_0x85c1('0x10'),JSON[_0x85c1('0x12')](_0x2e1123));if(_0x2e1123[_0x85c1('0x13')]){if(_0x2e1123[_0x85c1('0x13')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x351a5e,_0x2e1123[_0x85c1('0x13')][_0x85c1('0x14')]);return _0x1fcf3b(_0x2e1123[_0x85c1('0x13')][_0x85c1('0x14')]);}logger[_0x85c1('0x13')](_0x85c1('0x15'),_0x351a5e,_0x2e1123[_0x85c1('0x13')][_0x85c1('0x14')]);return _0x7ea22a(_0x2e1123[_0x85c1('0x13')][_0x85c1('0x14')]);}else{logger[_0x85c1('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x351a5e,_0x85c1('0x10'));_0x7ea22a(_0x2e1123[_0x85c1('0x16')][_0x85c1('0x14')]);}})['catch'](function(_0x3ef3de){logger[_0x85c1('0x13')](_0x85c1('0x15'),_0x351a5e,_0x3ef3de);_0x1fcf3b(_0x3ef3de);});});}exports['GetServicenowAccount']=function(_0xbfd528){var _0x4b3344=this;return new Promise(function(_0x4f1b6e,_0x2fa0ce){return db[_0x85c1('0x17')]['findAll']({'raw':_0xbfd528[_0x85c1('0x18')]?_0xbfd528['options'][_0x85c1('0x19')]===undefined?!![]:![]:!![],'where':_0xbfd528[_0x85c1('0x18')]?_0xbfd528[_0x85c1('0x18')][_0x85c1('0x1a')]||null:null,'attributes':_0xbfd528[_0x85c1('0x18')]?_0xbfd528[_0x85c1('0x18')][_0x85c1('0x1b')]||null:null,'limit':_0xbfd528[_0x85c1('0x18')]?_0xbfd528['options'][_0x85c1('0x1c')]||null:null,'include':_0xbfd528[_0x85c1('0x18')]?_0xbfd528[_0x85c1('0x18')][_0x85c1('0x1d')]?_[_0x85c1('0x1e')](_0xbfd528[_0x85c1('0x18')][_0x85c1('0x1d')],function(_0x4bc245){return{'model':db[_0x4bc245[_0x85c1('0x1f')]],'as':_0x4bc245['as'],'attributes':_0x4bc245[_0x85c1('0x1b')],'include':_0x4bc245[_0x85c1('0x1d')]?_[_0x85c1('0x1e')](_0x4bc245[_0x85c1('0x1d')],function(_0x25025a){return{'model':db[_0x25025a['model']],'as':_0x25025a['as'],'attributes':_0x25025a[_0x85c1('0x1b')],'include':_0x25025a[_0x85c1('0x1d')]?_[_0x85c1('0x1e')](_0x25025a[_0x85c1('0x1d')],function(_0x53a358){return{'model':db[_0x53a358['model']],'as':_0x53a358['as'],'attributes':_0x53a358[_0x85c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x85c1('0xe')](function(_0x4d2634){logger[_0x85c1('0xf')](_0x85c1('0x20'),_0xbfd528);logger[_0x85c1('0x11')](_0x85c1('0x20'),_0xbfd528,JSON[_0x85c1('0x12')](_0x4d2634));_0x4f1b6e(_0x4d2634);})['catch'](function(_0x23e498){logger['error'](_0x85c1('0x20'),_0x23e498[_0x85c1('0x14')],_0xbfd528);_0x2fa0ce(_0x4b3344[_0x85c1('0x13')](0x1f4,_0x23e498[_0x85c1('0x14')]));});});};exports[_0x85c1('0x21')]=function(_0x4a56a0){var _0x1c9aa0=this;return new Promise(function(_0x197872,_0x5b6566){return db[_0x85c1('0x17')][_0x85c1('0x22')]({'raw':_0x4a56a0[_0x85c1('0x18')]?_0x4a56a0[_0x85c1('0x18')][_0x85c1('0x19')]===undefined?!![]:![]:!![],'where':_0x4a56a0[_0x85c1('0x18')]?_0x4a56a0['options'][_0x85c1('0x1a')]||null:null,'attributes':_0x4a56a0[_0x85c1('0x18')]?_0x4a56a0[_0x85c1('0x18')]['attributes']||null:null,'include':_0x4a56a0['options']?_0x4a56a0['options'][_0x85c1('0x1d')]?_[_0x85c1('0x1e')](_0x4a56a0['options']['include'],function(_0x40d05d){return{'model':db[_0x40d05d[_0x85c1('0x1f')]],'as':_0x40d05d['as'],'attributes':_0x40d05d['attributes'],'include':_0x40d05d[_0x85c1('0x1d')]?_[_0x85c1('0x1e')](_0x40d05d[_0x85c1('0x1d')],function(_0x53c538){return{'model':db[_0x53c538[_0x85c1('0x1f')]],'as':_0x53c538['as'],'attributes':_0x53c538[_0x85c1('0x1b')],'include':_0x53c538[_0x85c1('0x1d')]?_[_0x85c1('0x1e')](_0x53c538[_0x85c1('0x1d')],function(_0x3748ae){return{'model':db[_0x3748ae[_0x85c1('0x1f')]],'as':_0x3748ae['as'],'attributes':_0x3748ae['attributes']};}):[]};}):[]};}):[]:[]})[_0x85c1('0xe')](function(_0x430215){logger[_0x85c1('0xf')]('ShowServicenowAccount',_0x4a56a0);logger['debug'](_0x85c1('0x21'),_0x4a56a0,JSON[_0x85c1('0x12')](_0x430215));_0x197872(_0x430215);})[_0x85c1('0x23')](function(_0x3ecf20){logger['error'](_0x85c1('0x21'),_0x3ecf20[_0x85c1('0x14')],_0x4a56a0);_0x5b6566(_0x1c9aa0[_0x85c1('0x13')](0x1f4,_0x3ecf20[_0x85c1('0x14')]));});});};