beeab0288634c8dfc86aef6c95098294133e2996
[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 _0xcb52=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x513a3e,_0xa7d9c5){var _0x2c8d04=function(_0xd47298){while(--_0xd47298){_0x513a3e['push'](_0x513a3e['shift']());}};_0x2c8d04(++_0xa7d9c5);}(_0xcb52,0x183));var _0x2cb5=function(_0x571b0f,_0x10ddf9){_0x571b0f=_0x571b0f-0x0;var _0xf0f1c9=_0xcb52[_0x571b0f];return _0xf0f1c9;};'use strict';var _=require(_0x2cb5('0x0'));var util=require(_0x2cb5('0x1'));var moment=require(_0x2cb5('0x2'));var BPromise=require(_0x2cb5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cb5('0x4'))['db'];var utils=require(_0x2cb5('0x5'));var logger=require(_0x2cb5('0x6'))('rpc');var config=require(_0x2cb5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cb5('0x8')][_0x2cb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2245f1,_0x1553ea,_0x39694c){return new BPromise(function(_0xd443e6,_0x193eb6){return client[_0x2cb5('0xa')](_0x2245f1,_0x39694c)[_0x2cb5('0xb')](function(_0x8cff6){logger['info'](_0x2cb5('0xc'),_0x1553ea,_0x2cb5('0xd'));logger[_0x2cb5('0xe')](_0x2cb5('0xf'),_0x1553ea,_0x2cb5('0xd'),JSON['stringify'](_0x8cff6));if(_0x8cff6[_0x2cb5('0x10')]){if(_0x8cff6['error'][_0x2cb5('0x11')]===0x1f4){logger[_0x2cb5('0x10')](_0x2cb5('0xc'),_0x1553ea,_0x8cff6[_0x2cb5('0x10')][_0x2cb5('0x12')]);return _0x193eb6(_0x8cff6[_0x2cb5('0x10')][_0x2cb5('0x12')]);}logger[_0x2cb5('0x10')](_0x2cb5('0xc'),_0x1553ea,_0x8cff6[_0x2cb5('0x10')]['message']);return _0xd443e6(_0x8cff6[_0x2cb5('0x10')][_0x2cb5('0x12')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x1553ea,_0x2cb5('0xd'));_0xd443e6(_0x8cff6[_0x2cb5('0x13')][_0x2cb5('0x12')]);}})[_0x2cb5('0x14')](function(_0x463e44){logger[_0x2cb5('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1553ea,_0x463e44);_0x193eb6(_0x463e44);});});}