3e84dcd00d49384e5589c030252e8856af4724b1
[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 _0x386f=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x25d3cb,_0x201a7d){var _0x53a675=function(_0x10c83b){while(--_0x10c83b){_0x25d3cb['push'](_0x25d3cb['shift']());}};_0x53a675(++_0x201a7d);}(_0x386f,0x11a));var _0xf386=function(_0x21bc1d,_0x18ef48){_0x21bc1d=_0x21bc1d-0x0;var _0x512ac5=_0x386f[_0x21bc1d];return _0x512ac5;};'use strict';var _=require(_0xf386('0x0'));var util=require(_0xf386('0x1'));var moment=require(_0xf386('0x2'));var BPromise=require(_0xf386('0x3'));var rs=require(_0xf386('0x4'));var fs=require('fs');var Redis=require(_0xf386('0x5'));var db=require(_0xf386('0x6'))['db'];var utils=require(_0xf386('0x7'));var logger=require(_0xf386('0x8'))('rpc');var config=require(_0xf386('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf386('0xa')][_0xf386('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e9c7c,_0x2123b0,_0x2c5b22){return new BPromise(function(_0x42e077,_0x59dced){return client[_0xf386('0xc')](_0x2e9c7c,_0x2c5b22)[_0xf386('0xd')](function(_0x3891ad){logger[_0xf386('0xe')](_0xf386('0xf'),_0x2123b0,_0xf386('0x10'));logger[_0xf386('0x11')](_0xf386('0x12'),_0x2123b0,'request\x20sent',JSON[_0xf386('0x13')](_0x3891ad));if(_0x3891ad[_0xf386('0x14')]){if(_0x3891ad['error'][_0xf386('0x15')]===0x1f4){logger[_0xf386('0x14')](_0xf386('0xf'),_0x2123b0,_0x3891ad[_0xf386('0x14')][_0xf386('0x16')]);return _0x59dced(_0x3891ad[_0xf386('0x14')][_0xf386('0x16')]);}logger[_0xf386('0x14')](_0xf386('0xf'),_0x2123b0,_0x3891ad[_0xf386('0x14')][_0xf386('0x16')]);return _0x42e077(_0x3891ad['error']['message']);}else{logger['info'](_0xf386('0xf'),_0x2123b0,_0xf386('0x10'));_0x42e077(_0x3891ad[_0xf386('0x17')][_0xf386('0x16')]);}})[_0xf386('0x18')](function(_0x5344f1){logger[_0xf386('0x14')](_0xf386('0xf'),_0x2123b0,_0x5344f1);_0x59dced(_0x5344f1);});});}