Built motion from commit 616d3211.|2.6.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 _0x90af=['where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update'];(function(_0x56e969,_0x2ed835){var _0x6577af=function(_0x171b9e){while(--_0x171b9e){_0x56e969['push'](_0x56e969['shift']());}};_0x6577af(++_0x2ed835);}(_0x90af,0xb2));var _0xf90a=function(_0x38d241,_0x31da02){_0x38d241=_0x38d241-0x0;var _0x4a5a1c=_0x90af[_0x38d241];return _0x4a5a1c;};'use strict';var _=require('lodash');var util=require(_0xf90a('0x0'));var moment=require(_0xf90a('0x1'));var BPromise=require(_0xf90a('0x2'));var rs=require(_0xf90a('0x3'));var fs=require('fs');var Redis=require(_0xf90a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf90a('0x5'));var logger=require(_0xf90a('0x6'))(_0xf90a('0x7'));var config=require(_0xf90a('0x8'));var jayson=require(_0xf90a('0x9'));var client=jayson[_0xf90a('0xa')][_0xf90a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x390327,_0x51d49b,_0x271cd8){return new BPromise(function(_0x14fde4,_0x6651b8){return client[_0xf90a('0xc')](_0x390327,_0x271cd8)[_0xf90a('0xd')](function(_0x273051){logger[_0xf90a('0xe')](_0xf90a('0xf'),_0x51d49b,_0xf90a('0x10'));logger[_0xf90a('0x11')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x51d49b,_0xf90a('0x10'),JSON[_0xf90a('0x12')](_0x273051));if(_0x273051[_0xf90a('0x13')]){if(_0x273051['error'][_0xf90a('0x14')]===0x1f4){logger[_0xf90a('0x13')](_0xf90a('0xf'),_0x51d49b,_0x273051[_0xf90a('0x13')]['message']);return _0x6651b8(_0x273051[_0xf90a('0x13')][_0xf90a('0x15')]);}logger[_0xf90a('0x13')](_0xf90a('0xf'),_0x51d49b,_0x273051[_0xf90a('0x13')][_0xf90a('0x15')]);return _0x14fde4(_0x273051[_0xf90a('0x13')][_0xf90a('0x15')]);}else{logger['info'](_0xf90a('0xf'),_0x51d49b,_0xf90a('0x10'));_0x14fde4(_0x273051[_0xf90a('0x16')]['message']);}})[_0xf90a('0x17')](function(_0x341cf0){logger[_0xf90a('0x13')](_0xf90a('0xf'),_0x51d49b,_0x341cf0);_0x6651b8(_0x341cf0);});});}exports[_0xf90a('0x18')]=function(_0x347d93){var _0x442c16=this;return new Promise(function(_0x9208e4,_0x1d0005){return db[_0xf90a('0x19')][_0xf90a('0x1a')](_0x347d93[_0xf90a('0x1b')],{'raw':_0x347d93['options']?_0x347d93[_0xf90a('0x1c')][_0xf90a('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x57fcd8){logger[_0xf90a('0xe')](_0xf90a('0x18'),_0x347d93);logger[_0xf90a('0x11')]('CreateSquareReport',_0x347d93,JSON['stringify'](_0x57fcd8));_0x9208e4(_0x57fcd8);})[_0xf90a('0x17')](function(_0x297d6a){logger[_0xf90a('0x13')]('CreateSquareReport',_0x297d6a['message'],_0x347d93);_0x1d0005(_0x442c16[_0xf90a('0x13')](0x1f4,_0x297d6a[_0xf90a('0x15')]));});});};exports[_0xf90a('0x1e')]=function(_0x949709){var _0x4e2f05=this;return new Promise(function(_0x278e6e,_0x56ff5f){return db[_0xf90a('0x19')][_0xf90a('0x1f')](_0x949709[_0xf90a('0x1b')],{'raw':_0x949709[_0xf90a('0x1c')]?_0x949709[_0xf90a('0x1c')][_0xf90a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x949709[_0xf90a('0x1c')]?_0x949709[_0xf90a('0x1c')][_0xf90a('0x20')]||null:null,'attributes':_0x949709[_0xf90a('0x1c')]?_0x949709[_0xf90a('0x1c')][_0xf90a('0x21')]||null:null,'limit':_0x949709['options']?_0x949709[_0xf90a('0x1c')][_0xf90a('0x22')]||null:null})['then'](function(_0x6af7de){logger[_0xf90a('0xe')](_0xf90a('0x1e'),_0x949709);logger[_0xf90a('0x11')](_0xf90a('0x1e'),_0x949709,JSON['stringify'](_0x6af7de));_0x278e6e(_0x6af7de);})[_0xf90a('0x17')](function(_0x1e4d86){logger[_0xf90a('0x13')](_0xf90a('0x1e'),_0x1e4d86[_0xf90a('0x15')],_0x949709);_0x56ff5f(_0x4e2f05['error'](0x1f4,_0x1e4d86[_0xf90a('0x15')]));});});};