ce1a04fc9ba2fe550725b801e51be5384085dd6b
[motion2.git] / server / api / intFreshsalesConfiguration / intFreshsalesConfiguration.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 _0xcce8=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1ec3ba,_0x312f55){var _0x4516ba=function(_0x45f55a){while(--_0x45f55a){_0x1ec3ba['push'](_0x1ec3ba['shift']());}};_0x4516ba(++_0x312f55);}(_0xcce8,0x1a5));var _0x8cce=function(_0x47c920,_0x48e0c1){_0x47c920=_0x47c920-0x0;var _0x36a003=_0xcce8[_0x47c920];return _0x36a003;};'use strict';var _=require(_0x8cce('0x0'));var util=require(_0x8cce('0x1'));var moment=require(_0x8cce('0x2'));var BPromise=require(_0x8cce('0x3'));var rs=require(_0x8cce('0x4'));var fs=require('fs');var Redis=require(_0x8cce('0x5'));var db=require(_0x8cce('0x6'))['db'];var utils=require(_0x8cce('0x7'));var logger=require(_0x8cce('0x8'))(_0x8cce('0x9'));var config=require('../../config/environment');var jayson=require(_0x8cce('0xa'));var client=jayson[_0x8cce('0xb')][_0x8cce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xca15a9,_0x382fca,_0x1421b3){return new BPromise(function(_0x5244e1,_0x56c14d){return client['request'](_0xca15a9,_0x1421b3)[_0x8cce('0xd')](function(_0x525d11){logger['info'](_0x8cce('0xe'),_0x382fca,_0x8cce('0xf'));logger['debug'](_0x8cce('0x10'),_0x382fca,_0x8cce('0xf'),JSON[_0x8cce('0x11')](_0x525d11));if(_0x525d11['error']){if(_0x525d11[_0x8cce('0x12')][_0x8cce('0x13')]===0x1f4){logger[_0x8cce('0x12')](_0x8cce('0xe'),_0x382fca,_0x525d11['error'][_0x8cce('0x14')]);return _0x56c14d(_0x525d11[_0x8cce('0x12')][_0x8cce('0x14')]);}logger[_0x8cce('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x382fca,_0x525d11[_0x8cce('0x12')]['message']);return _0x5244e1(_0x525d11['error'][_0x8cce('0x14')]);}else{logger['info'](_0x8cce('0xe'),_0x382fca,_0x8cce('0xf'));_0x5244e1(_0x525d11[_0x8cce('0x15')][_0x8cce('0x14')]);}})[_0x8cce('0x16')](function(_0x251edd){logger[_0x8cce('0x12')](_0x8cce('0xe'),_0x382fca,_0x251edd);_0x56c14d(_0x251edd);});});}