Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
New broadcast notification, use snake case
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed May 3, 2022
1 parent 5dde67e commit 0b2a6f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions model_sync_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/BuxOrg/bux/chainstate"
"github.com/BuxOrg/bux/datastore"
"github.com/BuxOrg/bux/notifications"
"github.com/BuxOrg/bux/taskmanager"
"github.com/BuxOrg/bux/utils"
"github.com/tonicpow/go-paymail"
Expand Down Expand Up @@ -408,6 +409,9 @@ func processBroadcastTransaction(ctx context.Context, syncTx *SyncTransaction) e
return err
}

// Fire a notification
notify(notifications.EventTypeBroadcast, syncTx)

// Notify any P2P paymail providers associated to the transaction
if syncTx.P2PStatus == SyncStatusReady {
return processP2PTransaction(ctx, syncTx, transaction)
Expand Down
10 changes: 5 additions & 5 deletions notifications/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (c *Client) GetWebhookEndpoint() string {
return c.options.config.webhookEndpoint
}

// Notify will create a new notification
// Notify will create a new notification event
func (c *Client) Notify(ctx context.Context, modelType string, eventType EventType,
model interface{}, id string) error {

Expand All @@ -23,10 +23,10 @@ func (c *Client) Notify(ctx context.Context, modelType string, eventType EventTy
}
} else {
jsonData, err := json.Marshal(map[string]interface{}{
"eventType": eventType,
"id": id,
"model": model,
"modelType": modelType,
"event_type": eventType,
"id": id,
"model": model,
"model_type": modelType,
})
if err != nil {
return err
Expand Down

0 comments on commit 0b2a6f5

Please sign in to comment.