Built motion from commit (unavailable).|2.5.14
[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 _0x4ab2=['FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x4ab2,0xbb));var _0x24ab=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x4ab2[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0x24ab('0x0'));var moment=require(_0x24ab('0x1'));var BPromise=require(_0x24ab('0x2'));var rs=require(_0x24ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24ab('0x4'))['db'];var utils=require(_0x24ab('0x5'));var logger=require(_0x24ab('0x6'))(_0x24ab('0x7'));var config=require(_0x24ab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24ab('0x9')][_0x24ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2232bb,_0x4114fc,_0x46679f){return new BPromise(function(_0x3068da,_0x4b3cbe){return client['request'](_0x2232bb,_0x46679f)['then'](function(_0xf16eca){logger['info'](_0x24ab('0xb'),_0x4114fc,_0x24ab('0xc'));logger[_0x24ab('0xd')](_0x24ab('0xe'),_0x4114fc,_0x24ab('0xc'),JSON[_0x24ab('0xf')](_0xf16eca));if(_0xf16eca[_0x24ab('0x10')]){if(_0xf16eca[_0x24ab('0x10')][_0x24ab('0x11')]===0x1f4){logger[_0x24ab('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4114fc,_0xf16eca[_0x24ab('0x10')][_0x24ab('0x12')]);return _0x4b3cbe(_0xf16eca[_0x24ab('0x10')]['message']);}logger[_0x24ab('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4114fc,_0xf16eca[_0x24ab('0x10')][_0x24ab('0x12')]);return _0x3068da(_0xf16eca[_0x24ab('0x10')][_0x24ab('0x12')]);}else{logger[_0x24ab('0x13')](_0x24ab('0xb'),_0x4114fc,'request\x20sent');_0x3068da(_0xf16eca[_0x24ab('0x14')][_0x24ab('0x12')]);}})[_0x24ab('0x15')](function(_0xd804a0){logger[_0x24ab('0x10')](_0x24ab('0xb'),_0x4114fc,_0xd804a0);_0x4b3cbe(_0xd804a0);});});}