12d02a546256b22be769cc00891b7d403992e1d0
[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 _0x323f=['stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x323f,0x1b3));var _0xf323=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x323f[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf323('0x0'));var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf323('0x4'))(_0xf323('0x5'));var config=require(_0xf323('0x6'));var jayson=require(_0xf323('0x7'));var client=jayson[_0xf323('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41b141,_0x73ef2c,_0x2eb595){return new BPromise(function(_0x56f447,_0x1f3417){return client[_0xf323('0x9')](_0x41b141,_0x2eb595)[_0xf323('0xa')](function(_0x3919fd){logger[_0xf323('0xb')](_0xf323('0xc'),_0x73ef2c,_0xf323('0xd'));logger[_0xf323('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x73ef2c,_0xf323('0xd'),JSON[_0xf323('0xf')](_0x3919fd));if(_0x3919fd[_0xf323('0x10')]){if(_0x3919fd['error']['code']===0x1f4){logger['error'](_0xf323('0xc'),_0x73ef2c,_0x3919fd[_0xf323('0x10')][_0xf323('0x11')]);return _0x1f3417(_0x3919fd[_0xf323('0x10')][_0xf323('0x11')]);}logger['error'](_0xf323('0xc'),_0x73ef2c,_0x3919fd[_0xf323('0x10')]['message']);return _0x56f447(_0x3919fd[_0xf323('0x10')][_0xf323('0x11')]);}else{logger[_0xf323('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x73ef2c,_0xf323('0xd'));_0x56f447(_0x3919fd[_0xf323('0x12')][_0xf323('0x11')]);}})[_0xf323('0x13')](function(_0x27d9e0){logger['error'](_0xf323('0xc'),_0x73ef2c,_0x27d9e0);_0x1f3417(_0x27d9e0);});});}exports[_0xf323('0x14')]=function(_0x8acf59){var _0x56bf27=this;return new Promise(function(_0x4b49de,_0x29aef8){return db[_0xf323('0x15')]['create'](_0x8acf59[_0xf323('0x16')],{'raw':_0x8acf59[_0xf323('0x17')]?_0x8acf59[_0xf323('0x17')][_0xf323('0x18')]===undefined?!![]:![]:!![]})[_0xf323('0xa')](function(_0xfd47b6){logger[_0xf323('0xb')](_0xf323('0x14'),_0x8acf59);logger[_0xf323('0xe')]('CreateSquareDetailsReport',_0x8acf59,JSON['stringify'](_0xfd47b6));_0x4b49de(_0xfd47b6);})[_0xf323('0x13')](function(_0x533cf1){logger['error']('CreateSquareDetailsReport',_0x533cf1[_0xf323('0x11')],_0x8acf59);_0x29aef8(_0x56bf27[_0xf323('0x10')](0x1f4,_0x533cf1[_0xf323('0x11')]));});});};