Built motion from commit c116dc8b.|2.6.30
[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 _0x95e6=['info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x220f9e,_0x138f56){var _0x29dd2b=function(_0x3fa887){while(--_0x3fa887){_0x220f9e['push'](_0x220f9e['shift']());}};_0x29dd2b(++_0x138f56);}(_0x95e6,0xff));var _0x695e=function(_0x466b5d,_0x55abd4){_0x466b5d=_0x466b5d-0x0;var _0x4c4c13=_0x95e6[_0x466b5d];return _0x4c4c13;};'use strict';var _=require(_0x695e('0x0'));var util=require(_0x695e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x695e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x695e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x695e('0x4'))('rpc');var config=require(_0x695e('0x5'));var jayson=require(_0x695e('0x6'));var client=jayson[_0x695e('0x7')][_0x695e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x432f36,_0x238899,_0x3bc76e){return new BPromise(function(_0x159501,_0x5da333){return client['request'](_0x432f36,_0x3bc76e)[_0x695e('0x9')](function(_0x51029d){logger['info'](_0x695e('0xa'),_0x238899,_0x695e('0xb'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x238899,_0x695e('0xb'),JSON['stringify'](_0x51029d));if(_0x51029d[_0x695e('0xc')]){if(_0x51029d[_0x695e('0xc')][_0x695e('0xd')]===0x1f4){logger[_0x695e('0xc')](_0x695e('0xa'),_0x238899,_0x51029d[_0x695e('0xc')][_0x695e('0xe')]);return _0x5da333(_0x51029d[_0x695e('0xc')][_0x695e('0xe')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x238899,_0x51029d[_0x695e('0xc')][_0x695e('0xe')]);return _0x159501(_0x51029d[_0x695e('0xc')]['message']);}else{logger[_0x695e('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x238899,_0x695e('0xb'));_0x159501(_0x51029d[_0x695e('0x10')][_0x695e('0xe')]);}})[_0x695e('0x11')](function(_0x4faeaa){logger[_0x695e('0xc')](_0x695e('0xa'),_0x238899,_0x4faeaa);_0x5da333(_0x4faeaa);});});}