refactored notificatoin / tgsettle responsibility boundaries

This commit is contained in:
Stephan D
2026-02-19 18:56:59 +01:00
parent 47f0a3d890
commit 2fd8a6ebb7
73 changed files with 3705 additions and 681 deletions

View File

@@ -33,3 +33,13 @@ type ConfirmationResult struct {
Status ConfirmationStatus `bson:"status,omitempty" json:"status,omitempty"`
ParseError string `bson:"parseError,omitempty" json:"parse_error,omitempty"`
}
// ConfirmationRequestDispatch is emitted by the notification service after it sends
// a confirmation prompt message to Telegram.
type ConfirmationRequestDispatch struct {
RequestID string `bson:"requestId,omitempty" json:"request_id,omitempty"`
ChatID string `bson:"chatId,omitempty" json:"chat_id,omitempty"`
MessageID string `bson:"messageId,omitempty" json:"message_id,omitempty"`
Rail string `bson:"rail,omitempty" json:"rail,omitempty"`
SourceService string `bson:"sourceService,omitempty" json:"source_service,omitempty"`
}

View File

@@ -63,7 +63,7 @@ func FromStringImp(s string) (*NotificationEventImp, error) {
func StringToNotificationAction(s string) (nm.NotificationAction, error) {
switch nm.NotificationAction(s) {
case nm.NACreated, nm.NAPending, nm.NAUpdated, nm.NAArchived, nm.NADeleted, nm.NAAssigned, nm.NAPasswordReset, nm.NAConfirmationRequest, nm.NATelegramReaction, nm.NAPaymentGatewayIntent, nm.NAPaymentGatewayExecution, nm.NADiscoveryServiceAnnounce, nm.NADiscoveryGatewayAnnounce, nm.NADiscoveryHeartbeat, nm.NADiscoveryLookupRequest, nm.NADiscoveryLookupResponse, nm.NADiscoveryRefreshUI:
case nm.NACreated, nm.NAPending, nm.NAUpdated, nm.NAArchived, nm.NADeleted, nm.NAAssigned, nm.NAPasswordReset, nm.NAConfirmationRequest, nm.NATelegramReaction, nm.NATelegramText, nm.NATelegramUpdate, nm.NAPaymentGatewayIntent, nm.NAPaymentGatewayExecution, nm.NADiscoveryServiceAnnounce, nm.NADiscoveryGatewayAnnounce, nm.NADiscoveryHeartbeat, nm.NADiscoveryLookupRequest, nm.NADiscoveryLookupResponse, nm.NADiscoveryRefreshUI:
return nm.NotificationAction(s), nil
default:
return "", merrors.DataConflict("invalid Notification action: " + s)

View File

@@ -14,6 +14,8 @@ const (
NAConfirmationRequest NotificationAction = "confirmation.request"
NATelegramReaction NotificationAction = "telegram.reaction"
NATelegramText NotificationAction = "telegram.text"
NATelegramUpdate NotificationAction = "telegram.update"
NAPaymentGatewayIntent NotificationAction = "intent.request"
NAPaymentGatewayExecution NotificationAction = "execution.result"

View File

@@ -85,6 +85,8 @@ func StringToNotificationAction(s string) (nm.NotificationAction, error) {
nm.NAPasswordReset,
nm.NAConfirmationRequest,
nm.NATelegramReaction,
nm.NATelegramText,
nm.NATelegramUpdate,
nm.NAPaymentGatewayIntent,
nm.NAPaymentGatewayExecution,
nm.NADiscoveryServiceAnnounce,

View File

@@ -16,3 +16,15 @@ type TelegramReactionRequest struct {
MessageID string `bson:"messageId,omitempty" json:"message_id,omitempty"`
Emoji string `bson:"emoji,omitempty" json:"emoji,omitempty"`
}
type TelegramTextRequest struct {
RequestID string `bson:"requestId,omitempty" json:"request_id,omitempty"`
ChatID string `bson:"chatId,omitempty" json:"chat_id,omitempty"`
Text string `bson:"text,omitempty" json:"text,omitempty"`
ReplyToMessageID string `bson:"replyToMessageId,omitempty" json:"reply_to_message_id,omitempty"`
}
type TelegramWebhookUpdate struct {
UpdateID int64 `bson:"updateId,omitempty" json:"update_id,omitempty"`
Message *TelegramMessage `bson:"message,omitempty" json:"message,omitempty"`
}