ae6c920f7a165aa28c8a5ad1050ef119b6c6e362
[motion2.git] / server / api / smsTransferReport / smsTransferReport.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 _0x5eb8=['info','SmsTransferReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x245801,_0x3d8556){var _0xbbe558=function(_0x112791){while(--_0x112791){_0x245801['push'](_0x245801['shift']());}};_0xbbe558(++_0x3d8556);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x152405,_0x5e8952){_0x152405=_0x152405-0x0;var _0x46647a=_0x5eb8[_0x152405];return _0x46647a;};'use strict';var _=require('lodash');var util=require(_0x85eb('0x0'));var moment=require(_0x85eb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85eb('0x2'));var db=require(_0x85eb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x85eb('0x4'))(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var jayson=require(_0x85eb('0x7'));var client=jayson['client'][_0x85eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x665c30,_0xffbb5b,_0x415299){return new BPromise(function(_0x2a5cef,_0x53f0eb){return client[_0x85eb('0x9')](_0x665c30,_0x415299)['then'](function(_0x49cfc6){logger[_0x85eb('0xa')](_0x85eb('0xb'),_0xffbb5b,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xffbb5b,'request\x20sent',JSON[_0x85eb('0xc')](_0x49cfc6));if(_0x49cfc6['error']){if(_0x49cfc6[_0x85eb('0xd')][_0x85eb('0xe')]===0x1f4){logger[_0x85eb('0xd')](_0x85eb('0xb'),_0xffbb5b,_0x49cfc6['error'][_0x85eb('0xf')]);return _0x53f0eb(_0x49cfc6[_0x85eb('0xd')]['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0xffbb5b,_0x49cfc6['error'][_0x85eb('0xf')]);return _0x2a5cef(_0x49cfc6['error']['message']);}else{logger['info'](_0x85eb('0xb'),_0xffbb5b,_0x85eb('0x10'));_0x2a5cef(_0x49cfc6[_0x85eb('0x11')]['message']);}})[_0x85eb('0x12')](function(_0x5b435c){logger[_0x85eb('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0xffbb5b,_0x5b435c);_0x53f0eb(_0x5b435c);});});}