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
894 B
Go
39 lines
894 B
Go
package v3
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
|
|
"github.com/formancehq/payments/internal/api/backend"
|
|
"github.com/formancehq/payments/internal/connectors/plugins/registry"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
"go.uber.org/mock/gomock"
|
|
)
|
|
|
|
var _ = Describe("API v3 Connectors Configs", func() {
|
|
var (
|
|
handlerFn http.HandlerFunc
|
|
)
|
|
|
|
Context("get connectors configs", func() {
|
|
var (
|
|
w *httptest.ResponseRecorder
|
|
m *backend.MockBackend
|
|
)
|
|
BeforeEach(func() {
|
|
w = httptest.NewRecorder()
|
|
ctrl := gomock.NewController(GinkgoT())
|
|
m = backend.NewMockBackend(ctrl)
|
|
handlerFn = connectorsConfigs(m)
|
|
})
|
|
|
|
It("should return data object", func(ctx SpecContext) {
|
|
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
|
m.EXPECT().ConnectorsConfigs().Return(registry.Configs{})
|
|
handlerFn(w, req)
|
|
|
|
assertExpectedResponse(w.Result(), http.StatusOK, "data")
|
|
})
|
|
})
|
|
})
|