9c41153b1a28a3ba10ddd08820814d67fa778501
[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 _0x17a7=['debug','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x17a7,0xc2));var _0x717a=function(_0x23a905,_0xaac615){_0x23a905=_0x23a905-0x0;var _0x52140a=_0x17a7[_0x23a905];return _0x52140a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});}exports[_0x717a('0x11')]=function(_0x152e10){var _0x8b295=this;return new Promise(function(_0x45dc38,_0x2fe7a7){return db[_0x717a('0x12')][_0x717a('0x13')](_0x152e10[_0x717a('0x14')],{'raw':_0x152e10[_0x717a('0x15')]?_0x152e10['options']['raw']===undefined?!![]:![]:!![]})[_0x717a('0x8')](function(_0x1d7ebd){logger[_0x717a('0x9')](_0x717a('0x11'),_0x152e10);logger[_0x717a('0x16')](_0x717a('0x11'),_0x152e10,JSON[_0x717a('0xc')](_0x1d7ebd));_0x45dc38(_0x1d7ebd);})[_0x717a('0x17')](function(_0x4e95dc){logger[_0x717a('0xd')](_0x717a('0x11'),_0x4e95dc[_0x717a('0xf')],_0x152e10);_0x2fe7a7(_0x8b295[_0x717a('0xd')](0x1f4,_0x4e95dc[_0x717a('0xf')]));});});};