unified code verification service

This commit is contained in:
Stephan D
2026-02-10 01:55:33 +01:00
parent 76c3bfdea9
commit 7f540671c1
120 changed files with 1863 additions and 1394 deletions

View File

@@ -31,10 +31,10 @@ func (ccn *ConfirmationCodeNotification) Serialize() ([]byte, error) {
}
func newConfirmationEvent(action nm.NotificationAction) model.NotificationEvent {
return model.NewNotification(mservice.Confirmations, action)
return model.NewNotification(mservice.Verification, action)
}
func NewConfirmationCodeEnvelope(sender string, accountRef bson.ObjectID, destination string, target model.ConfirmationTarget, code string) messaging.Envelope {
func NewConfirmationCodeEnvelope(sender string, accountRef bson.ObjectID, destination string, target model.VerificationPurpose, code string) messaging.Envelope {
return &ConfirmationCodeNotification{
Envelope: messaging.CreateEnvelope(sender, newConfirmationEvent(nm.NAPending)),
payload: confirmationCodePayload{

View File

@@ -42,10 +42,12 @@ func (ccp *ConfirmationCodeProcessor) Process(ctx context.Context, envelope me.E
return err
}
target := model.ConfirmationTarget(msg.Target)
if target != model.ConfirmationTargetLogin && target != model.ConfirmationTargetPayout {
return merrors.InvalidArgument("invalid confirmation target", "target")
target, err := model.VPFromString(msg.Target)
if err != nil {
ccp.logger.Warn("Failed to parse confirmation target from envelope", zap.Error(err), zap.String("topic", ccp.event.ToString()), zap.String("target", msg.Target))
return err
}
if msg.Code == "" {
return merrors.InvalidArgument("empty confirmation code", "code")
}

View File

@@ -51,7 +51,7 @@ func confirmationResultEvent(sourceService, rail string) model.NotificationEvent
rail = "default"
}
rail = strings.ToLower(rail)
return model.NewNotification(mservice.Confirmations, nm.NotificationAction(action+"."+rail))
return model.NewNotification(mservice.Verification, nm.NotificationAction(action+"."+rail))
}
func NewConfirmationRequestEnvelope(sender string, request *model.ConfirmationRequest) messaging.Envelope {