Built motion from commit 85328c08.|2.5.50
[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 _0x62d3=['http','request','then','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x406f30,_0x404e0d){var _0x4a5872=function(_0x19e743){while(--_0x19e743){_0x406f30['push'](_0x406f30['shift']());}};_0x4a5872(++_0x404e0d);}(_0x62d3,0x174));var _0x362d=function(_0xd156e0,_0x4d9132){_0xd156e0=_0xd156e0-0x0;var _0x5daa77=_0x62d3[_0xd156e0];return _0x5daa77;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x362d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x362d('0x1'));var db=require(_0x362d('0x2'))['db'];var utils=require(_0x362d('0x3'));var logger=require(_0x362d('0x4'))(_0x362d('0x5'));var config=require('../../config/environment');var jayson=require(_0x362d('0x6'));var client=jayson[_0x362d('0x7')][_0x362d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41e2b5,_0x250b21,_0x557567){return new BPromise(function(_0xb5f59b,_0x1e8e2c){return client[_0x362d('0x9')](_0x41e2b5,_0x557567)[_0x362d('0xa')](function(_0x213964){logger['info'](_0x362d('0xb'),_0x250b21,'request\x20sent');logger[_0x362d('0xc')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x250b21,_0x362d('0xd'),JSON[_0x362d('0xe')](_0x213964));if(_0x213964[_0x362d('0xf')]){if(_0x213964['error']['code']===0x1f4){logger[_0x362d('0xf')](_0x362d('0xb'),_0x250b21,_0x213964[_0x362d('0xf')][_0x362d('0x10')]);return _0x1e8e2c(_0x213964[_0x362d('0xf')][_0x362d('0x10')]);}logger[_0x362d('0xf')](_0x362d('0xb'),_0x250b21,_0x213964['error'][_0x362d('0x10')]);return _0xb5f59b(_0x213964[_0x362d('0xf')][_0x362d('0x10')]);}else{logger[_0x362d('0x11')](_0x362d('0xb'),_0x250b21,_0x362d('0xd'));_0xb5f59b(_0x213964[_0x362d('0x12')][_0x362d('0x10')]);}})['catch'](function(_0x518236){logger[_0x362d('0xf')](_0x362d('0xb'),_0x250b21,_0x518236);_0x1e8e2c(_0x518236);});});}