feat(billing): sell to the countries in BILLING_SELL_COUNTRIES #168
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-payment!168
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "feat/sell-abroad"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
What
Billing can sell outside Sweden, behind one allowlist. Four commits, in order:
fix(vat): standard rates for all EU-27 countries (Finland was 25.6, is 25.5). A Norwegian business without a validated VAT number pays VOEC like a consumer.feat(billing):charge.billing_countryandcharge.card_country(migration 0011). The Mollie adapter readsdetails.cardCountryCode.feat(billing):BILLING_SELL_COUNTRIESenforcement instartCheckout. Contract 0.11.0.feat(cli):cli.js sales <YYYY-Qn | YYYY> [--eur-rate N], README, ten-year retention for records that support an OSS return.How the flag works
BILLING_SELL_COUNTRIESis a comma-separated list of ISO alpha-2 codes. Unset or empty meansSE. It is parsed per call and every listed code must have a VAT rate, or the service does not start.startCheckouttakes an optionalcountry(^[A-Z]{2}$). It uses that, else the storedcustomer.country, elseSEonly while the list is exactly{SE}. Then:BAD_REQUESTcountry_not_sold.SElisted:country_required.one_time_sweden_only.restrictPaymentMethodsToCountry.card country mismatch) and not activated. A Swedish checkout accepts any card. Renewals are not checked.The price stays the same gross. VAT is backed out at the destination rate.
How it was tested
vat.test.ts: all 27 codes as consumer (oss) and validated business (reverse-charge), FI 2550, NO business without a number isvoec, unknown code throws.mollie.test.ts: card country read or omitted, restriction and card-only methods sent only withrestrictCountry.billing.test.ts(Postgres): with the variable unset a Swedish checkout is unchanged (25 % domestic, 150000 gross, no restriction argument); refusals; listed country at 1900osswith restriction; stored-country fallback; match activates; mismatch and missing card country refund and stay inactive; Swedish checkout with a foreign card activates; evidence columns on first payment and renewal; sales report query.config.test.ts,env.test.ts, contractindex.test.ts.sales.test.ts: Stockholm quarter bounds, grouping and section order, EUR rounding, refund VAT split, non-SEK rows, empty period, bad period and rate.pnpm test(594 tests, with Postgres 17),pnpm typecheck,pnpm lint,pnpm drizzle-kit check.Closes #117.
Version 0.12.0.