Built motion from commit 10af8726.|2.6.34
[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 _0x3819=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','info','result','catch'];(function(_0x2c96f8,_0x4c3c0c){var _0x2976b7=function(_0x15db63){while(--_0x15db63){_0x2c96f8['push'](_0x2c96f8['shift']());}};_0x2976b7(++_0x4c3c0c);}(_0x3819,0xdc));var _0x9381=function(_0x2cea83,_0x3c40f2){_0x2cea83=_0x2cea83-0x0;var _0x5b9572=_0x3819[_0x2cea83];return _0x5b9572;};'use strict';var _=require(_0x9381('0x0'));var util=require(_0x9381('0x1'));var moment=require(_0x9381('0x2'));var BPromise=require('bluebird');var rs=require(_0x9381('0x3'));var fs=require('fs');var Redis=require(_0x9381('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9381('0x5'));var logger=require('../../config/logger')(_0x9381('0x6'));var config=require(_0x9381('0x7'));var jayson=require(_0x9381('0x8'));var client=jayson[_0x9381('0x9')][_0x9381('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a0ac3,_0x23afda,_0x26dcad){return new BPromise(function(_0xe912f6,_0x2f10fc){return client['request'](_0x1a0ac3,_0x26dcad)[_0x9381('0xb')](function(_0x1ddd23){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x23afda,_0x9381('0xc'));logger[_0x9381('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x23afda,_0x9381('0xc'),JSON[_0x9381('0xe')](_0x1ddd23));if(_0x1ddd23[_0x9381('0xf')]){if(_0x1ddd23['error'][_0x9381('0x10')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x23afda,_0x1ddd23[_0x9381('0xf')][_0x9381('0x11')]);return _0x2f10fc(_0x1ddd23['error'][_0x9381('0x11')]);}logger[_0x9381('0xf')](_0x9381('0x12'),_0x23afda,_0x1ddd23[_0x9381('0xf')][_0x9381('0x11')]);return _0xe912f6(_0x1ddd23[_0x9381('0xf')][_0x9381('0x11')]);}else{logger[_0x9381('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x23afda,_0x9381('0xc'));_0xe912f6(_0x1ddd23[_0x9381('0x14')][_0x9381('0x11')]);}})[_0x9381('0x15')](function(_0x2d714d){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x23afda,_0x2d714d);_0x2f10fc(_0x2d714d);});});}