Built motion from commit (unavailable).|2.5.24
[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 _0x58e3=['jayson/promise','client','http','then','debug','request\x20sent','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x1fcc7d,_0x4eb620){var _0x3daa39=function(_0x2b90f9){while(--_0x2b90f9){_0x1fcc7d['push'](_0x1fcc7d['shift']());}};_0x3daa39(++_0x4eb620);}(_0x58e3,0xa4));var _0x358e=function(_0x16972f,_0x24951d){_0x16972f=_0x16972f-0x0;var _0x3e2509=_0x58e3[_0x16972f];return _0x3e2509;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x358e('0x0'));var BPromise=require(_0x358e('0x1'));var rs=require(_0x358e('0x2'));var fs=require('fs');var Redis=require(_0x358e('0x3'));var db=require(_0x358e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x358e('0x5'))('rpc');var config=require(_0x358e('0x6'));var jayson=require(_0x358e('0x7'));var client=jayson[_0x358e('0x8')][_0x358e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a8db1,_0x2c458d,_0x498a1f){return new BPromise(function(_0xa603ac,_0x4fd820){return client['request'](_0x1a8db1,_0x498a1f)[_0x358e('0xa')](function(_0x2f9570){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2c458d,'request\x20sent');logger[_0x358e('0xb')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2c458d,_0x358e('0xc'),JSON[_0x358e('0xd')](_0x2f9570));if(_0x2f9570['error']){if(_0x2f9570[_0x358e('0xe')]['code']===0x1f4){logger[_0x358e('0xe')](_0x358e('0xf'),_0x2c458d,_0x2f9570[_0x358e('0xe')]['message']);return _0x4fd820(_0x2f9570[_0x358e('0xe')][_0x358e('0x10')]);}logger[_0x358e('0xe')](_0x358e('0xf'),_0x2c458d,_0x2f9570['error'][_0x358e('0x10')]);return _0xa603ac(_0x2f9570[_0x358e('0xe')][_0x358e('0x10')]);}else{logger[_0x358e('0x11')](_0x358e('0xf'),_0x2c458d,_0x358e('0xc'));_0xa603ac(_0x2f9570[_0x358e('0x12')]['message']);}})['catch'](function(_0x26efb5){logger[_0x358e('0xe')](_0x358e('0xf'),_0x2c458d,_0x26efb5);_0x4fd820(_0x26efb5);});});}