Built motion from commit 1fa89557.|2.6.10
[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 _0x4024=['catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x4024,0x89));var _0x4402=function(_0x62512,_0x13cea6){_0x62512=_0x62512-0x0;var _0x1dee02=_0x4024[_0x62512];return _0x1dee02;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['create'](_0x231382[_0x4402('0x16')],{'raw':_0x231382[_0x4402('0x17')]?_0x231382['options'][_0x4402('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55cc8c){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x19')]('CreateSquareDetailsReport',_0x231382,JSON[_0x4402('0xd')](_0x55cc8c));_0x494389(_0x55cc8c);})['catch'](function(_0x47ab54){logger[_0x4402('0xe')](_0x4402('0x14'),_0x47ab54[_0x4402('0x11')],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x47ab54[_0x4402('0x11')]));});});};