Built motion from commit a61a4a20.|2.5.46
[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 _0x20ff=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x4a30b3,_0x3ddbdb){var _0x161079=function(_0x507543){while(--_0x507543){_0x4a30b3['push'](_0x4a30b3['shift']());}};_0x161079(++_0x3ddbdb);}(_0x20ff,0x166));var _0xf20f=function(_0x305d04,_0x9343f){_0x305d04=_0x305d04-0x0;var _0x5e7199=_0x20ff[_0x305d04];return _0x5e7199;};'use strict';var _=require('lodash');var util=require(_0xf20f('0x0'));var moment=require('moment');var BPromise=require(_0xf20f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf20f('0x3'));var logger=require(_0xf20f('0x4'))(_0xf20f('0x5'));var config=require(_0xf20f('0x6'));var jayson=require(_0xf20f('0x7'));var client=jayson['client'][_0xf20f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x691209,_0x366798,_0x529625){return new BPromise(function(_0x9d58c,_0x55d7e9){return client['request'](_0x691209,_0x529625)[_0xf20f('0x9')](function(_0x4448d7){logger[_0xf20f('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x366798,_0xf20f('0xb'));logger['debug'](_0xf20f('0xc'),_0x366798,'request\x20sent',JSON[_0xf20f('0xd')](_0x4448d7));if(_0x4448d7['error']){if(_0x4448d7[_0xf20f('0xe')][_0xf20f('0xf')]===0x1f4){logger[_0xf20f('0xe')](_0xf20f('0x10'),_0x366798,_0x4448d7['error'][_0xf20f('0x11')]);return _0x55d7e9(_0x4448d7['error']['message']);}logger['error'](_0xf20f('0x10'),_0x366798,_0x4448d7[_0xf20f('0xe')][_0xf20f('0x11')]);return _0x9d58c(_0x4448d7[_0xf20f('0xe')][_0xf20f('0x11')]);}else{logger[_0xf20f('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x366798,_0xf20f('0xb'));_0x9d58c(_0x4448d7[_0xf20f('0x12')][_0xf20f('0x11')]);}})[_0xf20f('0x13')](function(_0x189e72){logger['error'](_0xf20f('0x10'),_0x366798,_0x189e72);_0x55d7e9(_0x189e72);});});}