Built motion from commit (unavailable).|2.5.1
[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 _0x3ec5=['error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36fc5d,_0x3380a1){var _0x386a98=function(_0x2a7fb0){while(--_0x2a7fb0){_0x36fc5d['push'](_0x36fc5d['shift']());}};_0x386a98(++_0x3380a1);}(_0x3ec5,0x176));var _0x53ec=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3ec5[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x53ec('0x0'));var moment=require('moment');var BPromise=require(_0x53ec('0x1'));var rs=require(_0x53ec('0x2'));var fs=require('fs');var Redis=require(_0x53ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x53ec('0x4'));var logger=require(_0x53ec('0x5'))(_0x53ec('0x6'));var config=require('../../config/environment');var jayson=require(_0x53ec('0x7'));var client=jayson[_0x53ec('0x8')][_0x53ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43a10c,_0x1b0a16,_0x6f47f6){return new BPromise(function(_0x43ed21,_0x5da137){return client[_0x53ec('0xa')](_0x43a10c,_0x6f47f6)[_0x53ec('0xb')](function(_0x5ce810){logger[_0x53ec('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1b0a16,_0x53ec('0xd'));logger[_0x53ec('0xe')](_0x53ec('0xf'),_0x1b0a16,_0x53ec('0xd'),JSON[_0x53ec('0x10')](_0x5ce810));if(_0x5ce810[_0x53ec('0x11')]){if(_0x5ce810[_0x53ec('0x11')][_0x53ec('0x12')]===0x1f4){logger[_0x53ec('0x11')](_0x53ec('0x13'),_0x1b0a16,_0x5ce810[_0x53ec('0x11')][_0x53ec('0x14')]);return _0x5da137(_0x5ce810[_0x53ec('0x11')]['message']);}logger[_0x53ec('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x1b0a16,_0x5ce810[_0x53ec('0x11')]['message']);return _0x43ed21(_0x5ce810[_0x53ec('0x11')][_0x53ec('0x14')]);}else{logger['info'](_0x53ec('0x13'),_0x1b0a16,_0x53ec('0xd'));_0x43ed21(_0x5ce810[_0x53ec('0x15')]['message']);}})[_0x53ec('0x16')](function(_0x30e3aa){logger['error'](_0x53ec('0x13'),_0x1b0a16,_0x30e3aa);_0x5da137(_0x30e3aa);});});}