776a8f0b220c4cdaba8a333e6996c7f794a7898f
[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 _0x4213=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','then','debug','lodash'];(function(_0x4c555a,_0x277fc3){var _0x214229=function(_0x5d0684){while(--_0x5d0684){_0x4c555a['push'](_0x4c555a['shift']());}};_0x214229(++_0x277fc3);}(_0x4213,0x77));var _0x3421=function(_0x1cd85a,_0x19a66f){_0x1cd85a=_0x1cd85a-0x0;var _0x26eb27=_0x4213[_0x1cd85a];return _0x26eb27;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5469d8,_0x50e464,_0x1b152f){return new BPromise(function(_0x130625,_0x1cf6a0){return client[_0x3421('0xc')](_0x5469d8,_0x1b152f)['then'](function(_0x1f20cf){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x50e464,_0x3421('0xd'));logger['debug'](_0x3421('0xe'),_0x50e464,_0x3421('0xd'),JSON[_0x3421('0xf')](_0x1f20cf));if(_0x1f20cf[_0x3421('0x10')]){if(_0x1f20cf[_0x3421('0x10')][_0x3421('0x11')]===0x1f4){logger[_0x3421('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x50e464,_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);return _0x1cf6a0(_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);}logger[_0x3421('0x10')](_0x3421('0x13'),_0x50e464,_0x1f20cf[_0x3421('0x10')]['message']);return _0x130625(_0x1f20cf[_0x3421('0x10')]['message']);}else{logger[_0x3421('0x14')](_0x3421('0x13'),_0x50e464,'request\x20sent');_0x130625(_0x1f20cf[_0x3421('0x15')]['message']);}})[_0x3421('0x16')](function(_0x23694b){logger['error'](_0x3421('0x13'),_0x50e464,_0x23694b);_0x1cf6a0(_0x23694b);});});}exports[_0x3421('0x17')]=function(_0x130d3c){var _0x104cc5=this;return new Promise(function(_0x18acc1,_0x200fdd){return db[_0x3421('0x18')][_0x3421('0x19')](_0x130d3c[_0x3421('0x1a')],{'raw':_0x130d3c[_0x3421('0x1b')]?_0x130d3c[_0x3421('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3421('0x1c')](function(_0x4b59a5){logger['info']('CreateSquareDetailsReport',_0x130d3c);logger[_0x3421('0x1d')](_0x3421('0x17'),_0x130d3c,JSON[_0x3421('0xf')](_0x4b59a5));_0x18acc1(_0x4b59a5);})[_0x3421('0x16')](function(_0x132e8e){logger[_0x3421('0x10')](_0x3421('0x17'),_0x132e8e[_0x3421('0x12')],_0x130d3c);_0x200fdd(_0x104cc5[_0x3421('0x10')](0x1f4,_0x132e8e[_0x3421('0x12')]));});});};