0a37a33e866e7f739c710a6d4cd4e9187b376543
[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 _0xd895=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2e38f3,_0x2d5564){var _0x3c20bf=function(_0x109ef1){while(--_0x109ef1){_0x2e38f3['push'](_0x2e38f3['shift']());}};_0x3c20bf(++_0x2d5564);}(_0xd895,0x1e5));var _0x5d89=function(_0x5af19d,_0x160180){_0x5af19d=_0x5af19d-0x0;var _0x43545c=_0xd895[_0x5af19d];return _0x43545c;};'use strict';var _=require(_0x5d89('0x0'));var util=require(_0x5d89('0x1'));var moment=require(_0x5d89('0x2'));var BPromise=require(_0x5d89('0x3'));var rs=require(_0x5d89('0x4'));var fs=require('fs');var Redis=require(_0x5d89('0x5'));var db=require(_0x5d89('0x6'))['db'];var utils=require(_0x5d89('0x7'));var logger=require('../../config/logger')(_0x5d89('0x8'));var config=require(_0x5d89('0x9'));var jayson=require(_0x5d89('0xa'));var client=jayson[_0x5d89('0xb')][_0x5d89('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f227e,_0x4ae69e,_0x1be8af){return new BPromise(function(_0x1b48dd,_0x5851f5){return client[_0x5d89('0xd')](_0x1f227e,_0x1be8af)['then'](function(_0x468c56){logger[_0x5d89('0xe')](_0x5d89('0xf'),_0x4ae69e,_0x5d89('0x10'));logger['debug'](_0x5d89('0x11'),_0x4ae69e,_0x5d89('0x10'),JSON[_0x5d89('0x12')](_0x468c56));if(_0x468c56[_0x5d89('0x13')]){if(_0x468c56[_0x5d89('0x13')][_0x5d89('0x14')]===0x1f4){logger['error'](_0x5d89('0xf'),_0x4ae69e,_0x468c56[_0x5d89('0x13')][_0x5d89('0x15')]);return _0x5851f5(_0x468c56[_0x5d89('0x13')]['message']);}logger[_0x5d89('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4ae69e,_0x468c56['error']['message']);return _0x1b48dd(_0x468c56[_0x5d89('0x13')][_0x5d89('0x15')]);}else{logger[_0x5d89('0xe')](_0x5d89('0xf'),_0x4ae69e,_0x5d89('0x10'));_0x1b48dd(_0x468c56['result'][_0x5d89('0x15')]);}})[_0x5d89('0x16')](function(_0x3cfe0c){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4ae69e,_0x3cfe0c);_0x5851f5(_0x3cfe0c);});});}