550c760b63839315e75675d6e343e35d964d725f
[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 _0x3fc7=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x186abc,_0x5b4ee9){var _0x59697d=function(_0x35d2da){while(--_0x35d2da){_0x186abc['push'](_0x186abc['shift']());}};_0x59697d(++_0x5b4ee9);}(_0x3fc7,0x13b));var _0x73fc=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x3fc7[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0x73fc('0x0'));var util=require(_0x73fc('0x1'));var moment=require(_0x73fc('0x2'));var BPromise=require(_0x73fc('0x3'));var rs=require(_0x73fc('0x4'));var fs=require('fs');var Redis=require(_0x73fc('0x5'));var db=require(_0x73fc('0x6'))['db'];var utils=require(_0x73fc('0x7'));var logger=require(_0x73fc('0x8'))(_0x73fc('0x9'));var config=require(_0x73fc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x73fc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x878df9,_0x239290,_0x320119){return new BPromise(function(_0x1d65f9,_0x16f0e4){return client[_0x73fc('0xc')](_0x878df9,_0x320119)[_0x73fc('0xd')](function(_0x12ab0e){logger[_0x73fc('0xe')](_0x73fc('0xf'),_0x239290,'request\x20sent');logger[_0x73fc('0x10')](_0x73fc('0x11'),_0x239290,_0x73fc('0x12'),JSON[_0x73fc('0x13')](_0x12ab0e));if(_0x12ab0e['error']){if(_0x12ab0e['error']['code']===0x1f4){logger[_0x73fc('0x14')](_0x73fc('0xf'),_0x239290,_0x12ab0e[_0x73fc('0x14')][_0x73fc('0x15')]);return _0x16f0e4(_0x12ab0e[_0x73fc('0x14')][_0x73fc('0x15')]);}logger[_0x73fc('0x14')](_0x73fc('0xf'),_0x239290,_0x12ab0e['error'][_0x73fc('0x15')]);return _0x1d65f9(_0x12ab0e[_0x73fc('0x14')]['message']);}else{logger[_0x73fc('0xe')](_0x73fc('0xf'),_0x239290,_0x73fc('0x12'));_0x1d65f9(_0x12ab0e[_0x73fc('0x16')]['message']);}})[_0x73fc('0x17')](function(_0x4de2f7){logger[_0x73fc('0x14')](_0x73fc('0xf'),_0x239290,_0x4de2f7);_0x16f0e4(_0x4de2f7);});});}exports[_0x73fc('0x18')]=function(_0x1052ba){var _0x5474b6=this;return new Promise(function(_0x4ecfe9,_0x40d4aa){return db[_0x73fc('0x19')][_0x73fc('0x1a')](_0x1052ba['body'],{'raw':_0x1052ba[_0x73fc('0x1b')]?_0x1052ba['options']['raw']===undefined?!![]:![]:!![]})[_0x73fc('0xd')](function(_0x5951ed){logger[_0x73fc('0xe')]('CreateSquareDetailsReport',_0x1052ba);logger[_0x73fc('0x10')](_0x73fc('0x18'),_0x1052ba,JSON[_0x73fc('0x13')](_0x5951ed));_0x4ecfe9(_0x5951ed);})[_0x73fc('0x17')](function(_0x16eff6){logger[_0x73fc('0x14')](_0x73fc('0x18'),_0x16eff6[_0x73fc('0x15')],_0x1052ba);_0x40d4aa(_0x5474b6[_0x73fc('0x14')](0x1f4,_0x16eff6['message']));});});};