4469426c843a9dcd39386ad747567772f563b009
[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 _0xb799=['result','catch','SquareDetailsReport','create','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3030bd,_0x4963ae){var _0x363dc8=function(_0x134592){while(--_0x134592){_0x3030bd['push'](_0x3030bd['shift']());}};_0x363dc8(++_0x4963ae);}(_0xb799,0x10c));var _0x9b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb799[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9b79('0x0'));var util=require(_0x9b79('0x1'));var moment=require(_0x9b79('0x2'));var BPromise=require(_0x9b79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b79('0x4'));var db=require(_0x9b79('0x5'))['db'];var utils=require(_0x9b79('0x6'));var logger=require(_0x9b79('0x7'))('rpc');var config=require(_0x9b79('0x8'));var jayson=require(_0x9b79('0x9'));var client=jayson[_0x9b79('0xa')][_0x9b79('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x577fee,_0x2cbc51,_0x211811){return new BPromise(function(_0x11ffee,_0xfaa5a1){return client[_0x9b79('0xc')](_0x577fee,_0x211811)['then'](function(_0x4f39a5){logger[_0x9b79('0xd')](_0x9b79('0xe'),_0x2cbc51,_0x9b79('0xf'));logger[_0x9b79('0x10')](_0x9b79('0x11'),_0x2cbc51,'request\x20sent',JSON[_0x9b79('0x12')](_0x4f39a5));if(_0x4f39a5['error']){if(_0x4f39a5['error'][_0x9b79('0x13')]===0x1f4){logger[_0x9b79('0x14')](_0x9b79('0xe'),_0x2cbc51,_0x4f39a5['error'][_0x9b79('0x15')]);return _0xfaa5a1(_0x4f39a5['error'][_0x9b79('0x15')]);}logger[_0x9b79('0x14')](_0x9b79('0xe'),_0x2cbc51,_0x4f39a5[_0x9b79('0x14')][_0x9b79('0x15')]);return _0x11ffee(_0x4f39a5[_0x9b79('0x14')][_0x9b79('0x15')]);}else{logger[_0x9b79('0xd')](_0x9b79('0xe'),_0x2cbc51,_0x9b79('0xf'));_0x11ffee(_0x4f39a5[_0x9b79('0x16')][_0x9b79('0x15')]);}})[_0x9b79('0x17')](function(_0x453d27){logger[_0x9b79('0x14')](_0x9b79('0xe'),_0x2cbc51,_0x453d27);_0xfaa5a1(_0x453d27);});});}exports['CreateSquareDetailsReport']=function(_0xa0e79d){var _0x2beaa2=this;return new Promise(function(_0x5cca5e,_0x50244c){return db[_0x9b79('0x18')][_0x9b79('0x19')](_0xa0e79d['body'],{'raw':_0xa0e79d['options']?_0xa0e79d[_0x9b79('0x1a')][_0x9b79('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x39578d){logger['info'](_0x9b79('0x1c'),_0xa0e79d);logger[_0x9b79('0x10')]('CreateSquareDetailsReport',_0xa0e79d,JSON[_0x9b79('0x12')](_0x39578d));_0x5cca5e(_0x39578d);})['catch'](function(_0x12c7fc){logger[_0x9b79('0x14')](_0x9b79('0x1c'),_0x12c7fc['message'],_0xa0e79d);_0x50244c(_0x2beaa2[_0x9b79('0x14')](0x1f4,_0x12c7fc[_0x9b79('0x15')]));});});};