e4ba4e99d40e911a2358868ba38c63c488257a3c
[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 _0x7314=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7314,0x1b6));var _0x4731=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7314[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4731('0x0'));var util=require(_0x4731('0x1'));var moment=require(_0x4731('0x2'));var BPromise=require(_0x4731('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4731('0x4'));var db=require(_0x4731('0x5'))['db'];var utils=require(_0x4731('0x6'));var logger=require(_0x4731('0x7'))(_0x4731('0x8'));var config=require(_0x4731('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4731('0xa')][_0x4731('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4861c7,_0xe9f83c,_0x4bd579){return new BPromise(function(_0x3c0ba3,_0x3d9d88){return client[_0x4731('0xc')](_0x4861c7,_0x4bd579)[_0x4731('0xd')](function(_0x58e43){logger[_0x4731('0xe')](_0x4731('0xf'),_0xe9f83c,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0xe9f83c,_0x4731('0x10'),JSON[_0x4731('0x11')](_0x58e43));if(_0x58e43[_0x4731('0x12')]){if(_0x58e43['error']['code']===0x1f4){logger[_0x4731('0x12')](_0x4731('0xf'),_0xe9f83c,_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);return _0x3d9d88(_0x58e43['error'][_0x4731('0x13')]);}logger[_0x4731('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0xe9f83c,_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);return _0x3c0ba3(_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);}else{logger[_0x4731('0xe')](_0x4731('0xf'),_0xe9f83c,_0x4731('0x10'));_0x3c0ba3(_0x58e43[_0x4731('0x14')]['message']);}})[_0x4731('0x15')](function(_0x15da4a){logger['error'](_0x4731('0xf'),_0xe9f83c,_0x15da4a);_0x3d9d88(_0x15da4a);});});}