b0b10b99c66e18ef6bd175193c6ca42a72f6e535
[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 _0xaae9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x478c37,_0x2c5f5f){var _0x2cf7c8=function(_0x57e334){while(--_0x57e334){_0x478c37['push'](_0x478c37['shift']());}};_0x2cf7c8(++_0x2c5f5f);}(_0xaae9,0x18e));var _0x9aae=function(_0x331f1a,_0xf1e493){_0x331f1a=_0x331f1a-0x0;var _0x5f4632=_0xaae9[_0x331f1a];return _0x5f4632;};'use strict';var _=require(_0x9aae('0x0'));var util=require(_0x9aae('0x1'));var moment=require(_0x9aae('0x2'));var BPromise=require(_0x9aae('0x3'));var rs=require(_0x9aae('0x4'));var fs=require('fs');var Redis=require(_0x9aae('0x5'));var db=require(_0x9aae('0x6'))['db'];var utils=require(_0x9aae('0x7'));var logger=require(_0x9aae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9aae('0x9')][_0x9aae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77a20b,_0x182c66,_0x1f843b){return new BPromise(function(_0x431de2,_0x324746){return client['request'](_0x77a20b,_0x1f843b)[_0x9aae('0xb')](function(_0xbd3f4d){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x182c66,_0x9aae('0xc'));logger['debug'](_0x9aae('0xd'),_0x182c66,'request\x20sent',JSON[_0x9aae('0xe')](_0xbd3f4d));if(_0xbd3f4d[_0x9aae('0xf')]){if(_0xbd3f4d[_0x9aae('0xf')]['code']===0x1f4){logger[_0x9aae('0xf')](_0x9aae('0x10'),_0x182c66,_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);return _0x324746(_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);}logger['error'](_0x9aae('0x10'),_0x182c66,_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);return _0x431de2(_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);}else{logger[_0x9aae('0x12')](_0x9aae('0x10'),_0x182c66,_0x9aae('0xc'));_0x431de2(_0xbd3f4d['result'][_0x9aae('0x11')]);}})[_0x9aae('0x13')](function(_0x1ad285){logger[_0x9aae('0xf')](_0x9aae('0x10'),_0x182c66,_0x1ad285);_0x324746(_0x1ad285);});});}