Built motion from commit (unavailable).|2.5.15
[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 _0x1476=['request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5c81cb,_0x1b1dc8){var _0xa43794=function(_0x828eb1){while(--_0x828eb1){_0x5c81cb['push'](_0x5c81cb['shift']());}};_0xa43794(++_0x1b1dc8);}(_0x1476,0x133));var _0x6147=function(_0x3c053c,_0x3593db){_0x3c053c=_0x3c053c-0x0;var _0x594865=_0x1476[_0x3c053c];return _0x594865;};'use strict';var _=require(_0x6147('0x0'));var util=require(_0x6147('0x1'));var moment=require(_0x6147('0x2'));var BPromise=require(_0x6147('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6147('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6147('0x5'));var logger=require(_0x6147('0x6'))(_0x6147('0x7'));var config=require(_0x6147('0x8'));var jayson=require(_0x6147('0x9'));var client=jayson[_0x6147('0xa')][_0x6147('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9ba4,_0x5af2da,_0xded005){return new BPromise(function(_0x467cd6,_0x43826b){return client[_0x6147('0xc')](_0x3f9ba4,_0xded005)[_0x6147('0xd')](function(_0x33f6fb){logger[_0x6147('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x5af2da,_0x6147('0xf'));logger['debug'](_0x6147('0x10'),_0x5af2da,_0x6147('0xf'),JSON[_0x6147('0x11')](_0x33f6fb));if(_0x33f6fb['error']){if(_0x33f6fb['error'][_0x6147('0x12')]===0x1f4){logger[_0x6147('0x13')](_0x6147('0x14'),_0x5af2da,_0x33f6fb[_0x6147('0x13')]['message']);return _0x43826b(_0x33f6fb[_0x6147('0x13')][_0x6147('0x15')]);}logger[_0x6147('0x13')](_0x6147('0x14'),_0x5af2da,_0x33f6fb[_0x6147('0x13')][_0x6147('0x15')]);return _0x467cd6(_0x33f6fb[_0x6147('0x13')][_0x6147('0x15')]);}else{logger['info'](_0x6147('0x14'),_0x5af2da,_0x6147('0xf'));_0x467cd6(_0x33f6fb[_0x6147('0x16')]['message']);}})['catch'](function(_0x1ae928){logger[_0x6147('0x13')](_0x6147('0x14'),_0x5af2da,_0x1ae928);_0x43826b(_0x1ae928);});});}