Repository navigation
Release v0.0.8
Version 0.0.8: Optional Postal Address Support
Features:
- Optional postal address support for creditor and debtor
- Addresses included in XML only if provided
- Support for camelCase and snake_case formats
- Empty arrays ignored
- Comprehensive test coverage
Breaking Changes: None
Migration: No action required
Changelog
Added
- Postal Address Support (Optional): Added support for exporting creditor and debtor postal addresses in the generated XML
- Addresses are completely optional - only included if provided in the array
- Addresses are included using structured format (PstlAdr) with elements: StrtNm, TwnNm, PstCd, and Ctry
- Addresses are automatically added to XML using DOM manipulation after generation
- Both
DirectDebitDataandDirectDebitTransactionsupport address fields - Addresses can be set via object methods (
setCreditorAddress(),setDebtorAddress()) or array input (both camelCase and snake_case) - Support for
creditorAddressanddebtorAddressingenerateFromArray()method - Support for
creditor_addressanddebtor_addressin snake_case format - Support for individual address fields:
creditor_street,creditor_city,creditor_postal_code,creditor_country,debtor_street,debtor_city,debtor_postal_code,debtor_country - Updated
setCreditorAddress()andsetDebtorAddress()methods to accept arrays directly - Empty address arrays are ignored and will not create address elements
- At least one address field must be provided for the address to be included in XML
- Updated documentation to reflect address support and optional nature
Changed
- Updated
DEPRECATED_FIELDS.mdto clarify that addresses are now supported (as of v0.0.8) - Updated README examples to show address usage and clarify that addresses are optional
- Address methods now accept arrays directly as first parameter for better usability
Test Coverage
- Added 8 new tests for address functionality:
testGenerateXmlWithCreditorAddress()- Tests creditor address with object methodstestGenerateXmlWithDebtorAddress()- Tests debtor address with object methodstestGenerateXmlWithBothAddresses()- Tests both addresses togethertestGenerateFromArrayWithCreditorAddressSnakeCase()- Tests creditor address in snake_casetestGenerateXmlWithoutAddresses()- Tests that addresses are not included when not providedtestGenerateXmlWithEmptyAddressArray()- Tests that empty address arrays are ignored- Updated
testGenerateXml()- Verifies no address elements when addresses are not provided - Updated
testGenerateFromArrayWithAddresses()- Enhanced assertions for address elements - Updated
testGenerateFromArrayWithAddressesSnakeCase()- Enhanced assertions for address elements