Built motion from commit b5996064.|2.6.21
[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 _0x07ce=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x33cc5b,_0x1bbc53){var _0x172d2a=function(_0x164312){while(--_0x164312){_0x33cc5b['push'](_0x33cc5b['shift']());}};_0x172d2a(++_0x1bbc53);}(_0x07ce,0xea));var _0xe07c=function(_0x467886,_0x341b0e){_0x467886=_0x467886-0x0;var _0x4dede8=_0x07ce[_0x467886];return _0x4dede8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe07c('0x0'));var rs=require(_0xe07c('0x1'));var fs=require('fs');var Redis=require(_0xe07c('0x2'));var db=require(_0xe07c('0x3'))['db'];var utils=require(_0xe07c('0x4'));var logger=require('../../config/logger')(_0xe07c('0x5'));var config=require(_0xe07c('0x6'));var jayson=require(_0xe07c('0x7'));var client=jayson[_0xe07c('0x8')][_0xe07c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x257ef8,_0x1951e9,_0x37758f){return new BPromise(function(_0x4f4604,_0x518617){return client[_0xe07c('0xa')](_0x257ef8,_0x37758f)['then'](function(_0x4328b8){logger['info'](_0xe07c('0xb'),_0x1951e9,_0xe07c('0xc'));logger[_0xe07c('0xd')](_0xe07c('0xe'),_0x1951e9,_0xe07c('0xc'),JSON['stringify'](_0x4328b8));if(_0x4328b8[_0xe07c('0xf')]){if(_0x4328b8[_0xe07c('0xf')]['code']===0x1f4){logger['error'](_0xe07c('0xb'),_0x1951e9,_0x4328b8[_0xe07c('0xf')]['message']);return _0x518617(_0x4328b8['error']['message']);}logger[_0xe07c('0xf')](_0xe07c('0xb'),_0x1951e9,_0x4328b8[_0xe07c('0xf')][_0xe07c('0x10')]);return _0x4f4604(_0x4328b8['error'][_0xe07c('0x10')]);}else{logger[_0xe07c('0x11')](_0xe07c('0xb'),_0x1951e9,_0xe07c('0xc'));_0x4f4604(_0x4328b8['result'][_0xe07c('0x10')]);}})['catch'](function(_0x5bbc3c){logger[_0xe07c('0xf')](_0xe07c('0xb'),_0x1951e9,_0x5bbc3c);_0x518617(_0x5bbc3c);});});}