b9eb51230c12f0b36f6c68e4b0937035ab1aed4a
[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 _0x00b3=['request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x293340,_0x44d592){var _0x3b34f4=function(_0x7227ae){while(--_0x7227ae){_0x293340['push'](_0x293340['shift']());}};_0x3b34f4(++_0x44d592);}(_0x00b3,0x97));var _0x300b=function(_0x19318f,_0x38b0cb){_0x19318f=_0x19318f-0x0;var _0x54a793=_0x00b3[_0x19318f];return _0x54a793;};'use strict';var _=require(_0x300b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x300b('0x1'));var rs=require(_0x300b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x3'));var logger=require(_0x300b('0x4'))(_0x300b('0x5'));var config=require('../../config/environment');var jayson=require(_0x300b('0x6'));var client=jayson[_0x300b('0x7')][_0x300b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4294fe,_0x643a7b,_0x2cf1c5){return new BPromise(function(_0x103922,_0xcd2a68){return client[_0x300b('0x9')](_0x4294fe,_0x2cf1c5)[_0x300b('0xa')](function(_0x1b9048){logger[_0x300b('0xb')](_0x300b('0xc'),_0x643a7b,'request\x20sent');logger[_0x300b('0xd')](_0x300b('0xe'),_0x643a7b,_0x300b('0xf'),JSON['stringify'](_0x1b9048));if(_0x1b9048[_0x300b('0x10')]){if(_0x1b9048[_0x300b('0x10')]['code']===0x1f4){logger['error'](_0x300b('0xc'),_0x643a7b,_0x1b9048['error'][_0x300b('0x11')]);return _0xcd2a68(_0x1b9048[_0x300b('0x10')][_0x300b('0x11')]);}logger[_0x300b('0x10')](_0x300b('0xc'),_0x643a7b,_0x1b9048[_0x300b('0x10')]['message']);return _0x103922(_0x1b9048['error'][_0x300b('0x11')]);}else{logger[_0x300b('0xb')](_0x300b('0xc'),_0x643a7b,_0x300b('0xf'));_0x103922(_0x1b9048[_0x300b('0x12')][_0x300b('0x11')]);}})[_0x300b('0x13')](function(_0x3e1dbd){logger['error'](_0x300b('0xc'),_0x643a7b,_0x3e1dbd);_0xcd2a68(_0x3e1dbd);});});}