5dd56f8e7e11af4685209bf7ae854492a80e3e80
[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 _0xf4f1=['code','message','ChatProactiveAction,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5005ba,_0x423ed1){var _0x21278c=function(_0x49799b){while(--_0x49799b){_0x5005ba['push'](_0x5005ba['shift']());}};_0x21278c(++_0x423ed1);}(_0xf4f1,0x158));var _0x1f4f=function(_0x5d2990,_0x5a0dd6){_0x5d2990=_0x5d2990-0x0;var _0x154065=_0xf4f1[_0x5d2990];return _0x154065;};'use strict';var _=require('lodash');var util=require(_0x1f4f('0x0'));var moment=require(_0x1f4f('0x1'));var BPromise=require(_0x1f4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f4f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f4f('0x4'))(_0x1f4f('0x5'));var config=require('../../config/environment');var jayson=require(_0x1f4f('0x6'));var client=jayson['client'][_0x1f4f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x569fe6,_0x4f1d2f,_0x5dd50f){return new BPromise(function(_0x6dfcab,_0x2e35bc){return client[_0x1f4f('0x8')](_0x569fe6,_0x5dd50f)[_0x1f4f('0x9')](function(_0x687517){logger[_0x1f4f('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x4f1d2f,'request\x20sent');logger[_0x1f4f('0xb')](_0x1f4f('0xc'),_0x4f1d2f,_0x1f4f('0xd'),JSON[_0x1f4f('0xe')](_0x687517));if(_0x687517[_0x1f4f('0xf')]){if(_0x687517['error'][_0x1f4f('0x10')]===0x1f4){logger[_0x1f4f('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4f1d2f,_0x687517[_0x1f4f('0xf')][_0x1f4f('0x11')]);return _0x2e35bc(_0x687517[_0x1f4f('0xf')][_0x1f4f('0x11')]);}logger[_0x1f4f('0xf')](_0x1f4f('0x12'),_0x4f1d2f,_0x687517[_0x1f4f('0xf')][_0x1f4f('0x11')]);return _0x6dfcab(_0x687517['error']['message']);}else{logger[_0x1f4f('0xa')](_0x1f4f('0x12'),_0x4f1d2f,_0x1f4f('0xd'));_0x6dfcab(_0x687517['result'][_0x1f4f('0x11')]);}})[_0x1f4f('0x13')](function(_0x34f6be){logger['error'](_0x1f4f('0x12'),_0x4f1d2f,_0x34f6be);_0x2e35bc(_0x34f6be);});});}