e89a55cf38bd7308b6f3ac7cf0ff72204471100a
[motion2.git] / server / api / chatOfflineMessage / chatOfflineMessage.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 _0x400b=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2c5f78,_0x1a7b3c){var _0x2616c2=function(_0x5b9151){while(--_0x5b9151){_0x2c5f78['push'](_0x2c5f78['shift']());}};_0x2616c2(++_0x1a7b3c);}(_0x400b,0x1e5));var _0xb400=function(_0x2cbe3e,_0x398788){_0x2cbe3e=_0x2cbe3e-0x0;var _0x49d320=_0x400b[_0x2cbe3e];return _0x49d320;};'use strict';var _=require(_0xb400('0x0'));var util=require(_0xb400('0x1'));var moment=require(_0xb400('0x2'));var BPromise=require(_0xb400('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb400('0x4'));var db=require(_0xb400('0x5'))['db'];var utils=require(_0xb400('0x6'));var logger=require(_0xb400('0x7'))(_0xb400('0x8'));var config=require(_0xb400('0x9'));var jayson=require(_0xb400('0xa'));var client=jayson['client'][_0xb400('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x482574,_0xbb632c,_0x2c6b59){return new BPromise(function(_0x30e37c,_0x17c034){return client['request'](_0x482574,_0x2c6b59)['then'](function(_0x3e1b97){logger[_0xb400('0xc')](_0xb400('0xd'),_0xbb632c,'request\x20sent');logger[_0xb400('0xe')](_0xb400('0xf'),_0xbb632c,_0xb400('0x10'),JSON[_0xb400('0x11')](_0x3e1b97));if(_0x3e1b97[_0xb400('0x12')]){if(_0x3e1b97[_0xb400('0x12')][_0xb400('0x13')]===0x1f4){logger['error'](_0xb400('0xd'),_0xbb632c,_0x3e1b97[_0xb400('0x12')][_0xb400('0x14')]);return _0x17c034(_0x3e1b97[_0xb400('0x12')]['message']);}logger[_0xb400('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbb632c,_0x3e1b97[_0xb400('0x12')][_0xb400('0x14')]);return _0x30e37c(_0x3e1b97[_0xb400('0x12')][_0xb400('0x14')]);}else{logger[_0xb400('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0xbb632c,_0xb400('0x10'));_0x30e37c(_0x3e1b97['result'][_0xb400('0x14')]);}})[_0xb400('0x15')](function(_0x2f2de4){logger[_0xb400('0x12')](_0xb400('0xd'),_0xbb632c,_0x2f2de4);_0x17c034(_0x2f2de4);});});}