d7fb0ed97347931d8ac1e37e9ba7123bdf41bbce
[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 _0x70e9=['error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x28c52d,_0x4e870b){var _0x5d285c=function(_0x57c342){while(--_0x57c342){_0x28c52d['push'](_0x28c52d['shift']());}};_0x5d285c(++_0x4e870b);}(_0x70e9,0x193));var _0x970e=function(_0x3640e3,_0x5031a0){_0x3640e3=_0x3640e3-0x0;var _0x471398=_0x70e9[_0x3640e3];return _0x471398;};'use strict';var _=require('lodash');var util=require(_0x970e('0x0'));var moment=require(_0x970e('0x1'));var BPromise=require('bluebird');var rs=require(_0x970e('0x2'));var fs=require('fs');var Redis=require(_0x970e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x970e('0x4'));var logger=require('../../config/logger')(_0x970e('0x5'));var config=require(_0x970e('0x6'));var jayson=require(_0x970e('0x7'));var client=jayson[_0x970e('0x8')][_0x970e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x303190,_0x1e5701,_0x508324){return new BPromise(function(_0x50cab9,_0x388bf7){return client[_0x970e('0xa')](_0x303190,_0x508324)['then'](function(_0x38c7a0){logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,'request\x20sent');logger[_0x970e('0xd')](_0x970e('0xe'),_0x1e5701,_0x970e('0xf'),JSON[_0x970e('0x10')](_0x38c7a0));if(_0x38c7a0[_0x970e('0x11')]){if(_0x38c7a0[_0x970e('0x11')]['code']===0x1f4){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);return _0x388bf7(_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);}logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0['error'][_0x970e('0x12')]);return _0x50cab9(_0x38c7a0[_0x970e('0x11')]['message']);}else{logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,_0x970e('0xf'));_0x50cab9(_0x38c7a0[_0x970e('0x13')]['message']);}})[_0x970e('0x14')](function(_0x2ec7f5){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x2ec7f5);_0x388bf7(_0x2ec7f5);});});}