Repository navigation
Store the ticket billing country as an ISO code - #281
Draft
claude[bot] wants to merge 1 commit into
Draft
claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
The checkout's free-text country field becomes a select (EU/EEA, CH, GB,
US; default DE) and the API accepts only listed codes. A shared helper
maps legacy free text ("Deutschland", "Germany", ...) to codes and renders
a code as its German name, which the invoice PDF now uses. Legacy values
still print as entered. Prepares e-invoices (ZUGFeRD), which need the
buyer's country code.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FBHiR6NFRe6QR5SBjSv4nw
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Richard Hartmann · Slack thread
Before: The ticket checkout asked for the billing country as free text, so
ticket_orders.billing_countryholds whatever was typed ("Deutschland", "DE", "Germany", "Österreich", or nothing). E-invoices (ZUGFeRD / EN 16931) need the buyer's country as an ISO 3166-1 alpha-2 code, which can't be derived reliably from that.After: The checkout offers a country select (EU/EEA, Switzerland, UK, US; German names; default Deutschland) and stores the ISO code, e.g.
DE. The API rejects anything that isn't a listed code. Required-ness is unchanged: mandatory for company purchases, optional for the private address. The invoice PDF prints a code as its German name ("Deutschland"); older orders with free text print exactly as before. This prepares e-invoicing (ZUGFeRD); existing orders need no migration because the normalizer maps their free text to a code when the e-invoice is built.How: a new
shared-code/helpers/billingCountry.tsholds the country list plusnormalizeBillingCountry(free text or code → code, unknown/empty →undefined),getBillingCountryNameandformatBillingCountry. The Nuxt app (select, review step, zod schema) and the Directus bundle (invoice PDF) both import it, so nothing is duplicated. The checkout store also normalizes country values saved inlocalStoragebefore this change, so a returning buyer with "Deutschland" in their draft seesDEselected; an unknown value is cleared and has to be picked again. No Directus schema change.Tests:
nuxt-app/test/billingCountry.test.tscovers the normalizer and renderer, the list (unique codes, matchesIntl.DisplayNames('de'), sorted) and the schema rules.invoice-billing-country.test.tsin the bundle renders a PDF and checks the printed country line. Checked: nuxt-appprettier:check,lint,typecheck:ratchet(steady at baseline) andtest; bundleprettier:check,lint,testandbuild.Generated by Claude Code