Files
accounted/lib/providers/wint/config.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

57 lines
2.0 KiB
TypeScript

import { ResourceType } from '../dto';
import type { RateLimitConfig, WintResourceConfig } from '../types';
import {
mapWintToSalesInvoice,
mapWintToCustomer,
mapWintToAccountingAccount,
mapWintToCompanyInformation,
} from './mapper';
// WINT has no published developer docs; every endpoint below comes from the
// OpenAPI specs their API host serves itself (https://api.wint.se/index.html,
// spec /swagger/v1/swagger.json, fetched 2026-08-06). We deliberately stay on
// the partner-facing "v1" surface: the SIE export and IncomingInvoice
// endpoints exist only in their Full/Internal specs and are NOT used here
// (Tier A: the general ledger is reconstructed from /api/Voucher + /api/Account
// and rendered as SIE on our side; see sie-builder.ts).
export const WINT_BASE_URL = 'https://api.wint.se';
// Undocumented; start conservative until WINT confirms a real budget.
export const WINT_RATE_LIMIT: RateLimitConfig = { maxRequests: 3, windowMs: 1000 };
export const WINT_RESOURCE_CONFIGS: Partial<Record<ResourceType, WintResourceConfig>> = {
[ResourceType.SalesInvoices]: {
listEndpoint: '/api/Invoice',
detailEndpoint: '/api/Invoice/{id}',
idField: 'Id',
mapper: mapWintToSalesInvoice,
paginated: true,
modifiedParam: 'LastUpdated',
},
[ResourceType.Customers]: {
listEndpoint: '/api/Customer',
detailEndpoint: '/api/Customer/{id}',
idField: 'Id',
mapper: mapWintToCustomer,
paginated: true,
modifiedParam: 'UpdatedAfter',
},
[ResourceType.AccountingAccounts]: {
listEndpoint: '/api/Account',
detailEndpoint: '/api/Account',
idField: 'Id',
mapper: mapWintToAccountingAccount,
paginated: true,
},
[ResourceType.CompanyInformation]: {
// GET /api/Auth describes the company the current token is scoped to
// (Id, Name, Org, NoVat, FinancialYears, ...): WINT has no separate
// company-information endpoint on the v1 surface.
listEndpoint: '/api/Auth',
detailEndpoint: '/api/Auth',
idField: 'Id',
mapper: mapWintToCompanyInformation,
singleton: true,
},
};