Skip to content

Integration

1. Service anh em

Direction: gọi / được gọi bởi / hai chiều. Phụ thuộc build-time chỉ là @nx/core; mọi coupling bên dưới qua shared DB hoặc Kafka CDC.

SisterDirectionSurfaceContractAuthFailure ModeIdempotency
@nx/commerceKafka public.Product (Debezium)CDC envelope (TProductPgRow)at-least-once; log + skip(productId, taxGroupId, op)
@nx/pricingShared DB read pricing.TaxSet / pricing.TaxDrizzle row shapen/a (read)n/a
@nx/invoiceConsumer TaxInfo (không có bề mặt taxation)ghép chỉ qua core modeln/an/a
@nx/identityJWT issuer; JWKS verify mỗi requestES256 JWKSJWTrequest fail 401n/a
commerce MerchantRepositoryIn-process DI (MerchantRepository) để lookup taxMethodrepository contractthrow khi not-foundn/a

TaxGroupService inject một binding kiểu MerchantRepository để đọc merchant taxMethod trong lúc validate. Binding được resolve từ shared DI graph, không qua HTTP.

2. Hệ thống bên ngoài

SystemDirectionSurfaceAuthFailure Mode
Kafka / DebeziumConsume public.ProductSASL SCRAM-SHA-512broker reconnect (log)
PostgreSQLSchema tax + pricinguser/passpool error

3. Luồng cross-service quan trọng

3.1 Thay đổi sản phẩm → provisioning thuế

BướcChi tiết
1-2Commerce sở hữu Product; Debezium bắt thay đổi dòng
3-4Taxation reconcile: provision khi taxGroupId set, ngược lại deprovision
5Pricing đọc TaxSet/Tax đã provision trực tiếp — không có event từ taxation

3.2 Validate tax-method của merchant

BướcChi tiết
4Merchant DIRECT không thể dùng group DEDUCTION (và ngược lại); merchant taxMethod chưa set thì cho phép bất kỳ

4. Tính ổn định Contract

SurfaceStabilityVersioning
HTTP /tax-groups, /tax-group-itemsstableURL /v1/
HTTP /tax-provisioning/*stableURL /v1/
HTTP /vn-* readsstableURL /v1/
Kafka public.Product (inbound)external (Debezium-defined)Debezium schema
Shared read pricing.TaxSet / pricing.Taxstable (core-owned)schema migration

5. Trang liên quan

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.