Once the payment callback is fired, we need to create a reservation entity in our booking database. The booking workflow will go through various stages, and this persistent entity will be responsible for maintaining the reservation status for all the microservices involved in the workflow.
The booking service is a REST API, and we will implement it using Gin (which we covered in Chapter 5, Going Distributed). The createReservation API, which is called during the Payment Callback, is defined in the following code:
func createReservation(c *gin.Context) { var ( reservationDTO HotelReservationDTO err error ) if err = c.ShouldBindJSON(&reservationDTO); err == nil { fmt.Printf("In createReservation : %+v\n", reservationDTO) err = persistReservation(&reservationDTO) ...