Generate yookassa client via openapi tool ogen
This commit is contained in:
347
internal/service/yookassa/gen/oas_cfg_gen.go
Normal file
347
internal/service/yookassa/gen/oas_cfg_gen.go
Normal file
@@ -0,0 +1,347 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
ht "github.com/ogen-go/ogen/http"
|
||||
"github.com/ogen-go/ogen/middleware"
|
||||
"github.com/ogen-go/ogen/ogenerrors"
|
||||
"github.com/ogen-go/ogen/ogenregex"
|
||||
"github.com/ogen-go/ogen/otelogen"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
var regexMap = map[string]ogenregex.Regexp{
|
||||
"(.)([0-9а-яА-Яa-zA-Z]+)(.)": ogenregex.MustCompile("(.)([0-9а-яА-Яa-zA-Z]+)(.)"),
|
||||
"(?s).{1,210}": ogenregex.MustCompile("(?s).{1,210}"),
|
||||
"([\\d]{20})|(0)": ogenregex.MustCompile("([\\d]{20})|(0)"),
|
||||
"([\\d]{8})|(0)": ogenregex.MustCompile("([\\d]{8})|(0)"),
|
||||
"(^00[1-9]{1}$)|(^0[1-6]{1}[0-9]{1}$)|(^07[0-3]{1}$)": ogenregex.MustCompile("(^00[1-9]{1}$)|(^0[1-6]{1}[0-9]{1}$)|(^07[0-3]{1}$)"),
|
||||
"[0-9]{1,150}": ogenregex.MustCompile("[0-9]{1,150}"),
|
||||
"[0-9]{10}": ogenregex.MustCompile("[0-9]{10}"),
|
||||
"[0-9]{11,33}": ogenregex.MustCompile("[0-9]{11,33}"),
|
||||
"[0-9]{14,19}": ogenregex.MustCompile("[0-9]{14,19}"),
|
||||
"[0-9]{16,19}": ogenregex.MustCompile("[0-9]{16,19}"),
|
||||
"[0-9]{24}": ogenregex.MustCompile("[0-9]{24}"),
|
||||
"[0-9]{2}": ogenregex.MustCompile("[0-9]{2}"),
|
||||
"[0-9]{4,15}": ogenregex.MustCompile("[0-9]{4,15}"),
|
||||
"[0-9]{4}": ogenregex.MustCompile("[0-9]{4}"),
|
||||
"[0-9]{6}": ogenregex.MustCompile("[0-9]{6}"),
|
||||
"[0-9]{9}": ogenregex.MustCompile("[0-9]{9}"),
|
||||
"[0-9a-zA-Z+-_.]{1,64}": ogenregex.MustCompile("[0-9a-zA-Z+-_.]{1,64}"),
|
||||
"[A-Z]{3}": ogenregex.MustCompile("[A-Z]{3}"),
|
||||
"[a-zA-Z '-]{0,26}": ogenregex.MustCompile("[a-zA-Z '-]{0,26}"),
|
||||
"[a-zA-Z0-9]{12}": ogenregex.MustCompile("[a-zA-Z0-9]{12}"),
|
||||
"\\d{1,20}": ogenregex.MustCompile("\\d{1,20}"),
|
||||
"\\d{10}|\\d{12}": ogenregex.MustCompile("\\d{10}|\\d{12}"),
|
||||
"\\d{20}": ogenregex.MustCompile("\\d{20}"),
|
||||
"\\d{9}": ogenregex.MustCompile("\\d{9}"),
|
||||
"^[0]{1}$": ogenregex.MustCompile("^[0]{1}$"),
|
||||
"^[\\-a-zA-Zа-яёА-ЯЁ ]]*$": ogenregex.MustCompile("^[\\-a-zA-Zа-яёА-ЯЁ ]]*$"),
|
||||
}
|
||||
var (
|
||||
// Allocate option closure once.
|
||||
clientSpanKind = trace.WithSpanKind(trace.SpanKindClient)
|
||||
// Allocate option closure once.
|
||||
serverSpanKind = trace.WithSpanKind(trace.SpanKindServer)
|
||||
)
|
||||
|
||||
type (
|
||||
optionFunc[C any] func(*C)
|
||||
otelOptionFunc func(*otelConfig)
|
||||
)
|
||||
|
||||
type otelConfig struct {
|
||||
TracerProvider trace.TracerProvider
|
||||
Tracer trace.Tracer
|
||||
MeterProvider metric.MeterProvider
|
||||
Meter metric.Meter
|
||||
Attributes []attribute.KeyValue
|
||||
}
|
||||
|
||||
func (cfg *otelConfig) initOTEL() {
|
||||
if cfg.TracerProvider == nil {
|
||||
cfg.TracerProvider = otel.GetTracerProvider()
|
||||
}
|
||||
if cfg.MeterProvider == nil {
|
||||
cfg.MeterProvider = otel.GetMeterProvider()
|
||||
}
|
||||
cfg.Tracer = cfg.TracerProvider.Tracer(otelogen.Name,
|
||||
trace.WithInstrumentationVersion(otelogen.SemVersion()),
|
||||
)
|
||||
cfg.Meter = cfg.MeterProvider.Meter(otelogen.Name,
|
||||
metric.WithInstrumentationVersion(otelogen.SemVersion()),
|
||||
)
|
||||
}
|
||||
|
||||
// ErrorHandler is error handler.
|
||||
type ErrorHandler = ogenerrors.ErrorHandler
|
||||
|
||||
type serverConfig struct {
|
||||
otelConfig
|
||||
NotFound http.HandlerFunc
|
||||
MethodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)
|
||||
ErrorHandler ErrorHandler
|
||||
Prefix string
|
||||
Middleware Middleware
|
||||
MaxMultipartMemory int64
|
||||
}
|
||||
|
||||
// ServerOption is server config option.
|
||||
type ServerOption interface {
|
||||
applyServer(*serverConfig)
|
||||
}
|
||||
|
||||
var _ ServerOption = (optionFunc[serverConfig])(nil)
|
||||
|
||||
func (o optionFunc[C]) applyServer(c *C) {
|
||||
o(c)
|
||||
}
|
||||
|
||||
var _ ServerOption = (otelOptionFunc)(nil)
|
||||
|
||||
func (o otelOptionFunc) applyServer(c *serverConfig) {
|
||||
o(&c.otelConfig)
|
||||
}
|
||||
|
||||
func newServerConfig(opts ...ServerOption) serverConfig {
|
||||
cfg := serverConfig{
|
||||
NotFound: http.NotFound,
|
||||
MethodNotAllowed: nil,
|
||||
ErrorHandler: ogenerrors.DefaultErrorHandler,
|
||||
Middleware: nil,
|
||||
MaxMultipartMemory: 32 << 20, // 32 MB
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt.applyServer(&cfg)
|
||||
}
|
||||
cfg.initOTEL()
|
||||
return cfg
|
||||
}
|
||||
|
||||
type baseServer struct {
|
||||
cfg serverConfig
|
||||
requests metric.Int64Counter
|
||||
errors metric.Int64Counter
|
||||
duration metric.Float64Histogram
|
||||
}
|
||||
|
||||
func (s baseServer) notFound(w http.ResponseWriter, r *http.Request) {
|
||||
s.cfg.NotFound(w, r)
|
||||
}
|
||||
|
||||
type notAllowedParams struct {
|
||||
allowedMethods string
|
||||
allowedHeaders map[string]string
|
||||
acceptPost string
|
||||
acceptPatch string
|
||||
}
|
||||
|
||||
func (s baseServer) notAllowed(w http.ResponseWriter, r *http.Request, params notAllowedParams) {
|
||||
h := w.Header()
|
||||
isOptions := r.Method == "OPTIONS"
|
||||
if isOptions {
|
||||
h.Set("Access-Control-Allow-Methods", params.allowedMethods)
|
||||
if params.allowedHeaders != nil {
|
||||
m := r.Header.Get("Access-Control-Request-Method")
|
||||
if m != "" {
|
||||
allowedHeaders, ok := params.allowedHeaders[strings.ToUpper(m)]
|
||||
if ok {
|
||||
h.Set("Access-Control-Allow-Headers", allowedHeaders)
|
||||
}
|
||||
}
|
||||
}
|
||||
if params.acceptPost != "" {
|
||||
h.Set("Accept-Post", params.acceptPost)
|
||||
}
|
||||
if params.acceptPatch != "" {
|
||||
h.Set("Accept-Patch", params.acceptPatch)
|
||||
}
|
||||
}
|
||||
if s.cfg.MethodNotAllowed != nil {
|
||||
s.cfg.MethodNotAllowed(w, r, params.allowedMethods)
|
||||
return
|
||||
}
|
||||
status := http.StatusNoContent
|
||||
if !isOptions {
|
||||
h.Set("Allow", params.allowedMethods)
|
||||
status = http.StatusMethodNotAllowed
|
||||
}
|
||||
w.WriteHeader(status)
|
||||
}
|
||||
|
||||
func (cfg serverConfig) baseServer() (s baseServer, err error) {
|
||||
s = baseServer{cfg: cfg}
|
||||
if s.requests, err = otelogen.ServerRequestCountCounter(s.cfg.Meter); err != nil {
|
||||
return s, err
|
||||
}
|
||||
if s.errors, err = otelogen.ServerErrorsCountCounter(s.cfg.Meter); err != nil {
|
||||
return s, err
|
||||
}
|
||||
if s.duration, err = otelogen.ServerDurationHistogram(s.cfg.Meter); err != nil {
|
||||
return s, err
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
type clientConfig struct {
|
||||
otelConfig
|
||||
Client ht.Client
|
||||
}
|
||||
|
||||
// ClientOption is client config option.
|
||||
type ClientOption interface {
|
||||
applyClient(*clientConfig)
|
||||
}
|
||||
|
||||
var _ ClientOption = (optionFunc[clientConfig])(nil)
|
||||
|
||||
func (o optionFunc[C]) applyClient(c *C) {
|
||||
o(c)
|
||||
}
|
||||
|
||||
var _ ClientOption = (otelOptionFunc)(nil)
|
||||
|
||||
func (o otelOptionFunc) applyClient(c *clientConfig) {
|
||||
o(&c.otelConfig)
|
||||
}
|
||||
|
||||
func newClientConfig(opts ...ClientOption) clientConfig {
|
||||
cfg := clientConfig{
|
||||
Client: http.DefaultClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt.applyClient(&cfg)
|
||||
}
|
||||
cfg.initOTEL()
|
||||
return cfg
|
||||
}
|
||||
|
||||
type baseClient struct {
|
||||
cfg clientConfig
|
||||
requests metric.Int64Counter
|
||||
errors metric.Int64Counter
|
||||
duration metric.Float64Histogram
|
||||
}
|
||||
|
||||
func (cfg clientConfig) baseClient() (c baseClient, err error) {
|
||||
c = baseClient{cfg: cfg}
|
||||
if c.requests, err = otelogen.ClientRequestCountCounter(c.cfg.Meter); err != nil {
|
||||
return c, err
|
||||
}
|
||||
if c.errors, err = otelogen.ClientErrorsCountCounter(c.cfg.Meter); err != nil {
|
||||
return c, err
|
||||
}
|
||||
if c.duration, err = otelogen.ClientDurationHistogram(c.cfg.Meter); err != nil {
|
||||
return c, err
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// Option is config option.
|
||||
type Option interface {
|
||||
ServerOption
|
||||
ClientOption
|
||||
}
|
||||
|
||||
// WithTracerProvider specifies a tracer provider to use for creating a tracer.
|
||||
//
|
||||
// If none is specified, the global provider is used.
|
||||
func WithTracerProvider(provider trace.TracerProvider) Option {
|
||||
return otelOptionFunc(func(cfg *otelConfig) {
|
||||
if provider != nil {
|
||||
cfg.TracerProvider = provider
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithMeterProvider specifies a meter provider to use for creating a meter.
|
||||
//
|
||||
// If none is specified, the otel.GetMeterProvider() is used.
|
||||
func WithMeterProvider(provider metric.MeterProvider) Option {
|
||||
return otelOptionFunc(func(cfg *otelConfig) {
|
||||
if provider != nil {
|
||||
cfg.MeterProvider = provider
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithAttributes specifies default otel attributes.
|
||||
func WithAttributes(attributes ...attribute.KeyValue) Option {
|
||||
return otelOptionFunc(func(cfg *otelConfig) {
|
||||
cfg.Attributes = attributes
|
||||
})
|
||||
}
|
||||
|
||||
// WithClient specifies http client to use.
|
||||
func WithClient(client ht.Client) ClientOption {
|
||||
return optionFunc[clientConfig](func(cfg *clientConfig) {
|
||||
if client != nil {
|
||||
cfg.Client = client
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithNotFound specifies Not Found handler to use.
|
||||
func WithNotFound(notFound http.HandlerFunc) ServerOption {
|
||||
return optionFunc[serverConfig](func(cfg *serverConfig) {
|
||||
if notFound != nil {
|
||||
cfg.NotFound = notFound
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithMethodNotAllowed specifies Method Not Allowed handler to use.
|
||||
func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption {
|
||||
return optionFunc[serverConfig](func(cfg *serverConfig) {
|
||||
if methodNotAllowed != nil {
|
||||
cfg.MethodNotAllowed = methodNotAllowed
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithErrorHandler specifies error handler to use.
|
||||
func WithErrorHandler(h ErrorHandler) ServerOption {
|
||||
return optionFunc[serverConfig](func(cfg *serverConfig) {
|
||||
if h != nil {
|
||||
cfg.ErrorHandler = h
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithPathPrefix specifies server path prefix.
|
||||
func WithPathPrefix(prefix string) ServerOption {
|
||||
return optionFunc[serverConfig](func(cfg *serverConfig) {
|
||||
cfg.Prefix = prefix
|
||||
})
|
||||
}
|
||||
|
||||
// WithMiddleware specifies middlewares to use.
|
||||
func WithMiddleware(m ...Middleware) ServerOption {
|
||||
return optionFunc[serverConfig](func(cfg *serverConfig) {
|
||||
switch len(m) {
|
||||
case 0:
|
||||
cfg.Middleware = nil
|
||||
case 1:
|
||||
cfg.Middleware = m[0]
|
||||
default:
|
||||
cfg.Middleware = middleware.ChainMiddlewares(m...)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// WithMaxMultipartMemory specifies limit of memory for storing file parts.
|
||||
// File parts which can't be stored in memory will be stored on disk in temporary files.
|
||||
func WithMaxMultipartMemory(max int64) ServerOption {
|
||||
return optionFunc[serverConfig](func(cfg *serverConfig) {
|
||||
if max > 0 {
|
||||
cfg.MaxMultipartMemory = max
|
||||
}
|
||||
})
|
||||
}
|
||||
5049
internal/service/yookassa/gen/oas_client_gen.go
Normal file
5049
internal/service/yookassa/gen/oas_client_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
47
internal/service/yookassa/gen/oas_defaults_gen.go
Normal file
47
internal/service/yookassa/gen/oas_defaults_gen.go
Normal file
@@ -0,0 +1,47 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
// setDefaults set default value of fields.
|
||||
func (s *ConfirmationDataRedirect) setDefaults() {
|
||||
{
|
||||
val := bool(false)
|
||||
s.Enforce.SetTo(Enforce(val))
|
||||
}
|
||||
}
|
||||
|
||||
// setDefaults set default value of fields.
|
||||
func (s *ConfirmationRedirect) setDefaults() {
|
||||
{
|
||||
val := bool(false)
|
||||
s.Enforce.SetTo(Enforce(val))
|
||||
}
|
||||
}
|
||||
|
||||
// setDefaults set default value of fields.
|
||||
func (s *PaymentsPostReq) setDefaults() {
|
||||
{
|
||||
val := bool(false)
|
||||
s.SavePaymentMethod.SetTo(SavePaymentMethodAttribute(val))
|
||||
}
|
||||
{
|
||||
val := bool(false)
|
||||
s.Capture.SetTo(Capture(val))
|
||||
}
|
||||
}
|
||||
|
||||
// setDefaults set default value of fields.
|
||||
func (s *SafeDeal) setDefaults() {
|
||||
{
|
||||
val := FeeMoment("payment_succeeded")
|
||||
s.FeeMoment = val
|
||||
}
|
||||
}
|
||||
|
||||
// setDefaults set default value of fields.
|
||||
func (s *SafeDealRequest) setDefaults() {
|
||||
{
|
||||
val := FeeMoment("payment_succeeded")
|
||||
s.FeeMoment = val
|
||||
}
|
||||
}
|
||||
5980
internal/service/yookassa/gen/oas_handlers_gen.go
Normal file
5980
internal/service/yookassa/gen/oas_handlers_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
110
internal/service/yookassa/gen/oas_interfaces_gen.go
Normal file
110
internal/service/yookassa/gen/oas_interfaces_gen.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
package gen
|
||||
|
||||
type DealsDealIDGetRes interface {
|
||||
dealsDealIDGetRes()
|
||||
}
|
||||
|
||||
type DealsGetRes interface {
|
||||
dealsGetRes()
|
||||
}
|
||||
|
||||
type DealsPostRes interface {
|
||||
dealsPostRes()
|
||||
}
|
||||
|
||||
type MeGetRes interface {
|
||||
meGetRes()
|
||||
}
|
||||
|
||||
type PaymentMethodsPaymentMethodIDGetRes interface {
|
||||
paymentMethodsPaymentMethodIDGetRes()
|
||||
}
|
||||
|
||||
type PaymentMethodsPostRes interface {
|
||||
paymentMethodsPostRes()
|
||||
}
|
||||
|
||||
type PaymentsGetRes interface {
|
||||
paymentsGetRes()
|
||||
}
|
||||
|
||||
type PaymentsPaymentIDCancelPostRes interface {
|
||||
paymentsPaymentIDCancelPostRes()
|
||||
}
|
||||
|
||||
type PaymentsPaymentIDCapturePostRes interface {
|
||||
paymentsPaymentIDCapturePostRes()
|
||||
}
|
||||
|
||||
type PaymentsPaymentIDGetRes interface {
|
||||
paymentsPaymentIDGetRes()
|
||||
}
|
||||
|
||||
type PaymentsPostRes interface {
|
||||
paymentsPostRes()
|
||||
}
|
||||
|
||||
type PayoutsGetRes interface {
|
||||
payoutsGetRes()
|
||||
}
|
||||
|
||||
type PayoutsPayoutIDGetRes interface {
|
||||
payoutsPayoutIDGetRes()
|
||||
}
|
||||
|
||||
type PayoutsPostRes interface {
|
||||
payoutsPostRes()
|
||||
}
|
||||
|
||||
type PayoutsSearchGetRes interface {
|
||||
payoutsSearchGetRes()
|
||||
}
|
||||
|
||||
type PersonalDataPersonalDataIDGetRes interface {
|
||||
personalDataPersonalDataIDGetRes()
|
||||
}
|
||||
|
||||
type PersonalDataPostRes interface {
|
||||
personalDataPostRes()
|
||||
}
|
||||
|
||||
type ReceiptsGetRes interface {
|
||||
receiptsGetRes()
|
||||
}
|
||||
|
||||
type ReceiptsPostRes interface {
|
||||
receiptsPostRes()
|
||||
}
|
||||
|
||||
type ReceiptsReceiptIDGetRes interface {
|
||||
receiptsReceiptIDGetRes()
|
||||
}
|
||||
|
||||
type RefundsGetRes interface {
|
||||
refundsGetRes()
|
||||
}
|
||||
|
||||
type RefundsPostRes interface {
|
||||
refundsPostRes()
|
||||
}
|
||||
|
||||
type RefundsRefundIDGetRes interface {
|
||||
refundsRefundIDGetRes()
|
||||
}
|
||||
|
||||
type SbpBanksGetRes interface {
|
||||
sbpBanksGetRes()
|
||||
}
|
||||
|
||||
type WebhooksGetRes interface {
|
||||
webhooksGetRes()
|
||||
}
|
||||
|
||||
type WebhooksPostRes interface {
|
||||
webhooksPostRes()
|
||||
}
|
||||
|
||||
type WebhooksWebhookIDDeleteRes interface {
|
||||
webhooksWebhookIDDeleteRes()
|
||||
}
|
||||
41990
internal/service/yookassa/gen/oas_json_gen.go
Normal file
41990
internal/service/yookassa/gen/oas_json_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
42
internal/service/yookassa/gen/oas_labeler_gen.go
Normal file
42
internal/service/yookassa/gen/oas_labeler_gen.go
Normal file
@@ -0,0 +1,42 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// Labeler is used to allow adding custom attributes to the server request metrics.
|
||||
type Labeler struct {
|
||||
attrs []attribute.KeyValue
|
||||
}
|
||||
|
||||
// Add attributes to the Labeler.
|
||||
func (l *Labeler) Add(attrs ...attribute.KeyValue) {
|
||||
l.attrs = append(l.attrs, attrs...)
|
||||
}
|
||||
|
||||
// AttributeSet returns the attributes added to the Labeler as an attribute.Set.
|
||||
func (l *Labeler) AttributeSet() attribute.Set {
|
||||
return attribute.NewSet(l.attrs...)
|
||||
}
|
||||
|
||||
type labelerContextKey struct{}
|
||||
|
||||
// LabelerFromContext retrieves the Labeler from the provided context, if present.
|
||||
//
|
||||
// If no Labeler was found in the provided context a new, empty Labeler is returned and the second
|
||||
// return value is false. In this case it is safe to use the Labeler but any attributes added to
|
||||
// it will not be used.
|
||||
func LabelerFromContext(ctx context.Context) (*Labeler, bool) {
|
||||
if l, ok := ctx.Value(labelerContextKey{}).(*Labeler); ok {
|
||||
return l, true
|
||||
}
|
||||
return &Labeler{}, false
|
||||
}
|
||||
|
||||
func contextWithLabeler(ctx context.Context, l *Labeler) context.Context {
|
||||
return context.WithValue(ctx, labelerContextKey{}, l)
|
||||
}
|
||||
10
internal/service/yookassa/gen/oas_middleware_gen.go
Normal file
10
internal/service/yookassa/gen/oas_middleware_gen.go
Normal file
@@ -0,0 +1,10 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"github.com/ogen-go/ogen/middleware"
|
||||
)
|
||||
|
||||
// Middleware is middleware type.
|
||||
type Middleware = middleware.Middleware
|
||||
36
internal/service/yookassa/gen/oas_operations_gen.go
Normal file
36
internal/service/yookassa/gen/oas_operations_gen.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
// OperationName is the ogen operation name
|
||||
type OperationName = string
|
||||
|
||||
const (
|
||||
DealsDealIDGetOperation OperationName = "DealsDealIDGet"
|
||||
DealsGetOperation OperationName = "DealsGet"
|
||||
DealsPostOperation OperationName = "DealsPost"
|
||||
MeGetOperation OperationName = "MeGet"
|
||||
PaymentMethodsPaymentMethodIDGetOperation OperationName = "PaymentMethodsPaymentMethodIDGet"
|
||||
PaymentMethodsPostOperation OperationName = "PaymentMethodsPost"
|
||||
PaymentsGetOperation OperationName = "PaymentsGet"
|
||||
PaymentsPaymentIDCancelPostOperation OperationName = "PaymentsPaymentIDCancelPost"
|
||||
PaymentsPaymentIDCapturePostOperation OperationName = "PaymentsPaymentIDCapturePost"
|
||||
PaymentsPaymentIDGetOperation OperationName = "PaymentsPaymentIDGet"
|
||||
PaymentsPostOperation OperationName = "PaymentsPost"
|
||||
PayoutsGetOperation OperationName = "PayoutsGet"
|
||||
PayoutsPayoutIDGetOperation OperationName = "PayoutsPayoutIDGet"
|
||||
PayoutsPostOperation OperationName = "PayoutsPost"
|
||||
PayoutsSearchGetOperation OperationName = "PayoutsSearchGet"
|
||||
PersonalDataPersonalDataIDGetOperation OperationName = "PersonalDataPersonalDataIDGet"
|
||||
PersonalDataPostOperation OperationName = "PersonalDataPost"
|
||||
ReceiptsGetOperation OperationName = "ReceiptsGet"
|
||||
ReceiptsPostOperation OperationName = "ReceiptsPost"
|
||||
ReceiptsReceiptIDGetOperation OperationName = "ReceiptsReceiptIDGet"
|
||||
RefundsGetOperation OperationName = "RefundsGet"
|
||||
RefundsPostOperation OperationName = "RefundsPost"
|
||||
RefundsRefundIDGetOperation OperationName = "RefundsRefundIDGet"
|
||||
SbpBanksGetOperation OperationName = "SbpBanksGet"
|
||||
WebhooksGetOperation OperationName = "WebhooksGet"
|
||||
WebhooksPostOperation OperationName = "WebhooksPost"
|
||||
WebhooksWebhookIDDeleteOperation OperationName = "WebhooksWebhookIDDelete"
|
||||
)
|
||||
5237
internal/service/yookassa/gen/oas_parameters_gen.go
Normal file
5237
internal/service/yookassa/gen/oas_parameters_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
718
internal/service/yookassa/gen/oas_request_decoders_gen.go
Normal file
718
internal/service/yookassa/gen/oas_request_decoders_gen.go
Normal file
@@ -0,0 +1,718 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"mime"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-faster/errors"
|
||||
"github.com/go-faster/jx"
|
||||
"github.com/ogen-go/ogen/ogenerrors"
|
||||
"github.com/ogen-go/ogen/validate"
|
||||
)
|
||||
|
||||
func (s *Server) decodeDealsPostRequest(r *http.Request) (
|
||||
req *SafeDealRequest,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request SafeDealRequest
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodePaymentMethodsPostRequest(r *http.Request) (
|
||||
req PaymentMethodsPostReq,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request PaymentMethodsPostReq
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodePaymentsPaymentIDCapturePostRequest(r *http.Request) (
|
||||
req *PaymentsPaymentIDCapturePostReq,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request PaymentsPaymentIDCapturePostReq
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodePaymentsPostRequest(r *http.Request) (
|
||||
req *PaymentsPostReq,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request PaymentsPostReq
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodePayoutsPostRequest(r *http.Request) (
|
||||
req *PayoutRequest,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request PayoutRequest
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodePersonalDataPostRequest(r *http.Request) (
|
||||
req PersonalDataPostReq,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request PersonalDataPostReq
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeReceiptsPostRequest(r *http.Request) (
|
||||
req PostReceiptData,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request PostReceiptData
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
return request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeRefundsPostRequest(r *http.Request) (
|
||||
req *RefundsPostReq,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request RefundsPostReq
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeWebhooksPostRequest(r *http.Request) (
|
||||
req *WebhooksPostReq,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request WebhooksPostReq
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return &request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
137
internal/service/yookassa/gen/oas_request_encoders_gen.go
Normal file
137
internal/service/yookassa/gen/oas_request_encoders_gen.go
Normal file
@@ -0,0 +1,137 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-faster/jx"
|
||||
ht "github.com/ogen-go/ogen/http"
|
||||
)
|
||||
|
||||
func encodeDealsPostRequest(
|
||||
req *SafeDealRequest,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodePaymentMethodsPostRequest(
|
||||
req PaymentMethodsPostReq,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodePaymentsPaymentIDCapturePostRequest(
|
||||
req *PaymentsPaymentIDCapturePostReq,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodePaymentsPostRequest(
|
||||
req *PaymentsPostReq,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodePayoutsPostRequest(
|
||||
req *PayoutRequest,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodePersonalDataPostRequest(
|
||||
req PersonalDataPostReq,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeReceiptsPostRequest(
|
||||
req PostReceiptData,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeRefundsPostRequest(
|
||||
req *RefundsPostReq,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeWebhooksPostRequest(
|
||||
req *WebhooksPostReq,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
e := new(jx.Encoder)
|
||||
{
|
||||
req.Encode(e)
|
||||
}
|
||||
encoded := e.Bytes()
|
||||
ht.SetBody(r, bytes.NewReader(encoded), contentType)
|
||||
return nil
|
||||
}
|
||||
7031
internal/service/yookassa/gen/oas_response_decoders_gen.go
Normal file
7031
internal/service/yookassa/gen/oas_response_decoders_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
2229
internal/service/yookassa/gen/oas_response_encoders_gen.go
Normal file
2229
internal/service/yookassa/gen/oas_response_encoders_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
1691
internal/service/yookassa/gen/oas_router_gen.go
Normal file
1691
internal/service/yookassa/gen/oas_router_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
24790
internal/service/yookassa/gen/oas_schemas_gen.go
Normal file
24790
internal/service/yookassa/gen/oas_schemas_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
207
internal/service/yookassa/gen/oas_security_gen.go
Normal file
207
internal/service/yookassa/gen/oas_security_gen.go
Normal file
@@ -0,0 +1,207 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/go-faster/errors"
|
||||
"github.com/ogen-go/ogen/ogenerrors"
|
||||
)
|
||||
|
||||
// SecurityHandler is handler for security parameters.
|
||||
type SecurityHandler interface {
|
||||
// HandleBasicAuth handles BasicAuth security.
|
||||
// HTTP Basic аутентификация клиента ЮKassa.
|
||||
HandleBasicAuth(ctx context.Context, operationName OperationName, t BasicAuth) (context.Context, error)
|
||||
// HandleOAuth2 handles OAuth2 security.
|
||||
// Авторизация клиента ЮKassa с использованием OAuth-токена.
|
||||
HandleOAuth2(ctx context.Context, operationName OperationName, t OAuth2) (context.Context, error)
|
||||
}
|
||||
|
||||
func findAuthorization(h http.Header, prefix string) (string, bool) {
|
||||
v, ok := h["Authorization"]
|
||||
if !ok {
|
||||
return "", false
|
||||
}
|
||||
for _, vv := range v {
|
||||
scheme, value, ok := strings.Cut(vv, " ")
|
||||
if !ok || !strings.EqualFold(scheme, prefix) {
|
||||
continue
|
||||
}
|
||||
return value, true
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
// operationRolesBasicAuth is a private map storing roles per operation.
|
||||
var operationRolesBasicAuth = map[string][]string{
|
||||
DealsDealIDGetOperation: []string{},
|
||||
DealsGetOperation: []string{},
|
||||
DealsPostOperation: []string{},
|
||||
MeGetOperation: []string{},
|
||||
PaymentMethodsPaymentMethodIDGetOperation: []string{},
|
||||
PaymentMethodsPostOperation: []string{},
|
||||
PaymentsGetOperation: []string{},
|
||||
PaymentsPaymentIDCancelPostOperation: []string{},
|
||||
PaymentsPaymentIDCapturePostOperation: []string{},
|
||||
PaymentsPaymentIDGetOperation: []string{},
|
||||
PaymentsPostOperation: []string{},
|
||||
PayoutsGetOperation: []string{},
|
||||
PayoutsPayoutIDGetOperation: []string{},
|
||||
PayoutsPostOperation: []string{},
|
||||
PayoutsSearchGetOperation: []string{},
|
||||
PersonalDataPersonalDataIDGetOperation: []string{},
|
||||
PersonalDataPostOperation: []string{},
|
||||
ReceiptsGetOperation: []string{},
|
||||
ReceiptsPostOperation: []string{},
|
||||
ReceiptsReceiptIDGetOperation: []string{},
|
||||
RefundsGetOperation: []string{},
|
||||
RefundsPostOperation: []string{},
|
||||
RefundsRefundIDGetOperation: []string{},
|
||||
SbpBanksGetOperation: []string{},
|
||||
WebhooksGetOperation: []string{},
|
||||
WebhooksPostOperation: []string{},
|
||||
WebhooksWebhookIDDeleteOperation: []string{},
|
||||
}
|
||||
|
||||
// GetRolesForBasicAuth returns the required roles for the given operation.
|
||||
//
|
||||
// This is useful for authorization scenarios where you need to know which roles
|
||||
// are required for an operation.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// requiredRoles := GetRolesForBasicAuth(AddPetOperation)
|
||||
//
|
||||
// Returns nil if the operation has no role requirements or if the operation is unknown.
|
||||
func GetRolesForBasicAuth(operation string) []string {
|
||||
roles, ok := operationRolesBasicAuth[operation]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
// Return a copy to prevent external modification
|
||||
result := make([]string, len(roles))
|
||||
copy(result, roles)
|
||||
return result
|
||||
}
|
||||
|
||||
// oauth2ScopesOAuth2 is a private map storing OAuth2 scopes per operation.
|
||||
var oauth2ScopesOAuth2 = map[string][]string{
|
||||
DealsDealIDGetOperation: []string{},
|
||||
DealsGetOperation: []string{},
|
||||
DealsPostOperation: []string{},
|
||||
MeGetOperation: []string{},
|
||||
PaymentMethodsPaymentMethodIDGetOperation: []string{},
|
||||
PaymentMethodsPostOperation: []string{},
|
||||
PaymentsGetOperation: []string{},
|
||||
PaymentsPaymentIDCancelPostOperation: []string{},
|
||||
PaymentsPaymentIDCapturePostOperation: []string{},
|
||||
PaymentsPaymentIDGetOperation: []string{},
|
||||
PaymentsPostOperation: []string{},
|
||||
PayoutsGetOperation: []string{},
|
||||
PayoutsPayoutIDGetOperation: []string{},
|
||||
PayoutsPostOperation: []string{},
|
||||
PayoutsSearchGetOperation: []string{},
|
||||
PersonalDataPersonalDataIDGetOperation: []string{},
|
||||
PersonalDataPostOperation: []string{},
|
||||
ReceiptsGetOperation: []string{},
|
||||
ReceiptsPostOperation: []string{},
|
||||
ReceiptsReceiptIDGetOperation: []string{},
|
||||
RefundsGetOperation: []string{},
|
||||
RefundsPostOperation: []string{},
|
||||
RefundsRefundIDGetOperation: []string{},
|
||||
SbpBanksGetOperation: []string{},
|
||||
WebhooksGetOperation: []string{},
|
||||
WebhooksPostOperation: []string{},
|
||||
WebhooksWebhookIDDeleteOperation: []string{},
|
||||
}
|
||||
|
||||
// GetOAuth2ScopesForOAuth2 returns the required OAuth2 scopes for the given operation.
|
||||
//
|
||||
// This is useful for token exchange scenarios where you need to know which scopes
|
||||
// to request when obtaining a token for a downstream API call.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// requiredScopes := GetOAuth2ScopesForOAuth2(AddPetOperation)
|
||||
// token := exchangeTokenWithScopes(requiredScopes, "https://api.example.com")
|
||||
//
|
||||
// Returns nil if the operation has no scope requirements or if the operation is unknown.
|
||||
func GetOAuth2ScopesForOAuth2(operation string) []string {
|
||||
scopes, ok := oauth2ScopesOAuth2[operation]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
// Return a copy to prevent external modification
|
||||
result := make([]string, len(scopes))
|
||||
copy(result, scopes)
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *Server) securityBasicAuth(ctx context.Context, operationName OperationName, req *http.Request) (context.Context, bool, error) {
|
||||
var t BasicAuth
|
||||
if _, ok := findAuthorization(req.Header, "Basic"); !ok {
|
||||
return ctx, false, nil
|
||||
}
|
||||
username, password, ok := req.BasicAuth()
|
||||
if !ok {
|
||||
return nil, false, errors.New("invalid basic auth")
|
||||
}
|
||||
t.Username = username
|
||||
t.Password = password
|
||||
t.Roles = operationRolesBasicAuth[operationName]
|
||||
rctx, err := s.sec.HandleBasicAuth(ctx, operationName, t)
|
||||
if errors.Is(err, ogenerrors.ErrSkipServerSecurity) {
|
||||
return nil, false, nil
|
||||
} else if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
return rctx, true, err
|
||||
}
|
||||
|
||||
func (s *Server) securityOAuth2(ctx context.Context, operationName OperationName, req *http.Request) (context.Context, bool, error) {
|
||||
var t OAuth2
|
||||
token, ok := findAuthorization(req.Header, "Bearer")
|
||||
if !ok {
|
||||
return ctx, false, nil
|
||||
}
|
||||
t.Token = token
|
||||
t.Scopes = oauth2ScopesOAuth2[operationName]
|
||||
rctx, err := s.sec.HandleOAuth2(ctx, operationName, t)
|
||||
if errors.Is(err, ogenerrors.ErrSkipServerSecurity) {
|
||||
return nil, false, nil
|
||||
} else if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
return rctx, true, err
|
||||
}
|
||||
|
||||
// SecuritySource is provider of security values (tokens, passwords, etc.).
|
||||
type SecuritySource interface {
|
||||
// BasicAuth provides BasicAuth security value.
|
||||
// HTTP Basic аутентификация клиента ЮKassa.
|
||||
BasicAuth(ctx context.Context, operationName OperationName) (BasicAuth, error)
|
||||
// OAuth2 provides OAuth2 security value.
|
||||
// Авторизация клиента ЮKassa с использованием OAuth-токена.
|
||||
OAuth2(ctx context.Context, operationName OperationName) (OAuth2, error)
|
||||
}
|
||||
|
||||
func (s *Client) securityBasicAuth(ctx context.Context, operationName OperationName, req *http.Request) error {
|
||||
t, err := s.sec.BasicAuth(ctx, operationName)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "security source \"BasicAuth\"")
|
||||
}
|
||||
req.SetBasicAuth(t.Username, t.Password)
|
||||
return nil
|
||||
}
|
||||
func (s *Client) securityOAuth2(ctx context.Context, operationName OperationName, req *http.Request) error {
|
||||
t, err := s.sec.OAuth2(ctx, operationName)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "security source \"OAuth2\"")
|
||||
}
|
||||
req.Header.Set("Authorization", "Bearer "+t.Token)
|
||||
return nil
|
||||
}
|
||||
316
internal/service/yookassa/gen/oas_server_gen.go
Normal file
316
internal/service/yookassa/gen/oas_server_gen.go
Normal file
@@ -0,0 +1,316 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// Handler handles operations described by OpenAPI v3 specification.
|
||||
type Handler interface {
|
||||
// DealsDealIDGet implements GET /deals/{deal_id} operation.
|
||||
//
|
||||
// Запрос позволяет получить информацию о текущем
|
||||
// состоянии сделки по ее уникальному идентификатору.
|
||||
//
|
||||
// GET /deals/{deal_id}
|
||||
DealsDealIDGet(ctx context.Context, params DealsDealIDGetParams) (DealsDealIDGetRes, error)
|
||||
// DealsGet implements GET /deals operation.
|
||||
//
|
||||
// Запрос позволяет получить список сделок,
|
||||
// отфильтрованный по заданным критериям. Подробнее о
|
||||
// работе со списками: https://yookassa.ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /deals
|
||||
DealsGet(ctx context.Context, params DealsGetParams) (DealsGetRes, error)
|
||||
// DealsPost implements POST /deals operation.
|
||||
//
|
||||
// Запрос позволяет создать сделку, в рамках которой
|
||||
// необходимо принять оплату от покупателя и
|
||||
// перечислить ее продавцу.
|
||||
//
|
||||
// POST /deals
|
||||
DealsPost(ctx context.Context, req *SafeDealRequest, params DealsPostParams) (DealsPostRes, error)
|
||||
// MeGet implements GET /me operation.
|
||||
//
|
||||
// С помощью этого запроса вы можете получить
|
||||
// информацию о магазине или шлюзе: * Для Сплитования
|
||||
// платежей: https://yookassa.ru/developers/solutions-for-platforms/split-payments/basics: в
|
||||
// запросе необходимо передать параметр on_behalf_of с
|
||||
// идентификатором магазина продавца и ваши данные для
|
||||
// аутентификации: https://yookassa.ru/developers/using-api/interaction-format#auth
|
||||
// (идентификатор и секретный ключ вашей платформы). *
|
||||
// Для партнеров: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/partners-api/basics: в запросе необходимо
|
||||
// передать OAuth-токен магазина. * Для выплат: https://yookassa.
|
||||
// ru/developers/payouts/overview: в запросе необходимо передать ваши
|
||||
// данные для аутентификации: https://yookassa.
|
||||
// ru/developers/using-api/interaction-format#auth (идентификатор и секретный
|
||||
// ключ вашего шлюза).
|
||||
//
|
||||
// GET /me
|
||||
MeGet(ctx context.Context, params MeGetParams) (MeGetRes, error)
|
||||
// PaymentMethodsPaymentMethodIDGet implements GET /payment_methods/{payment_method_id} operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы получить информацию о
|
||||
// текущем состоянии способа оплаты по его уникальному
|
||||
// идентификатору.
|
||||
//
|
||||
// GET /payment_methods/{payment_method_id}
|
||||
PaymentMethodsPaymentMethodIDGet(ctx context.Context, params PaymentMethodsPaymentMethodIDGetParams) (PaymentMethodsPaymentMethodIDGetRes, error)
|
||||
// PaymentMethodsPost implements POST /payment_methods operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы создать в ЮKassa объект
|
||||
// способа оплаты: https://yookassa.ru/developers/api#payment_method_object. В
|
||||
// запросе необходимо передать код способа оплаты,
|
||||
// который вы хотите сохранить, и при необходимости
|
||||
// дополнительные параметры, связанные с той
|
||||
// функциональностью, которую вы хотите использовать.
|
||||
// Идентификатор созданного способа оплаты вы можете
|
||||
// использовать при проведении автоплатежей: https://yookassa.
|
||||
// ru/developers/payment-acceptance/scenario-extensions/recurring-payments/create-recurring или
|
||||
// выплат: https://yookassa.ru/developers/payouts/scenario-extensions/multipurpose-token.
|
||||
//
|
||||
// POST /payment_methods
|
||||
PaymentMethodsPost(ctx context.Context, req PaymentMethodsPostReq, params PaymentMethodsPostParams) (PaymentMethodsPostRes, error)
|
||||
// PaymentsGet implements GET /payments operation.
|
||||
//
|
||||
// Use this request to get a list of payments. You can download payments created over the last 3
|
||||
// years. You can filter the list by specified criteria. More about working with lists:
|
||||
// https://yookassa.ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /payments
|
||||
PaymentsGet(ctx context.Context, params PaymentsGetParams) (PaymentsGetRes, error)
|
||||
// PaymentsPaymentIDCancelPost implements POST /payments/{payment_id}/cancel operation.
|
||||
//
|
||||
// Cancel payments with the waiting_for_capture status. Payment cancelation means you are not ready
|
||||
// to dispatch a product or to provide a service to the user. Once you cancel the payment, we will
|
||||
// start returning the money to the payer’s account. If the payment was made from a bank card, a
|
||||
// YooMoney wallet, or via SberPay, the money will be refunded instantly. If the payment was made
|
||||
// using other payment methods, the process can take up to several days. More about capturing and
|
||||
// canceling payments: https://yookassa.
|
||||
// ru/developers/payment-acceptance/getting-started/payment-process#capture-and-cancel.
|
||||
//
|
||||
// POST /payments/{payment_id}/cancel
|
||||
PaymentsPaymentIDCancelPost(ctx context.Context, params PaymentsPaymentIDCancelPostParams) (PaymentsPaymentIDCancelPostRes, error)
|
||||
// PaymentsPaymentIDCapturePost implements POST /payments/{payment_id}/capture operation.
|
||||
//
|
||||
// Confirm you’re ready to accept the payment. Once the payment is captured, the status will change
|
||||
// to succeeded. After that, you can provide the customer with the product or service. You can only
|
||||
// capture payments with the waiting_for_capture status, and only for a certain amount of time
|
||||
// (depending on the payment method). If you do not capture the payment within the allotted time, the
|
||||
// status will change to canceled, and the money will be returned to the user. More about capturing
|
||||
// and canceling payments: https://yookassa.
|
||||
// ru/developers/payment-acceptance/getting-started/payment-process#capture-and-cancel.
|
||||
//
|
||||
// POST /payments/{payment_id}/capture
|
||||
PaymentsPaymentIDCapturePost(ctx context.Context, req *PaymentsPaymentIDCapturePostReq, params PaymentsPaymentIDCapturePostParams) (PaymentsPaymentIDCapturePostRes, error)
|
||||
// PaymentsPaymentIDGet implements GET /payments/{payment_id} operation.
|
||||
//
|
||||
// This request allows you to get the information about the current payment status by its unique ID.
|
||||
//
|
||||
// GET /payments/{payment_id}
|
||||
PaymentsPaymentIDGet(ctx context.Context, params PaymentsPaymentIDGetParams) (PaymentsPaymentIDGetRes, error)
|
||||
// PaymentsPost implements POST /payments operation.
|
||||
//
|
||||
// To accept a payment, you need to create a payment object: https://yookassa.
|
||||
// ru/developers/api#payment_object, Payment. It contains all the necessary payment information
|
||||
// (amount, currency, and status). Payments have a linear life cycle, going from one status to the
|
||||
// next sequentially.
|
||||
//
|
||||
// POST /payments
|
||||
PaymentsPost(ctx context.Context, req *PaymentsPostReq, params PaymentsPostParams) (PaymentsPostRes, error)
|
||||
// PayoutsGet implements GET /payouts operation.
|
||||
//
|
||||
// Use this request to get a list of payouts. You can download payments created over the last 3 years.
|
||||
// You can filter the list by specified criteria. Request authentication details: https://yookassa.
|
||||
// ru/developers/using-api/interaction-format#auth depend on which payment solution you are using:
|
||||
// basic payouts: https://yookassa.ru/developers/payouts/overview or payouts within the Safe Deal:
|
||||
// https://yookassa.ru/developers/solutions-for-platforms/safe-deal/basics. More about working with
|
||||
// lists: https://yookassa.ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /payouts
|
||||
PayoutsGet(ctx context.Context, params PayoutsGetParams) (PayoutsGetRes, error)
|
||||
// PayoutsPayoutIDGet implements GET /payouts/{payout_id} operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы получить информацию о
|
||||
// текущем состоянии выплаты по ее уникальному
|
||||
// идентификатору. Данные для аутентификации: https://yookassa.
|
||||
// ru/developers/using-api/interaction-format#auth запросов зависят от того,
|
||||
// какое платежное решение вы используете — обычные
|
||||
// выплаты: https://yookassa.ru/developers/payouts/overview или выплаты в
|
||||
// рамках Безопасной сделки: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/safe-deal/basics.
|
||||
//
|
||||
// GET /payouts/{payout_id}
|
||||
PayoutsPayoutIDGet(ctx context.Context, params PayoutsPayoutIDGetParams) (PayoutsPayoutIDGetRes, error)
|
||||
// PayoutsPost implements POST /payouts operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы создать в ЮKassa объект
|
||||
// выплаты: https://yookassa.ru/developers/api#payout_object. В запросе
|
||||
// необходимо передать сумму выплаты, данные о способе
|
||||
// получения выплаты (например, номер кошелька ЮMoney),
|
||||
// описание выплаты и при необходимости дополнительные
|
||||
// параметры, связанные с той функциональностью,
|
||||
// которую вы хотите использовать. Передаваемые
|
||||
// параметры и данные для аутентификации: https://yookassa.
|
||||
// ru/developers/using-api/interaction-format#auth запросов зависят от того,
|
||||
// какое платежное решение вы используете — обычные
|
||||
// выплаты: https://yookassa.ru/developers/payouts/overview или выплаты в
|
||||
// рамках Безопасной сделки: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/safe-deal/basics.
|
||||
//
|
||||
// POST /payouts
|
||||
PayoutsPost(ctx context.Context, req *PayoutRequest, params PayoutsPostParams) (PayoutsPostRes, error)
|
||||
// PayoutsSearchGet implements GET /payouts/search operation.
|
||||
//
|
||||
// Use this request to search for payouts by the specified criteria. Available only for payouts
|
||||
// created over the last 3 months. At this time, only search by the metadata parameter is available.
|
||||
// You can also specify the date and time when the payout was created (the created_at parameter).
|
||||
// Request authentication details: https://yookassa.ru/developers/using-api/interaction-format#auth
|
||||
// depend on which payment solution you are using: basic payouts: https://yookassa.
|
||||
// ru/developers/payouts/overview or payouts within the Safe Deal: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/safe-deal/basics.
|
||||
//
|
||||
// GET /payouts/search
|
||||
PayoutsSearchGet(ctx context.Context, params PayoutsSearchGetParams) (PayoutsSearchGetRes, error)
|
||||
// PersonalDataPersonalDataIDGet implements GET /personal_data/{personal_data_id} operation.
|
||||
//
|
||||
// С помощью этого запроса вы можете получить
|
||||
// информацию о текущем статусе объекта персональных
|
||||
// данных по его уникальному идентификатору.
|
||||
//
|
||||
// GET /personal_data/{personal_data_id}
|
||||
PersonalDataPersonalDataIDGet(ctx context.Context, params PersonalDataPersonalDataIDGetParams) (PersonalDataPersonalDataIDGetRes, error)
|
||||
// PersonalDataPost implements POST /personal_data operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы создать в ЮKassa объект
|
||||
// персональных данных: https://yookassa.ru/developers/api#personal_data_object. В
|
||||
// запросе необходимо указать тип данных (с какой целью
|
||||
// они будут использоваться) и передать информацию о
|
||||
// пользователе: фамилию, имя, отчество и другие — в
|
||||
// зависимости от выбранного типа. Идентификатор
|
||||
// созданного объекта персональных данных необходимо
|
||||
// использовать в запросе на создание выплаты: https://yookassa.
|
||||
// ru/developers/api#create_payout.
|
||||
//
|
||||
// POST /personal_data
|
||||
PersonalDataPost(ctx context.Context, req PersonalDataPostReq, params PersonalDataPostParams) (PersonalDataPostRes, error)
|
||||
// ReceiptsGet implements GET /receipts operation.
|
||||
//
|
||||
// Запрос позволяет получить список чеков,
|
||||
// отфильтрованный по заданным критериям. Можно
|
||||
// запросить чеки по конкретному платежу, чеки по
|
||||
// конкретному возврату или все чеки магазина.
|
||||
// Подробнее о работе со списками: https://yookassa.
|
||||
// ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /receipts
|
||||
ReceiptsGet(ctx context.Context, params ReceiptsGetParams) (ReceiptsGetRes, error)
|
||||
// ReceiptsPost implements POST /receipts operation.
|
||||
//
|
||||
// Используйте этот запрос при оплате с соблюдением
|
||||
// требований 54-ФЗ: https://yookassa.
|
||||
// ru/developers/payment-acceptance/receipts/54fz/basics, чтобы создать чек
|
||||
// зачета предоплаты. Если вы работаете по сценарию
|
||||
// Сначала платеж, потом чек: https://yookassa.
|
||||
// ru/developers/payment-acceptance/receipts/54fz/other-services/basics#receipt-after-payment, в
|
||||
// запросе также нужно передавать данные для
|
||||
// формирования чека прихода и чека возврата прихода.
|
||||
//
|
||||
// POST /receipts
|
||||
ReceiptsPost(ctx context.Context, req PostReceiptData, params ReceiptsPostParams) (ReceiptsPostRes, error)
|
||||
// ReceiptsReceiptIDGet implements GET /receipts/{receipt_id} operation.
|
||||
//
|
||||
// Запрос позволяет получить информацию о текущем
|
||||
// состоянии чека по его уникальному идентификатору.
|
||||
//
|
||||
// GET /receipts/{receipt_id}
|
||||
ReceiptsReceiptIDGet(ctx context.Context, params ReceiptsReceiptIDGetParams) (ReceiptsReceiptIDGetRes, error)
|
||||
// RefundsGet implements GET /refunds operation.
|
||||
//
|
||||
// Use this request to get a list of refunds. You can download refunds created over the last 3 years.
|
||||
// You can filter the list by specified criteria. More about working with lists: https://yookassa.
|
||||
// ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /refunds
|
||||
RefundsGet(ctx context.Context, params RefundsGetParams) (RefundsGetRes, error)
|
||||
// RefundsPost implements POST /refunds operation.
|
||||
//
|
||||
// Создает возврат успешного платежа на указанную сумму.
|
||||
// Платеж можно вернуть только в течение трех лет с
|
||||
// момента его создания: https://yookassa.ru/developers/api#create_payment.
|
||||
// Комиссия ЮKassa за проведение платежа не возвращается.
|
||||
//
|
||||
// POST /refunds
|
||||
RefundsPost(ctx context.Context, req *RefundsPostReq, params RefundsPostParams) (RefundsPostRes, error)
|
||||
// RefundsRefundIDGet implements GET /refunds/{refund_id} operation.
|
||||
//
|
||||
// Запрос позволяет получить информацию о текущем
|
||||
// состоянии возврата по его уникальному
|
||||
// идентификатору.
|
||||
//
|
||||
// GET /refunds/{refund_id}
|
||||
RefundsRefundIDGet(ctx context.Context, params RefundsRefundIDGetParams) (RefundsRefundIDGetRes, error)
|
||||
// SbpBanksGet implements GET /sbp_banks operation.
|
||||
//
|
||||
// С помощью этого запроса вы можете получить
|
||||
// актуальный список всех участников СБП. Список нужно
|
||||
// вывести получателю выплаты, идентификатор
|
||||
// выбранного участника СБП необходимо использовать в
|
||||
// запросе на создание выплаты: https://yookassa.
|
||||
// ru/developers/api#create_payout. Подробнее о выплатах через СБП:
|
||||
// https://yookassa.ru/developers/payouts/making-payouts/sbp.
|
||||
//
|
||||
// GET /sbp_banks
|
||||
SbpBanksGet(ctx context.Context) (SbpBanksGetRes, error)
|
||||
// WebhooksGet implements GET /webhooks operation.
|
||||
//
|
||||
// Запрос позволяет узнать, какие webhook есть для
|
||||
// переданного OAuth-токена.
|
||||
//
|
||||
// GET /webhooks
|
||||
WebhooksGet(ctx context.Context) (WebhooksGetRes, error)
|
||||
// WebhooksPost implements POST /webhooks operation.
|
||||
//
|
||||
// Запрос позволяет подписаться на уведомления о
|
||||
// событиях: https://yookassa.ru/developers/using-api/webhooks#events (например,
|
||||
// переход платежа в статус succeeded). C помощью webhook можно
|
||||
// подписаться только на события платежей и возвратов.
|
||||
// Если вы хотите получать уведомления о нескольких
|
||||
// событиях, вам нужно для каждого из них создать свой
|
||||
// webhook. Для каждого OAuth-токена нужно создавать свой
|
||||
// набор webhook.
|
||||
//
|
||||
// POST /webhooks
|
||||
WebhooksPost(ctx context.Context, req *WebhooksPostReq, params WebhooksPostParams) (WebhooksPostRes, error)
|
||||
// WebhooksWebhookIDDelete implements DELETE /webhooks/{webhook_id} operation.
|
||||
//
|
||||
// Запрос позволяет отписаться от уведомлений о событии
|
||||
// для переданного OAuth-токена. Чтобы удалить webhook, вам
|
||||
// нужно передать в запросе его идентификатор.
|
||||
//
|
||||
// DELETE /webhooks/{webhook_id}
|
||||
WebhooksWebhookIDDelete(ctx context.Context, params WebhooksWebhookIDDeleteParams) (WebhooksWebhookIDDeleteRes, error)
|
||||
}
|
||||
|
||||
// Server implements http server based on OpenAPI v3 specification and
|
||||
// calls Handler to handle requests.
|
||||
type Server struct {
|
||||
h Handler
|
||||
sec SecurityHandler
|
||||
baseServer
|
||||
}
|
||||
|
||||
// NewServer creates new Server.
|
||||
func NewServer(h Handler, sec SecurityHandler, opts ...ServerOption) (*Server, error) {
|
||||
s, err := newServerConfig(opts...).baseServer()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Server{
|
||||
h: h,
|
||||
sec: sec,
|
||||
baseServer: s,
|
||||
}, nil
|
||||
}
|
||||
383
internal/service/yookassa/gen/oas_unimplemented_gen.go
Normal file
383
internal/service/yookassa/gen/oas_unimplemented_gen.go
Normal file
@@ -0,0 +1,383 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
ht "github.com/ogen-go/ogen/http"
|
||||
)
|
||||
|
||||
// UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
|
||||
type UnimplementedHandler struct{}
|
||||
|
||||
var _ Handler = UnimplementedHandler{}
|
||||
|
||||
// DealsDealIDGet implements GET /deals/{deal_id} operation.
|
||||
//
|
||||
// Запрос позволяет получить информацию о текущем
|
||||
// состоянии сделки по ее уникальному идентификатору.
|
||||
//
|
||||
// GET /deals/{deal_id}
|
||||
func (UnimplementedHandler) DealsDealIDGet(ctx context.Context, params DealsDealIDGetParams) (r DealsDealIDGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// DealsGet implements GET /deals operation.
|
||||
//
|
||||
// Запрос позволяет получить список сделок,
|
||||
// отфильтрованный по заданным критериям. Подробнее о
|
||||
// работе со списками: https://yookassa.ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /deals
|
||||
func (UnimplementedHandler) DealsGet(ctx context.Context, params DealsGetParams) (r DealsGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// DealsPost implements POST /deals operation.
|
||||
//
|
||||
// Запрос позволяет создать сделку, в рамках которой
|
||||
// необходимо принять оплату от покупателя и
|
||||
// перечислить ее продавцу.
|
||||
//
|
||||
// POST /deals
|
||||
func (UnimplementedHandler) DealsPost(ctx context.Context, req *SafeDealRequest, params DealsPostParams) (r DealsPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// MeGet implements GET /me operation.
|
||||
//
|
||||
// С помощью этого запроса вы можете получить
|
||||
// информацию о магазине или шлюзе: * Для Сплитования
|
||||
// платежей: https://yookassa.ru/developers/solutions-for-platforms/split-payments/basics: в
|
||||
// запросе необходимо передать параметр on_behalf_of с
|
||||
// идентификатором магазина продавца и ваши данные для
|
||||
// аутентификации: https://yookassa.ru/developers/using-api/interaction-format#auth
|
||||
// (идентификатор и секретный ключ вашей платформы). *
|
||||
// Для партнеров: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/partners-api/basics: в запросе необходимо
|
||||
// передать OAuth-токен магазина. * Для выплат: https://yookassa.
|
||||
// ru/developers/payouts/overview: в запросе необходимо передать ваши
|
||||
// данные для аутентификации: https://yookassa.
|
||||
// ru/developers/using-api/interaction-format#auth (идентификатор и секретный
|
||||
// ключ вашего шлюза).
|
||||
//
|
||||
// GET /me
|
||||
func (UnimplementedHandler) MeGet(ctx context.Context, params MeGetParams) (r MeGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PaymentMethodsPaymentMethodIDGet implements GET /payment_methods/{payment_method_id} operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы получить информацию о
|
||||
// текущем состоянии способа оплаты по его уникальному
|
||||
// идентификатору.
|
||||
//
|
||||
// GET /payment_methods/{payment_method_id}
|
||||
func (UnimplementedHandler) PaymentMethodsPaymentMethodIDGet(ctx context.Context, params PaymentMethodsPaymentMethodIDGetParams) (r PaymentMethodsPaymentMethodIDGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PaymentMethodsPost implements POST /payment_methods operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы создать в ЮKassa объект
|
||||
// способа оплаты: https://yookassa.ru/developers/api#payment_method_object. В
|
||||
// запросе необходимо передать код способа оплаты,
|
||||
// который вы хотите сохранить, и при необходимости
|
||||
// дополнительные параметры, связанные с той
|
||||
// функциональностью, которую вы хотите использовать.
|
||||
// Идентификатор созданного способа оплаты вы можете
|
||||
// использовать при проведении автоплатежей: https://yookassa.
|
||||
// ru/developers/payment-acceptance/scenario-extensions/recurring-payments/create-recurring или
|
||||
// выплат: https://yookassa.ru/developers/payouts/scenario-extensions/multipurpose-token.
|
||||
//
|
||||
// POST /payment_methods
|
||||
func (UnimplementedHandler) PaymentMethodsPost(ctx context.Context, req PaymentMethodsPostReq, params PaymentMethodsPostParams) (r PaymentMethodsPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PaymentsGet implements GET /payments operation.
|
||||
//
|
||||
// Use this request to get a list of payments. You can download payments created over the last 3
|
||||
// years. You can filter the list by specified criteria. More about working with lists:
|
||||
// https://yookassa.ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /payments
|
||||
func (UnimplementedHandler) PaymentsGet(ctx context.Context, params PaymentsGetParams) (r PaymentsGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PaymentsPaymentIDCancelPost implements POST /payments/{payment_id}/cancel operation.
|
||||
//
|
||||
// Cancel payments with the waiting_for_capture status. Payment cancelation means you are not ready
|
||||
// to dispatch a product or to provide a service to the user. Once you cancel the payment, we will
|
||||
// start returning the money to the payer’s account. If the payment was made from a bank card, a
|
||||
// YooMoney wallet, or via SberPay, the money will be refunded instantly. If the payment was made
|
||||
// using other payment methods, the process can take up to several days. More about capturing and
|
||||
// canceling payments: https://yookassa.
|
||||
// ru/developers/payment-acceptance/getting-started/payment-process#capture-and-cancel.
|
||||
//
|
||||
// POST /payments/{payment_id}/cancel
|
||||
func (UnimplementedHandler) PaymentsPaymentIDCancelPost(ctx context.Context, params PaymentsPaymentIDCancelPostParams) (r PaymentsPaymentIDCancelPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PaymentsPaymentIDCapturePost implements POST /payments/{payment_id}/capture operation.
|
||||
//
|
||||
// Confirm you’re ready to accept the payment. Once the payment is captured, the status will change
|
||||
// to succeeded. After that, you can provide the customer with the product or service. You can only
|
||||
// capture payments with the waiting_for_capture status, and only for a certain amount of time
|
||||
// (depending on the payment method). If you do not capture the payment within the allotted time, the
|
||||
// status will change to canceled, and the money will be returned to the user. More about capturing
|
||||
// and canceling payments: https://yookassa.
|
||||
// ru/developers/payment-acceptance/getting-started/payment-process#capture-and-cancel.
|
||||
//
|
||||
// POST /payments/{payment_id}/capture
|
||||
func (UnimplementedHandler) PaymentsPaymentIDCapturePost(ctx context.Context, req *PaymentsPaymentIDCapturePostReq, params PaymentsPaymentIDCapturePostParams) (r PaymentsPaymentIDCapturePostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PaymentsPaymentIDGet implements GET /payments/{payment_id} operation.
|
||||
//
|
||||
// This request allows you to get the information about the current payment status by its unique ID.
|
||||
//
|
||||
// GET /payments/{payment_id}
|
||||
func (UnimplementedHandler) PaymentsPaymentIDGet(ctx context.Context, params PaymentsPaymentIDGetParams) (r PaymentsPaymentIDGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PaymentsPost implements POST /payments operation.
|
||||
//
|
||||
// To accept a payment, you need to create a payment object: https://yookassa.
|
||||
// ru/developers/api#payment_object, Payment. It contains all the necessary payment information
|
||||
// (amount, currency, and status). Payments have a linear life cycle, going from one status to the
|
||||
// next sequentially.
|
||||
//
|
||||
// POST /payments
|
||||
func (UnimplementedHandler) PaymentsPost(ctx context.Context, req *PaymentsPostReq, params PaymentsPostParams) (r PaymentsPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PayoutsGet implements GET /payouts operation.
|
||||
//
|
||||
// Use this request to get a list of payouts. You can download payments created over the last 3 years.
|
||||
//
|
||||
// You can filter the list by specified criteria. Request authentication details: https://yookassa.
|
||||
//
|
||||
// ru/developers/using-api/interaction-format#auth depend on which payment solution you are using:
|
||||
// basic payouts: https://yookassa.ru/developers/payouts/overview or payouts within the Safe Deal:
|
||||
// https://yookassa.ru/developers/solutions-for-platforms/safe-deal/basics. More about working with
|
||||
// lists: https://yookassa.ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /payouts
|
||||
func (UnimplementedHandler) PayoutsGet(ctx context.Context, params PayoutsGetParams) (r PayoutsGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PayoutsPayoutIDGet implements GET /payouts/{payout_id} operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы получить информацию о
|
||||
// текущем состоянии выплаты по ее уникальному
|
||||
// идентификатору. Данные для аутентификации: https://yookassa.
|
||||
// ru/developers/using-api/interaction-format#auth запросов зависят от того,
|
||||
// какое платежное решение вы используете — обычные
|
||||
// выплаты: https://yookassa.ru/developers/payouts/overview или выплаты в
|
||||
// рамках Безопасной сделки: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/safe-deal/basics.
|
||||
//
|
||||
// GET /payouts/{payout_id}
|
||||
func (UnimplementedHandler) PayoutsPayoutIDGet(ctx context.Context, params PayoutsPayoutIDGetParams) (r PayoutsPayoutIDGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PayoutsPost implements POST /payouts operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы создать в ЮKassa объект
|
||||
// выплаты: https://yookassa.ru/developers/api#payout_object. В запросе
|
||||
// необходимо передать сумму выплаты, данные о способе
|
||||
// получения выплаты (например, номер кошелька ЮMoney),
|
||||
// описание выплаты и при необходимости дополнительные
|
||||
// параметры, связанные с той функциональностью,
|
||||
// которую вы хотите использовать. Передаваемые
|
||||
// параметры и данные для аутентификации: https://yookassa.
|
||||
// ru/developers/using-api/interaction-format#auth запросов зависят от того,
|
||||
// какое платежное решение вы используете — обычные
|
||||
// выплаты: https://yookassa.ru/developers/payouts/overview или выплаты в
|
||||
// рамках Безопасной сделки: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/safe-deal/basics.
|
||||
//
|
||||
// POST /payouts
|
||||
func (UnimplementedHandler) PayoutsPost(ctx context.Context, req *PayoutRequest, params PayoutsPostParams) (r PayoutsPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PayoutsSearchGet implements GET /payouts/search operation.
|
||||
//
|
||||
// Use this request to search for payouts by the specified criteria. Available only for payouts
|
||||
// created over the last 3 months. At this time, only search by the metadata parameter is available.
|
||||
// You can also specify the date and time when the payout was created (the created_at parameter).
|
||||
// Request authentication details: https://yookassa.ru/developers/using-api/interaction-format#auth
|
||||
// depend on which payment solution you are using: basic payouts: https://yookassa.
|
||||
// ru/developers/payouts/overview or payouts within the Safe Deal: https://yookassa.
|
||||
// ru/developers/solutions-for-platforms/safe-deal/basics.
|
||||
//
|
||||
// GET /payouts/search
|
||||
func (UnimplementedHandler) PayoutsSearchGet(ctx context.Context, params PayoutsSearchGetParams) (r PayoutsSearchGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PersonalDataPersonalDataIDGet implements GET /personal_data/{personal_data_id} operation.
|
||||
//
|
||||
// С помощью этого запроса вы можете получить
|
||||
// информацию о текущем статусе объекта персональных
|
||||
// данных по его уникальному идентификатору.
|
||||
//
|
||||
// GET /personal_data/{personal_data_id}
|
||||
func (UnimplementedHandler) PersonalDataPersonalDataIDGet(ctx context.Context, params PersonalDataPersonalDataIDGetParams) (r PersonalDataPersonalDataIDGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// PersonalDataPost implements POST /personal_data operation.
|
||||
//
|
||||
// Используйте этот запрос, чтобы создать в ЮKassa объект
|
||||
// персональных данных: https://yookassa.ru/developers/api#personal_data_object. В
|
||||
// запросе необходимо указать тип данных (с какой целью
|
||||
// они будут использоваться) и передать информацию о
|
||||
// пользователе: фамилию, имя, отчество и другие — в
|
||||
// зависимости от выбранного типа. Идентификатор
|
||||
// созданного объекта персональных данных необходимо
|
||||
// использовать в запросе на создание выплаты: https://yookassa.
|
||||
// ru/developers/api#create_payout.
|
||||
//
|
||||
// POST /personal_data
|
||||
func (UnimplementedHandler) PersonalDataPost(ctx context.Context, req PersonalDataPostReq, params PersonalDataPostParams) (r PersonalDataPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ReceiptsGet implements GET /receipts operation.
|
||||
//
|
||||
// Запрос позволяет получить список чеков,
|
||||
// отфильтрованный по заданным критериям. Можно
|
||||
// запросить чеки по конкретному платежу, чеки по
|
||||
// конкретному возврату или все чеки магазина.
|
||||
// Подробнее о работе со списками: https://yookassa.
|
||||
// ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /receipts
|
||||
func (UnimplementedHandler) ReceiptsGet(ctx context.Context, params ReceiptsGetParams) (r ReceiptsGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ReceiptsPost implements POST /receipts operation.
|
||||
//
|
||||
// Используйте этот запрос при оплате с соблюдением
|
||||
// требований 54-ФЗ: https://yookassa.
|
||||
// ru/developers/payment-acceptance/receipts/54fz/basics, чтобы создать чек
|
||||
// зачета предоплаты. Если вы работаете по сценарию
|
||||
// Сначала платеж, потом чек: https://yookassa.
|
||||
// ru/developers/payment-acceptance/receipts/54fz/other-services/basics#receipt-after-payment, в
|
||||
// запросе также нужно передавать данные для
|
||||
// формирования чека прихода и чека возврата прихода.
|
||||
//
|
||||
// POST /receipts
|
||||
func (UnimplementedHandler) ReceiptsPost(ctx context.Context, req PostReceiptData, params ReceiptsPostParams) (r ReceiptsPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ReceiptsReceiptIDGet implements GET /receipts/{receipt_id} operation.
|
||||
//
|
||||
// Запрос позволяет получить информацию о текущем
|
||||
// состоянии чека по его уникальному идентификатору.
|
||||
//
|
||||
// GET /receipts/{receipt_id}
|
||||
func (UnimplementedHandler) ReceiptsReceiptIDGet(ctx context.Context, params ReceiptsReceiptIDGetParams) (r ReceiptsReceiptIDGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// RefundsGet implements GET /refunds operation.
|
||||
//
|
||||
// Use this request to get a list of refunds. You can download refunds created over the last 3 years.
|
||||
// You can filter the list by specified criteria. More about working with lists: https://yookassa.
|
||||
// ru/developers/using-api/lists.
|
||||
//
|
||||
// GET /refunds
|
||||
func (UnimplementedHandler) RefundsGet(ctx context.Context, params RefundsGetParams) (r RefundsGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// RefundsPost implements POST /refunds operation.
|
||||
//
|
||||
// Создает возврат успешного платежа на указанную сумму.
|
||||
//
|
||||
// Платеж можно вернуть только в течение трех лет с
|
||||
//
|
||||
// момента его создания: https://yookassa.ru/developers/api#create_payment.
|
||||
// Комиссия ЮKassa за проведение платежа не возвращается.
|
||||
//
|
||||
// POST /refunds
|
||||
func (UnimplementedHandler) RefundsPost(ctx context.Context, req *RefundsPostReq, params RefundsPostParams) (r RefundsPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// RefundsRefundIDGet implements GET /refunds/{refund_id} operation.
|
||||
//
|
||||
// Запрос позволяет получить информацию о текущем
|
||||
// состоянии возврата по его уникальному
|
||||
// идентификатору.
|
||||
//
|
||||
// GET /refunds/{refund_id}
|
||||
func (UnimplementedHandler) RefundsRefundIDGet(ctx context.Context, params RefundsRefundIDGetParams) (r RefundsRefundIDGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// SbpBanksGet implements GET /sbp_banks operation.
|
||||
//
|
||||
// С помощью этого запроса вы можете получить
|
||||
// актуальный список всех участников СБП. Список нужно
|
||||
// вывести получателю выплаты, идентификатор
|
||||
// выбранного участника СБП необходимо использовать в
|
||||
// запросе на создание выплаты: https://yookassa.
|
||||
// ru/developers/api#create_payout. Подробнее о выплатах через СБП:
|
||||
// https://yookassa.ru/developers/payouts/making-payouts/sbp.
|
||||
//
|
||||
// GET /sbp_banks
|
||||
func (UnimplementedHandler) SbpBanksGet(ctx context.Context) (r SbpBanksGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// WebhooksGet implements GET /webhooks operation.
|
||||
//
|
||||
// Запрос позволяет узнать, какие webhook есть для
|
||||
// переданного OAuth-токена.
|
||||
//
|
||||
// GET /webhooks
|
||||
func (UnimplementedHandler) WebhooksGet(ctx context.Context) (r WebhooksGetRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// WebhooksPost implements POST /webhooks operation.
|
||||
//
|
||||
// Запрос позволяет подписаться на уведомления о
|
||||
// событиях: https://yookassa.ru/developers/using-api/webhooks#events (например,
|
||||
// переход платежа в статус succeeded). C помощью webhook можно
|
||||
// подписаться только на события платежей и возвратов.
|
||||
// Если вы хотите получать уведомления о нескольких
|
||||
// событиях, вам нужно для каждого из них создать свой
|
||||
// webhook. Для каждого OAuth-токена нужно создавать свой
|
||||
// набор webhook.
|
||||
//
|
||||
// POST /webhooks
|
||||
func (UnimplementedHandler) WebhooksPost(ctx context.Context, req *WebhooksPostReq, params WebhooksPostParams) (r WebhooksPostRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// WebhooksWebhookIDDelete implements DELETE /webhooks/{webhook_id} operation.
|
||||
//
|
||||
// Запрос позволяет отписаться от уведомлений о событии
|
||||
// для переданного OAuth-токена. Чтобы удалить webhook, вам
|
||||
// нужно передать в запросе его идентификатор.
|
||||
//
|
||||
// DELETE /webhooks/{webhook_id}
|
||||
func (UnimplementedHandler) WebhooksWebhookIDDelete(ctx context.Context, params WebhooksWebhookIDDeleteParams) (r WebhooksWebhookIDDeleteRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
67
internal/service/yookassa/gen/oas_uri_gen.go
Normal file
67
internal/service/yookassa/gen/oas_uri_gen.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package gen
|
||||
|
||||
import (
|
||||
"github.com/go-faster/errors"
|
||||
"github.com/ogen-go/ogen/conv"
|
||||
"github.com/ogen-go/ogen/uri"
|
||||
"github.com/ogen-go/ogen/validate"
|
||||
)
|
||||
|
||||
// EncodeURI encodes MetadataInQueryParameter as URI form.
|
||||
func (s MetadataInQueryParameter) EncodeURI(e uri.Encoder) error {
|
||||
for k, elem := range s {
|
||||
if err := e.EncodeField(k, func(e uri.Encoder) error {
|
||||
|
||||
return e.EncodeValue(conv.StringToString(elem))
|
||||
}); err != nil {
|
||||
return errors.Wrapf(err, "encode field %q", k)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DecodeURI decodes MetadataInQueryParameter from URI form.
|
||||
func (s *MetadataInQueryParameter) DecodeURI(d uri.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode MetadataInQueryParameter to nil")
|
||||
}
|
||||
m := s.init()
|
||||
var propertiesCount int
|
||||
if err := d.DecodeFields(func(k string, d uri.Decoder) error {
|
||||
propertiesCount++
|
||||
var elem string
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
elem = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return errors.Wrapf(err, "decode field %q", k)
|
||||
}
|
||||
m[string(k)] = elem
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode MetadataInQueryParameter")
|
||||
}
|
||||
// Validate properties count.
|
||||
if err := (validate.Object{
|
||||
MinProperties: 0,
|
||||
MinPropertiesSet: false,
|
||||
MaxProperties: 1,
|
||||
MaxPropertiesSet: true,
|
||||
}).ValidateProperties(propertiesCount); err != nil {
|
||||
return errors.Wrap(err, "object")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
13852
internal/service/yookassa/gen/oas_validators_gen.go
Normal file
13852
internal/service/yookassa/gen/oas_validators_gen.go
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user