Handlers, DB, Cache
This commit is contained in:
17
internal/api/payment/module.go
Normal file
17
internal/api/payment/module.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package payment
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
|
||||
var Module = fx.Options(
|
||||
fx.Provide(NewPaymentHandler),
|
||||
)
|
||||
|
||||
type Handler interface {
|
||||
GetSbpBanks(http.ResponseWriter, *http.Request)
|
||||
PaymentCreate(http.ResponseWriter, *http.Request)
|
||||
PaymentCallback(http.ResponseWriter, *http.Request)
|
||||
}
|
||||
54
internal/api/payment/payment_handler.go
Normal file
54
internal/api/payment/payment_handler.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package payment
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"go.uber.org/fx"
|
||||
|
||||
"payouts/internal/config"
|
||||
"payouts/internal/service/cache"
|
||||
"payouts/internal/service/database"
|
||||
)
|
||||
|
||||
const (
|
||||
BaseRoute = "/payment"
|
||||
CreateRoute = "/create"
|
||||
CallbackRoute = "/callback"
|
||||
BanksRoute = "/sbp/banks"
|
||||
)
|
||||
|
||||
type paymentHandler struct {
|
||||
dbService database.Service
|
||||
cacheService cache.Service
|
||||
}
|
||||
|
||||
// Params represents the module input params
|
||||
type Params struct {
|
||||
fx.In
|
||||
|
||||
AppConfig *config.App
|
||||
DbService database.Service
|
||||
CacheService cache.Service
|
||||
}
|
||||
|
||||
func NewPaymentHandler(p Params) (Handler, error) {
|
||||
return &paymentHandler{
|
||||
dbService: p.DbService,
|
||||
cacheService: p.CacheService,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetSbpBanks implements [Handler].
|
||||
func (p *paymentHandler) GetSbpBanks(http.ResponseWriter, *http.Request) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// PaymentCreate implements [Handler].
|
||||
func (p *paymentHandler) PaymentCreate(http.ResponseWriter, *http.Request) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
// PaymentCallback implements [Handler].
|
||||
func (p *paymentHandler) PaymentCallback(http.ResponseWriter, *http.Request) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
Reference in New Issue
Block a user