b4cc430769b98ee7b840ae1025ec61c4c2c3cd15
[motion2.git] / server / api / squareReportDetail / squareReportDetail.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 _0x55cb=['CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x55cb,0x164));var _0xb55c=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0x55cb[_0x383158];return _0x507985;};'use strict';var _=require(_0xb55c('0x0'));var util=require(_0xb55c('0x1'));var moment=require(_0xb55c('0x2'));var BPromise=require(_0xb55c('0x3'));var rs=require(_0xb55c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb55c('0x5'))['db'];var utils=require(_0xb55c('0x6'));var logger=require('../../config/logger')(_0xb55c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb55c('0x8'));var client=jayson['client'][_0xb55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ceb67,_0x40a370,_0x4da357){return new BPromise(function(_0x235659,_0x253d32){return client[_0xb55c('0xa')](_0x1ceb67,_0x4da357)['then'](function(_0x5a2bce){logger[_0xb55c('0xb')](_0xb55c('0xc'),_0x40a370,_0xb55c('0xd'));logger[_0xb55c('0xe')](_0xb55c('0xf'),_0x40a370,_0xb55c('0xd'),JSON[_0xb55c('0x10')](_0x5a2bce));if(_0x5a2bce[_0xb55c('0x11')]){if(_0x5a2bce['error']['code']===0x1f4){logger[_0xb55c('0x11')](_0xb55c('0xc'),_0x40a370,_0x5a2bce['error'][_0xb55c('0x12')]);return _0x253d32(_0x5a2bce[_0xb55c('0x11')][_0xb55c('0x12')]);}logger[_0xb55c('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x40a370,_0x5a2bce['error'][_0xb55c('0x12')]);return _0x235659(_0x5a2bce[_0xb55c('0x11')][_0xb55c('0x12')]);}else{logger[_0xb55c('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x40a370,'request\x20sent');_0x235659(_0x5a2bce['result'][_0xb55c('0x12')]);}})['catch'](function(_0x2e5be5){logger[_0xb55c('0x11')](_0xb55c('0xc'),_0x40a370,_0x2e5be5);_0x253d32(_0x2e5be5);});});}exports[_0xb55c('0x13')]=function(_0x9ef566){var _0x2c8df4=this;return new Promise(function(_0x1504be,_0x5dc836){return db[_0xb55c('0x14')][_0xb55c('0x15')](_0x9ef566[_0xb55c('0x16')],{'raw':_0x9ef566[_0xb55c('0x17')]?_0x9ef566['options']['raw']===undefined?!![]:![]:!![]})[_0xb55c('0x18')](function(_0x2db82a){logger[_0xb55c('0xb')]('CreateSquareDetailsReport',_0x9ef566);logger[_0xb55c('0xe')](_0xb55c('0x13'),_0x9ef566,JSON[_0xb55c('0x10')](_0x2db82a));_0x1504be(_0x2db82a);})['catch'](function(_0x5d396e){logger[_0xb55c('0x11')]('CreateSquareDetailsReport',_0x5d396e[_0xb55c('0x12')],_0x9ef566);_0x5dc836(_0x2c8df4[_0xb55c('0x11')](0x1f4,_0x5d396e[_0xb55c('0x12')]));});});};