Remove ogen-related client implementation

This commit is contained in:
2026-03-17 16:42:34 +03:00
parent 2c19b9c29b
commit 075a53f6ef
26 changed files with 6 additions and 115926 deletions

20
go.mod
View File

@@ -3,23 +3,17 @@ module payouts
go 1.25.0 go 1.25.0
require ( require (
github.com/go-faster/errors v0.7.1
github.com/go-faster/jx v1.2.0
github.com/go-viper/encoding/javaproperties v0.1.0 github.com/go-viper/encoding/javaproperties v0.1.0
github.com/go-viper/mapstructure/v2 v2.5.0 github.com/go-viper/mapstructure/v2 v2.5.0
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1 github.com/gorilla/mux v1.8.1
github.com/jellydator/ttlcache/v3 v3.4.0 github.com/jellydator/ttlcache/v3 v3.4.0
github.com/jinzhu/copier v0.4.0 github.com/jinzhu/copier v0.4.0
github.com/ogen-go/ogen v1.20.1
github.com/ogier/pflag v0.0.1 github.com/ogier/pflag v0.0.1
github.com/orandin/slog-gorm v1.4.0 github.com/orandin/slog-gorm v1.4.0
github.com/prometheus/client_golang v1.23.2 github.com/prometheus/client_golang v1.23.2
github.com/samber/slog-multi v1.7.1 github.com/samber/slog-multi v1.7.1
github.com/spf13/viper v1.21.0 github.com/spf13/viper v1.21.0
go.opentelemetry.io/otel v1.42.0
go.opentelemetry.io/otel/metric v1.42.0
go.opentelemetry.io/otel/trace v1.42.0
go.uber.org/fx v1.24.0 go.uber.org/fx v1.24.0
golang.org/x/crypto v0.48.0 golang.org/x/crypto v0.48.0
gorm.io/driver/postgres v1.6.0 gorm.io/driver/postgres v1.6.0
@@ -30,15 +24,9 @@ require (
require ( require (
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/getkin/kin-openapi v0.133.0 // indirect github.com/getkin/kin-openapi v0.133.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-faster/yaml v0.4.6 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
@@ -48,10 +36,9 @@ require (
github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.18.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
@@ -63,11 +50,10 @@ require (
github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/common v0.66.1 // indirect
github.com/prometheus/procfs v0.16.1 // indirect github.com/prometheus/procfs v0.16.1 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/samber/lo v1.52.0 // indirect github.com/samber/lo v1.52.0 // indirect
github.com/samber/slog-common v0.20.0 // indirect github.com/samber/slog-common v0.20.0 // indirect
github.com/segmentio/asm v1.2.1 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/speakeasy-api/jsonpath v0.6.0 // indirect github.com/speakeasy-api/jsonpath v0.6.0 // indirect
github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect
@@ -77,13 +63,11 @@ require (
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
github.com/woodsbury/decimal128 v1.3.0 // indirect github.com/woodsbury/decimal128 v1.3.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.uber.org/dig v1.19.0 // indirect go.uber.org/dig v1.19.0 // indirect
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.1 // indirect go.uber.org/zap v1.27.1 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect
golang.org/x/mod v0.33.0 // indirect golang.org/x/mod v0.33.0 // indirect
golang.org/x/net v0.51.0 // indirect golang.org/x/net v0.51.0 // indirect
golang.org/x/sync v0.19.0 // indirect golang.org/x/sync v0.19.0 // indirect

40
go.sum
View File

@@ -8,13 +8,9 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58=
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w=
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -23,19 +19,6 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/getkin/kin-openapi v0.133.0 h1:pJdmNohVIJ97r4AUFtEXRXwESr8b0bD721u/Tz6k8PQ= github.com/getkin/kin-openapi v0.133.0 h1:pJdmNohVIJ97r4AUFtEXRXwESr8b0bD721u/Tz6k8PQ=
github.com/getkin/kin-openapi v0.133.0/go.mod h1:boAciF6cXk5FhPqe/NQeBTeenbjqU4LhWBf09ILVvWE= github.com/getkin/kin-openapi v0.133.0/go.mod h1:boAciF6cXk5FhPqe/NQeBTeenbjqU4LhWBf09ILVvWE=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-faster/errors v0.7.1 h1:MkJTnDoEdi9pDabt1dpWf7AA8/BaSYZqibYyhZ20AYg=
github.com/go-faster/errors v0.7.1/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo=
github.com/go-faster/jx v1.2.0 h1:T2YHJPrFaYu21fJtUxC9GzmluKu8rVIFDwwGBKTDseI=
github.com/go-faster/jx v1.2.0/go.mod h1:UWLOVDmMG597a5tBFPLIWJdUxz5/2emOpfsj9Neg0PE=
github.com/go-faster/yaml v0.4.6 h1:lOK/EhI04gCpPgPhgt0bChS6bvw7G3WwI8xxVe0sw9I=
github.com/go-faster/yaml v0.4.6/go.mod h1:390dRIvV4zbnO7qC9FGo6YYutc+wyyUSHBgbXL52eXk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
@@ -102,11 +85,6 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
@@ -122,8 +100,6 @@ github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//J
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw= github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw=
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c= github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c=
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o=
github.com/ogen-go/ogen v1.20.1 h1:AFpIeI2rS37TNIMRQTHhAkThICQpa1p+Pceu7HP7xsA=
github.com/ogen-go/ogen v1.20.1/go.mod h1:eXQeqzIfw9qUjXdpqNtkX+XCvhlWNymqU1bm7S7y8iU=
github.com/ogier/pflag v0.0.1 h1:RW6JSWSu/RkSatfcLtogGfFgpim5p7ARQ10ECk5O750= github.com/ogier/pflag v0.0.1 h1:RW6JSWSu/RkSatfcLtogGfFgpim5p7ARQ10ECk5O750=
github.com/ogier/pflag v0.0.1/go.mod h1:zkFki7tvTa0tafRvTBIZTvzYyAu6kQhPZFnshFFPE+g= github.com/ogier/pflag v0.0.1/go.mod h1:zkFki7tvTa0tafRvTBIZTvzYyAu6kQhPZFnshFFPE+g=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -164,12 +140,8 @@ github.com/samber/slog-common v0.20.0 h1:WaLnm/aCvBJSk5nR5aXZTFBaV0B47A+AEaEOiZD
github.com/samber/slog-common v0.20.0/go.mod h1:+Ozat1jgnnE59UAlmNX1IF3IByHsODnnwf9jUcBZ+m8= github.com/samber/slog-common v0.20.0/go.mod h1:+Ozat1jgnnE59UAlmNX1IF3IByHsODnnwf9jUcBZ+m8=
github.com/samber/slog-multi v1.7.1 h1:aCLXHRxgU+2v0PVlEOh7phynzM7CRo89ZgFtOwaqVEE= github.com/samber/slog-multi v1.7.1 h1:aCLXHRxgU+2v0PVlEOh7phynzM7CRo89ZgFtOwaqVEE=
github.com/samber/slog-multi v1.7.1/go.mod h1:A4KQC99deqfkCDJcL/cO3kX6McX7FffQAx/8QHink+c= github.com/samber/slog-multi v1.7.1/go.mod h1:A4KQC99deqfkCDJcL/cO3kX6McX7FffQAx/8QHink+c=
github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0=
github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/speakeasy-api/jsonpath v0.6.0 h1:IhtFOV9EbXplhyRqsVhHoBmmYjblIRh5D1/g8DHMXJ8= github.com/speakeasy-api/jsonpath v0.6.0 h1:IhtFOV9EbXplhyRqsVhHoBmmYjblIRh5D1/g8DHMXJ8=
@@ -200,14 +172,6 @@ github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN
github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0= github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0=
github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds= github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho=
go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc=
go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4=
go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI=
go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY=
go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc=
go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4=
go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE=
go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg=
@@ -227,8 +191,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 h1:Di6/M8l0O2lCLc6VVRWhgCiApHV8MnQurBnFSHsQtNY=
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
@@ -260,8 +222,6 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

View File

@@ -1,347 +0,0 @@
// 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
}
})
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +0,0 @@
// 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
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,110 +0,0 @@
// 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()
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +0,0 @@
// 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)
}

View File

@@ -1,10 +0,0 @@
// Code generated by ogen, DO NOT EDIT.
package gen
import (
"github.com/ogen-go/ogen/middleware"
)
// Middleware is middleware type.
type Middleware = middleware.Middleware

View File

@@ -1,36 +0,0 @@
// 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"
)

File diff suppressed because it is too large Load Diff

View File

@@ -1,718 +0,0 @@
// 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)
}
}

View File

@@ -1,139 +0,0 @@
// Code generated by ogen, DO NOT EDIT.
package gen
import (
"bytes"
"log/slog"
"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()
slog.Info(string(encoded))
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
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,207 +0,0 @@
// 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
}

View File

@@ -1,316 +0,0 @@
// 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 payers 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 youre 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
}

