This project implements the payment instruction parser and executor described in the Resilience17 Node backend assessment, using the provided scaffold.
The main REST endpoint is:
POST /payment-instructions
It parses instructions like:
DEBIT 30 USD FROM ACCOUNT a FOR CREDIT TO ACCOUNT b
or
CREDIT 300 NGN TO ACCOUNT acc-002 FOR DEBIT FROM ACCOUNT acc-001 ON 2026-12-31
and returns a structured response with transaction status, codes, and updated account balances.
- Node.js (CommonJS)
- Express (via
@app-core/server) - In‑memory account processing (no database required for this assessment)
- Install dependencies:
npm install- Create a
.envfile (optional). For this assessment:
- No MongoDB is required.
- Ensure either:
DISABLE_DB=1, orMONGO_URIis not set.
- Start the server:
node app.jsBy default the app listens on process.env.PORT (or 8811 if set in your environment).
If this project is deployed, the assessment endpoint is available at:
POST https://payment-instruction-parser-hykt.onrender.com/payment-instructions
Quick test with curl:
curl -X POST https://payment-instruction-parser-hykt.onrender.com/payment-instructions \
-H "Content-Type: application/json" \
-d '{
"accounts": [
{ "id": "a", "balance": 230, "currency": "USD" },
{ "id": "b", "balance": 300, "currency": "USD" }
],
"instruction": "DEBIT 30 USD FROM ACCOUNT a FOR CREDIT TO ACCOUNT b"
}'Request body:
{
"accounts": [
{ "id": "a", "balance": 230, "currency": "USD" },
{ "id": "b", "balance": 300, "currency": "USD" }
],
"instruction": "DEBIT 30 USD FROM ACCOUNT a FOR CREDIT TO ACCOUNT b"
}Response (successful example):
{
"type": "DEBIT",
"amount": 30,
"currency": "USD",
"debit_account": "a",
"credit_account": "b",
"execute_by": null,
"status": "successful",
"status_reason": "Transaction executed successfully",
"status_code": "AP00",
"accounts": [
{
"id": "a",
"balance": 200,
"balance_before": 230,
"currency": "USD"
},
{
"id": "b",
"balance": 330,
"balance_before": 300,
"currency": "USD"
}
]
}Common error responses use:
status:"failed"or"pending"status_code: one ofAM01,CU01,CU02,AC01,AC02,AC03,AC04,DT01,SY01,SY02,SY03,AP00,AP02
For completely unparseable instructions, all parseable fields are null and accounts is an empty array.
- Parser is implemented in
services/payment-instructions/parser.jsusing string methods only (no regex). - Business rules and status codes live in
services/payment-instructions/validator.js. - Orchestration and response shaping are in
services/payment-instructions/process-payment-instruction.js. - Endpoint handler is
endpoints/payment-instructions/create.jsand is wired inapp.jsviaENDPOINT_CONFIGS.
When deploying to a platform like Render:
- Build command:
npm install - Start command:
node app.js - Environment variables:
DISABLE_DB=1NODE_ENV=production- Do not set
MONGO_URI/MONGODB_URI
Deployed endpoint path remains:
POST https://<your-host>/payment-instructions