outbox for gateways
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user