f8a0f2a1b9c5f5f5e1125ef4794b3b945c58d7a6
[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 _0xf483=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x324e6f,_0x4e8b46){var _0xee91a5=function(_0xf9519e){while(--_0xf9519e){_0x324e6f['push'](_0x324e6f['shift']());}};_0xee91a5(++_0x4e8b46);}(_0xf483,0xf2));var _0x3f48=function(_0x2f80f7,_0xaa774c){_0x2f80f7=_0x2f80f7-0x0;var _0x198a88=_0xf483[_0x2f80f7];return _0x198a88;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var moment=require('moment');var BPromise=require(_0x3f48('0x1'));var rs=require(_0x3f48('0x2'));var fs=require('fs');var Redis=require(_0x3f48('0x3'));var db=require(_0x3f48('0x4'))['db'];var utils=require(_0x3f48('0x5'));var logger=require(_0x3f48('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f48('0x7')][_0x3f48('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x524a4f,_0x76804e,_0x2f1ca5){return new BPromise(function(_0x1746fd,_0x1f8a24){return client[_0x3f48('0x9')](_0x524a4f,_0x2f1ca5)[_0x3f48('0xa')](function(_0x264d15){logger['info'](_0x3f48('0xb'),_0x76804e,_0x3f48('0xc'));logger['debug'](_0x3f48('0xd'),_0x76804e,'request\x20sent',JSON[_0x3f48('0xe')](_0x264d15));if(_0x264d15[_0x3f48('0xf')]){if(_0x264d15[_0x3f48('0xf')][_0x3f48('0x10')]===0x1f4){logger[_0x3f48('0xf')](_0x3f48('0xb'),_0x76804e,_0x264d15[_0x3f48('0xf')][_0x3f48('0x11')]);return _0x1f8a24(_0x264d15[_0x3f48('0xf')][_0x3f48('0x11')]);}logger['error'](_0x3f48('0xb'),_0x76804e,_0x264d15[_0x3f48('0xf')][_0x3f48('0x11')]);return _0x1746fd(_0x264d15['error'][_0x3f48('0x11')]);}else{logger['info'](_0x3f48('0xb'),_0x76804e,_0x3f48('0xc'));_0x1746fd(_0x264d15[_0x3f48('0x12')]['message']);}})[_0x3f48('0x13')](function(_0x319aa5){logger[_0x3f48('0xf')](_0x3f48('0xb'),_0x76804e,_0x319aa5);_0x1f8a24(_0x319aa5);});});}