ec21914f78506ffd2ec3205a41a77cdd2ac4040f
[motion2.git] / server / api / jscriptyAnswerReport / jscriptyAnswerReport.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 _0xf9d8=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0xf9d8,0xc4));var _0x8f9d=function(_0x4ed598,_0x4be0d7){_0x4ed598=_0x4ed598-0x0;var _0x23f702=_0xf9d8[_0x4ed598];return _0x23f702;};'use strict';var _=require(_0x8f9d('0x0'));var util=require(_0x8f9d('0x1'));var moment=require(_0x8f9d('0x2'));var BPromise=require(_0x8f9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f9d('0x4'));var logger=require('../../config/logger')(_0x8f9d('0x5'));var config=require(_0x8f9d('0x6'));var jayson=require(_0x8f9d('0x7'));var client=jayson[_0x8f9d('0x8')][_0x8f9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f736d,_0x38665f,_0xec8cab){return new BPromise(function(_0x382b34,_0x585484){return client[_0x8f9d('0xa')](_0x4f736d,_0xec8cab)['then'](function(_0x38c6d2){logger[_0x8f9d('0xb')](_0x8f9d('0xc'),_0x38665f,_0x8f9d('0xd'));logger[_0x8f9d('0xe')](_0x8f9d('0xf'),_0x38665f,_0x8f9d('0xd'),JSON['stringify'](_0x38c6d2));if(_0x38c6d2[_0x8f9d('0x10')]){if(_0x38c6d2[_0x8f9d('0x10')]['code']===0x1f4){logger[_0x8f9d('0x10')](_0x8f9d('0xc'),_0x38665f,_0x38c6d2[_0x8f9d('0x10')][_0x8f9d('0x11')]);return _0x585484(_0x38c6d2[_0x8f9d('0x10')][_0x8f9d('0x11')]);}logger[_0x8f9d('0x10')](_0x8f9d('0xc'),_0x38665f,_0x38c6d2[_0x8f9d('0x10')][_0x8f9d('0x11')]);return _0x382b34(_0x38c6d2[_0x8f9d('0x10')]['message']);}else{logger[_0x8f9d('0xb')](_0x8f9d('0xc'),_0x38665f,'request\x20sent');_0x382b34(_0x38c6d2['result']['message']);}})[_0x8f9d('0x12')](function(_0x54a909){logger['error'](_0x8f9d('0xc'),_0x38665f,_0x54a909);_0x585484(_0x54a909);});});}