1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0xd070=['code','message','result','catch','create','options','CreateSquareDetailsReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x276221,_0x378da4){var _0x4fa716=function(_0x4dd561){while(--_0x4dd561){_0x276221['push'](_0x276221['shift']());}};_0x4fa716(++_0x378da4);}(_0xd070,0x8e));var _0x0d07=function(_0x313f6a,_0x1063e9){_0x313f6a=_0x313f6a-0x0;var _0x4f1e71=_0xd070[_0x313f6a];return _0x4f1e71;};'use strict';var _=require(_0x0d07('0x0'));var util=require('util');var moment=require(_0x0d07('0x1'));var BPromise=require(_0x0d07('0x2'));var rs=require(_0x0d07('0x3'));var fs=require('fs');var Redis=require(_0x0d07('0x4'));var db=require(_0x0d07('0x5'))['db'];var utils=require(_0x0d07('0x6'));var logger=require(_0x0d07('0x7'))(_0x0d07('0x8'));var config=require(_0x0d07('0x9'));var jayson=require(_0x0d07('0xa'));var client=jayson[_0x0d07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d75a,_0x5a4366,_0x20fd56){return new BPromise(function(_0x8c16d8,_0x1f989e){return client[_0x0d07('0xc')](_0x13d75a,_0x20fd56)[_0x0d07('0xd')](function(_0xc5b04d){logger[_0x0d07('0xe')](_0x0d07('0xf'),_0x5a4366,_0x0d07('0x10'));logger[_0x0d07('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5a4366,'request\x20sent',JSON[_0x0d07('0x12')](_0xc5b04d));if(_0xc5b04d[_0x0d07('0x13')]){if(_0xc5b04d['error'][_0x0d07('0x14')]===0x1f4){logger['error'](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')]['message']);return _0x1f989e(_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);}logger[_0x0d07('0x13')](_0x0d07('0xf'),_0x5a4366,_0xc5b04d[_0x0d07('0x13')][_0x0d07('0x15')]);return _0x8c16d8(_0xc5b04d['error'][_0x0d07('0x15')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x5a4366,_0x0d07('0x10'));_0x8c16d8(_0xc5b04d[_0x0d07('0x16')][_0x0d07('0x15')]);}})[_0x0d07('0x17')](function(_0x220203){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5a4366,_0x220203);_0x1f989e(_0x220203);});});}exports['CreateSquareDetailsReport']=function(_0x187df2){var _0x312015=this;return new Promise(function(_0x52cb4b,_0x410ad2){return db['SquareDetailsReport'][_0x0d07('0x18')](_0x187df2['body'],{'raw':_0x187df2['options']?_0x187df2[_0x0d07('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0d07('0xd')](function(_0x54790f){logger[_0x0d07('0xe')]('CreateSquareDetailsReport',_0x187df2);logger['debug'](_0x0d07('0x1a'),_0x187df2,JSON[_0x0d07('0x12')](_0x54790f));_0x52cb4b(_0x54790f);})[_0x0d07('0x17')](function(_0x57e997){logger[_0x0d07('0x13')]('CreateSquareDetailsReport',_0x57e997['message'],_0x187df2);_0x410ad2(_0x312015[_0x0d07('0x13')](0x1f4,_0x57e997[_0x0d07('0x15')]));});});};