Built motion from commit (unavailable).|2.5.4
[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 _0xb92e=['jayson/promise','client','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','create','options','raw','UpdateSquareReport','SquareReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x28b72f,_0x569ef1){var _0xa4c413=function(_0x55b580){while(--_0x55b580){_0x28b72f['push'](_0x28b72f['shift']());}};_0xa4c413(++_0x569ef1);}(_0xb92e,0x1bd));var _0xeb92=function(_0x100338,_0x5cdbcc){_0x100338=_0x100338-0x0;var _0x330d32=_0xb92e[_0x100338];return _0x330d32;};'use strict';var _=require(_0xeb92('0x0'));var util=require(_0xeb92('0x1'));var moment=require(_0xeb92('0x2'));var BPromise=require(_0xeb92('0x3'));var rs=require(_0xeb92('0x4'));var fs=require('fs');var Redis=require(_0xeb92('0x5'));var db=require(_0xeb92('0x6'))['db'];var utils=require(_0xeb92('0x7'));var logger=require('../../config/logger')(_0xeb92('0x8'));var config=require(_0xeb92('0x9'));var jayson=require(_0xeb92('0xa'));var client=jayson[_0xeb92('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a8a57,_0x4b5526,_0xfe7b8b){return new BPromise(function(_0x40ea89,_0x5c4a64){return client['request'](_0x4a8a57,_0xfe7b8b)[_0xeb92('0xc')](function(_0x1d7a79){logger[_0xeb92('0xd')]('SquareReport,\x20%s,\x20%s',_0x4b5526,_0xeb92('0xe'));logger[_0xeb92('0xf')](_0xeb92('0x10'),_0x4b5526,_0xeb92('0xe'),JSON[_0xeb92('0x11')](_0x1d7a79));if(_0x1d7a79[_0xeb92('0x12')]){if(_0x1d7a79[_0xeb92('0x12')][_0xeb92('0x13')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x4b5526,_0x1d7a79[_0xeb92('0x12')]['message']);return _0x5c4a64(_0x1d7a79[_0xeb92('0x12')][_0xeb92('0x14')]);}logger[_0xeb92('0x12')](_0xeb92('0x15'),_0x4b5526,_0x1d7a79['error']['message']);return _0x40ea89(_0x1d7a79['error'][_0xeb92('0x14')]);}else{logger['info'](_0xeb92('0x15'),_0x4b5526,_0xeb92('0xe'));_0x40ea89(_0x1d7a79[_0xeb92('0x16')][_0xeb92('0x14')]);}})[_0xeb92('0x17')](function(_0x2beb26){logger[_0xeb92('0x12')]('SquareReport,\x20%s,\x20%s',_0x4b5526,_0x2beb26);_0x5c4a64(_0x2beb26);});});}exports[_0xeb92('0x18')]=function(_0x24d172){var _0x58baef=this;return new Promise(function(_0x31cd61,_0x4ad8f1){return db['SquareReport'][_0xeb92('0x19')](_0x24d172['body'],{'raw':_0x24d172[_0xeb92('0x1a')]?_0x24d172[_0xeb92('0x1a')][_0xeb92('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5efe5d){logger[_0xeb92('0xd')](_0xeb92('0x18'),_0x24d172);logger[_0xeb92('0xf')](_0xeb92('0x18'),_0x24d172,JSON[_0xeb92('0x11')](_0x5efe5d));_0x31cd61(_0x5efe5d);})[_0xeb92('0x17')](function(_0x1909e0){logger[_0xeb92('0x12')]('CreateSquareReport',_0x1909e0['message'],_0x24d172);_0x4ad8f1(_0x58baef[_0xeb92('0x12')](0x1f4,_0x1909e0[_0xeb92('0x14')]));});});};exports[_0xeb92('0x1c')]=function(_0x539927){var _0x128517=this;return new Promise(function(_0x3f1d0e,_0x54b81c){return db[_0xeb92('0x1d')][_0xeb92('0x1e')](_0x539927[_0xeb92('0x1f')],{'raw':_0x539927['options']?_0x539927[_0xeb92('0x1a')][_0xeb92('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x539927[_0xeb92('0x1a')]?_0x539927['options'][_0xeb92('0x20')]||null:null,'attributes':_0x539927[_0xeb92('0x1a')]?_0x539927[_0xeb92('0x1a')][_0xeb92('0x21')]||null:null,'limit':_0x539927['options']?_0x539927['options'][_0xeb92('0x22')]||null:null})[_0xeb92('0xc')](function(_0x15cca2){logger['info'](_0xeb92('0x1c'),_0x539927);logger[_0xeb92('0xf')](_0xeb92('0x1c'),_0x539927,JSON['stringify'](_0x15cca2));_0x3f1d0e(_0x15cca2);})[_0xeb92('0x17')](function(_0x618d42){logger['error'](_0xeb92('0x1c'),_0x618d42[_0xeb92('0x14')],_0x539927);_0x54b81c(_0x128517['error'](0x1f4,_0x618d42[_0xeb92('0x14')]));});});};