Built motion from commit 9e1399f3.|2.5.37
[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 _0x38f3=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0xc975c8,_0xee0abc){var _0x47259f=function(_0x2eccad){while(--_0x2eccad){_0xc975c8['push'](_0xc975c8['shift']());}};_0x47259f(++_0xee0abc);}(_0x38f3,0x1e4));var _0x338f=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x38f3[_0x523adf];return _0x283870;};'use strict';var _=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var moment=require(_0x338f('0x2'));var BPromise=require(_0x338f('0x3'));var rs=require(_0x338f('0x4'));var fs=require('fs');var Redis=require(_0x338f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x338f('0x6'));var logger=require(_0x338f('0x7'))(_0x338f('0x8'));var config=require(_0x338f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x338f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337b92,_0x41c15b,_0x96576){return new BPromise(function(_0x2e897a,_0x3eceaa){return client[_0x338f('0xb')](_0x337b92,_0x96576)[_0x338f('0xc')](function(_0x2718d8){logger['info'](_0x338f('0xd'),_0x41c15b,_0x338f('0xe'));logger[_0x338f('0xf')](_0x338f('0x10'),_0x41c15b,_0x338f('0xe'),JSON['stringify'](_0x2718d8));if(_0x2718d8[_0x338f('0x11')]){if(_0x2718d8[_0x338f('0x11')]['code']===0x1f4){logger[_0x338f('0x11')](_0x338f('0xd'),_0x41c15b,_0x2718d8[_0x338f('0x11')][_0x338f('0x12')]);return _0x3eceaa(_0x2718d8[_0x338f('0x11')][_0x338f('0x12')]);}logger[_0x338f('0x11')](_0x338f('0xd'),_0x41c15b,_0x2718d8[_0x338f('0x11')]['message']);return _0x2e897a(_0x2718d8['error'][_0x338f('0x12')]);}else{logger[_0x338f('0x13')](_0x338f('0xd'),_0x41c15b,_0x338f('0xe'));_0x2e897a(_0x2718d8['result'][_0x338f('0x12')]);}})[_0x338f('0x14')](function(_0x1064af){logger['error'](_0x338f('0xd'),_0x41c15b,_0x1064af);_0x3eceaa(_0x1064af);});});}