Built motion from commit (unavailable).|2.5.21
[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 _0x4c61=['info','debug','request\x20sent','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','CreateSquareDetailsReport','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4c61,0x15e));var _0x14c6=function(_0x3391b1,_0x1a0e6a){_0x3391b1=_0x3391b1-0x0;var _0x1417ed=_0x4c61[_0x3391b1];return _0x1417ed;};'use strict';var _=require(_0x14c6('0x0'));var util=require(_0x14c6('0x1'));var moment=require(_0x14c6('0x2'));var BPromise=require(_0x14c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14c6('0x4'));var db=require(_0x14c6('0x5'))['db'];var utils=require(_0x14c6('0x6'));var logger=require(_0x14c6('0x7'))(_0x14c6('0x8'));var config=require(_0x14c6('0x9'));var jayson=require(_0x14c6('0xa'));var client=jayson['client'][_0x14c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535c77,_0x3df4cb,_0x3be172){return new BPromise(function(_0x2b5ccb,_0x363880){return client[_0x14c6('0xc')](_0x535c77,_0x3be172)[_0x14c6('0xd')](function(_0x317a7e){logger[_0x14c6('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x3df4cb,'request\x20sent');logger[_0x14c6('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3df4cb,_0x14c6('0x10'),JSON[_0x14c6('0x11')](_0x317a7e));if(_0x317a7e[_0x14c6('0x12')]){if(_0x317a7e['error'][_0x14c6('0x13')]===0x1f4){logger[_0x14c6('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x3df4cb,_0x317a7e[_0x14c6('0x12')][_0x14c6('0x14')]);return _0x363880(_0x317a7e[_0x14c6('0x12')]['message']);}logger[_0x14c6('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x3df4cb,_0x317a7e[_0x14c6('0x12')][_0x14c6('0x14')]);return _0x2b5ccb(_0x317a7e[_0x14c6('0x12')][_0x14c6('0x14')]);}else{logger['info'](_0x14c6('0x15'),_0x3df4cb,_0x14c6('0x10'));_0x2b5ccb(_0x317a7e[_0x14c6('0x16')][_0x14c6('0x14')]);}})['catch'](function(_0x12a903){logger[_0x14c6('0x12')](_0x14c6('0x15'),_0x3df4cb,_0x12a903);_0x363880(_0x12a903);});});}exports[_0x14c6('0x17')]=function(_0x20207f){var _0x114e3d=this;return new Promise(function(_0x92cd8,_0x496e95){return db['SquareDetailsReport']['create'](_0x20207f[_0x14c6('0x18')],{'raw':_0x20207f[_0x14c6('0x19')]?_0x20207f[_0x14c6('0x19')][_0x14c6('0x1a')]===undefined?!![]:![]:!![]})[_0x14c6('0xd')](function(_0x18a57b){logger[_0x14c6('0xe')](_0x14c6('0x17'),_0x20207f);logger[_0x14c6('0xf')](_0x14c6('0x17'),_0x20207f,JSON[_0x14c6('0x11')](_0x18a57b));_0x92cd8(_0x18a57b);})[_0x14c6('0x1b')](function(_0x56c838){logger[_0x14c6('0x12')](_0x14c6('0x17'),_0x56c838[_0x14c6('0x14')],_0x20207f);_0x496e95(_0x114e3d['error'](0x1f4,_0x56c838[_0x14c6('0x14')]));});});};