0d1b9fbf9def5e6ed69fb134eea9b84d7b989575
[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 _0x9858=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9858,0x101));var _0x8985=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x9858[_0x336ca2];return _0xda59a6;};'use strict';var _=require(_0x8985('0x0'));var util=require(_0x8985('0x1'));var moment=require(_0x8985('0x2'));var BPromise=require(_0x8985('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8985('0x4'));var db=require(_0x8985('0x5'))['db'];var utils=require(_0x8985('0x6'));var logger=require(_0x8985('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8985('0x8'));var client=jayson[_0x8985('0x9')][_0x8985('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25ed0f,_0x5af910,_0x30375d){return new BPromise(function(_0x258e02,_0x5b610e){return client[_0x8985('0xb')](_0x25ed0f,_0x30375d)['then'](function(_0x5f4456){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5af910,_0x8985('0xc'));logger[_0x8985('0xd')](_0x8985('0xe'),_0x5af910,_0x8985('0xc'),JSON['stringify'](_0x5f4456));if(_0x5f4456[_0x8985('0xf')]){if(_0x5f4456[_0x8985('0xf')][_0x8985('0x10')]===0x1f4){logger[_0x8985('0xf')](_0x8985('0x11'),_0x5af910,_0x5f4456[_0x8985('0xf')][_0x8985('0x12')]);return _0x5b610e(_0x5f4456[_0x8985('0xf')][_0x8985('0x12')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5af910,_0x5f4456['error'][_0x8985('0x12')]);return _0x258e02(_0x5f4456['error'][_0x8985('0x12')]);}else{logger['info'](_0x8985('0x11'),_0x5af910,_0x8985('0xc'));_0x258e02(_0x5f4456[_0x8985('0x13')][_0x8985('0x12')]);}})['catch'](function(_0x1bf9c0){logger[_0x8985('0xf')](_0x8985('0x11'),_0x5af910,_0x1bf9c0);_0x5b610e(_0x1bf9c0);});});}