6c46902c3b588c3b434efb43a5c82a127a645e36
[motion2.git] / server / api / intDeskField / intDeskField.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 _0x2a60=['error','message','result','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x2a60,0x1d1));var _0x02a6=function(_0x55a782,_0x5099ce){_0x55a782=_0x55a782-0x0;var _0x137a5d=_0x2a60[_0x55a782];return _0x137a5d;};'use strict';var _=require(_0x02a6('0x0'));var util=require(_0x02a6('0x1'));var moment=require('moment');var BPromise=require(_0x02a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x02a6('0x4'))(_0x02a6('0x5'));var config=require(_0x02a6('0x6'));var jayson=require(_0x02a6('0x7'));var client=jayson[_0x02a6('0x8')][_0x02a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x328f75,_0x13fb23,_0x8f4d36){return new BPromise(function(_0xb6c9b,_0x190b2d){return client[_0x02a6('0xa')](_0x328f75,_0x8f4d36)[_0x02a6('0xb')](function(_0x36c861){logger[_0x02a6('0xc')](_0x02a6('0xd'),_0x13fb23,_0x02a6('0xe'));logger['debug'](_0x02a6('0xf'),_0x13fb23,_0x02a6('0xe'),JSON[_0x02a6('0x10')](_0x36c861));if(_0x36c861['error']){if(_0x36c861['error'][_0x02a6('0x11')]===0x1f4){logger[_0x02a6('0x12')]('DeskField,\x20%s,\x20%s',_0x13fb23,_0x36c861[_0x02a6('0x12')][_0x02a6('0x13')]);return _0x190b2d(_0x36c861[_0x02a6('0x12')][_0x02a6('0x13')]);}logger[_0x02a6('0x12')](_0x02a6('0xd'),_0x13fb23,_0x36c861['error'][_0x02a6('0x13')]);return _0xb6c9b(_0x36c861[_0x02a6('0x12')][_0x02a6('0x13')]);}else{logger['info'](_0x02a6('0xd'),_0x13fb23,_0x02a6('0xe'));_0xb6c9b(_0x36c861[_0x02a6('0x14')]['message']);}})['catch'](function(_0x35ff4d){logger['error']('DeskField,\x20%s,\x20%s',_0x13fb23,_0x35ff4d);_0x190b2d(_0x35ff4d);});});}