Testing standard nested YAML structure dengan multiple root keys dan arrays of objects dengan properties kompleks.
Configuration file untuk multiple billers dengan struktur yang sama, di mana setiap biller punya API credentials dan HTTP headers configuration.
fundtastic:
ApiSecret: secret_fundtastic_123
TrxAuthMethod: basic
TrxSignKey: X-Signature
TrxSignAlgorithm: HMACSHA256(hex)/ApiSecret
endpoint: https://api.fundtastic.com/v1
timeout: 30000
headers:
- name: Content-Type
type: LITERAL
value: application/json
- name: X-Timestamp
type: DEFAULT
- name: X-Signature
type: PATH
value: Environment.Variables.Signature
itm:
ApiSecret: secret_itm_456
TrxAuthMethod: bearer
TrxSignKey: Authorization
endpoint: https://api.itm.com/payment
headers:
- name: Authorization
type: LITERAL
value: Bearer token123
- name: Content-Type
value: application/json
{
"fundtastic": {
"ApiSecret": "secret_fundtastic_123",
"TrxAuthMethod": "basic",
"TrxSignKey": "X-Signature",
"TrxSignAlgorithm": "HMACSHA256(hex)/ApiSecret",
"endpoint": "https://api.fundtastic.com/v1",
"timeout": "30000",
"headers": [
{
"name": "Content-Type",
"type": "LITERAL",
"value": "application/json"
},
{
"name": "X-Timestamp",
"type": "DEFAULT"
},
{
"name": "X-Signature",
"type": "PATH",
"value": "Environment.Variables.Signature"
}
]
},
"itm": {
"ApiSecret": "secret_itm_456",
"TrxAuthMethod": "bearer",
"TrxSignKey": "Authorization",
"endpoint": "https://api.itm.com/payment",
"headers": [
{
"name": "Authorization",
"type": "LITERAL",
"value": "Bearer token123"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
}
-- Ambil config untuk biller 'fundtastic'
DECLARE billerConfig REFERENCE TO Environment.Variables;
DECLARE success BOOLEAN;
CALL ACE_LIB.getConfig(
'BILLER_CONFIG_fundtastic',
'fundtastic',
'/path/to/CONFIG1.yaml',
'600',
billerConfig
) INTO success;
IF success THEN
-- Akses scalar values
DECLARE apiSecret CHARACTER billerConfig.ApiSecret;
DECLARE endpoint CHARACTER billerConfig.endpoint;
DECLARE timeout CHARACTER billerConfig.timeout;
-- Loop headers array
DECLARE headerRef REFERENCE TO billerConfig.headers[1];
WHILE LASTMOVE(headerRef) DO
DECLARE headerName CHARACTER headerRef.name;
DECLARE headerType CHARACTER headerRef.type;
DECLARE headerValue CHARACTER COALESCE(headerRef.value, '');
-- Process header...
MOVE headerRef NEXTSIBLING;
END WHILE;
END IF;
✅ Multiple root keys (fundtastic, itm)
✅ Nested scalar values
✅ Arrays of objects with multiple properties
✅ Optional properties in array items (some headers have value, some don't)
✅ Dynamic key selection (dapat pilih fundtastic atau itm)