a01214b2a152226c01cdcf3fb25931103b6badb8
[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 _0x594d=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','create','options','raw','CreateSquareDetailsReport','stringify','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x3cab09,_0x5ce19b){var _0x5e6828=function(_0x1e2a5b){while(--_0x1e2a5b){_0x3cab09['push'](_0x3cab09['shift']());}};_0x5e6828(++_0x5ce19b);}(_0x594d,0x92));var _0xd594=function(_0x1beaa8,_0x535e82){_0x1beaa8=_0x1beaa8-0x0;var _0x3ed3c0=_0x594d[_0x1beaa8];return _0x3ed3c0;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1c64,_0x446711,_0xeedad0){return new BPromise(function(_0x20325a,_0x20718a){return client[_0xd594('0x9')](_0x3b1c64,_0xeedad0)[_0xd594('0xa')](function(_0xf3043e){logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');logger[_0xd594('0xd')](_0xd594('0xe'),_0x446711,_0xd594('0xf'),JSON['stringify'](_0xf3043e));if(_0xf3043e[_0xd594('0x10')]){if(_0xf3043e[_0xd594('0x10')][_0xd594('0x11')]===0x1f4){logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e[_0xd594('0x10')][_0xd594('0x12')]);return _0x20718a(_0xf3043e['error']['message']);}logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e['error'][_0xd594('0x12')]);return _0x20325a(_0xf3043e['error'][_0xd594('0x12')]);}else{logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');_0x20325a(_0xf3043e[_0xd594('0x13')]['message']);}})['catch'](function(_0x2a5f17){logger[_0xd594('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x446711,_0x2a5f17);_0x20718a(_0x2a5f17);});});}exports['CreateSquareDetailsReport']=function(_0x232776){var _0x4ea0d5=this;return new Promise(function(_0x54f640,_0x3ae9be){return db['SquareDetailsReport'][_0xd594('0x14')](_0x232776['body'],{'raw':_0x232776[_0xd594('0x15')]?_0x232776['options'][_0xd594('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3b0fda){logger[_0xd594('0xb')](_0xd594('0x17'),_0x232776);logger[_0xd594('0xd')](_0xd594('0x17'),_0x232776,JSON[_0xd594('0x18')](_0x3b0fda));_0x54f640(_0x3b0fda);})[_0xd594('0x19')](function(_0x2b8495){logger[_0xd594('0x10')](_0xd594('0x17'),_0x2b8495[_0xd594('0x12')],_0x232776);_0x3ae9be(_0x4ea0d5[_0xd594('0x10')](0x1f4,_0x2b8495[_0xd594('0x12')]));});});};