b81bedd87034a62ef2ca61f02eb1e58d09bf6ee4
[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 _0xa55e=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x33c537,_0x4c6b7a){var _0x5c7907=function(_0x9c8365){while(--_0x9c8365){_0x33c537['push'](_0x33c537['shift']());}};_0x5c7907(++_0x4c6b7a);}(_0xa55e,0x186));var _0xea55=function(_0x41bfc8,_0x564943){_0x41bfc8=_0x41bfc8-0x0;var _0x12e942=_0xa55e[_0x41bfc8];return _0x12e942;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea55('0x0'));var BPromise=require(_0xea55('0x1'));var rs=require(_0xea55('0x2'));var fs=require('fs');var Redis=require(_0xea55('0x3'));var db=require(_0xea55('0x4'))['db'];var utils=require(_0xea55('0x5'));var logger=require(_0xea55('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xea55('0x7')][_0xea55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x591bf7,_0x16c568,_0x51e501){return new BPromise(function(_0x3169ec,_0xc4fa7d){return client[_0xea55('0x9')](_0x591bf7,_0x51e501)[_0xea55('0xa')](function(_0x407338){logger[_0xea55('0xb')](_0xea55('0xc'),_0x16c568,_0xea55('0xd'));logger['debug'](_0xea55('0xe'),_0x16c568,_0xea55('0xd'),JSON[_0xea55('0xf')](_0x407338));if(_0x407338[_0xea55('0x10')]){if(_0x407338['error'][_0xea55('0x11')]===0x1f4){logger['error'](_0xea55('0xc'),_0x16c568,_0x407338['error'][_0xea55('0x12')]);return _0xc4fa7d(_0x407338['error'][_0xea55('0x12')]);}logger[_0xea55('0x10')](_0xea55('0xc'),_0x16c568,_0x407338[_0xea55('0x10')][_0xea55('0x12')]);return _0x3169ec(_0x407338[_0xea55('0x10')]['message']);}else{logger[_0xea55('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x16c568,'request\x20sent');_0x3169ec(_0x407338[_0xea55('0x13')][_0xea55('0x12')]);}})[_0xea55('0x14')](function(_0x35f222){logger[_0xea55('0x10')](_0xea55('0xc'),_0x16c568,_0x35f222);_0xc4fa7d(_0x35f222);});});}