Files
fgueryandGitHub 322f0cbabc feat(EN-420): change pagination, have it hard coded per connector instead of user configured (#602)
* feat(EN-420): added page size as a const for each plugin

* feat(EN-420): remove pageSize from connector config

* feat(EN-420): review all limits according to api docs

* ensure pageSize is marked as deprecated

* sdk generation

* fix: tests

* fix: ignore linting error on depreated call

* feat: change deprecation message

* regenerate openapi & sdk

* change message to avoid duplicating the deprecation word

* regenerate openapi & sdk

* feat: change deprecation message

* regenerate openapi & sdk
2025-11-26 11:12:30 +00:00

31 lines
942 B
Go

package adyen
import (
"encoding/json"
"github.com/formancehq/payments/internal/models"
"github.com/go-playground/validator/v10"
"github.com/pkg/errors"
)
type Config struct {
APIKey string `json:"apiKey" validate:"required"`
CompanyID string `json:"companyID" validate:"required"`
LiveEndpointPrefix string `json:"liveEndpointPrefix" validate:"omitempty,url_encoded"`
// https://datatracker.ietf.org/doc/html/rfc7617
WebhookUsername string `json:"webhookUsername" validate:"omitempty,excludes=:"`
WebhookPassword string `json:"webhookPassword" validate:""`
}
const PAGE_SIZE = 100
func unmarshalAndValidateConfig(payload []byte) (Config, error) {
var config Config
if err := json.Unmarshal(payload, &config); err != nil {
return Config{}, errors.Wrap(models.ErrInvalidConfig, err.Error())
}
validate := validator.New(validator.WithRequiredStructEnabled())
return config, validate.Struct(config)
}