Mauricio Araujo vor 2 Jahren
Ursprung
Commit
e9e6e4842c

+ 1 - 0
api/server/handlers/billing/ingest.go

@@ -18,6 +18,7 @@ type IngestEventsHandler struct {
 	handlers.PorterHandlerReadWriter
 }
 
+// NewIngestEventsHandler returns a new IngestEventsHandler
 func NewIngestEventsHandler(
 	config *config.Config,
 	decoderValidator shared.RequestDecoderValidator,

+ 1 - 0
api/types/billing_metronome.go

@@ -141,6 +141,7 @@ type ColorOverride struct {
 	Value string `json:"value"`
 }
 
+// BillingEvent represents a Metronome billing event.
 type BillingEvent struct {
 	CustomerID    string                 `json:"customer_id"`
 	EventType     string                 `json:"event_type"`

+ 2 - 0
internal/billing/metronome.go

@@ -257,6 +257,7 @@ func (m MetronomeClient) GetCustomerDashboard(ctx context.Context, customerID uu
 	return result.Data["url"], nil
 }
 
+// IngestEvents sends a list of billing events to Metronome's ingest endpoint
 func (m MetronomeClient) IngestEvents(ctx context.Context, events []types.BillingEvent) (err error) {
 	path := "ingest"
 
@@ -314,6 +315,7 @@ func (m MetronomeClient) do(method string, path string, body interface{}, data i
 	if err != nil {
 		return statusCode, err
 	}
+	statusCode = resp.StatusCode
 
 	if resp.StatusCode != http.StatusOK {
 		// If there is an error, try to decode the message