802af4bd0eb91ec694dce05577f53efb3fb2bc35
[motion2.git] / server / api / schedule / schedule.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 _0x40ff=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','Schedule,\x20%s,\x20%s','message'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x40ff,0x132));var _0xf40f=function(_0x1e42ff,_0xa3737f){_0x1e42ff=_0x1e42ff-0x0;var _0x1c693e=_0x40ff[_0x1e42ff];return _0x1c693e;};'use strict';var _=require(_0xf40f('0x0'));var util=require(_0xf40f('0x1'));var moment=require('moment');var BPromise=require(_0xf40f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf40f('0x3'))['db'];var utils=require(_0xf40f('0x4'));var logger=require(_0xf40f('0x5'))('rpc');var config=require(_0xf40f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf40f('0x7')][_0xf40f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x487100,_0x18621c,_0x41956d){return new BPromise(function(_0x309208,_0x4cfac1){return client[_0xf40f('0x9')](_0x487100,_0x41956d)[_0xf40f('0xa')](function(_0x22fe31){logger[_0xf40f('0xb')]('Schedule,\x20%s,\x20%s',_0x18621c,_0xf40f('0xc'));logger['debug'](_0xf40f('0xd'),_0x18621c,'request\x20sent',JSON['stringify'](_0x22fe31));if(_0x22fe31['error']){if(_0x22fe31[_0xf40f('0xe')]['code']===0x1f4){logger['error'](_0xf40f('0xf'),_0x18621c,_0x22fe31[_0xf40f('0xe')][_0xf40f('0x10')]);return _0x4cfac1(_0x22fe31['error'][_0xf40f('0x10')]);}logger['error'](_0xf40f('0xf'),_0x18621c,_0x22fe31[_0xf40f('0xe')][_0xf40f('0x10')]);return _0x309208(_0x22fe31[_0xf40f('0xe')]['message']);}else{logger[_0xf40f('0xb')](_0xf40f('0xf'),_0x18621c,'request\x20sent');_0x309208(_0x22fe31[_0xf40f('0x11')]['message']);}})[_0xf40f('0x12')](function(_0x365d17){logger[_0xf40f('0xe')](_0xf40f('0xf'),_0x18621c,_0x365d17);_0x4cfac1(_0x365d17);});});}