Skip to content

Integration

1. Service anh em

Direction: gọi / được gọi bởi / hai chiều. Phụ thuộc lúc build chỉ là @nx/core; mọi liên kết bên dưới đều 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 shape-n/a (read)n/a
@nx/invoiceBên tiêu thụ TaxInfo (không có bề mặt taxation)chỉ ghép nối qua core model-n/an/a
@nx/identityJWT issuer; JWKS được xác minh mỗi requestES256 JWKSJWTrequest lỗi 401n/a
commerce MerchantRepositoryIn-process DI (MerchantRepository) để tra cứu taxMethodrepository contract-ném lỗi khi không tìm thấyn/a

TaxGroupService inject một binding kiểu MerchantRepository để đọc merchant taxMethod trong lúc kiểm tra. Binding được phân giải từ shared DI graph, không qua HTTP.

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

SystemDirectionSurfaceAuthFailure Mode
Kafka / DebeziumTiêu thụ public.ProductSASL SCRAM-SHA-512broker kết nối lại (có 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 của dòng
3-4Taxation reconcile: provision khi có taxGroupId, ngược lại deprovision
5Pricing đọc trực tiếp TaxSet/Tax đã provision - không có event từ taxation

3.2 Kiểm tra phương pháp thuế của merchant

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

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.