dd010d6490c18d86f5a62b3436f0e7b76ca8f747
[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 _0xf754=['http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x488bba,_0x22829b){var _0x54b4b0=function(_0x42af4e){while(--_0x42af4e){_0x488bba['push'](_0x488bba['shift']());}};_0x54b4b0(++_0x22829b);}(_0xf754,0xd6));var _0x4f75=function(_0x5264d0,_0xeef3b8){_0x5264d0=_0x5264d0-0x0;var _0x3219bf=_0xf754[_0x5264d0];return _0x3219bf;};'use strict';var _=require('lodash');var util=require(_0x4f75('0x0'));var moment=require(_0x4f75('0x1'));var BPromise=require(_0x4f75('0x2'));var rs=require(_0x4f75('0x3'));var fs=require('fs');var Redis=require(_0x4f75('0x4'));var db=require(_0x4f75('0x5'))['db'];var utils=require(_0x4f75('0x6'));var logger=require(_0x4f75('0x7'))(_0x4f75('0x8'));var config=require('../../config/environment');var jayson=require(_0x4f75('0x9'));var client=jayson[_0x4f75('0xa')][_0x4f75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423c3d,_0x56b472,_0x405cbe){return new BPromise(function(_0x4f4163,_0x10a01d){return client[_0x4f75('0xc')](_0x423c3d,_0x405cbe)[_0x4f75('0xd')](function(_0x256609){logger[_0x4f75('0xe')](_0x4f75('0xf'),_0x56b472,_0x4f75('0x10'));logger[_0x4f75('0x11')](_0x4f75('0x12'),_0x56b472,_0x4f75('0x10'),JSON[_0x4f75('0x13')](_0x256609));if(_0x256609[_0x4f75('0x14')]){if(_0x256609[_0x4f75('0x14')][_0x4f75('0x15')]===0x1f4){logger[_0x4f75('0x14')](_0x4f75('0xf'),_0x56b472,_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);return _0x10a01d(_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x56b472,_0x256609['error'][_0x4f75('0x16')]);return _0x4f4163(_0x256609[_0x4f75('0x14')][_0x4f75('0x16')]);}else{logger['info'](_0x4f75('0xf'),_0x56b472,_0x4f75('0x10'));_0x4f4163(_0x256609[_0x4f75('0x17')]['message']);}})[_0x4f75('0x18')](function(_0x139213){logger[_0x4f75('0x14')](_0x4f75('0xf'),_0x56b472,_0x139213);_0x10a01d(_0x139213);});});}