Built motion from commit 1fa89557.|2.6.10
[motion2.git] / server / api / userWhatsappQueue / userWhatsappQueue.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 _0xf134=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3249ab,_0x53459d){var _0x2eddfc=function(_0x413c83){while(--_0x413c83){_0x3249ab['push'](_0x3249ab['shift']());}};_0x2eddfc(++_0x53459d);}(_0xf134,0x12e));var _0x4f13=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xf134[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x4f13('0x0'));var util=require(_0x4f13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f13('0x2'));var db=require(_0x4f13('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f13('0x4'))(_0x4f13('0x5'));var config=require(_0x4f13('0x6'));var jayson=require(_0x4f13('0x7'));var client=jayson[_0x4f13('0x8')][_0x4f13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47f304,_0x42280e,_0x154c97){return new BPromise(function(_0x45b743,_0x2f9f67){return client[_0x4f13('0xa')](_0x47f304,_0x154c97)[_0x4f13('0xb')](function(_0x3e3625){logger[_0x4f13('0xc')](_0x4f13('0xd'),_0x42280e,_0x4f13('0xe'));logger['debug'](_0x4f13('0xf'),_0x42280e,'request\x20sent',JSON[_0x4f13('0x10')](_0x3e3625));if(_0x3e3625[_0x4f13('0x11')]){if(_0x3e3625[_0x4f13('0x11')][_0x4f13('0x12')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x42280e,_0x3e3625[_0x4f13('0x11')]['message']);return _0x2f9f67(_0x3e3625[_0x4f13('0x11')][_0x4f13('0x13')]);}logger['error'](_0x4f13('0xd'),_0x42280e,_0x3e3625[_0x4f13('0x11')][_0x4f13('0x13')]);return _0x45b743(_0x3e3625[_0x4f13('0x11')][_0x4f13('0x13')]);}else{logger['info'](_0x4f13('0xd'),_0x42280e,'request\x20sent');_0x45b743(_0x3e3625[_0x4f13('0x14')][_0x4f13('0x13')]);}})['catch'](function(_0x4fadbd){logger[_0x4f13('0x11')](_0x4f13('0xd'),_0x42280e,_0x4fadbd);_0x2f9f67(_0x4fadbd);});});}