feat(1099): wire W-9 document upload/view for recipients
Adds POST/GET payee-1099/{id}/w9, mirroring the expense-receipt upload:
IFileStorage saves to finance/w9/{id}{ext}, content-type derived from the
blob extension. Frontend dialog (edit mode) gains a W-9 file input and an
auth-correct blob "View W-9" link. Payee1099Service ctor now takes
IFileStorage; tests updated with an in-memory FakeStorage.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -39,4 +39,19 @@ export class Payee1099ApiService {
|
||||
revealTin(id: number): Observable<{ tin: string | null }> {
|
||||
return this.http.get<{ tin: string | null }>(`${this.endpoint}/${id}/tin`);
|
||||
}
|
||||
|
||||
uploadW9(id: number, file: File): Observable<void> {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
return this.http.post<void>(`${this.endpoint}/${id}/w9`, form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the stored W-9 as a Blob via HttpClient so the auth interceptor attaches
|
||||
* the JWT. A plain window.open on the API URL would be an unauthenticated browser
|
||||
* navigation and the API's permission gate would reject it.
|
||||
*/
|
||||
downloadW9(id: number): Observable<Blob> {
|
||||
return this.http.get(`${this.endpoint}/${id}/w9`, { responseType: 'blob' });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user