af7d00abb5493e9b6f5463cdc729772d46d5fbbb
[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 _0x6b94=['rpc','../../config/environment','client','request','info','request\x20sent','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xbd6f8e,_0x10c174){var _0x57b158=function(_0x4ccfaa){while(--_0x4ccfaa){_0xbd6f8e['push'](_0xbd6f8e['shift']());}};_0x57b158(++_0x10c174);}(_0x6b94,0xd1));var _0x46b9=function(_0x280551,_0x3e9b84){_0x280551=_0x280551-0x0;var _0x1f0ad2=_0x6b94[_0x280551];return _0x1f0ad2;};'use strict';var _=require('lodash');var util=require(_0x46b9('0x0'));var moment=require(_0x46b9('0x1'));var BPromise=require(_0x46b9('0x2'));var rs=require(_0x46b9('0x3'));var fs=require('fs');var Redis=require(_0x46b9('0x4'));var db=require(_0x46b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46b9('0x6'))(_0x46b9('0x7'));var config=require(_0x46b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257ff1,_0x320eb2,_0x3eed05){return new BPromise(function(_0x450198,_0x310ddf){return client[_0x46b9('0xa')](_0x257ff1,_0x3eed05)['then'](function(_0x458d5f){logger[_0x46b9('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x320eb2,_0x46b9('0xc'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x320eb2,'request\x20sent',JSON['stringify'](_0x458d5f));if(_0x458d5f[_0x46b9('0xd')]){if(_0x458d5f[_0x46b9('0xd')][_0x46b9('0xe')]===0x1f4){logger[_0x46b9('0xd')](_0x46b9('0xf'),_0x320eb2,_0x458d5f[_0x46b9('0xd')]['message']);return _0x310ddf(_0x458d5f[_0x46b9('0xd')][_0x46b9('0x10')]);}logger[_0x46b9('0xd')](_0x46b9('0xf'),_0x320eb2,_0x458d5f[_0x46b9('0xd')]['message']);return _0x450198(_0x458d5f['error'][_0x46b9('0x10')]);}else{logger['info'](_0x46b9('0xf'),_0x320eb2,_0x46b9('0xc'));_0x450198(_0x458d5f['result'][_0x46b9('0x10')]);}})[_0x46b9('0x11')](function(_0x441125){logger[_0x46b9('0xd')](_0x46b9('0xf'),_0x320eb2,_0x441125);_0x310ddf(_0x441125);});});}