9b7f4b3de9792d1ccec6aaeb86cca3cc7ca8952f
[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 _0xd4bb=['request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareDetailsReport','create','body','raw','CreateSquareDetailsReport','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x531b53,_0x2fe6ae){var _0x1fc9f6=function(_0x4ae4ec){while(--_0x4ae4ec){_0x531b53['push'](_0x531b53['shift']());}};_0x1fc9f6(++_0x2fe6ae);}(_0xd4bb,0x142));var _0xbd4b=function(_0x14e5c3,_0x58d057){_0x14e5c3=_0x14e5c3-0x0;var _0x3ec1c3=_0xd4bb[_0x14e5c3];return _0x3ec1c3;};'use strict';var _=require(_0xbd4b('0x0'));var util=require(_0xbd4b('0x1'));var moment=require('moment');var BPromise=require(_0xbd4b('0x2'));var rs=require(_0xbd4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd4b('0x4'))['db'];var utils=require(_0xbd4b('0x5'));var logger=require(_0xbd4b('0x6'))(_0xbd4b('0x7'));var config=require(_0xbd4b('0x8'));var jayson=require(_0xbd4b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3463fb,_0x134784,_0x1ba9f9){return new BPromise(function(_0x140229,_0x317cc9){return client[_0xbd4b('0xa')](_0x3463fb,_0x1ba9f9)[_0xbd4b('0xb')](function(_0x491a27){logger[_0xbd4b('0xc')](_0xbd4b('0xd'),_0x134784,_0xbd4b('0xe'));logger[_0xbd4b('0xf')](_0xbd4b('0x10'),_0x134784,_0xbd4b('0xe'),JSON['stringify'](_0x491a27));if(_0x491a27['error']){if(_0x491a27[_0xbd4b('0x11')][_0xbd4b('0x12')]===0x1f4){logger[_0xbd4b('0x11')](_0xbd4b('0xd'),_0x134784,_0x491a27['error'][_0xbd4b('0x13')]);return _0x317cc9(_0x491a27[_0xbd4b('0x11')][_0xbd4b('0x13')]);}logger[_0xbd4b('0x11')](_0xbd4b('0xd'),_0x134784,_0x491a27[_0xbd4b('0x11')][_0xbd4b('0x13')]);return _0x140229(_0x491a27[_0xbd4b('0x11')][_0xbd4b('0x13')]);}else{logger[_0xbd4b('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x134784,_0xbd4b('0xe'));_0x140229(_0x491a27[_0xbd4b('0x14')][_0xbd4b('0x13')]);}})[_0xbd4b('0x15')](function(_0x3e656b){logger[_0xbd4b('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x134784,_0x3e656b);_0x317cc9(_0x3e656b);});});}exports['CreateSquareDetailsReport']=function(_0xbad247){var _0x31463b=this;return new Promise(function(_0x477f95,_0x4a8e6c){return db[_0xbd4b('0x16')][_0xbd4b('0x17')](_0xbad247[_0xbd4b('0x18')],{'raw':_0xbad247['options']?_0xbad247['options'][_0xbd4b('0x19')]===undefined?!![]:![]:!![]})[_0xbd4b('0xb')](function(_0x55c585){logger[_0xbd4b('0xc')](_0xbd4b('0x1a'),_0xbad247);logger[_0xbd4b('0xf')](_0xbd4b('0x1a'),_0xbad247,JSON[_0xbd4b('0x1b')](_0x55c585));_0x477f95(_0x55c585);})[_0xbd4b('0x15')](function(_0x21fb85){logger[_0xbd4b('0x11')](_0xbd4b('0x1a'),_0x21fb85[_0xbd4b('0x13')],_0xbad247);_0x4a8e6c(_0x31463b['error'](0x1f4,_0x21fb85[_0xbd4b('0x13')]));});});};