Built motion from commit 3a7e82ea.|2.6.29
[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 _0x49f8=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','then','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info'];(function(_0x3c4087,_0x5c764b){var _0x23ad1f=function(_0x39bf1c){while(--_0x39bf1c){_0x3c4087['push'](_0x3c4087['shift']());}};_0x23ad1f(++_0x5c764b);}(_0x49f8,0xff));var _0x849f=function(_0x487933,_0x77076d){_0x487933=_0x487933-0x0;var _0x741518=_0x49f8[_0x487933];return _0x741518;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});};