00734252b1d2368fa6e79eba5eb53346bc7f921e
[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 _0x4ccc=['client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x12818c,_0x2f769a){var _0x495f81=function(_0x4a6f16){while(--_0x4a6f16){_0x12818c['push'](_0x12818c['shift']());}};_0x495f81(++_0x2f769a);}(_0x4ccc,0x18a));var _0xc4cc=function(_0x477d2b,_0x22ac8b){_0x477d2b=_0x477d2b-0x0;var _0x199420=_0x4ccc[_0x477d2b];return _0x199420;};'use strict';var _=require('lodash');var util=require(_0xc4cc('0x0'));var moment=require('moment');var BPromise=require(_0xc4cc('0x1'));var rs=require(_0xc4cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4cc('0x3'))['db'];var utils=require(_0xc4cc('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc4cc('0x5')][_0xc4cc('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3f05be,_0x288b8c,_0x4e63cf){return new BPromise(function(_0x57cfb4,_0x5eb80e){return client[_0xc4cc('0x7')](_0x3f05be,_0x4e63cf)[_0xc4cc('0x8')](function(_0x5b9e75){logger['info'](_0xc4cc('0x9'),_0x288b8c,_0xc4cc('0xa'));logger[_0xc4cc('0xb')](_0xc4cc('0xc'),_0x288b8c,_0xc4cc('0xa'),JSON['stringify'](_0x5b9e75));if(_0x5b9e75[_0xc4cc('0xd')]){if(_0x5b9e75['error'][_0xc4cc('0xe')]===0x1f4){logger[_0xc4cc('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x288b8c,_0x5b9e75[_0xc4cc('0xd')][_0xc4cc('0xf')]);return _0x5eb80e(_0x5b9e75[_0xc4cc('0xd')][_0xc4cc('0xf')]);}logger['error'](_0xc4cc('0x9'),_0x288b8c,_0x5b9e75['error']['message']);return _0x57cfb4(_0x5b9e75[_0xc4cc('0xd')][_0xc4cc('0xf')]);}else{logger[_0xc4cc('0x10')](_0xc4cc('0x9'),_0x288b8c,_0xc4cc('0xa'));_0x57cfb4(_0x5b9e75[_0xc4cc('0x11')]['message']);}})[_0xc4cc('0x12')](function(_0x13f1ba){logger[_0xc4cc('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x288b8c,_0x13f1ba);_0x5eb80e(_0x13f1ba);});});}