274945d0805473d3401956a87f362b5057023d9a
[motion2.git] / server / api / intFreshsalesField / intFreshsalesField.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 _0x555f=['error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x555f,0x1e0));var _0xf555=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x555f[_0x5d6270];return _0x168f26;};'use strict';var _=require(_0xf555('0x0'));var util=require('util');var moment=require(_0xf555('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf555('0x2'));var db=require(_0xf555('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf555('0x4'));var config=require(_0xf555('0x5'));var jayson=require(_0xf555('0x6'));var client=jayson['client'][_0xf555('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc5080c,_0x3d4795,_0x3f9c15){return new BPromise(function(_0x8685b9,_0x31ea83){return client[_0xf555('0x8')](_0xc5080c,_0x3f9c15)['then'](function(_0x52c540){logger[_0xf555('0x9')](_0xf555('0xa'),_0x3d4795,_0xf555('0xb'));logger[_0xf555('0xc')](_0xf555('0xd'),_0x3d4795,_0xf555('0xb'),JSON['stringify'](_0x52c540));if(_0x52c540[_0xf555('0xe')]){if(_0x52c540[_0xf555('0xe')][_0xf555('0xf')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3d4795,_0x52c540[_0xf555('0xe')]['message']);return _0x31ea83(_0x52c540[_0xf555('0xe')][_0xf555('0x10')]);}logger['error'](_0xf555('0xa'),_0x3d4795,_0x52c540['error']['message']);return _0x8685b9(_0x52c540['error'][_0xf555('0x10')]);}else{logger[_0xf555('0x9')]('FreshsalesField,\x20%s,\x20%s',_0x3d4795,_0xf555('0xb'));_0x8685b9(_0x52c540[_0xf555('0x11')][_0xf555('0x10')]);}})[_0xf555('0x12')](function(_0x446361){logger[_0xf555('0xe')](_0xf555('0xa'),_0x3d4795,_0x446361);_0x31ea83(_0x446361);});});}