94402f500f44be488bd02fe719abb8cd09da0552
[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 _0xe649=['error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x544f33,_0x9d9c80){var _0x20085e=function(_0x2e4043){while(--_0x2e4043){_0x544f33['push'](_0x544f33['shift']());}};_0x20085e(++_0x9d9c80);}(_0xe649,0x97));var _0x9e64=function(_0x47249e,_0xc7683b){_0x47249e=_0x47249e-0x0;var _0x154d33=_0xe649[_0x47249e];return _0x154d33;};'use strict';var _=require('lodash');var util=require(_0x9e64('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e64('0x1'));var fs=require('fs');var Redis=require(_0x9e64('0x2'));var db=require(_0x9e64('0x3'))['db'];var utils=require(_0x9e64('0x4'));var logger=require(_0x9e64('0x5'))(_0x9e64('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e64('0x7'));var client=jayson[_0x9e64('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300433,_0x2a588a,_0x1b68dc){return new BPromise(function(_0x19cf2e,_0x1d6a9d){return client[_0x9e64('0x9')](_0x300433,_0x1b68dc)[_0x9e64('0xa')](function(_0x2019a0){logger[_0x9e64('0xb')](_0x9e64('0xc'),_0x2a588a,_0x9e64('0xd'));logger[_0x9e64('0xe')](_0x9e64('0xf'),_0x2a588a,_0x9e64('0xd'),JSON[_0x9e64('0x10')](_0x2019a0));if(_0x2019a0[_0x9e64('0x11')]){if(_0x2019a0[_0x9e64('0x11')]['code']===0x1f4){logger[_0x9e64('0x11')](_0x9e64('0xc'),_0x2a588a,_0x2019a0[_0x9e64('0x11')][_0x9e64('0x12')]);return _0x1d6a9d(_0x2019a0[_0x9e64('0x11')][_0x9e64('0x12')]);}logger['error'](_0x9e64('0xc'),_0x2a588a,_0x2019a0[_0x9e64('0x11')][_0x9e64('0x12')]);return _0x19cf2e(_0x2019a0['error']['message']);}else{logger[_0x9e64('0xb')](_0x9e64('0xc'),_0x2a588a,'request\x20sent');_0x19cf2e(_0x2019a0[_0x9e64('0x13')]['message']);}})[_0x9e64('0x14')](function(_0x35c4e5){logger[_0x9e64('0x11')](_0x9e64('0xc'),_0x2a588a,_0x35c4e5);_0x1d6a9d(_0x35c4e5);});});}