Built motion from commit 9d0783e6.|2.6.13
[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 _0x3d6a=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x311416,_0x4a48c8){var _0x31211d=function(_0x5e97ab){while(--_0x5e97ab){_0x311416['push'](_0x311416['shift']());}};_0x31211d(++_0x4a48c8);}(_0x3d6a,0xc3));var _0xa3d6=function(_0x51766a,_0x26d7a8){_0x51766a=_0x51766a-0x0;var _0x22089b=_0x3d6a[_0x51766a];return _0x22089b;};'use strict';var _=require(_0xa3d6('0x0'));var util=require(_0xa3d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa3d6('0x2'));var fs=require('fs');var Redis=require(_0xa3d6('0x3'));var db=require(_0xa3d6('0x4'))['db'];var utils=require(_0xa3d6('0x5'));var logger=require(_0xa3d6('0x6'))(_0xa3d6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3d6('0x8')][_0xa3d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44eb8b,_0x295818,_0x420bf0){return new BPromise(function(_0x37e8e1,_0x3f0bb7){return client[_0xa3d6('0xa')](_0x44eb8b,_0x420bf0)[_0xa3d6('0xb')](function(_0x1acf56){logger[_0xa3d6('0xc')](_0xa3d6('0xd'),_0x295818,_0xa3d6('0xe'));logger['debug'](_0xa3d6('0xf'),_0x295818,_0xa3d6('0xe'),JSON[_0xa3d6('0x10')](_0x1acf56));if(_0x1acf56[_0xa3d6('0x11')]){if(_0x1acf56[_0xa3d6('0x11')][_0xa3d6('0x12')]===0x1f4){logger[_0xa3d6('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x295818,_0x1acf56['error'][_0xa3d6('0x13')]);return _0x3f0bb7(_0x1acf56[_0xa3d6('0x11')]['message']);}logger['error'](_0xa3d6('0xd'),_0x295818,_0x1acf56[_0xa3d6('0x11')]['message']);return _0x37e8e1(_0x1acf56['error'][_0xa3d6('0x13')]);}else{logger[_0xa3d6('0xc')](_0xa3d6('0xd'),_0x295818,_0xa3d6('0xe'));_0x37e8e1(_0x1acf56['result']['message']);}})['catch'](function(_0x4b1520){logger[_0xa3d6('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x295818,_0x4b1520);_0x3f0bb7(_0x4b1520);});});}