a57ada47bc8e67a84189b98fe381f8045fb8d7c9
[motion2.git] / server / api / whatsappTransferReport / whatsappTransferReport.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 _0xdd5e=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x17c1d5,_0x150c20){var _0x1c9e4c=function(_0xca9c17){while(--_0xca9c17){_0x17c1d5['push'](_0x17c1d5['shift']());}};_0x1c9e4c(++_0x150c20);}(_0xdd5e,0x127));var _0xedd5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xdd5e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0xedd5('0x0'));var moment=require(_0xedd5('0x1'));var BPromise=require(_0xedd5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedd5('0x3'));var db=require(_0xedd5('0x4'))['db'];var utils=require(_0xedd5('0x5'));var logger=require('../../config/logger')(_0xedd5('0x6'));var config=require(_0xedd5('0x7'));var jayson=require(_0xedd5('0x8'));var client=jayson[_0xedd5('0x9')][_0xedd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc43c,_0x4d7607,_0x13f3c3){return new BPromise(function(_0x202832,_0x217992){return client['request'](_0x1dc43c,_0x13f3c3)[_0xedd5('0xb')](function(_0x54c662){logger[_0xedd5('0xc')](_0xedd5('0xd'),_0x4d7607,_0xedd5('0xe'));logger[_0xedd5('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4d7607,_0xedd5('0xe'),JSON[_0xedd5('0x10')](_0x54c662));if(_0x54c662['error']){if(_0x54c662['error'][_0xedd5('0x11')]===0x1f4){logger[_0xedd5('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4d7607,_0x54c662[_0xedd5('0x12')]['message']);return _0x217992(_0x54c662[_0xedd5('0x12')][_0xedd5('0x13')]);}logger[_0xedd5('0x12')](_0xedd5('0xd'),_0x4d7607,_0x54c662[_0xedd5('0x12')][_0xedd5('0x13')]);return _0x202832(_0x54c662[_0xedd5('0x12')][_0xedd5('0x13')]);}else{logger[_0xedd5('0xc')](_0xedd5('0xd'),_0x4d7607,_0xedd5('0xe'));_0x202832(_0x54c662['result'][_0xedd5('0x13')]);}})['catch'](function(_0x5ec79d){logger[_0xedd5('0x12')](_0xedd5('0xd'),_0x4d7607,_0x5ec79d);_0x217992(_0x5ec79d);});});}