Built motion from commit 3e059bc2.|2.5.32
[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 _0x5db6=['then','info','request\x20sent','debug','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5db6,0x88));var _0x65db=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x5db6[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0x65db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65db('0x1'));var db=require(_0x65db('0x2'))['db'];var utils=require(_0x65db('0x3'));var logger=require(_0x65db('0x4'))(_0x65db('0x5'));var config=require(_0x65db('0x6'));var jayson=require(_0x65db('0x7'));var client=jayson[_0x65db('0x8')][_0x65db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15cf75,_0x21a7c5,_0x36242b){return new BPromise(function(_0x254457,_0x439251){return client[_0x65db('0xa')](_0x15cf75,_0x36242b)[_0x65db('0xb')](function(_0x37215c){logger[_0x65db('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x21a7c5,_0x65db('0xd'));logger[_0x65db('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x21a7c5,'request\x20sent',JSON[_0x65db('0xf')](_0x37215c));if(_0x37215c[_0x65db('0x10')]){if(_0x37215c[_0x65db('0x10')]['code']===0x1f4){logger[_0x65db('0x10')](_0x65db('0x11'),_0x21a7c5,_0x37215c[_0x65db('0x10')]['message']);return _0x439251(_0x37215c[_0x65db('0x10')]['message']);}logger[_0x65db('0x10')](_0x65db('0x11'),_0x21a7c5,_0x37215c['error'][_0x65db('0x12')]);return _0x254457(_0x37215c[_0x65db('0x10')][_0x65db('0x12')]);}else{logger[_0x65db('0xc')](_0x65db('0x11'),_0x21a7c5,_0x65db('0xd'));_0x254457(_0x37215c[_0x65db('0x13')][_0x65db('0x12')]);}})[_0x65db('0x14')](function(_0x333ff0){logger['error'](_0x65db('0x11'),_0x21a7c5,_0x333ff0);_0x439251(_0x333ff0);});});}