Built motion from commit da617fac.|2.6.6
[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 _0x7fcf=['ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','info'];(function(_0x3a7bdf,_0x58bdd8){var _0x35a9a8=function(_0x21da98){while(--_0x21da98){_0x3a7bdf['push'](_0x3a7bdf['shift']());}};_0x35a9a8(++_0x58bdd8);}(_0x7fcf,0xce));var _0xf7fc=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x7fcf[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0xf7fc('0x0'));var moment=require(_0xf7fc('0x1'));var BPromise=require(_0xf7fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7fc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf7fc('0x5'));var jayson=require(_0xf7fc('0x6'));var client=jayson[_0xf7fc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x87869b,_0x5efb7a,_0x44007d){return new BPromise(function(_0x246819,_0x75925a){return client[_0xf7fc('0x8')](_0x87869b,_0x44007d)['then'](function(_0x383197){logger[_0xf7fc('0x9')](_0xf7fc('0xa'),_0x5efb7a,'request\x20sent');logger[_0xf7fc('0xb')](_0xf7fc('0xc'),_0x5efb7a,_0xf7fc('0xd'),JSON[_0xf7fc('0xe')](_0x383197));if(_0x383197[_0xf7fc('0xf')]){if(_0x383197[_0xf7fc('0xf')][_0xf7fc('0x10')]===0x1f4){logger[_0xf7fc('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5efb7a,_0x383197[_0xf7fc('0xf')][_0xf7fc('0x11')]);return _0x75925a(_0x383197[_0xf7fc('0xf')]['message']);}logger['error'](_0xf7fc('0xa'),_0x5efb7a,_0x383197['error'][_0xf7fc('0x11')]);return _0x246819(_0x383197['error'][_0xf7fc('0x11')]);}else{logger[_0xf7fc('0x9')](_0xf7fc('0xa'),_0x5efb7a,'request\x20sent');_0x246819(_0x383197['result']['message']);}})['catch'](function(_0x13e07c){logger[_0xf7fc('0xf')](_0xf7fc('0xa'),_0x5efb7a,_0x13e07c);_0x75925a(_0x13e07c);});});}