feat: Global-2 EU VAT Engine — per-country VAT routing for non-India stores#9
Open
SVamseekar wants to merge 11 commits into
Open
feat: Global-2 EU VAT Engine — per-country VAT routing for non-India stores#9SVamseekar wants to merge 11 commits into
SVamseekar wants to merge 11 commits into
Conversation
…ice.createOrder — Global-2 pre-req Documents existing behaviour (5% GST, RECEIVED status, subtotal calculation, event publishing) before any EU VAT Engine changes land.
…lds to Store entity
…(PostgreSQL V4 migration)
…em for VAT routing
- StoreServiceClient.getStore() fetches Store from core-service (fail-open → empty Store) - OrderService.createOrder() routes EU stores (countryCode non-null) to EuVatEngine, India stores (countryCode null) continue on existing GST/TaxConfiguration path - Order item category field propagated from CreateOrderRequest through to OrderItem - VatBreakdown attached to Order + dual-written to OrderJpaEntity (JSONB column) - OrderServiceEuVatTest: 4 unit tests covering DE DINE_IN, DE TAKEAWAY, FR mixed items, and India-store null-countryCode guard
- OrderCreatedEvent: new vatCountryCode + totalVatAmount fields (nullable, backward compatible) Jackson @JsonCreator updated to deserialize both new fields - OrderStatusChangedEvent: same two fields added with same pattern - OrderService: all 5 event publish call sites (createOrder + 4 status transitions) now populate vatCountryCode/totalVatAmount from the saved Order - OrderEventVatFieldsTest: 4 tests cover DE/FR EU round-trip and India null guard
Store entity already carries countryCode/vatNumber/currency/locale (added Task 3). StoreController uses Store as both request/response body, so passthrough is automatic. 4 tests confirm: null defaults for India stores, round-trip for EU stores, and the routing gate (non-null countryCode = EU VAT path).
…er Global-2 wiring - OrderServiceCreateOrderTest: add EuVatEngine (16th constructor arg) and stub storeServiceClient.getStore() to return empty Store (India GST path) - StoreVatFieldsTest: fix setStoreCode() → setCode() (Store field is 'code' not 'storeCode')
SVamseekar
added a commit
that referenced
this pull request
Apr 10, 2026
… order to show G1+G2 done, G3-G9 pending
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.
Summary
shared-models; per-line BigDecimal calculation with HALF_UP roundingcountryCode,vatNumber,currency,localefields addedvatCountryCode,vatBreakdown,totalNetAmount,totalVatAmount,totalGrossAmountadded; Flyway V4 migration adds columns + JSONB index tocommerce_schema.orders@Service; routes by(countryCode, orderContext, category)with FOOD fallbackstore.countryCode != null→ EuVatEngine;null→ existing GST/TaxConfiguration path unchangedOrderCreatedEvent+OrderStatusChangedEventgainvatCountryCode+totalVatAmount(backward-compatible, nullable)Test plan
TaxConfigurationTest(9) — safety floor, India GST path unchangedEuVatConfigurationTest(8) — rate lookup, fallback, unknown countryOrderVatFieldsTest(7) — entity field round-tripsOrderServiceCreateOrderTest(6) — India store order creation still correctEuVatEngineTest(5) — DE DINE_IN 19%, DE TAKEAWAY 7%, null category fallback, multi-line totalsOrderServiceEuVatTest(4) — EU routing: DE/FR, India null-countryCode guardVatBreakdownTest(2) — shared-models value objectStoreVatFieldsTestshared-models (6) + core-service (4)OrderEventVatFieldsTest(4) — event VAT field round-tripsDependencies