bbbd77b01d4e4bb614ba40ea1e52e2159c68b149
[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 _0x5704=['error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x594821,_0x153b6c){var _0x139112=function(_0x105337){while(--_0x105337){_0x594821['push'](_0x594821['shift']());}};_0x139112(++_0x153b6c);}(_0x5704,0x1e3));var _0x4570=function(_0x44e201,_0x2477f9){_0x44e201=_0x44e201-0x0;var _0xb720a9=_0x5704[_0x44e201];return _0xb720a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4570('0x0'));var BPromise=require(_0x4570('0x1'));var rs=require(_0x4570('0x2'));var fs=require('fs');var Redis=require(_0x4570('0x3'));var db=require(_0x4570('0x4'))['db'];var utils=require(_0x4570('0x5'));var logger=require(_0x4570('0x6'))(_0x4570('0x7'));var config=require(_0x4570('0x8'));var jayson=require(_0x4570('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24bbe2,_0x39f107,_0x1e97c9){return new BPromise(function(_0x3ad974,_0x2ac130){return client[_0x4570('0xa')](_0x24bbe2,_0x1e97c9)[_0x4570('0xb')](function(_0x3648aa){logger[_0x4570('0xc')](_0x4570('0xd'),_0x39f107,_0x4570('0xe'));logger[_0x4570('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x39f107,_0x4570('0xe'),JSON[_0x4570('0x10')](_0x3648aa));if(_0x3648aa['error']){if(_0x3648aa[_0x4570('0x11')]['code']===0x1f4){logger['error'](_0x4570('0xd'),_0x39f107,_0x3648aa[_0x4570('0x11')][_0x4570('0x12')]);return _0x2ac130(_0x3648aa['error'][_0x4570('0x12')]);}logger[_0x4570('0x11')](_0x4570('0xd'),_0x39f107,_0x3648aa[_0x4570('0x11')][_0x4570('0x12')]);return _0x3ad974(_0x3648aa['error'][_0x4570('0x12')]);}else{logger[_0x4570('0xc')](_0x4570('0xd'),_0x39f107,_0x4570('0xe'));_0x3ad974(_0x3648aa[_0x4570('0x13')][_0x4570('0x12')]);}})['catch'](function(_0x3da18d){logger[_0x4570('0x11')](_0x4570('0xd'),_0x39f107,_0x3da18d);_0x2ac130(_0x3da18d);});});}