Built motion from commit (unavailable).|2.4.18
[motion2.git] / server / api / squareReport / squareReport.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 _0xe5c2=['info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareReport','SquareReport','options','raw','debug','UpdateSquareReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x136aae,_0x35aad0){var _0x35aba9=function(_0x48cbed){while(--_0x48cbed){_0x136aae['push'](_0x136aae['shift']());}};_0x35aba9(++_0x35aad0);}(_0xe5c2,0x167));var _0x2e5c=function(_0x1c6786,_0x2e4a25){_0x1c6786=_0x1c6786-0x0;var _0x2623bf=_0xe5c2[_0x1c6786];return _0x2623bf;};'use strict';var _=require(_0x2e5c('0x0'));var util=require(_0x2e5c('0x1'));var moment=require(_0x2e5c('0x2'));var BPromise=require(_0x2e5c('0x3'));var rs=require(_0x2e5c('0x4'));var fs=require('fs');var Redis=require(_0x2e5c('0x5'));var db=require(_0x2e5c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e5c('0x7'))(_0x2e5c('0x8'));var config=require('../../config/environment');var jayson=require(_0x2e5c('0x9'));var client=jayson[_0x2e5c('0xa')][_0x2e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18b8c0,_0x38670e,_0x290bb4){return new BPromise(function(_0x308c0b,_0x32313c){return client['request'](_0x18b8c0,_0x290bb4)[_0x2e5c('0xc')](function(_0x5a0466){logger[_0x2e5c('0xd')](_0x2e5c('0xe'),_0x38670e,'request\x20sent');logger['debug'](_0x2e5c('0xf'),_0x38670e,_0x2e5c('0x10'),JSON[_0x2e5c('0x11')](_0x5a0466));if(_0x5a0466[_0x2e5c('0x12')]){if(_0x5a0466['error']['code']===0x1f4){logger[_0x2e5c('0x12')]('SquareReport,\x20%s,\x20%s',_0x38670e,_0x5a0466['error'][_0x2e5c('0x13')]);return _0x32313c(_0x5a0466[_0x2e5c('0x12')][_0x2e5c('0x13')]);}logger['error'](_0x2e5c('0xe'),_0x38670e,_0x5a0466['error'][_0x2e5c('0x13')]);return _0x308c0b(_0x5a0466['error']['message']);}else{logger[_0x2e5c('0xd')](_0x2e5c('0xe'),_0x38670e,_0x2e5c('0x10'));_0x308c0b(_0x5a0466[_0x2e5c('0x14')]['message']);}})[_0x2e5c('0x15')](function(_0x247dd5){logger['error']('SquareReport,\x20%s,\x20%s',_0x38670e,_0x247dd5);_0x32313c(_0x247dd5);});});}exports[_0x2e5c('0x16')]=function(_0x4324c0){var _0x137f18=this;return new Promise(function(_0xabf9ac,_0x3ea026){return db[_0x2e5c('0x17')]['create'](_0x4324c0['body'],{'raw':_0x4324c0[_0x2e5c('0x18')]?_0x4324c0[_0x2e5c('0x18')][_0x2e5c('0x19')]===undefined?!![]:![]:!![]})[_0x2e5c('0xc')](function(_0x4fe483){logger[_0x2e5c('0xd')](_0x2e5c('0x16'),_0x4324c0);logger[_0x2e5c('0x1a')](_0x2e5c('0x16'),_0x4324c0,JSON['stringify'](_0x4fe483));_0xabf9ac(_0x4fe483);})[_0x2e5c('0x15')](function(_0x4022de){logger[_0x2e5c('0x12')](_0x2e5c('0x16'),_0x4022de[_0x2e5c('0x13')],_0x4324c0);_0x3ea026(_0x137f18[_0x2e5c('0x12')](0x1f4,_0x4022de[_0x2e5c('0x13')]));});});};exports[_0x2e5c('0x1b')]=function(_0x2ee388){var _0x3333a6=this;return new Promise(function(_0x40951c,_0x4e2083){return db[_0x2e5c('0x17')][_0x2e5c('0x1c')](_0x2ee388['body'],{'raw':_0x2ee388[_0x2e5c('0x18')]?_0x2ee388[_0x2e5c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee388[_0x2e5c('0x18')]?_0x2ee388[_0x2e5c('0x18')][_0x2e5c('0x1d')]||null:null,'attributes':_0x2ee388[_0x2e5c('0x18')]?_0x2ee388['options'][_0x2e5c('0x1e')]||null:null,'limit':_0x2ee388[_0x2e5c('0x18')]?_0x2ee388['options']['limit']||null:null})[_0x2e5c('0xc')](function(_0x29e36d){logger[_0x2e5c('0xd')]('UpdateSquareReport',_0x2ee388);logger[_0x2e5c('0x1a')](_0x2e5c('0x1b'),_0x2ee388,JSON[_0x2e5c('0x11')](_0x29e36d));_0x40951c(_0x29e36d);})[_0x2e5c('0x15')](function(_0x3d0975){logger['error'](_0x2e5c('0x1b'),_0x3d0975['message'],_0x2ee388);_0x4e2083(_0x3333a6[_0x2e5c('0x12')](0x1f4,_0x3d0975[_0x2e5c('0x13')]));});});};