bcgov / bcgov/entity

Pay-UI Refunds – 500 when fetching service-account-created invoices

Open
#34,229 0 comments 0 reactions 0 assignees View on GitHub
bug Pay
Dominant language
JavaScript
Stars
23
Forks
62
Avg merge
24m
Merged PRs (30d)
1

Description

Fetching an invoice created by a service account (e.g. NR service account, invoice 11338052) on the MVP Refunds page returns 500.

Root cause: Service-account invoices store the client name (ACCOUNT-NAME-...) as account id instead of a numeric org id. check_auth() calls auth-api orgs/{name}/authorizations → 404 → pay-api returns 500.

Workaround (verified): Submit refund directly via Postman — POST /api/v1/payment-requests/{invoice_id}/refunds with staff token and body {"reason": "..."} → 202. The POST path skips the org lookup.

Fix: In pay-api check_auth(), when caller is staff and account id is non-numeric (service account), skip the org authorization call and use the staff branch instead of surfacing 404 as 500.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in pay-api's check_auth() and trace the invoice-fetch request for service-account invoice 11338052. Verify the MVP Refunds page no longer returns 500 for a non-numeric service-account id, while the staff refund endpoint POST /api/v1/payment-requests/{invoice_id}/refunds still returns 202.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, postman, python
Domain
api, authentication, backend, payments
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.