From 9319129fe1554c286430d047656c60fe16d249d7 Mon Sep 17 00:00:00 2001 From: shreyvishal Date: Fri, 29 Mar 2024 20:53:24 +0530 Subject: [PATCH] Added:Control Certer Backend APIs --- controllers/ControlCenter.js | 7 ++++--- controllers/Notification.js | 5 +++-- utils/constants.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/controllers/ControlCenter.js b/controllers/ControlCenter.js index 5e5a8ed..5582af6 100644 --- a/controllers/ControlCenter.js +++ b/controllers/ControlCenter.js @@ -9,9 +9,10 @@ import { } from '../utils/constants.js' const action = new Actions() const TOURISM_STRAPI_URL = process.env.TOURISM_STRAPI_URL || '' +const TWILIO_RECEPIENT_NUMBER = process.env.TOURISM_STRAPI_URL export const cancelBookingController = async (req, res) => { try { - const { recipientNumber, messageBody, orderId } = req.body + const { messageBody, orderId } = req.body console.log(orderId) const getOrderFulfillmentDetails = await axios.get( `${TOURISM_STRAPI_URL}/order-fulfillments?order_id=${orderId}`, @@ -37,7 +38,7 @@ export const cancelBookingController = async (req, res) => { } ) - await action.send_message(recipientNumber, messageBody) + await action.send_message(TWILIO_RECEPIENT_NUMBER, messageBody) return res.send({ message: 'Notified' }) } @@ -64,7 +65,7 @@ export const updateCatalog = async (req, res) => { }, } ) - + await action.send_message(TWILIO_RECEPIENT_NUMBER, messageBody) return res.send({ message: 'Catalog Updated' }) } catch (error) { logger.error(error.message) diff --git a/controllers/Notification.js b/controllers/Notification.js index a57c29b..66fb16d 100644 --- a/controllers/Notification.js +++ b/controllers/Notification.js @@ -1,11 +1,12 @@ import Actions from '../services/Actions.js' import logger from '../utils/logger.js' const action = new Actions() +const TWILIO_RECEPIENT_NUMBER = process.env.TOURISM_STRAPI_URL export const notificationController = async (req, res) => { try { - const { recipientNumber, messageBody } = req.body + const { messageBody } = req.body const sendWhatsappNotificationResponse = await action.send_message( - recipientNumber, + TWILIO_RECEPIENT_NUMBER, messageBody ) return res.send(sendWhatsappNotificationResponse) diff --git a/utils/constants.js b/utils/constants.js index acc7287..761136b 100644 --- a/utils/constants.js +++ b/utils/constants.js @@ -2,6 +2,6 @@ export const STRAPI_TOURISM_TOKEN = '82ed7f48afbd0c0605ef36bf4b81259f90c7e6bc357db032a011b1c0ab2bc7db2a753fa84c959f403b256ee66b44174dcc453bd0a40797ce8c22c1b6dab7f416cf3b8a247c19144bc3d019f229612f36b12612223b35f28a1a7fec6ff779228730b45fd93a793399d8f462ba0bada15077725a843d3023cf133838876da3547e' export const ITEM_ID = '4' -export const ITEM_NAME = 'MUSEUM' +export const ITEM_NAME = 'Ticket Pass-Mueseum' export const CAT_ATTR_TAG_RELATIONS = [2, 3, 4, 5]