1dd4cfd991be6e6e4d998a36ecf163815e86eed3
[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 _0xf687=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0xf687,0x1cf));var _0x7f68=function(_0x431970,_0x3d390b){_0x431970=_0x431970-0x0;var _0x3a347a=_0xf687[_0x431970];return _0x3a347a;};'use strict';var _=require(_0x7f68('0x0'));var util=require(_0x7f68('0x1'));var moment=require(_0x7f68('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f68('0x3'));var fs=require('fs');var Redis=require(_0x7f68('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f68('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7f68('0x6'));var jayson=require(_0x7f68('0x7'));var client=jayson[_0x7f68('0x8')][_0x7f68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4af3ac,_0x33294c,_0x10ad14){return new BPromise(function(_0x159091,_0x4f135c){return client[_0x7f68('0xa')](_0x4af3ac,_0x10ad14)['then'](function(_0x14e878){logger[_0x7f68('0xb')](_0x7f68('0xc'),_0x33294c,_0x7f68('0xd'));logger[_0x7f68('0xe')](_0x7f68('0xf'),_0x33294c,_0x7f68('0xd'),JSON['stringify'](_0x14e878));if(_0x14e878[_0x7f68('0x10')]){if(_0x14e878[_0x7f68('0x10')][_0x7f68('0x11')]===0x1f4){logger[_0x7f68('0x10')](_0x7f68('0xc'),_0x33294c,_0x14e878['error']['message']);return _0x4f135c(_0x14e878['error'][_0x7f68('0x12')]);}logger[_0x7f68('0x10')](_0x7f68('0xc'),_0x33294c,_0x14e878[_0x7f68('0x10')]['message']);return _0x159091(_0x14e878[_0x7f68('0x10')][_0x7f68('0x12')]);}else{logger[_0x7f68('0xb')](_0x7f68('0xc'),_0x33294c,_0x7f68('0xd'));_0x159091(_0x14e878[_0x7f68('0x13')][_0x7f68('0x12')]);}})[_0x7f68('0x14')](function(_0x7ea0b4){logger[_0x7f68('0x10')](_0x7f68('0xc'),_0x33294c,_0x7ea0b4);_0x4f135c(_0x7ea0b4);});});}