package yookassa import ( "context" "payouts/internal/service/yookassa/config" "payouts/internal/service/yookassa/gen" "github.com/ogen-go/ogen/ogenerrors" ) type yookassaService struct { conf config.YooKassa payClient *gen.Client } // BasicAuth implements [gen.SecuritySource]. func (y *yookassaService) BasicAuth(ctx context.Context, operationName gen.OperationName) (gen.BasicAuth, error) { return gen.BasicAuth{ Username: y.conf.ApiPaymentKey, Password: y.conf.ApiBaseSecret, }, nil } // OAuth2 implements [gen.SecuritySource]. func (y *yookassaService) OAuth2(ctx context.Context, operationName gen.OperationName) (gen.OAuth2, error) { return gen.OAuth2{}, ogenerrors.ErrSkipClientSecurity } func NewYookassaService(conf config.YooKassa) (Service, error) { svc := &yookassaService{ conf: conf, } payClient, err := gen.NewClient(conf.BaseUrl, svc) if err != nil { return nil, err } svc.payClient = payClient // payClient.PaymentsPost() return svc, nil }