mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
Some checks are pending
CI / checks (push) Waiting to run
Introduce backend and frontend support for generating Stripe payment links for outstanding booking balances. Adds a new POST endpoint to create payment links, updates booking view to include a Stripe button, and integrates error handling and feedback for payment link creation. Refactors view models and templates to support the new feature.
50 lines
1.9 KiB
Go
50 lines
1.9 KiB
Go
package server
|
|
|
|
import (
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/labstack/echo/v4/middleware"
|
|
)
|
|
|
|
func (s Server) MountHandlers() {
|
|
s.Router.GET("/healthz", handleHealthCheck())
|
|
s.Router.GET("/", handleLoginPage())
|
|
s.Router.POST("/", handleLogin(s.as))
|
|
s.Router.POST("/webhooks/stripe", handleStripeWebhook(s.bs, s.stripeWebhookSecret))
|
|
|
|
api := s.Router.Group("/api")
|
|
api.Use(middleware.KeyAuthWithConfig(middleware.KeyAuthConfig{
|
|
KeyLookup: "header:api-key",
|
|
Validator: func(key string, c echo.Context) (bool, error) {
|
|
return s.as.ValidateAPIKey(key), nil
|
|
},
|
|
}))
|
|
api.POST("/sync", handleSync(s.bs))
|
|
api.GET("/bookings", handleBookingList(s.bs))
|
|
api.POST("/bookings", handleCreateBooking(s.bs))
|
|
api.POST("/stripe/sync", handleStripeSync(s.bs))
|
|
|
|
private := s.Router.Group("")
|
|
private.Use(MakeAuthMiddleware(s.as))
|
|
|
|
private.GET("/bookings", handleBookingListPage(s.bs, s.hc))
|
|
private.GET("/bookings/new", handleBookingCreatePage(s.hc))
|
|
private.POST("/bookings/new", handleBookingCreate(s.bs))
|
|
private.GET("/bookings/:id", handleBookingPage(s.bs, s.hc))
|
|
private.POST("/bookings/:id/stripe/payment-link", handleBookingStripePaymentLink(s.bs))
|
|
private.PUT("/bookings/:id", handleBookingUpdate(s.bs, s.hc))
|
|
private.PATCH("/bookings/:id/cancel", handleBookingCancel(s.bs))
|
|
private.POST("/bookings/:id/items", handleCreateItem(s.bs, s.hc))
|
|
private.GET("/bookings/pdf/:id", handlePdfCreateInvoice(s.bs, s.hc))
|
|
|
|
private.POST("/items/:id", handleItemPay(s.bs))
|
|
private.PUT("/items/:id", handleItemUpdate(s.bs))
|
|
private.GET("/items/:id", handleLineItemForm(s.bs))
|
|
|
|
private.GET("/reports", handleReportsPage())
|
|
private.GET("/reports/do", handleReportCompute(s.bs, s.hc))
|
|
private.GET("/reports/pdf", handlePdfCreateReport(s.bs))
|
|
|
|
private.POST("/payments/:id", handleCreatePayment(s.bs))
|
|
private.PUT("/payments/:id", handlePaymentUpdate(s.bs))
|
|
private.GET("/payments/:id", handlePaymentForm(s.bs))
|
|
}
|