Built motion from commit bab6f49e.|2.6.17
[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 _0xf2c1=['request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x120f72,_0x30bbf3){var _0x4add03=function(_0x416728){while(--_0x416728){_0x120f72['push'](_0x120f72['shift']());}};_0x4add03(++_0x30bbf3);}(_0xf2c1,0x15e));var _0x1f2c=function(_0x401bd8,_0x516d2f){_0x401bd8=_0x401bd8-0x0;var _0x40afaf=_0xf2c1[_0x401bd8];return _0x40afaf;};'use strict';var _=require(_0x1f2c('0x0'));var util=require(_0x1f2c('0x1'));var moment=require('moment');var BPromise=require(_0x1f2c('0x2'));var rs=require(_0x1f2c('0x3'));var fs=require('fs');var Redis=require(_0x1f2c('0x4'));var db=require(_0x1f2c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f2c('0x6'))(_0x1f2c('0x7'));var config=require(_0x1f2c('0x8'));var jayson=require(_0x1f2c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d078a,_0x5064f5,_0x44c8f8){return new BPromise(function(_0x54c846,_0x32f107){return client[_0x1f2c('0xa')](_0x1d078a,_0x44c8f8)['then'](function(_0x5b36c3){logger[_0x1f2c('0xb')](_0x1f2c('0xc'),_0x5064f5,_0x1f2c('0xd'));logger[_0x1f2c('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5064f5,'request\x20sent',JSON[_0x1f2c('0xf')](_0x5b36c3));if(_0x5b36c3[_0x1f2c('0x10')]){if(_0x5b36c3['error'][_0x1f2c('0x11')]===0x1f4){logger[_0x1f2c('0x10')](_0x1f2c('0xc'),_0x5064f5,_0x5b36c3['error'][_0x1f2c('0x12')]);return _0x32f107(_0x5b36c3[_0x1f2c('0x10')]['message']);}logger[_0x1f2c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5064f5,_0x5b36c3[_0x1f2c('0x10')]['message']);return _0x54c846(_0x5b36c3[_0x1f2c('0x10')][_0x1f2c('0x12')]);}else{logger['info'](_0x1f2c('0xc'),_0x5064f5,'request\x20sent');_0x54c846(_0x5b36c3[_0x1f2c('0x13')][_0x1f2c('0x12')]);}})['catch'](function(_0x45fe03){logger[_0x1f2c('0x10')](_0x1f2c('0xc'),_0x5064f5,_0x45fe03);_0x32f107(_0x45fe03);});});}