Files
Distribution_GL/General_Ledger_Service.http

338 lines
7.1 KiB
HTTP

@General_Ledger_Service_HostAddress = http://localhost:5200
@ApiKey = dev-only-api-key-please-change-me
GET {{General_Ledger_Service_HostAddress}}/api/v1/status
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 2 - root-level account (no parent) - should succeed
POST {{General_Ledger_Service_HostAddress}}/api/v1/accounts
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"accountCode": "5000",
"accountName": "Expenses",
"accountTypeId": 5,
"isControlAccount": false,
"isPostable": false,
"currencyCode": "LKR"
}
###
# Phase 2 - child account under the root above - should succeed
POST {{General_Ledger_Service_HostAddress}}/api/v1/accounts
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"accountCode": "5401",
"accountName": "Rent Expense",
"parentAccountId": 1,
"accountTypeId": 5,
"isControlAccount": false,
"isPostable": true,
"currencyCode": "LKR"
}
###
# Phase 2 - duplicate account code - should return 400
POST {{General_Ledger_Service_HostAddress}}/api/v1/accounts
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"accountCode": "5000",
"accountName": "Duplicate Expenses",
"accountTypeId": 5,
"isControlAccount": false,
"isPostable": true,
"currencyCode": "LKR"
}
###
# Phase 3 - get one account by code (plain, no tree)
GET {{General_Ledger_Service_HostAddress}}/api/v1/accounts/5000
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 3 - get one account by code with descendant tree
GET {{General_Ledger_Service_HostAddress}}/api/v1/accounts/5401?expand=tree
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 3 - non-existent account code - should return 404
GET {{General_Ledger_Service_HostAddress}}/api/v1/accounts/DOES-NOT-EXIST
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 4 - simple field update (rename), no re-parent
PUT {{General_Ledger_Service_HostAddress}}/api/v1/accounts/5401
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"accountName": "Rent Expense (Updated)"
}
###
# Phase 4 - re-parent to a different existing parent (depth/cycle checks run)
PUT {{General_Ledger_Service_HostAddress}}/api/v1/accounts/5401
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"parentAccountId": null
}
###
# Phase 4 - re-parent onto own descendant - should return 400 (cycle)
PUT {{General_Ledger_Service_HostAddress}}/api/v1/accounts/5000
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"parentAccountId": 2
}
###
# Phase 4 - non-existent account code - should return 404
PUT {{General_Ledger_Service_HostAddress}}/api/v1/accounts/DOES-NOT-EXIST
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"accountName": "Whatever"
}
###
# Phase 5 - list all accounts, default paging
GET {{General_Ledger_Service_HostAddress}}/api/v1/accounts
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 5 - filter by accountTypeId
GET {{General_Ledger_Service_HostAddress}}/api/v1/accounts?accountTypeId=5
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 5 - filter by isPostable + paging
GET {{General_Ledger_Service_HostAddress}}/api/v1/accounts?isPostable=true&page=1&pageSize=2
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 6 - create fiscal year, no auto-generate periods
POST {{General_Ledger_Service_HostAddress}}/api/v1/fiscal-years
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"yearName": "2026",
"startDate": "2026-01-01",
"endDate": "2026-12-31",
"autoGeneratePeriods": false
}
###
# Phase 6 - create fiscal year WITH auto-generate periods (12 monthly)
POST {{General_Ledger_Service_HostAddress}}/api/v1/fiscal-years
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"yearName": "2027",
"startDate": "2027-01-01",
"endDate": "2027-12-31",
"autoGeneratePeriods": true
}
###
# Phase 6 - overlapping date range - should return 400
POST {{General_Ledger_Service_HostAddress}}/api/v1/fiscal-years
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"yearName": "2026 Overlap",
"startDate": "2026-06-01",
"endDate": "2027-06-30",
"autoGeneratePeriods": false
}
###
# Phase 7 - generate periods for the fiscal year created without auto-generate (fiscalYearId=1)
POST {{General_Ledger_Service_HostAddress}}/api/v1/fiscal-years/1/periods
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"periodCount": 12
}
###
# Phase 7 - non-existent fiscal year - should return 404
POST {{General_Ledger_Service_HostAddress}}/api/v1/fiscal-years/999999/periods
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"periodCount": 12
}
###
# Phase 8 - lock period id=1
PUT {{General_Ledger_Service_HostAddress}}/api/v1/periods/1/lock
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"action": "LOCK",
"reason": "Month-end close in progress"
}
###
# Phase 38.1 - get the period covering a date
GET {{General_Ledger_Service_HostAddress}}/api/v1/fiscal-years/periods/by-date?date=2028-01-15
X-Api-Key: {{ApiKey}}
###
# Phase 38.1 - no period covers this date - should return 404
GET {{General_Ledger_Service_HostAddress}}/api/v1/fiscal-years/periods/by-date?date=1999-01-01
X-Api-Key: {{ApiKey}}
###
# Phase 8 - invalid action - should return 400
PUT {{General_Ledger_Service_HostAddress}}/api/v1/periods/1/lock
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"action": "BOGUS",
"reason": "test"
}
###
# Phase 8 - non-existent period - should return 404
PUT {{General_Ledger_Service_HostAddress}}/api/v1/periods/999999/lock
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"action": "LOCK",
"reason": "test"
}
###
# Phase 30 - list all currencies
GET {{General_Ledger_Service_HostAddress}}/api/v1/currencies
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 9 - create a root-level cost center
POST {{General_Ledger_Service_HostAddress}}/api/v1/cost-centers
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"code": "CC-HQ",
"name": "Head Office",
"isActive": true
}
###
# Phase 9 - create a child cost center
POST {{General_Ledger_Service_HostAddress}}/api/v1/cost-centers
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"code": "CC-SALES",
"name": "Sales Department",
"parentCostCenterId": 1,
"isActive": true
}
###
# Phase 9 - duplicate code - should return 400
POST {{General_Ledger_Service_HostAddress}}/api/v1/cost-centers
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"code": "CC-HQ",
"name": "Duplicate",
"isActive": true
}
###
# Phase 9 - non-existent parent - should return 404
POST {{General_Ledger_Service_HostAddress}}/api/v1/cost-centers
X-Api-Key: {{ApiKey}}
Content-Type: application/json
{
"code": "CC-ORPHAN",
"name": "Orphan",
"parentCostCenterId": 999999,
"isActive": true
}
###
# Phase 10 - get one cost center (plain, no tree)
GET {{General_Ledger_Service_HostAddress}}/api/v1/cost-centers/CC-SALES
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 10 - get one cost center with descendant tree
GET {{General_Ledger_Service_HostAddress}}/api/v1/cost-centers/CC-HQ?expand=tree
X-Api-Key: {{ApiKey}}
Accept: application/json
###
# Phase 10 - non-existent cost center code - should return 404
GET {{General_Ledger_Service_HostAddress}}/api/v1/cost-centers/DOES-NOT-EXIST
X-Api-Key: {{ApiKey}}
Accept: application/json
###