b3ed02ae09e87e3eb8f1585176479bf9aa4883dd
[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 _0xf678=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','create','body','options','raw','lodash'];(function(_0x5aea31,_0x1192ca){var _0x5cc58d=function(_0x519773){while(--_0x519773){_0x5aea31['push'](_0x5aea31['shift']());}};_0x5cc58d(++_0x1192ca);}(_0xf678,0x1cf));var _0x8f67=function(_0x37a997,_0x2a9b5e){_0x37a997=_0x37a997-0x0;var _0x1a24a3=_0xf678[_0x37a997];return _0x1a24a3;};'use strict';var _=require(_0x8f67('0x0'));var util=require(_0x8f67('0x1'));var moment=require(_0x8f67('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f67('0x3'));var fs=require('fs');var Redis=require(_0x8f67('0x4'));var db=require(_0x8f67('0x5'))['db'];var utils=require(_0x8f67('0x6'));var logger=require(_0x8f67('0x7'))(_0x8f67('0x8'));var config=require(_0x8f67('0x9'));var jayson=require(_0x8f67('0xa'));var client=jayson[_0x8f67('0xb')][_0x8f67('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20f5cc,_0x5f5657,_0xde9d1e){return new BPromise(function(_0x319c87,_0x5140ef){return client[_0x8f67('0xd')](_0x20f5cc,_0xde9d1e)[_0x8f67('0xe')](function(_0x52e94f){logger[_0x8f67('0xf')](_0x8f67('0x10'),_0x5f5657,'request\x20sent');logger['debug'](_0x8f67('0x11'),_0x5f5657,_0x8f67('0x12'),JSON[_0x8f67('0x13')](_0x52e94f));if(_0x52e94f[_0x8f67('0x14')]){if(_0x52e94f[_0x8f67('0x14')][_0x8f67('0x15')]===0x1f4){logger[_0x8f67('0x14')](_0x8f67('0x10'),_0x5f5657,_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);return _0x5140ef(_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);}logger['error'](_0x8f67('0x10'),_0x5f5657,_0x52e94f[_0x8f67('0x14')][_0x8f67('0x16')]);return _0x319c87(_0x52e94f['error'][_0x8f67('0x16')]);}else{logger[_0x8f67('0xf')](_0x8f67('0x10'),_0x5f5657,_0x8f67('0x12'));_0x319c87(_0x52e94f['result'][_0x8f67('0x16')]);}})[_0x8f67('0x17')](function(_0xa614d9){logger[_0x8f67('0x14')](_0x8f67('0x10'),_0x5f5657,_0xa614d9);_0x5140ef(_0xa614d9);});});}exports[_0x8f67('0x18')]=function(_0x590f95){var _0x55c75e=this;return new Promise(function(_0x3bd82c,_0x1ae332){return db['SquareDetailsReport'][_0x8f67('0x19')](_0x590f95[_0x8f67('0x1a')],{'raw':_0x590f95[_0x8f67('0x1b')]?_0x590f95['options'][_0x8f67('0x1c')]===undefined?!![]:![]:!![]})[_0x8f67('0xe')](function(_0x202f94){logger['info'](_0x8f67('0x18'),_0x590f95);logger['debug'](_0x8f67('0x18'),_0x590f95,JSON['stringify'](_0x202f94));_0x3bd82c(_0x202f94);})[_0x8f67('0x17')](function(_0x4b8940){logger['error']('CreateSquareDetailsReport',_0x4b8940[_0x8f67('0x16')],_0x590f95);_0x1ae332(_0x55c75e[_0x8f67('0x14')](0x1f4,_0x4b8940[_0x8f67('0x16')]));});});};