Built motion from commit (unavailable).|2.4.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 _0x2a43=['catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','lodash','util','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x29570a,_0x124a5b){var _0x7be1a2=function(_0x44faaf){while(--_0x44faaf){_0x29570a['push'](_0x29570a['shift']());}};_0x7be1a2(++_0x124a5b);}(_0x2a43,0x1bf));var _0x32a4=function(_0x6ffa51,_0x381094){_0x6ffa51=_0x6ffa51-0x0;var _0x15c339=_0x2a43[_0x6ffa51];return _0x15c339;};'use strict';var _=require(_0x32a4('0x0'));var util=require(_0x32a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32a4('0x2'));var logger=require(_0x32a4('0x3'))(_0x32a4('0x4'));var config=require('../../config/environment');var jayson=require(_0x32a4('0x5'));var client=jayson['client'][_0x32a4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4917e9,_0x1e2e66,_0x30fb27){return new BPromise(function(_0x1fe613,_0x1a2aad){return client['request'](_0x4917e9,_0x30fb27)['then'](function(_0x288ee1){logger[_0x32a4('0x7')](_0x32a4('0x8'),_0x1e2e66,_0x32a4('0x9'));logger[_0x32a4('0xa')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1e2e66,_0x32a4('0x9'),JSON[_0x32a4('0xb')](_0x288ee1));if(_0x288ee1[_0x32a4('0xc')]){if(_0x288ee1[_0x32a4('0xc')][_0x32a4('0xd')]===0x1f4){logger[_0x32a4('0xc')](_0x32a4('0x8'),_0x1e2e66,_0x288ee1['error'][_0x32a4('0xe')]);return _0x1a2aad(_0x288ee1[_0x32a4('0xc')]['message']);}logger[_0x32a4('0xc')](_0x32a4('0x8'),_0x1e2e66,_0x288ee1[_0x32a4('0xc')][_0x32a4('0xe')]);return _0x1fe613(_0x288ee1[_0x32a4('0xc')][_0x32a4('0xe')]);}else{logger[_0x32a4('0x7')](_0x32a4('0x8'),_0x1e2e66,_0x32a4('0x9'));_0x1fe613(_0x288ee1['result'][_0x32a4('0xe')]);}})[_0x32a4('0xf')](function(_0x87d807){logger[_0x32a4('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x1e2e66,_0x87d807);_0x1a2aad(_0x87d807);});});}exports[_0x32a4('0x10')]=function(_0x295047){var _0x3404e3=this;return new Promise(function(_0x1f3166,_0x56a4d9){return db[_0x32a4('0x11')]['create'](_0x295047[_0x32a4('0x12')],{'raw':_0x295047[_0x32a4('0x13')]?_0x295047[_0x32a4('0x13')][_0x32a4('0x14')]===undefined?!![]:![]:!![]})[_0x32a4('0x15')](function(_0x37e842){logger['info']('CreateSquareDetailsReport',_0x295047);logger[_0x32a4('0xa')](_0x32a4('0x10'),_0x295047,JSON[_0x32a4('0xb')](_0x37e842));_0x1f3166(_0x37e842);})['catch'](function(_0x464767){logger[_0x32a4('0xc')](_0x32a4('0x10'),_0x464767[_0x32a4('0xe')],_0x295047);_0x56a4d9(_0x3404e3[_0x32a4('0xc')](0x1f4,_0x464767[_0x32a4('0xe')]));});});};