aac22d4ae373c0a652d4fce833d52f483b1ba277
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.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 _0xcb8b=['request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcb8b,0x6c));var _0xbcb8=function(_0x9449a1,_0x53b397){_0x9449a1=_0x9449a1-0x0;var _0x1447df=_0xcb8b[_0x9449a1];return _0x1447df;};'use strict';var _=require(_0xbcb8('0x0'));var util=require(_0xbcb8('0x1'));var moment=require(_0xbcb8('0x2'));var BPromise=require(_0xbcb8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbcb8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbcb8('0x6'));var client=jayson[_0xbcb8('0x7')][_0xbcb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x687105,_0x22813c,_0x59772f){return new BPromise(function(_0x460740,_0x15d439){return client['request'](_0x687105,_0x59772f)['then'](function(_0x1e765e){logger[_0xbcb8('0x9')](_0xbcb8('0xa'),_0x22813c,_0xbcb8('0xb'));logger[_0xbcb8('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x22813c,_0xbcb8('0xb'),JSON['stringify'](_0x1e765e));if(_0x1e765e['error']){if(_0x1e765e[_0xbcb8('0xd')][_0xbcb8('0xe')]===0x1f4){logger[_0xbcb8('0xd')](_0xbcb8('0xa'),_0x22813c,_0x1e765e['error'][_0xbcb8('0xf')]);return _0x15d439(_0x1e765e['error']['message']);}logger[_0xbcb8('0xd')](_0xbcb8('0xa'),_0x22813c,_0x1e765e[_0xbcb8('0xd')][_0xbcb8('0xf')]);return _0x460740(_0x1e765e[_0xbcb8('0xd')][_0xbcb8('0xf')]);}else{logger['info'](_0xbcb8('0xa'),_0x22813c,'request\x20sent');_0x460740(_0x1e765e[_0xbcb8('0x10')]['message']);}})['catch'](function(_0x24c446){logger[_0xbcb8('0xd')](_0xbcb8('0xa'),_0x22813c,_0x24c446);_0x15d439(_0x24c446);});});}