1765768737a77f805bcd4779c2fb3a82aa968ac7
[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 _0xf611=['ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/utils','rpc','../../config/environment','http','request','then','info'];(function(_0x3d7959,_0x180c1c){var _0x4fffa0=function(_0x3fbfc7){while(--_0x3fbfc7){_0x3d7959['push'](_0x3d7959['shift']());}};_0x4fffa0(++_0x180c1c);}(_0xf611,0x7b));var _0x1f61=function(_0x10b7a5,_0xd3f792){_0x10b7a5=_0x10b7a5-0x0;var _0x1764b9=_0xf611[_0x10b7a5];return _0x1764b9;};'use strict';var _=require('lodash');var util=require(_0x1f61('0x0'));var moment=require(_0x1f61('0x1'));var BPromise=require(_0x1f61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f61('0x3'));var logger=require('../../config/logger')(_0x1f61('0x4'));var config=require(_0x1f61('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f61('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34a924,_0x3a5e33,_0x21e3f6){return new BPromise(function(_0x5b2e5b,_0x2d3aeb){return client[_0x1f61('0x7')](_0x34a924,_0x21e3f6)[_0x1f61('0x8')](function(_0x47f426){logger[_0x1f61('0x9')](_0x1f61('0xa'),_0x3a5e33,'request\x20sent');logger['debug'](_0x1f61('0xb'),_0x3a5e33,_0x1f61('0xc'),JSON[_0x1f61('0xd')](_0x47f426));if(_0x47f426[_0x1f61('0xe')]){if(_0x47f426[_0x1f61('0xe')][_0x1f61('0xf')]===0x1f4){logger[_0x1f61('0xe')](_0x1f61('0xa'),_0x3a5e33,_0x47f426['error'][_0x1f61('0x10')]);return _0x2d3aeb(_0x47f426[_0x1f61('0xe')][_0x1f61('0x10')]);}logger[_0x1f61('0xe')](_0x1f61('0xa'),_0x3a5e33,_0x47f426[_0x1f61('0xe')][_0x1f61('0x10')]);return _0x5b2e5b(_0x47f426[_0x1f61('0xe')][_0x1f61('0x10')]);}else{logger[_0x1f61('0x9')](_0x1f61('0xa'),_0x3a5e33,_0x1f61('0xc'));_0x5b2e5b(_0x47f426[_0x1f61('0x11')][_0x1f61('0x10')]);}})[_0x1f61('0x12')](function(_0x3a3a5a){logger[_0x1f61('0xe')](_0x1f61('0xa'),_0x3a5e33,_0x3a3a5a);_0x2d3aeb(_0x3a3a5a);});});}