ad415ded86b2ce7b37995595e1a0d6822dd77bee
[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 _0x0105=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment'];(function(_0x34562b,_0x4f2fb0){var _0xf2666a=function(_0x482047){while(--_0x482047){_0x34562b['push'](_0x34562b['shift']());}};_0xf2666a(++_0x4f2fb0);}(_0x0105,0x75));var _0x5010=function(_0x58ec0e,_0x45ccc3){_0x58ec0e=_0x58ec0e-0x0;var _0x227a6c=_0x0105[_0x58ec0e];return _0x227a6c;};'use strict';var _=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var moment=require(_0x5010('0x2'));var BPromise=require(_0x5010('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5010('0x4'))['db'];var utils=require(_0x5010('0x5'));var logger=require(_0x5010('0x6'))(_0x5010('0x7'));var config=require(_0x5010('0x8'));var jayson=require(_0x5010('0x9'));var client=jayson[_0x5010('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x272f70,_0x490df4,_0x303fb6){return new BPromise(function(_0xbcaa3e,_0x21bc93){return client[_0x5010('0xb')](_0x272f70,_0x303fb6)['then'](function(_0x41c1c3){logger['info'](_0x5010('0xc'),_0x490df4,_0x5010('0xd'));logger[_0x5010('0xe')](_0x5010('0xf'),_0x490df4,'request\x20sent',JSON[_0x5010('0x10')](_0x41c1c3));if(_0x41c1c3[_0x5010('0x11')]){if(_0x41c1c3[_0x5010('0x11')][_0x5010('0x12')]===0x1f4){logger['error'](_0x5010('0xc'),_0x490df4,_0x41c1c3[_0x5010('0x11')][_0x5010('0x13')]);return _0x21bc93(_0x41c1c3['error'][_0x5010('0x13')]);}logger[_0x5010('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x490df4,_0x41c1c3[_0x5010('0x11')][_0x5010('0x13')]);return _0xbcaa3e(_0x41c1c3[_0x5010('0x11')][_0x5010('0x13')]);}else{logger['info'](_0x5010('0xc'),_0x490df4,_0x5010('0xd'));_0xbcaa3e(_0x41c1c3['result'][_0x5010('0x13')]);}})['catch'](function(_0x4ccdc4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x490df4,_0x4ccdc4);_0x21bc93(_0x4ccdc4);});});}