85050ffde93063dbe0d8add32d8d959e87ffe727
[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 _0xa368=['result','catch','lodash','moment','../../config/utils','../../config/logger','rpc','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x273774,_0xd450d3){var _0x65cc66=function(_0x3ff5d8){while(--_0x3ff5d8){_0x273774['push'](_0x273774['shift']());}};_0x65cc66(++_0xd450d3);}(_0xa368,0xe6));var _0x8a36=function(_0x1cc8e9,_0x4f0f81){_0x1cc8e9=_0x1cc8e9-0x0;var _0x3c91f6=_0xa368[_0x1cc8e9];return _0x3c91f6;};'use strict';var _=require(_0x8a36('0x0'));var util=require('util');var moment=require(_0x8a36('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(_0x8a36('0x2'));var logger=require(_0x8a36('0x3'))(_0x8a36('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8a36('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x31fbde,_0x4bf3c2,_0x265580){return new BPromise(function(_0x159c8a,_0x29982d){return client[_0x8a36('0x6')](_0x31fbde,_0x265580)[_0x8a36('0x7')](function(_0x1a2602){logger[_0x8a36('0x8')](_0x8a36('0x9'),_0x4bf3c2,'request\x20sent');logger[_0x8a36('0xa')](_0x8a36('0xb'),_0x4bf3c2,_0x8a36('0xc'),JSON[_0x8a36('0xd')](_0x1a2602));if(_0x1a2602['error']){if(_0x1a2602[_0x8a36('0xe')][_0x8a36('0xf')]===0x1f4){logger[_0x8a36('0xe')](_0x8a36('0x9'),_0x4bf3c2,_0x1a2602[_0x8a36('0xe')]['message']);return _0x29982d(_0x1a2602[_0x8a36('0xe')][_0x8a36('0x10')]);}logger['error'](_0x8a36('0x9'),_0x4bf3c2,_0x1a2602[_0x8a36('0xe')][_0x8a36('0x10')]);return _0x159c8a(_0x1a2602[_0x8a36('0xe')][_0x8a36('0x10')]);}else{logger[_0x8a36('0x8')](_0x8a36('0x9'),_0x4bf3c2,_0x8a36('0xc'));_0x159c8a(_0x1a2602[_0x8a36('0x11')][_0x8a36('0x10')]);}})[_0x8a36('0x12')](function(_0xebab4e){logger[_0x8a36('0xe')](_0x8a36('0x9'),_0x4bf3c2,_0xebab4e);_0x29982d(_0xebab4e);});});}