965894c4925352fb69f68ef01381ebee13ff8d2f
[motion2.git] / server / api / jscriptyQuestionReport / jscriptyQuestionReport.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 _0xa152=['message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xa152,0x1dd));var _0x2a15=function(_0x46363f,_0x37c62e){_0x46363f=_0x46363f-0x0;var _0x5bc670=_0xa152[_0x46363f];return _0x5bc670;};'use strict';var _=require(_0x2a15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2a15('0x1'));var fs=require('fs');var Redis=require(_0x2a15('0x2'));var db=require(_0x2a15('0x3'))['db'];var utils=require(_0x2a15('0x4'));var logger=require(_0x2a15('0x5'))('rpc');var config=require(_0x2a15('0x6'));var jayson=require(_0x2a15('0x7'));var client=jayson[_0x2a15('0x8')][_0x2a15('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cd6b8,_0x41627b,_0x531848){return new BPromise(function(_0x4fa100,_0x83f498){return client['request'](_0x1cd6b8,_0x531848)['then'](function(_0x59741d){logger[_0x2a15('0xa')](_0x2a15('0xb'),_0x41627b,_0x2a15('0xc'));logger[_0x2a15('0xd')](_0x2a15('0xe'),_0x41627b,_0x2a15('0xc'),JSON['stringify'](_0x59741d));if(_0x59741d[_0x2a15('0xf')]){if(_0x59741d[_0x2a15('0xf')][_0x2a15('0x10')]===0x1f4){logger[_0x2a15('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x41627b,_0x59741d['error'][_0x2a15('0x11')]);return _0x83f498(_0x59741d[_0x2a15('0xf')]['message']);}logger[_0x2a15('0xf')](_0x2a15('0xb'),_0x41627b,_0x59741d[_0x2a15('0xf')][_0x2a15('0x11')]);return _0x4fa100(_0x59741d[_0x2a15('0xf')][_0x2a15('0x11')]);}else{logger[_0x2a15('0xa')](_0x2a15('0xb'),_0x41627b,_0x2a15('0xc'));_0x4fa100(_0x59741d['result']['message']);}})[_0x2a15('0x12')](function(_0x2b12fe){logger['error'](_0x2a15('0xb'),_0x41627b,_0x2b12fe);_0x83f498(_0x2b12fe);});});}