Skip to content

Commit

Permalink
Added:Control Certer Backend APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyvishal committed Mar 29, 2024
1 parent df99c7f commit 9319129
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions controllers/ControlCenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand All @@ -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' })
}

Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions controllers/Notification.js
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]

0 comments on commit 9319129

Please sign in to comment.