POS and payment webhooks
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
POS HTTP API
Section titled “POS HTTP API”PosController—@Controller('pos')→/api/v1/pos(global API prefix).- Auth:
AuthJwtGuard— accepts admin or vendor JWTs (see file-level comment inpos.controller.ts). Swagger tag: POS (vendor + admin). store_id: optional on many handlers; when omitted,PosService.resolveStoreIdForActorpicks the active store. If none exists, list endpoints may return empty data withstore_id: null; placing an order can return 400no_store_available.- Money side:
POST /pos/orderspersists orders and related finance rows per service comments (receivables / debt flags when applicable). Vendor expense flows stay under vendor finance APIs, not POS.
Terminal payment webhook (server-to-terminal)
Section titled “Terminal payment webhook (server-to-terminal)”PosPaymentWebhookController—@Controller('pos/payments')→/api/v1/pos/payments.- Route:
POST /pos/payments/terminal-webhook(excluded from Swagger via@ApiExcludeEndpoint— treat as integration surface, not public UI). - Headers: optional
x-pos-terminal-key— passed intoPosService.handleTerminalPaymentWebhookfor per-store terminal API key validation (see unit tests inpos.service.spec.tsfor invalid-key rejection). - Body:
TerminalPaymentWebhookDto— validate against DTO / service behavior when integrating a physical terminal or PSP callback. Optionalentry_mode,card_last4,card_exp, andterminal_transaction_at(ISO-8601) are stored interminal_payment_metafor receipt lines (ACCT / CARD / DATE/TIME); optionalsignal_data(PAX-styleindex,levelsegments joined by^, fromEcrHubResult.normalized.signalData) is merged intoterminal_payment_metaand summarized on the receipt SIG line. The WebSocketpayment_resultuses camelCase aliases (entryMode,cardLast4,cardExp,terminalTransactionAt) mapped by the pos-bridge service.
For PSP-specific retry schedules, signature algorithms, and idempotency guarantees, document against your payment provider and the behavior inside PosService.handleTerminalPaymentWebhook (unit tests in pos.service.spec.ts cover invalid keys).
Related
Section titled “Related”- POS card terminals & ECR Hub (PAX focus) — bridge, webhook, PAX layering, checklist, UAT scenarios.
- POS card terminal — CodePay (ECR Hub) — CodePay JSON topics, envelope,
CodepayAdapter, vendor-web lab. - Vendor POS — who may open
/posin the SPA. - API conventions — Swagger as contract source.