outbox for gateways

This commit is contained in:
Stephan D
2026-02-18 01:35:28 +01:00
parent 974caf286c
commit 69531cee73
221 changed files with 12172 additions and 782 deletions

View File

@@ -38,7 +38,7 @@ func (s *Service) blockAccountResponder(_ context.Context, req *ledgerv1.BlockAc
if err == storage.ErrAccountNotFound {
return nil, merrors.NoData("account not found")
}
logger.Warn("failed to get account for block", zap.Error(err))
logger.Warn("Failed to get account for block", zap.Error(err))
return nil, merrors.Internal("failed to get account")
}
@@ -61,17 +61,17 @@ func (s *Service) blockAccountResponder(_ context.Context, req *ledgerv1.BlockAc
}
if account.Status == pmodel.LedgerAccountStatusFrozen {
logger.Debug("account already frozen", mzap.AccRef(accountRef))
logger.Debug("Account already frozen", mzap.AccRef(accountRef))
return &ledgerv1.BlockAccountResponse{Account: toProtoAccount(account)}, nil
}
if err := s.storage.Accounts().UpdateStatus(ctx, accountRef, pmodel.LedgerAccountStatusFrozen); err != nil {
logger.Warn("failed to freeze account", zap.Error(err))
logger.Warn("Failed to freeze account", zap.Error(err))
return nil, merrors.Internal("failed to block account")
}
account.Status = pmodel.LedgerAccountStatusFrozen
logger.Info("account blocked (frozen)", mzap.AccRef(accountRef))
logger.Info("Account blocked (frozen)", mzap.AccRef(accountRef))
return &ledgerv1.BlockAccountResponse{Account: toProtoAccount(account)}, nil
}
}
@@ -101,7 +101,7 @@ func (s *Service) unblockAccountResponder(_ context.Context, req *ledgerv1.Unblo
if err == storage.ErrAccountNotFound {
return nil, merrors.NoData("account not found")
}
logger.Warn("failed to get account for unblock", zap.Error(err))
logger.Warn("Failed to get account for unblock", zap.Error(err))
return nil, merrors.Internal("failed to get account")
}
@@ -124,17 +124,17 @@ func (s *Service) unblockAccountResponder(_ context.Context, req *ledgerv1.Unblo
}
if account.Status == pmodel.LedgerAccountStatusActive {
logger.Debug("account already active", mzap.AccRef(accountRef))
logger.Debug("Account already active", mzap.AccRef(accountRef))
return &ledgerv1.UnblockAccountResponse{Account: toProtoAccount(account)}, nil
}
if err := s.storage.Accounts().UpdateStatus(ctx, accountRef, pmodel.LedgerAccountStatusActive); err != nil {
logger.Warn("failed to activate account", zap.Error(err))
logger.Warn("Failed to activate account", zap.Error(err))
return nil, merrors.Internal("failed to unblock account")
}
account.Status = pmodel.LedgerAccountStatusActive
logger.Info("account unblocked (active)", mzap.AccRef(accountRef))
logger.Info("Account unblocked (active)", mzap.AccRef(accountRef))
return &ledgerv1.UnblockAccountResponse{Account: toProtoAccount(account)}, nil
}
}