Built motion from commit (unavailable).|2.5.14
[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 _0x612a=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareDetailsReport','create','options','raw','CreateSquareDetailsReport','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x6dff11,_0x1df1cf){var _0x5b6012=function(_0x16880c){while(--_0x16880c){_0x6dff11['push'](_0x6dff11['shift']());}};_0x5b6012(++_0x1df1cf);}(_0x612a,0xab));var _0xa612=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x612a[_0x46428c];return _0x16a677;};'use strict';var _=require(_0xa612('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa612('0x1'));var rs=require(_0xa612('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa612('0x3'))['db'];var utils=require(_0xa612('0x4'));var logger=require(_0xa612('0x5'))(_0xa612('0x6'));var config=require(_0xa612('0x7'));var jayson=require(_0xa612('0x8'));var client=jayson['client'][_0xa612('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x853b75,_0x469c8b,_0x489d08){return new BPromise(function(_0x519d1a,_0x5a9939){return client['request'](_0x853b75,_0x489d08)[_0xa612('0xa')](function(_0x8c7102){logger[_0xa612('0xb')](_0xa612('0xc'),_0x469c8b,_0xa612('0xd'));logger[_0xa612('0xe')](_0xa612('0xf'),_0x469c8b,_0xa612('0xd'),JSON['stringify'](_0x8c7102));if(_0x8c7102['error']){if(_0x8c7102[_0xa612('0x10')][_0xa612('0x11')]===0x1f4){logger[_0xa612('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x469c8b,_0x8c7102['error'][_0xa612('0x12')]);return _0x5a9939(_0x8c7102[_0xa612('0x10')][_0xa612('0x12')]);}logger['error'](_0xa612('0xc'),_0x469c8b,_0x8c7102[_0xa612('0x10')][_0xa612('0x12')]);return _0x519d1a(_0x8c7102['error'][_0xa612('0x12')]);}else{logger[_0xa612('0xb')](_0xa612('0xc'),_0x469c8b,_0xa612('0xd'));_0x519d1a(_0x8c7102['result'][_0xa612('0x12')]);}})[_0xa612('0x13')](function(_0x4f5d47){logger[_0xa612('0x10')](_0xa612('0xc'),_0x469c8b,_0x4f5d47);_0x5a9939(_0x4f5d47);});});}exports['CreateSquareDetailsReport']=function(_0x33008c){var _0x593d77=this;return new Promise(function(_0x156900,_0x4568b6){return db[_0xa612('0x14')][_0xa612('0x15')](_0x33008c['body'],{'raw':_0x33008c[_0xa612('0x16')]?_0x33008c[_0xa612('0x16')][_0xa612('0x17')]===undefined?!![]:![]:!![]})[_0xa612('0xa')](function(_0x38d622){logger[_0xa612('0xb')](_0xa612('0x18'),_0x33008c);logger[_0xa612('0xe')](_0xa612('0x18'),_0x33008c,JSON[_0xa612('0x19')](_0x38d622));_0x156900(_0x38d622);})[_0xa612('0x13')](function(_0x7babac){logger['error']('CreateSquareDetailsReport',_0x7babac[_0xa612('0x12')],_0x33008c);_0x4568b6(_0x593d77[_0xa612('0x10')](0x1f4,_0x7babac['message']));});});};