6c0ea2bb1c186de731a617ba147e1bfa99bfd821
[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 _0x4c6e=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateSquareDetailsReport','create','body','options','raw'];(function(_0x445332,_0x59cdb2){var _0x425025=function(_0x37a535){while(--_0x37a535){_0x445332['push'](_0x445332['shift']());}};_0x425025(++_0x59cdb2);}(_0x4c6e,0x146));var _0xe4c6=function(_0xb1840,_0x42cb61){_0xb1840=_0xb1840-0x0;var _0x4758b3=_0x4c6e[_0xb1840];return _0x4758b3;};'use strict';var _=require(_0xe4c6('0x0'));var util=require(_0xe4c6('0x1'));var moment=require(_0xe4c6('0x2'));var BPromise=require(_0xe4c6('0x3'));var rs=require(_0xe4c6('0x4'));var fs=require('fs');var Redis=require(_0xe4c6('0x5'));var db=require(_0xe4c6('0x6'))['db'];var utils=require(_0xe4c6('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4c6('0x8')][_0xe4c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5efe3d,_0x2dee86,_0x1e141b){return new BPromise(function(_0x1dfa3d,_0x3c5314){return client[_0xe4c6('0xa')](_0x5efe3d,_0x1e141b)[_0xe4c6('0xb')](function(_0xf45f8f){logger[_0xe4c6('0xc')](_0xe4c6('0xd'),_0x2dee86,_0xe4c6('0xe'));logger['debug'](_0xe4c6('0xf'),_0x2dee86,_0xe4c6('0xe'),JSON['stringify'](_0xf45f8f));if(_0xf45f8f['error']){if(_0xf45f8f['error']['code']===0x1f4){logger[_0xe4c6('0x10')](_0xe4c6('0xd'),_0x2dee86,_0xf45f8f[_0xe4c6('0x10')][_0xe4c6('0x11')]);return _0x3c5314(_0xf45f8f[_0xe4c6('0x10')]['message']);}logger[_0xe4c6('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2dee86,_0xf45f8f[_0xe4c6('0x10')][_0xe4c6('0x11')]);return _0x1dfa3d(_0xf45f8f[_0xe4c6('0x10')]['message']);}else{logger[_0xe4c6('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2dee86,'request\x20sent');_0x1dfa3d(_0xf45f8f['result'][_0xe4c6('0x11')]);}})[_0xe4c6('0x12')](function(_0x1b1cdd){logger[_0xe4c6('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2dee86,_0x1b1cdd);_0x3c5314(_0x1b1cdd);});});}exports[_0xe4c6('0x13')]=function(_0x476c16){var _0x53730c=this;return new Promise(function(_0x3ddfe9,_0x40d3b3){return db['SquareDetailsReport'][_0xe4c6('0x14')](_0x476c16[_0xe4c6('0x15')],{'raw':_0x476c16[_0xe4c6('0x16')]?_0x476c16[_0xe4c6('0x16')][_0xe4c6('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3e8535){logger[_0xe4c6('0xc')](_0xe4c6('0x13'),_0x476c16);logger[_0xe4c6('0x18')](_0xe4c6('0x13'),_0x476c16,JSON['stringify'](_0x3e8535));_0x3ddfe9(_0x3e8535);})[_0xe4c6('0x12')](function(_0x1ade3f){logger[_0xe4c6('0x10')](_0xe4c6('0x13'),_0x1ade3f[_0xe4c6('0x11')],_0x476c16);_0x40d3b3(_0x53730c['error'](0x1f4,_0x1ade3f[_0xe4c6('0x11')]));});});};