2040eb025fd382a3812762ef61964deed40ff5ea
[motion2.git] / server / api / UserWhatsappInteraction / UserWhatsappInteraction.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 _0x74ac=['request\x20sent','error','message','result','catch','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s'];(function(_0x4abfcd,_0x346eb7){var _0xb01833=function(_0x258c3f){while(--_0x258c3f){_0x4abfcd['push'](_0x4abfcd['shift']());}};_0xb01833(++_0x346eb7);}(_0x74ac,0x105));var _0xc74a=function(_0xf5fafb,_0xdc4ceb){_0xf5fafb=_0xf5fafb-0x0;var _0x35f5a7=_0x74ac[_0xf5fafb];return _0x35f5a7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc74a('0x0'));var db=require(_0xc74a('0x1'))['db'];var utils=require(_0xc74a('0x2'));var logger=require('../../config/logger')(_0xc74a('0x3'));var config=require(_0xc74a('0x4'));var jayson=require(_0xc74a('0x5'));var client=jayson['client'][_0xc74a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x7452d6,_0x46e80a,_0x2541f4){return new BPromise(function(_0x291899,_0xfc3454){return client[_0xc74a('0x7')](_0x7452d6,_0x2541f4)[_0xc74a('0x8')](function(_0x329c26){logger[_0xc74a('0x9')](_0xc74a('0xa'),_0x46e80a,_0xc74a('0xb'));logger['debug']('UserWhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x46e80a,_0xc74a('0xb'),JSON['stringify'](_0x329c26));if(_0x329c26[_0xc74a('0xc')]){if(_0x329c26[_0xc74a('0xc')]['code']===0x1f4){logger[_0xc74a('0xc')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x46e80a,_0x329c26[_0xc74a('0xc')]['message']);return _0xfc3454(_0x329c26[_0xc74a('0xc')][_0xc74a('0xd')]);}logger[_0xc74a('0xc')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x46e80a,_0x329c26['error'][_0xc74a('0xd')]);return _0x291899(_0x329c26[_0xc74a('0xc')][_0xc74a('0xd')]);}else{logger[_0xc74a('0x9')](_0xc74a('0xa'),_0x46e80a,_0xc74a('0xb'));_0x291899(_0x329c26[_0xc74a('0xe')][_0xc74a('0xd')]);}})[_0xc74a('0xf')](function(_0x428981){logger[_0xc74a('0xc')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x46e80a,_0x428981);_0xfc3454(_0x428981);});});}