4baa0899a56130cd152a1b71204600d4cc2c4885
[motion2.git] / server / api / faxTransferReport / faxTransferReport.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 _0x1cd7=['bluebird','randomstring','rpc','../../config/environment','client','http','then','FaxTransferReport,\x20%s,\x20%s','debug','error','message','info','result','catch','util'];(function(_0xe10326,_0x5a8de6){var _0x433c15=function(_0x532385){while(--_0x532385){_0xe10326['push'](_0xe10326['shift']());}};_0x433c15(++_0x5a8de6);}(_0x1cd7,0x158));var _0x71cd=function(_0x383c15,_0x4b75c2){_0x383c15=_0x383c15-0x0;var _0x5d1345=_0x1cd7[_0x383c15];return _0x5d1345;};'use strict';var _=require('lodash');var util=require(_0x71cd('0x0'));var moment=require('moment');var BPromise=require(_0x71cd('0x1'));var rs=require(_0x71cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x71cd('0x3'));var config=require(_0x71cd('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x71cd('0x5')][_0x71cd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x116d7a,_0x3cc3c0,_0x38ee62){return new BPromise(function(_0x3322c6,_0x22ac78){return client['request'](_0x116d7a,_0x38ee62)[_0x71cd('0x7')](function(_0x28097c){logger['info'](_0x71cd('0x8'),_0x3cc3c0,'request\x20sent');logger[_0x71cd('0x9')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3cc3c0,'request\x20sent',JSON['stringify'](_0x28097c));if(_0x28097c[_0x71cd('0xa')]){if(_0x28097c['error']['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x3cc3c0,_0x28097c[_0x71cd('0xa')]['message']);return _0x22ac78(_0x28097c[_0x71cd('0xa')][_0x71cd('0xb')]);}logger['error'](_0x71cd('0x8'),_0x3cc3c0,_0x28097c[_0x71cd('0xa')]['message']);return _0x3322c6(_0x28097c[_0x71cd('0xa')][_0x71cd('0xb')]);}else{logger[_0x71cd('0xc')](_0x71cd('0x8'),_0x3cc3c0,'request\x20sent');_0x3322c6(_0x28097c[_0x71cd('0xd')][_0x71cd('0xb')]);}})[_0x71cd('0xe')](function(_0xd46b54){logger['error'](_0x71cd('0x8'),_0x3cc3c0,_0xd46b54);_0x22ac78(_0xd46b54);});});}