mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* Use validation library for dummypay config * Replace individual connector configs with go-playground/validation struct * Update command to compile configs.json * Update connector template to use new validation system * Move plugin configuration into registry and remove config.json * Detect different types of configuration data when registering plugins * Ensure that RegisterPlugin skips non-json fields in Config * Update connector template to send Config struct to RegisterPlugin * Allow omission of optional Adyen fields from config * Add panic statements in RegisterPlugin to guard against bad plugin config setup
39 lines
793 B
Go
39 lines
793 B
Go
package registry
|
|
|
|
type Type string
|
|
|
|
const (
|
|
TypeLongString Type = "long string"
|
|
TypeString Type = "string"
|
|
TypeDurationNs Type = "duration ns"
|
|
TypeUnsignedInteger Type = "unsigned integer"
|
|
TypeBoolean Type = "boolean"
|
|
)
|
|
|
|
type Configs map[string]Config
|
|
type Config map[string]Parameter
|
|
type Parameter struct {
|
|
DataType Type `json:"dataType"`
|
|
Required bool `json:"required"`
|
|
DefaultValue string `json:"defaultValue"`
|
|
}
|
|
|
|
var (
|
|
defaultParameters = map[string]Parameter{
|
|
"pollingPeriod": {
|
|
DataType: TypeDurationNs,
|
|
Required: false,
|
|
DefaultValue: "2m",
|
|
},
|
|
"pageSize": {
|
|
DataType: TypeUnsignedInteger,
|
|
Required: false,
|
|
DefaultValue: "100",
|
|
},
|
|
"name": {
|
|
DataType: TypeString,
|
|
Required: true,
|
|
},
|
|
}
|
|
)
|