04d7fd47b2bac0ca367472e61b30d6d5a2e99aba
[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 _0xd238=['debug','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent'];(function(_0x7c7662,_0x3f0ef6){var _0x99250c=function(_0x68f47a){while(--_0x68f47a){_0x7c7662['push'](_0x7c7662['shift']());}};_0x99250c(++_0x3f0ef6);}(_0xd238,0x106));var _0x8d23=function(_0x37b530,_0x15be84){_0x37b530=_0x37b530-0x0;var _0x551028=_0xd238[_0x37b530];return _0x551028;};'use strict';var _=require(_0x8d23('0x0'));var util=require('util');var moment=require(_0x8d23('0x1'));var BPromise=require(_0x8d23('0x2'));var rs=require(_0x8d23('0x3'));var fs=require('fs');var Redis=require(_0x8d23('0x4'));var db=require(_0x8d23('0x5'))['db'];var utils=require(_0x8d23('0x6'));var logger=require(_0x8d23('0x7'))(_0x8d23('0x8'));var config=require(_0x8d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d23('0xa')][_0x8d23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a037c,_0x49f271,_0x11f651){return new BPromise(function(_0x9c4295,_0x3289c1){return client[_0x8d23('0xc')](_0x3a037c,_0x11f651)['then'](function(_0x29138e){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x49f271,_0x8d23('0xd'));logger[_0x8d23('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x49f271,'request\x20sent',JSON[_0x8d23('0xf')](_0x29138e));if(_0x29138e[_0x8d23('0x10')]){if(_0x29138e[_0x8d23('0x10')][_0x8d23('0x11')]===0x1f4){logger[_0x8d23('0x10')](_0x8d23('0x12'),_0x49f271,_0x29138e['error'][_0x8d23('0x13')]);return _0x3289c1(_0x29138e[_0x8d23('0x10')]['message']);}logger[_0x8d23('0x10')](_0x8d23('0x12'),_0x49f271,_0x29138e['error'][_0x8d23('0x13')]);return _0x9c4295(_0x29138e[_0x8d23('0x10')][_0x8d23('0x13')]);}else{logger[_0x8d23('0x14')](_0x8d23('0x12'),_0x49f271,'request\x20sent');_0x9c4295(_0x29138e[_0x8d23('0x15')][_0x8d23('0x13')]);}})[_0x8d23('0x16')](function(_0x10f6ef){logger[_0x8d23('0x10')](_0x8d23('0x12'),_0x49f271,_0x10f6ef);_0x3289c1(_0x10f6ef);});});}