Handlers, DB, Cache
This commit is contained in:
10
internal/service/yookassa/config/yookassa.go
Normal file
10
internal/service/yookassa/config/yookassa.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
type YooKassa struct {
|
||||
BaseUrl string
|
||||
|
||||
ApiBaseKey string
|
||||
ApiBaseSecret string
|
||||
ApiPaymentKey string
|
||||
ApiPaymentSecret string
|
||||
}
|
||||
37
internal/service/yookassa/module.go
Normal file
37
internal/service/yookassa/module.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package yookassa
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.uber.org/fx"
|
||||
|
||||
"payouts/internal/config"
|
||||
)
|
||||
|
||||
var Module = fx.Options(
|
||||
fx.Provide(New),
|
||||
)
|
||||
|
||||
type params struct {
|
||||
ctx context.Context
|
||||
}
|
||||
type Optional func(*params)
|
||||
|
||||
func WithContext(ctx context.Context) Optional {
|
||||
return func(p *params) {
|
||||
p.ctx = ctx
|
||||
}
|
||||
}
|
||||
|
||||
type Service interface {
|
||||
}
|
||||
|
||||
type Param struct {
|
||||
fx.In
|
||||
|
||||
AppConfig *config.App
|
||||
}
|
||||
|
||||
func New(p Param) (Service, error) {
|
||||
return NewYookassaService(p.AppConfig.YooKassa)
|
||||
}
|
||||
13
internal/service/yookassa/yookassa_service.go
Normal file
13
internal/service/yookassa/yookassa_service.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package yookassa
|
||||
|
||||
import "payouts/internal/service/yookassa/config"
|
||||
|
||||
type yookassaService struct {
|
||||
conf config.YooKassa
|
||||
}
|
||||
|
||||
func NewYookassaService(conf config.YooKassa) (Service, error) {
|
||||
return &yookassaService{
|
||||
conf: conf,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user