Built motion from commit 97153652.|2.6.26
[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 _0x0c2e=['include','map','model','attributes','GetDynamics365Account','find','raw','ShowDynamics365Account','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Dynamics365Account','findAll','options','where','limit'];(function(_0x1beb1c,_0xb9e72c){var _0x401b20=function(_0x4ad115){while(--_0x4ad115){_0x1beb1c['push'](_0x1beb1c['shift']());}};_0x401b20(++_0xb9e72c);}(_0x0c2e,0x14d));var _0xe0c2=function(_0x545928,_0x28b70f){_0x545928=_0x545928-0x0;var _0x3b3dac=_0x0c2e[_0x545928];return _0x3b3dac;};'use strict';var _=require(_0xe0c2('0x0'));var util=require(_0xe0c2('0x1'));var moment=require(_0xe0c2('0x2'));var BPromise=require(_0xe0c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0c2('0x5'));var logger=require(_0xe0c2('0x6'))('rpc');var config=require(_0xe0c2('0x7'));var jayson=require(_0xe0c2('0x8'));var client=jayson[_0xe0c2('0x9')][_0xe0c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x489dbb,_0x26d88a,_0x440a23){return new BPromise(function(_0x1f8e4a,_0x50a567){return client['request'](_0x489dbb,_0x440a23)[_0xe0c2('0xb')](function(_0x4ef345){logger[_0xe0c2('0xc')](_0xe0c2('0xd'),_0x26d88a,_0xe0c2('0xe'));logger[_0xe0c2('0xf')](_0xe0c2('0x10'),_0x26d88a,'request\x20sent',JSON[_0xe0c2('0x11')](_0x4ef345));if(_0x4ef345[_0xe0c2('0x12')]){if(_0x4ef345[_0xe0c2('0x12')][_0xe0c2('0x13')]===0x1f4){logger[_0xe0c2('0x12')](_0xe0c2('0xd'),_0x26d88a,_0x4ef345['error'][_0xe0c2('0x14')]);return _0x50a567(_0x4ef345[_0xe0c2('0x12')][_0xe0c2('0x14')]);}logger['error'](_0xe0c2('0xd'),_0x26d88a,_0x4ef345['error'][_0xe0c2('0x14')]);return _0x1f8e4a(_0x4ef345[_0xe0c2('0x12')][_0xe0c2('0x14')]);}else{logger[_0xe0c2('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x26d88a,'request\x20sent');_0x1f8e4a(_0x4ef345[_0xe0c2('0x15')][_0xe0c2('0x14')]);}})['catch'](function(_0x51907a){logger[_0xe0c2('0x12')](_0xe0c2('0xd'),_0x26d88a,_0x51907a);_0x50a567(_0x51907a);});});}exports['GetDynamics365Account']=function(_0x4c48d1){var _0x587a70=this;return new Promise(function(_0x583c25,_0x1d54ab){return db[_0xe0c2('0x16')][_0xe0c2('0x17')]({'raw':_0x4c48d1[_0xe0c2('0x18')]?_0x4c48d1[_0xe0c2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c48d1[_0xe0c2('0x18')]?_0x4c48d1['options'][_0xe0c2('0x19')]||null:null,'attributes':_0x4c48d1[_0xe0c2('0x18')]?_0x4c48d1['options']['attributes']||null:null,'limit':_0x4c48d1[_0xe0c2('0x18')]?_0x4c48d1['options'][_0xe0c2('0x1a')]||null:null,'include':_0x4c48d1[_0xe0c2('0x18')]?_0x4c48d1[_0xe0c2('0x18')][_0xe0c2('0x1b')]?_[_0xe0c2('0x1c')](_0x4c48d1[_0xe0c2('0x18')][_0xe0c2('0x1b')],function(_0x129712){return{'model':db[_0x129712[_0xe0c2('0x1d')]],'as':_0x129712['as'],'attributes':_0x129712[_0xe0c2('0x1e')],'include':_0x129712[_0xe0c2('0x1b')]?_[_0xe0c2('0x1c')](_0x129712[_0xe0c2('0x1b')],function(_0x3fec12){return{'model':db[_0x3fec12[_0xe0c2('0x1d')]],'as':_0x3fec12['as'],'attributes':_0x3fec12[_0xe0c2('0x1e')],'include':_0x3fec12['include']?_[_0xe0c2('0x1c')](_0x3fec12['include'],function(_0x388eca){return{'model':db[_0x388eca[_0xe0c2('0x1d')]],'as':_0x388eca['as'],'attributes':_0x388eca['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xec24b3){logger[_0xe0c2('0xc')]('GetDynamics365Account',_0x4c48d1);logger['debug'](_0xe0c2('0x1f'),_0x4c48d1,JSON[_0xe0c2('0x11')](_0xec24b3));_0x583c25(_0xec24b3);})['catch'](function(_0x54fb6e){logger['error'](_0xe0c2('0x1f'),_0x54fb6e['message'],_0x4c48d1);_0x1d54ab(_0x587a70['error'](0x1f4,_0x54fb6e[_0xe0c2('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x1711f1){var _0x2119a3=this;return new Promise(function(_0x34845e,_0x53ff78){return db[_0xe0c2('0x16')][_0xe0c2('0x20')]({'raw':_0x1711f1[_0xe0c2('0x18')]?_0x1711f1[_0xe0c2('0x18')][_0xe0c2('0x21')]===undefined?!![]:![]:!![],'where':_0x1711f1[_0xe0c2('0x18')]?_0x1711f1[_0xe0c2('0x18')][_0xe0c2('0x19')]||null:null,'attributes':_0x1711f1[_0xe0c2('0x18')]?_0x1711f1[_0xe0c2('0x18')]['attributes']||null:null,'include':_0x1711f1[_0xe0c2('0x18')]?_0x1711f1[_0xe0c2('0x18')][_0xe0c2('0x1b')]?_[_0xe0c2('0x1c')](_0x1711f1['options'][_0xe0c2('0x1b')],function(_0x14de1b){return{'model':db[_0x14de1b[_0xe0c2('0x1d')]],'as':_0x14de1b['as'],'attributes':_0x14de1b[_0xe0c2('0x1e')],'include':_0x14de1b['include']?_[_0xe0c2('0x1c')](_0x14de1b['include'],function(_0x2c4119){return{'model':db[_0x2c4119[_0xe0c2('0x1d')]],'as':_0x2c4119['as'],'attributes':_0x2c4119[_0xe0c2('0x1e')],'include':_0x2c4119[_0xe0c2('0x1b')]?_[_0xe0c2('0x1c')](_0x2c4119[_0xe0c2('0x1b')],function(_0x294933){return{'model':db[_0x294933[_0xe0c2('0x1d')]],'as':_0x294933['as'],'attributes':_0x294933['attributes']};}):[]};}):[]};}):[]:[]})[_0xe0c2('0xb')](function(_0x205dc4){logger[_0xe0c2('0xc')](_0xe0c2('0x22'),_0x1711f1);logger[_0xe0c2('0xf')](_0xe0c2('0x22'),_0x1711f1,JSON[_0xe0c2('0x11')](_0x205dc4));_0x34845e(_0x205dc4);})[_0xe0c2('0x23')](function(_0x594e02){logger[_0xe0c2('0x12')](_0xe0c2('0x22'),_0x594e02[_0xe0c2('0x14')],_0x1711f1);_0x53ff78(_0x2119a3[_0xe0c2('0x12')](0x1f4,_0x594e02[_0xe0c2('0x14')]));});});};