Built motion from commit (unavailable).|2.5.1
[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 _0x20b1=['../../config/utils','../../config/logger','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment'];(function(_0x4bdcd8,_0x5b4cd6){var _0x2bf60=function(_0x526da7){while(--_0x526da7){_0x4bdcd8['push'](_0x4bdcd8['shift']());}};_0x2bf60(++_0x5b4cd6);}(_0x20b1,0xa3));var _0x120b=function(_0x46d51c,_0x492de3){_0x46d51c=_0x46d51c-0x0;var _0x5dc062=_0x20b1[_0x46d51c];return _0x5dc062;};'use strict';var _=require('lodash');var util=require(_0x120b('0x0'));var moment=require(_0x120b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x120b('0x2'));var logger=require(_0x120b('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x120b('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1557,_0x220c3d,_0x2b2099){return new BPromise(function(_0x49092c,_0x5b3dcd){return client[_0x120b('0x5')](_0x3a1557,_0x2b2099)['then'](function(_0x42bd98){logger[_0x120b('0x6')](_0x120b('0x7'),_0x220c3d,_0x120b('0x8'));logger[_0x120b('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x220c3d,_0x120b('0x8'),JSON[_0x120b('0xa')](_0x42bd98));if(_0x42bd98[_0x120b('0xb')]){if(_0x42bd98['error']['code']===0x1f4){logger[_0x120b('0xb')](_0x120b('0x7'),_0x220c3d,_0x42bd98[_0x120b('0xb')][_0x120b('0xc')]);return _0x5b3dcd(_0x42bd98[_0x120b('0xb')]['message']);}logger[_0x120b('0xb')](_0x120b('0x7'),_0x220c3d,_0x42bd98[_0x120b('0xb')]['message']);return _0x49092c(_0x42bd98[_0x120b('0xb')][_0x120b('0xc')]);}else{logger[_0x120b('0x6')](_0x120b('0x7'),_0x220c3d,'request\x20sent');_0x49092c(_0x42bd98[_0x120b('0xd')][_0x120b('0xc')]);}})[_0x120b('0xe')](function(_0x58e0bc){logger[_0x120b('0xb')](_0x120b('0x7'),_0x220c3d,_0x58e0bc);_0x5b3dcd(_0x58e0bc);});});}