Built motion from commit 994c64e1.|2.6.1
[motion2.git] / server / api / intDynamics365Account / intDynamics365Account.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 _0x1649=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Dynamics365Account,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find'];(function(_0x1984ed,_0x47b444){var _0x496182=function(_0x4ad887){while(--_0x4ad887){_0x1984ed['push'](_0x1984ed['shift']());}};_0x496182(++_0x47b444);}(_0x1649,0x1dc));var _0x9164=function(_0x1ae693,_0x47d58c){_0x1ae693=_0x1ae693-0x0;var _0x738029=_0x1649[_0x1ae693];return _0x738029;};'use strict';var _=require(_0x9164('0x0'));var util=require(_0x9164('0x1'));var moment=require(_0x9164('0x2'));var BPromise=require('bluebird');var rs=require(_0x9164('0x3'));var fs=require('fs');var Redis=require(_0x9164('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9164('0x5'));var logger=require(_0x9164('0x6'))(_0x9164('0x7'));var config=require(_0x9164('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9164('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b2605,_0x25a186,_0x3fbb7d){return new BPromise(function(_0x1e76ee,_0x128825){return client['request'](_0x3b2605,_0x3fbb7d)[_0x9164('0xa')](function(_0x19941f){logger[_0x9164('0xb')](_0x9164('0xc'),_0x25a186,'request\x20sent');logger[_0x9164('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x25a186,'request\x20sent',JSON['stringify'](_0x19941f));if(_0x19941f[_0x9164('0xe')]){if(_0x19941f['error'][_0x9164('0xf')]===0x1f4){logger[_0x9164('0xe')](_0x9164('0xc'),_0x25a186,_0x19941f['error'][_0x9164('0x10')]);return _0x128825(_0x19941f[_0x9164('0xe')][_0x9164('0x10')]);}logger[_0x9164('0xe')](_0x9164('0xc'),_0x25a186,_0x19941f[_0x9164('0xe')][_0x9164('0x10')]);return _0x1e76ee(_0x19941f[_0x9164('0xe')][_0x9164('0x10')]);}else{logger['info'](_0x9164('0xc'),_0x25a186,_0x9164('0x11'));_0x1e76ee(_0x19941f[_0x9164('0x12')][_0x9164('0x10')]);}})[_0x9164('0x13')](function(_0x449151){logger[_0x9164('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x25a186,_0x449151);_0x128825(_0x449151);});});}exports[_0x9164('0x14')]=function(_0x26924e){var _0x5a6614=this;return new Promise(function(_0x2d7d60,_0x148b62){return db[_0x9164('0x15')][_0x9164('0x16')]({'raw':_0x26924e[_0x9164('0x17')]?_0x26924e['options'][_0x9164('0x18')]===undefined?!![]:![]:!![],'where':_0x26924e[_0x9164('0x17')]?_0x26924e[_0x9164('0x17')][_0x9164('0x19')]||null:null,'attributes':_0x26924e[_0x9164('0x17')]?_0x26924e[_0x9164('0x17')][_0x9164('0x1a')]||null:null,'limit':_0x26924e[_0x9164('0x17')]?_0x26924e[_0x9164('0x17')][_0x9164('0x1b')]||null:null,'include':_0x26924e['options']?_0x26924e['options'][_0x9164('0x1c')]?_[_0x9164('0x1d')](_0x26924e[_0x9164('0x17')][_0x9164('0x1c')],function(_0x103b13){return{'model':db[_0x103b13['model']],'as':_0x103b13['as'],'attributes':_0x103b13[_0x9164('0x1a')],'include':_0x103b13['include']?_[_0x9164('0x1d')](_0x103b13[_0x9164('0x1c')],function(_0x2970e6){return{'model':db[_0x2970e6[_0x9164('0x1e')]],'as':_0x2970e6['as'],'attributes':_0x2970e6[_0x9164('0x1a')],'include':_0x2970e6[_0x9164('0x1c')]?_[_0x9164('0x1d')](_0x2970e6['include'],function(_0x24d2ff){return{'model':db[_0x24d2ff['model']],'as':_0x24d2ff['as'],'attributes':_0x24d2ff[_0x9164('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9164('0xa')](function(_0x343f82){logger[_0x9164('0xb')](_0x9164('0x14'),_0x26924e);logger[_0x9164('0xd')](_0x9164('0x14'),_0x26924e,JSON[_0x9164('0x1f')](_0x343f82));_0x2d7d60(_0x343f82);})[_0x9164('0x13')](function(_0x131789){logger['error'](_0x9164('0x14'),_0x131789[_0x9164('0x10')],_0x26924e);_0x148b62(_0x5a6614[_0x9164('0xe')](0x1f4,_0x131789[_0x9164('0x10')]));});});};exports[_0x9164('0x20')]=function(_0x23fb61){var _0x38e77e=this;return new Promise(function(_0x1274c7,_0x3afceb){return db[_0x9164('0x15')][_0x9164('0x21')]({'raw':_0x23fb61[_0x9164('0x17')]?_0x23fb61[_0x9164('0x17')][_0x9164('0x18')]===undefined?!![]:![]:!![],'where':_0x23fb61[_0x9164('0x17')]?_0x23fb61[_0x9164('0x17')][_0x9164('0x19')]||null:null,'attributes':_0x23fb61['options']?_0x23fb61[_0x9164('0x17')][_0x9164('0x1a')]||null:null,'include':_0x23fb61[_0x9164('0x17')]?_0x23fb61[_0x9164('0x17')]['include']?_[_0x9164('0x1d')](_0x23fb61[_0x9164('0x17')][_0x9164('0x1c')],function(_0x891196){return{'model':db[_0x891196['model']],'as':_0x891196['as'],'attributes':_0x891196['attributes'],'include':_0x891196[_0x9164('0x1c')]?_[_0x9164('0x1d')](_0x891196[_0x9164('0x1c')],function(_0x2531d2){return{'model':db[_0x2531d2['model']],'as':_0x2531d2['as'],'attributes':_0x2531d2['attributes'],'include':_0x2531d2[_0x9164('0x1c')]?_[_0x9164('0x1d')](_0x2531d2[_0x9164('0x1c')],function(_0xded758){return{'model':db[_0xded758[_0x9164('0x1e')]],'as':_0xded758['as'],'attributes':_0xded758['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cd245){logger[_0x9164('0xb')](_0x9164('0x20'),_0x23fb61);logger[_0x9164('0xd')](_0x9164('0x20'),_0x23fb61,JSON[_0x9164('0x1f')](_0x2cd245));_0x1274c7(_0x2cd245);})[_0x9164('0x13')](function(_0x29cca2){logger['error']('ShowDynamics365Account',_0x29cca2['message'],_0x23fb61);_0x3afceb(_0x38e77e[_0x9164('0xe')](0x1f4,_0x29cca2[_0x9164('0x10')]));});});};