Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions components/payments/cmd/connectors/internal/api/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/formancehq/payments/internal/otel"
"github.com/formancehq/stack/libs/go-libs/api"
"github.com/formancehq/stack/libs/go-libs/bun/bunpaginate"
"github.com/formancehq/stack/libs/go-libs/logging"
"github.com/formancehq/stack/libs/go-libs/pointer"
"github.com/google/uuid"
"github.com/gorilla/mux"
Expand Down Expand Up @@ -132,24 +131,6 @@ func readConfig[Config models.ConnectorConfigObject](
caser := cases.Title(language.English)
m["provider"] = caser.String(connectorID.Provider.String())

// rewrite pollingDuration struct as a string to match API spec
pollingPeriod, ok := m["pollingPeriod"].(map[string]interface{})
if ok {
duration, found := pollingPeriod["duration"]
if found {
var ns int64
switch v := duration.(type) {
case int64:
ns = v
case float64:
ns = int64(v)
default:
logging.FromContext(ctx).Debugf("pollingPeriod.Duration was of an unexpected type: %T", v)
}
m["pollingPeriod"] = time.Duration(ns).String()
}
}

result, err := json.Marshal(m)
if err != nil {
otel.RecordError(span, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Duration struct {
time.Duration `json:"duration"`
}

func (d *Duration) MarshalJSON() ([]byte, error) {
func (d Duration) MarshalJSON() ([]byte, error) {
return json.Marshal(d.Duration.String())
}

Expand Down