Skip to content

Commit

Permalink
move strip webhooks to webhooks api bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
naueramant committed Oct 20, 2023
1 parent 5d4207d commit 3ad8c18
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
12 changes: 3 additions & 9 deletions internal/rest/controllers/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"github.com/opsway-io/backend/internal/check"
"github.com/opsway-io/backend/internal/monitor"
"github.com/opsway-io/backend/internal/rest/controllers/authentication"
"github.com/opsway-io/backend/internal/rest/controllers/billings"
"github.com/opsway-io/backend/internal/rest/controllers/changelogs"
"github.com/opsway-io/backend/internal/rest/controllers/healthz"
"github.com/opsway-io/backend/internal/rest/controllers/monitors"
"github.com/opsway-io/backend/internal/rest/controllers/teams"
"github.com/opsway-io/backend/internal/rest/controllers/users"
"github.com/opsway-io/backend/internal/rest/controllers/webhooks"
"github.com/opsway-io/backend/internal/rest/helpers"
"github.com/opsway-io/backend/internal/rest/middleware"
"github.com/opsway-io/backend/internal/team"
Expand All @@ -36,7 +36,6 @@ func Register(
changelogService changelog.Service,
) {
AuthGuard := middleware.AuthGuardFactory(logger, authenticationService)
StripeGuard := middleware.StripeGuardFactory(logger)

root := e.Group(
"/v1",
Expand All @@ -47,14 +46,9 @@ func Register(
AuthGuard(),
)

stripeRoot := e.Group(
"/stripe",
StripeGuard(),
)

// Stripe
// Webhooks

billings.Register(stripeRoot, logger, billingService)
webhooks.Register(root, logger, billingService)

// Healthz

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package billings
package webhooks

import (
"github.com/labstack/echo/v4"
"github.com/opsway-io/backend/internal/authentication"
"github.com/opsway-io/backend/internal/billing"
"github.com/opsway-io/backend/internal/rest/handlers"
"github.com/opsway-io/backend/internal/rest/middleware"
"github.com/sirupsen/logrus"
)

Expand All @@ -22,8 +23,14 @@ func Register(
BillingService: billingService,
}

StripeHandler := handlers.StripeHandlerFactory(logger)
root := e.Group(
"/webhooks",
)

// Stripe

e.POST("/webhook", StripeHandler(h.handleWebhook))
StripeGuard := middleware.StripeGuardFactory(logger)
StripeHandler := handlers.StripeHandlerFactory(logger)

root.POST("/stripe", StripeHandler(h.handleWebhook), StripeGuard())
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package billings
package webhooks

import (
"io"
Expand Down
Binary file added main
Binary file not shown.
7 changes: 0 additions & 7 deletions main.go

This file was deleted.

0 comments on commit 3ad8c18

Please sign in to comment.