Built motion from commit (unavailable).|2.5.4
[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 _0x6a90=['request','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x6a90,0x14e));var _0x06a9=function(_0x5e8653,_0x368047){_0x5e8653=_0x5e8653-0x0;var _0x3291d7=_0x6a90[_0x5e8653];return _0x3291d7;};'use strict';var _=require('lodash');var util=require(_0x06a9('0x0'));var moment=require(_0x06a9('0x1'));var BPromise=require(_0x06a9('0x2'));var rs=require(_0x06a9('0x3'));var fs=require('fs');var Redis=require(_0x06a9('0x4'));var db=require(_0x06a9('0x5'))['db'];var utils=require(_0x06a9('0x6'));var logger=require(_0x06a9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x06a9('0x8'));var client=jayson[_0x06a9('0x9')][_0x06a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8db,_0x242016,_0x47529c){return new BPromise(function(_0x5bfc28,_0x54b797){return client[_0x06a9('0xb')](_0x5ad8db,_0x47529c)['then'](function(_0x1e84a5){logger[_0x06a9('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x242016,_0x06a9('0xd'));logger[_0x06a9('0xe')](_0x06a9('0xf'),_0x242016,_0x06a9('0xd'),JSON[_0x06a9('0x10')](_0x1e84a5));if(_0x1e84a5['error']){if(_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x12')]===0x1f4){logger['error'](_0x06a9('0x13'),_0x242016,_0x1e84a5[_0x06a9('0x11')]['message']);return _0x54b797(_0x1e84a5[_0x06a9('0x11')]['message']);}logger[_0x06a9('0x11')](_0x06a9('0x13'),_0x242016,_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x14')]);return _0x5bfc28(_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x14')]);}else{logger[_0x06a9('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x242016,_0x06a9('0xd'));_0x5bfc28(_0x1e84a5[_0x06a9('0x15')][_0x06a9('0x14')]);}})[_0x06a9('0x16')](function(_0x13c551){logger['error'](_0x06a9('0x13'),_0x242016,_0x13c551);_0x54b797(_0x13c551);});});}