Skip to content

Architecture

1. System Context (C4 L1)

2. Container View (C4 L2)

3. Mode-Based Deployment

Controlled by APP_ENV_MQ_PAY_MODE. Source: @nx/mq-pay/src/common/constants.ts:11-14.

ModeControllersQueue producerWorkerProduction pattern
FULL (default)Dev / single-instance
APIOne pod, scale REST horizontally
WORKERN pods, each with unique Snowflake ID (91, 92, …)

4. Component View (C4 L3)

5. Runtime Scenarios

5.1 Boot — MQ-Pay wiring

5.2 IPN → Event → Webhook + WS

5.3 Per-merchant credential lookup

6. Crosscutting Concerns

ConcernHandling
EncryptionCryptoUtility (AES-256-GCM) + secret from APP_ENV_APPLICATION_SECRET; payment provider credentials encrypted at rest
Mode-based deploymentAPP_ENV_MQ_PAY_MODE ∈ {FULL, API, WORKER}; ApplicationPaymentComponent binds options accordingly
AuthNJWT (verified locally via JWKS from identity); IPN endpoints have provider-signature verification (in MQ-Pay)
AuthZCasbin via PolicyDefinitionService; permissions cached
IdempotencyWebhookEventHandlerHelper skips webhook dispatch for non-actionable events (CREATED/SENT); subscriber-side dedup recommended
LoggingIGNIS structured (key: %s); event type + transaction id in every line
Soft-deleteWebhookConfig soft-deletable; Configuration soft-deletable
IDsSnowflake; FULL=4, API=8, WORKER=91+

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