This commit is contained in:
Stephan D
2026-03-10 12:31:09 +01:00
parent d87e709f43
commit e77d1ab793
287 changed files with 2089 additions and 1550 deletions

View File

@@ -267,7 +267,8 @@ func (r *Router) captureAmount(ctx context.Context, userID, accountID, chatID st
})
return
}
if typed, ok := err.(limitError); ok {
var typed limitError
if errors.As(err, &typed) {
switch typed.LimitKind() {
case "per_operation":
_ = r.sendText(ctx, chatID, "*Amount exceeds allowed limit*\n\n*Max per operation:* "+markdownCode(typed.LimitMax())+"\n\nEnter another amount or "+markdownCommand(CommandCancel)+".")

View File

@@ -22,7 +22,7 @@ func (f fakeUserBindingResolver) ResolveUserBinding(_ context.Context, telegramU
return nil, f.err
}
if f.bindings == nil {
return nil, nil
return nil, nil //nolint:nilnil // test resolver: missing bindings means user is unknown
}
return f.bindings[telegramUserID], nil
}
@@ -36,7 +36,7 @@ func (fakeService) MaxPerOperationLimit() string {
}
func (fakeService) GetActiveRequestForAccount(context.Context, string) (*storagemodel.TreasuryRequest, error) {
return nil, nil
return nil, nil //nolint:nilnil // test service: no active request by default
}
func (fakeService) GetAccountProfile(_ context.Context, ledgerAccountID string) (*AccountProfile, error) {
@@ -48,15 +48,15 @@ func (fakeService) GetAccountProfile(_ context.Context, ledgerAccountID string)
}
func (fakeService) CreateRequest(context.Context, CreateRequestInput) (*storagemodel.TreasuryRequest, error) {
return nil, nil
return nil, nil //nolint:nilnil // test service: request creation is not exercised in these tests
}
func (fakeService) ConfirmRequest(context.Context, string, string) (*storagemodel.TreasuryRequest, error) {
return nil, nil
return nil, nil //nolint:nilnil // test service: confirmation path is not exercised in these tests
}
func (fakeService) CancelRequest(context.Context, string, string) (*storagemodel.TreasuryRequest, error) {
return nil, nil
return nil, nil //nolint:nilnil // test service: cancellation path is not exercised in these tests
}
func TestRouterUnauthorizedInAllowedChatSendsAccessDenied(t *testing.T) {