Built motion from commit 87cd5f02.|2.5.48
[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 _0x3cae=['catch','CreateSquareDetailsReport','SquareDetailsReport','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x1e7b52,_0x493ec6){var _0x1013a1=function(_0x5042f8){while(--_0x5042f8){_0x1e7b52['push'](_0x1e7b52['shift']());}};_0x1013a1(++_0x493ec6);}(_0x3cae,0x117));var _0xe3ca=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x3cae[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0xe3ca('0x0'));var util=require(_0xe3ca('0x1'));var moment=require(_0xe3ca('0x2'));var BPromise=require(_0xe3ca('0x3'));var rs=require(_0xe3ca('0x4'));var fs=require('fs');var Redis=require(_0xe3ca('0x5'));var db=require(_0xe3ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3ca('0x7'))(_0xe3ca('0x8'));var config=require('../../config/environment');var jayson=require(_0xe3ca('0x9'));var client=jayson['client'][_0xe3ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7fafb4,_0x36d17a,_0x578178){return new BPromise(function(_0x2c4863,_0x100c20){return client[_0xe3ca('0xb')](_0x7fafb4,_0x578178)[_0xe3ca('0xc')](function(_0x1ae7bf){logger[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x36d17a,'request\x20sent');logger[_0xe3ca('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x36d17a,_0xe3ca('0x10'),JSON[_0xe3ca('0x11')](_0x1ae7bf));if(_0x1ae7bf[_0xe3ca('0x12')]){if(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x13')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x36d17a,_0x1ae7bf[_0xe3ca('0x12')]['message']);return _0x100c20(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);}logger['error'](_0xe3ca('0xe'),_0x36d17a,_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);return _0x2c4863(_0x1ae7bf[_0xe3ca('0x12')][_0xe3ca('0x14')]);}else{logger[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x36d17a,_0xe3ca('0x10'));_0x2c4863(_0x1ae7bf['result']['message']);}})[_0xe3ca('0x15')](function(_0x4296ae){logger[_0xe3ca('0x12')](_0xe3ca('0xe'),_0x36d17a,_0x4296ae);_0x100c20(_0x4296ae);});});}exports[_0xe3ca('0x16')]=function(_0x2d73d9){var _0x5bb8d8=this;return new Promise(function(_0x2eafde,_0xda5841){return db[_0xe3ca('0x17')]['create'](_0x2d73d9['body'],{'raw':_0x2d73d9['options']?_0x2d73d9[_0xe3ca('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3b7591){logger[_0xe3ca('0xd')](_0xe3ca('0x16'),_0x2d73d9);logger[_0xe3ca('0xf')](_0xe3ca('0x16'),_0x2d73d9,JSON['stringify'](_0x3b7591));_0x2eafde(_0x3b7591);})[_0xe3ca('0x15')](function(_0x3ab26e){logger['error'](_0xe3ca('0x16'),_0x3ab26e[_0xe3ca('0x14')],_0x2d73d9);_0xda5841(_0x5bb8d8[_0xe3ca('0x12')](0x1f4,_0x3ab26e[_0xe3ca('0x14')]));});});};