618b44723960f4733101b17c555073f1caa72b22
[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 _0x3730=['request','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x566620,_0x4e9772){var _0xe7d7ab=function(_0x2c837e){while(--_0x2c837e){_0x566620['push'](_0x566620['shift']());}};_0xe7d7ab(++_0x4e9772);}(_0x3730,0x1ad));var _0x0373=function(_0x29b652,_0x8ec75f){_0x29b652=_0x29b652-0x0;var _0x5f387c=_0x3730[_0x29b652];return _0x5f387c;};'use strict';var _=require(_0x0373('0x0'));var util=require(_0x0373('0x1'));var moment=require(_0x0373('0x2'));var BPromise=require(_0x0373('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0373('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0373('0x5'))(_0x0373('0x6'));var config=require(_0x0373('0x7'));var jayson=require(_0x0373('0x8'));var client=jayson[_0x0373('0x9')][_0x0373('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e0b1,_0x5d9400,_0x4e107a){return new BPromise(function(_0x5a79e6,_0x215b7a){return client[_0x0373('0xb')](_0x18e0b1,_0x4e107a)['then'](function(_0x2277cd){logger[_0x0373('0xc')](_0x0373('0xd'),_0x5d9400,'request\x20sent');logger[_0x0373('0xe')](_0x0373('0xf'),_0x5d9400,_0x0373('0x10'),JSON[_0x0373('0x11')](_0x2277cd));if(_0x2277cd['error']){if(_0x2277cd[_0x0373('0x12')]['code']===0x1f4){logger[_0x0373('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x5d9400,_0x2277cd[_0x0373('0x12')][_0x0373('0x13')]);return _0x215b7a(_0x2277cd['error'][_0x0373('0x13')]);}logger[_0x0373('0x12')](_0x0373('0xd'),_0x5d9400,_0x2277cd['error'][_0x0373('0x13')]);return _0x5a79e6(_0x2277cd['error']['message']);}else{logger[_0x0373('0xc')](_0x0373('0xd'),_0x5d9400,_0x0373('0x10'));_0x5a79e6(_0x2277cd[_0x0373('0x14')][_0x0373('0x13')]);}})[_0x0373('0x15')](function(_0x474d1b){logger[_0x0373('0x12')](_0x0373('0xd'),_0x5d9400,_0x474d1b);_0x215b7a(_0x474d1b);});});}