1bcc383fd81db80cad0fe9c483c86328e13de741
[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 _0xa468=['moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util'];(function(_0x4994be,_0x20f185){var _0x25029b=function(_0x516be6){while(--_0x516be6){_0x4994be['push'](_0x4994be['shift']());}};_0x25029b(++_0x20f185);}(_0xa468,0x9f));var _0x8a46=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa468[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0x8a46('0x0'));var moment=require(_0x8a46('0x1'));var BPromise=require(_0x8a46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a46('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a46('0x4'))('rpc');var config=require(_0x8a46('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8a46('0x6')][_0x8a46('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e8878,_0x32e678,_0x3b7cb1){return new BPromise(function(_0x55d7cb,_0x43d0c8){return client[_0x8a46('0x8')](_0x1e8878,_0x3b7cb1)[_0x8a46('0x9')](function(_0x275f13){logger[_0x8a46('0xa')](_0x8a46('0xb'),_0x32e678,'request\x20sent');logger[_0x8a46('0xc')](_0x8a46('0xd'),_0x32e678,_0x8a46('0xe'),JSON[_0x8a46('0xf')](_0x275f13));if(_0x275f13[_0x8a46('0x10')]){if(_0x275f13[_0x8a46('0x10')][_0x8a46('0x11')]===0x1f4){logger[_0x8a46('0x10')](_0x8a46('0xb'),_0x32e678,_0x275f13['error'][_0x8a46('0x12')]);return _0x43d0c8(_0x275f13[_0x8a46('0x10')]['message']);}logger[_0x8a46('0x10')](_0x8a46('0xb'),_0x32e678,_0x275f13['error'][_0x8a46('0x12')]);return _0x55d7cb(_0x275f13[_0x8a46('0x10')][_0x8a46('0x12')]);}else{logger[_0x8a46('0xa')](_0x8a46('0xb'),_0x32e678,_0x8a46('0xe'));_0x55d7cb(_0x275f13['result'][_0x8a46('0x12')]);}})[_0x8a46('0x13')](function(_0x501c8c){logger[_0x8a46('0x10')](_0x8a46('0xb'),_0x32e678,_0x501c8c);_0x43d0c8(_0x501c8c);});});}