8000 fix: Ingestion message payload marshaling by antoinegelloz · Pull Request #32 · formancehq/payments · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Ingestion message payload marshaling #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement 8000 . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2022
Merged
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
18 changes: 6 additions & 12 deletions pkg/bridge/ingestion/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ingestion

import (
"context"
"encoding/json"
"time"

"github.com/numary/go-libs/sharedlogging"
Expand All @@ -19,25 +18,20 @@ const (
)

type EventMessage struct {
Date time.Time `json:"date"`
App string `json:"app"`
Version string `json:"version"`
Type string `json:"type"`
Payload json.RawMessage `json:"payload"`
Date time.Time `json:"date"`
App string `json:"app"`
Version string `json:"version"`
Type string `json:"type"`
Payload any `json:"payload"`
}

func NewEventSavedPayment(payment payments.SavedPayment) EventMessage {
payload, err := json.Marshal(payment)
if err != nil {
panic(err)
}

return EventMessage{
Date: time.Now().UTC(),
App: EventApp,
Version: EventVersion,
Type: EventTypeSavedPayment,
Payload: payload,
Payload: payment,
}
}

Expand Down
0