Skip to content

Integration

1. Service anh em

Direction: gọi / được gọi bởi (tiêu thụ từ) / hai chiều.

SisterDirectionSurfaceContractAuthFailure ModeIdempotency
@nx/saleKafka payment.successevent → phiếu RECEIPTat-least-once(SALE_ORDER, attempt.uid)
@nx/inventoryKafka purchase-order.receivedevent → phiếu PAYMENT (party VENDOR)at-least-once(PURCHASE_ORDER, purchaseOrderId)
@nx/inventoryKafka inventory.issued-for-saleevent → COGS ADJUSTMENTat-least-once(SALE_ORDER, attemptUid)
@nx/inventoryKafka inventory.adjustedevent → INVENTORY ADJUSTMENTat-least-once(INVENTORY_ADJUSTMENT, inventoryTrackingId)
@nx/commerceDebezium CDC Merchantrow → đối soát tài khoảnat-least-oncekiểm tra tồn tại tài khoản
@nx/corein-process (repos/services re-export)DI bindings
@nx/assetin-process componentdữ liệu tham chiếu ngân hàng VN
@nx/identityHTTP — JWKS verify (VerifierApplication)JWT (ES256)JWTretry / cacherequest-id được propagate

Finance resolve PurchaseOrder + Vendor qua repository @nx/core được re-export (cùng DB) để enrich party của phiếu PAYMENT — không có lời gọi HTTP tới inventory.

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

Không trực tiếp. Credential payment-gateway (VNPAY, banks, e-wallets) được lưu trong PaymentIntegration (encrypted) nhưng finance không gọi các gateway đó — @nx/mq-pay sở hữu traffic provider. @nx/asset cung cấp dữ liệu tham chiếu ngân hàng Việt Nam tĩnh.

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

3.1 Thanh toán bán hàng → thu nhập ledger

Contract: finance chỉ hạch toán khi payload sale mang theo tài khoản được chọn (attempt.finance.source.id). Tender tách post một RECEIPT cho mỗi attempt, dedup theo attempt.uid.

3.2 Đơn mua đã nhận → thanh toán vendor + tài sản tồn kho

3.3 Xuất/điều chỉnh tồn kho → hạch toán COGS & tài sản

3.4 Onboarding merchant (CDC)

4. Tính ổn định Contract

SurfaceStabilityVersioning
HTTP /v1/api/finance/*stableURL prefix /v1/
Kafka payment.success (tiêu thụ)stablepayload chỉ thêm trường
Kafka purchase-order.received (tiêu thụ)stablepayload chỉ thêm trường
Kafka inventory.issued-for-sale / inventory.adjusted (tiêu thụ)stablepayload chỉ thêm trường
Debezium Merchant CDCtheo schema commercechỉ thêm cột
Kafka outboundhiện không códự trữ

5. Trang liên quan

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