Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions api/booking/register.controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
)

func BookEventCsrf(c *gin.Context) {
Expand Down Expand Up @@ -356,14 +357,15 @@ func BookEvent(c *gin.Context) {
totalFee,
)
bookingID, err := q.CreateBooking(ctx, tx, db.CreateBookingParams{
EventID: eventId,
StudentID: leaderId,
TxnID: txnId,
RegistrationFee: totalFee,
TxnStatus: models.PaymentPending,
ProductInfo: prodInfo,
SeatsReleased: 1,
Metadata: metadataJson, // TODO: I need to set it as default data of the jsonb if not present
EventID: eventId,
StudentID: leaderId,
TxnID: txnId,
RegistrationFee: totalFee,
TxnStatus: models.PaymentPending,
ProductInfo: prodInfo,
SeatsReleased: 1,
RegistrationFeeWithoutGst: pgtype.Int4{Int32: event.Price, Valid: true},
Metadata: metadataJson, // TODO: I need to set it as default data of the jsonb if not present
})
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
Expand Down
3 changes: 2 additions & 1 deletion api/booking/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ func BookingRoutes(r *gin.RouterGroup) {

// Booking endpoints
r.POST("/:eventId/book", mw.VerifyCsrf, mw.Auth, BookEvent)
r.POST("/verify", mw.Auth, VerifyTransaction)
r.POST("/verify", mw.Auth, VerifyTransactionNew)
r.POST("/reverify", ReverifyFailedTransaction)

// Fetch transactions
r.GET("/transactions", mw.Auth, mw.CheckAdmin, FetchAdminTransactions)
Expand Down
Loading