View File

@@ -1,383 +0,0 @@
// 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 payers 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 youre 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
}

View File

@@ -1,67 +0,0 @@
// 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
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
generator:
ignore_not_implemented: ["all"]
# features:
# enable:
# # Enables paths client generation
# - "paths/client"
# # Enables validation of client requests
# - "client/request/validation"
# # Enables validation of server responses
# - "server/response/validation"
# disable_all: true

File diff suppressed because it is too large Load Diff

View File

@@ -3,20 +3,13 @@ package yookassa
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"log/slog"
"net/http"
"payouts/internal/models" "payouts/internal/models"
"payouts/internal/service/database/orm" "payouts/internal/service/database/orm"
"payouts/internal/service/yookassa/config" "payouts/internal/service/yookassa/config"
"payouts/internal/service/yookassa/gen"
"github.com/ogen-go/ogen/ogenerrors"
) )
type yookassaService struct { type yookassaService struct {
conf config.YooKassa conf config.YooKassa
payClient *gen.Client
ctx context.Context ctx context.Context
} }
@@ -26,14 +19,6 @@ func NewYookassaService(conf config.YooKassa) (Service, error) {
conf: conf, conf: conf,
ctx: context.Background(), ctx: context.Background(),
} }
payClient, err := gen.NewClient(conf.BaseUrl, svc, gen.WithClient(&http.Client{
Timeout: conf.Timeout,
}))
if err != nil {
return nil, err
}
svc.payClient = payClient
return svc, nil return svc, nil
} }
@@ -47,65 +32,17 @@ func (y *yookassaService) getParams(options ...Optional) *params {
return params return params
} }
// BasicAuth implements [gen.SecuritySource].
func (y *yookassaService) BasicAuth(ctx context.Context, operationName gen.OperationName) (gen.BasicAuth, error) {
return gen.BasicAuth{
Username: y.conf.ApiPaymentKey,
Password: y.conf.ApiPaymentSecret,
}, nil
}
// OAuth2 implements [gen.SecuritySource].
func (y *yookassaService) OAuth2(ctx context.Context, operationName gen.OperationName) (gen.OAuth2, error) {
return gen.OAuth2{}, ogenerrors.ErrSkipClientSecurity
}
// CreatePayout implements [Service]. // CreatePayout implements [Service].
func (y *yookassaService) CreatePayout(req models.PayoutReq, userSession *orm.User, idempotenceKey string, opts ...Optional) (models.PayoutResp, error) { func (y *yookassaService) CreatePayout(req models.PayoutReq, userSession *orm.User, idempotenceKey string, opts ...Optional) (models.PayoutResp, error) {
params := y.getParams(opts...) // params := y.getParams(opts...)
var payoutDestination gen.PayoutRequestPayoutDestinationData
switch req.PayoutType { switch req.PayoutType {
case models.TypeSBP: case models.TypeSBP:
payoutDestination = gen.NewSbpPayoutRequestPayoutDestinationData(gen.Sbp{
Type: gen.PayoutDestinationDataTypeSbp,
Phone: userSession.Phone,
})
case models.TypeYooMoney: case models.TypeYooMoney:
payoutDestination = gen.NewYooMoneyPayoutRequestPayoutDestinationData(gen.YooMoney{
Type: gen.PayoutDestinationDataTypeYooMoney,
AccountNumber: req.AccountNumber,
})
default: default:
return models.PayoutResp{Result: "failed", ErrorReason: "unsupported payout type"}, errors.New("unsupported payout type") return models.PayoutResp{Result: "failed", ErrorReason: "unsupported payout type"}, errors.New("unsupported payout type")
} }
return models.PayoutResp{}, nil
payoutOpt := gen.NewOptPayoutRequestPayoutDestinationData(payoutDestination)
postResp, err := y.payClient.PayoutsPost(params.ctx, &gen.PayoutRequest{
Amount: gen.PayoutRequestAmount{
Value: fmt.Sprintf("%.2f", req.Amount),
Currency: gen.CurrencyCodeRUB,
},
PayoutDestinationData: payoutOpt,
Test: gen.NewOptTest(gen.Test(y.conf.Test)),
}, gen.PayoutsPostParams{
IdempotenceKey: idempotenceKey,
})
slog.Debug(fmt.Sprintf("Received from yookassa: error %v; response %v", err, postResp))
if err == nil {
switch payoutResp := postResp.(type) {
case *gen.Payout:
slog.Info(fmt.Sprintf("Succeeded payout. It's id = %s", payoutResp.ID))
return models.PayoutResp{Result: string(payoutResp.Status), PayoutID: string(payoutResp.ID)}, nil
default:
return models.PayoutResp{Result: "failed", ErrorReason: fmt.Sprintf("%T", postResp)}, nil
}
}
return models.PayoutResp{Result: "failed", ErrorReason: errors.Join(errors.New("failed to call yookassa api"), err).Error()}, err
} }
// GetConfig implements [Service]. // GetConfig implements [Service].