🍗 PCK ZRA Middleware Wiki

Integrated Systems

The middleware integrates with four external systems and one internal database. Each integration has its own authentication mechanism, data format and failure modes.

1. Oracle Simphony (Micros POS) — inbound

The point-of-sale system at all Pedro's Chicken locations. When a cashier completes a sale, the terminal sends the invoice here for fiscal processing.

PropertyValue
DirectionInbound (POS → Middleware)
Protocol / formatHTTPS REST, JSON (Taxint format)
AuthenticationBearer JWT (Oracle Restaurant IDM)
EndpointPOST /pckzra/api/taxint/pos/upload

The POS sends a StandardInvoicePayloadDto: DocumentInfo (folio ID, TPIN), SellerInfo (SellerName, contact), FolioInfo (currency, rate, cashier, postings, VAT codes), optional BuyerInfo, and PaymentInfo. It receives an UploadResponseDto with the fiscal folio number and fiscal outputs (QR code, SDC ID, MRC, signature, tax data).

2. Chrilan Smart API (ZRA) — outbound

The fiscal compliance gateway to ZRA. It registers invoices, assigns receipt numbers, generates QR codes and returns digitally signed fiscal data.

PropertyValue
DirectionOutbound
Base URLhttps://zra.abc.co.zm/smartinv
AuthenticationAPI key per store (header x-api-key)
Timeout30 seconds; retry 3 attempts with 1s backoff
EndpointMethodPurpose
/invoice/createPOSTSubmit invoice for fiscal registration
/product/createBulkPOSTCreate/update products in the catalog
/product/validateGETCheck whether a product PLU exists
/codes/currency/allGETList supported currencies

Chrilan errors return JSON with code, message and type; the middleware wraps them in a ChrilanApiException carrying the HTTP status, error details and full response body.

3. Oracle STS API — outbound

Simphony Transaction Services: the source of menu items and tax definitions for synchronization.

PropertyValue
Base URLhttps://msaf-sts.oraclemicros.com/api/v1
AuthenticationOAuth 2.0 authorization code + PKCE (id_token cached until 60s before expiry)
OIDC authorityhttps://ors-idm.msaf.oraclerestaurants.com
OrganizationPCK
Timeout30 seconds
EndpointMethodPurpose
/menus/{menuPath}GETFetch menu items, paginated (offset/limit, loop while hasMore)
/taxesGETFetch tax classes and rates for vatCat mapping

Menu path format: {OrgShortName}:{LocationRef}:{RevenueCenterRef}, e.g. PCK:PCK_3103:101. Both query parameters and Simphony-* headers are required on calls — omitting either yields HTTP 403.

4. Whapi (WhatsApp API) — outbound

WhatsApp Business gateway used to deliver OTP codes to administrators, and available for store-level alert notifications.

PropertyValue
Base URLhttps://gate.whapi.cloud
AuthenticationBearer token
Endpoint usedPOST /messages/text
Togglewhapi.api.enabled

5. MariaDB — internal

PropertyValue
Host / database192.168.0.50:3306 / pckmiddle
DriverMariaDB JDBC (org.mariadb.jdbc.Driver)
PoolHikariCP, max 20 connections, min 5 idle
MigrationsFlyway (V001–V008), auto-run on startup
TablePurpose
api_transactionsFull request/response logging
conversion_logsData transformation audit trail
fiscal_invoicesIssued invoice records for refund lookups
store_registrationsPer-store configuration and API keys
usersPortal user accounts (BCrypt passwords, OTP fields)
system_configKey-value configuration store

Schema detail: Database Schema.

Failure modes quick reference

SystemTypical failureSymptom
Oracle IDMJWKS unreachablePOS calls rejected (401) when validation enabled
ChrilanTimeout / 5xx / invalid keyPOS receives HTTP 500; transaction logged with Chrilan error body
Oracle STSWrong LocRef, expired credentialsMenu sync HTTP 403; products go stale
WhapiToken invalid / disabledOTP not delivered; portal sign-in blocked
MariaDBConnection lossApplication health check fails; requests error