Built motion from commit (unavailable).|2.5.11
[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 _0xc4b2=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1d5025,_0x4e8f97){var _0x2a3c16=function(_0xcbd95a){while(--_0xcbd95a){_0x1d5025['push'](_0x1d5025['shift']());}};_0x2a3c16(++_0x4e8f97);}(_0xc4b2,0x113));var _0x2c4b=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xc4b2[_0x349367];return _0x14179b;};'use strict';var _=require(_0x2c4b('0x0'));var util=require(_0x2c4b('0x1'));var moment=require(_0x2c4b('0x2'));var BPromise=require(_0x2c4b('0x3'));var rs=require(_0x2c4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c4b('0x5'));var config=require(_0x2c4b('0x6'));var jayson=require(_0x2c4b('0x7'));var client=jayson['client'][_0x2c4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa3872a,_0x212312,_0x38fa57){return new BPromise(function(_0x5ad03c,_0x1d5d1c){return client[_0x2c4b('0x9')](_0xa3872a,_0x38fa57)['then'](function(_0x5836a4){logger[_0x2c4b('0xa')](_0x2c4b('0xb'),_0x212312,_0x2c4b('0xc'));logger[_0x2c4b('0xd')](_0x2c4b('0xe'),_0x212312,'request\x20sent',JSON['stringify'](_0x5836a4));if(_0x5836a4['error']){if(_0x5836a4[_0x2c4b('0xf')][_0x2c4b('0x10')]===0x1f4){logger['error'](_0x2c4b('0xb'),_0x212312,_0x5836a4[_0x2c4b('0xf')]['message']);return _0x1d5d1c(_0x5836a4[_0x2c4b('0xf')]['message']);}logger[_0x2c4b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x212312,_0x5836a4[_0x2c4b('0xf')][_0x2c4b('0x11')]);return _0x5ad03c(_0x5836a4[_0x2c4b('0xf')]['message']);}else{logger[_0x2c4b('0xa')](_0x2c4b('0xb'),_0x212312,'request\x20sent');_0x5ad03c(_0x5836a4['result'][_0x2c4b('0x11')]);}})[_0x2c4b('0x12')](function(_0x40067e){logger['error'](_0x2c4b('0xb'),_0x212312,_0x40067e);_0x1d5d1c(_0x40067e);});});}