sendBulkTransactionWebhook sends a webhook notification for a bulk transaction result
(batchID, status, errorMsg string, transactionCount int)
| 2457 | |
| 2458 | // sendBulkTransactionWebhook sends a webhook notification for a bulk transaction result |
| 2459 | func (l *LedgerForge) sendBulkTransactionWebhook(batchID, status, errorMsg string, transactionCount int) { |
| 2460 | // Create payload with or without error info depending on status |
| 2461 | payload := map[string]interface{}{ |
| 2462 | "batch_id": batchID, |
| 2463 | "status": status, |
| 2464 | "timestamp": time.Now(), |
| 2465 | } |
| 2466 | |
| 2467 | // Only include transaction count for success cases |
| 2468 | if status != "failed" { |
| 2469 | payload["transaction_count"] = transactionCount |
| 2470 | } |
| 2471 | |
| 2472 | // Include error details for failure cases |
| 2473 | if status == "failed" && errorMsg != "" { |
| 2474 | payload["error"] = errorMsg |
| 2475 | } |
| 2476 | |
| 2477 | err := l.SendWebhook(NewWebhook{ |
| 2478 | Event: "bulk_transaction." + status, |
| 2479 | Payload: payload, |
| 2480 | }) |
| 2481 | if err != nil { |
| 2482 | logrus.WithError(err).WithField("batch_id", batchID).Error("failed to send webhook notification") |
| 2483 | } |
| 2484 | } |
| 2485 | |
| 2486 | // handleAsyncBulkTransactionFailure handles failures in asynchronous processing |
| 2487 | // and builds a detailed error message including rollback status |
no test coverage detected