@breadstone/ziegel-intl-commerce
v0.0.9
Published
A set of classes and functions related to payment systems, currencies, amount, money and card etc.
Readme
@breadstone/ziegel-intl-commerce
International commerce and financial services utilities for the ziegel framework. Provides IBAN validation, BIC/SWIFT codes, country-specific commerce information, and financial data handling.
Financial I18n: Specialized internationalization support for commerce, banking, and financial applications with robust validation and formatting.
🚀 Overview
@breadstone/ziegel-intl-commerce provides:
- IBAN Support: Complete IBAN validation, parsing, formatting, and country-specific handling
- BIC/SWIFT Codes: Bank Identifier Code validation and processing
- Country Commerce Info: Country-specific commerce data, payment methods, and financial regulations
- Financial Validation: Robust validation utilities for financial identifiers and formats
- Payment System Abstractions: Interfaces for international payment processing
📦 Installation
npm install @breadstone/ziegel-intl-commerce
# or
yarn add @breadstone/ziegel-intl-commerce🧩 Features & Usage Examples
IBAN Processing
import { Iban, IIbanLike } from '@breadstone/ziegel-intl-commerce';
// Create and validate IBAN
const iban = new Iban('DE89370400440532013000');
console.log(iban.isValid); // true
console.log(iban.countryCode); // "DE"
console.log(iban.formatted); // "DE89 3704 0044 0532 0130 00"
// Work with IBAN-like objects
class CustomIban implements IIbanLike {
constructor(private value: string) {}
get iban() { return this.value; }
get isValid() { return Iban.validate(this.value); }
}BIC/SWIFT Code Handling
import { IBicLike } from '@breadstone/ziegel-intl-commerce';
class BicCode implements IBicLike {
constructor(private code: string) {}
get bankCode(): string {
return this.code.substring(0, 4);
}
get countryCode(): string {
return this.code.substring(4, 6);
}
get locationCode(): string {
return this.code.substring(6, 8);
}
}
const bic = new BicCode('DEUTDEFF');
console.log(bic.bankCode); // "DEUT"
console.log(bic.countryCode); // "DE"Country Commerce Information
import { CountryInfo, ICountryInfoLike } from '@breadstone/ziegel-intl-commerce';
const germanyInfo = new CountryInfo('DE');
console.log(germanyInfo.ibanLength); // 22
console.log(germanyInfo.supportedPaymentMethods);
console.log(germanyInfo.currencyCode); // "EUR"
// Custom country info implementation
class CustomCountryInfo implements ICountryInfoLike {
constructor(private code: string) {}
get countryCode() { return this.code; }
get paymentRegulations() { return this.getRegulations(); }
private getRegulations() {
// Return country-specific payment regulations
return {};
}
}Financial Data Validation
import { Iban } from '@breadstone/ziegel-intl-commerce';
// Batch IBAN validation
const ibanCodes = [
'DE89370400440532013000',
'GB82WEST12345698765432',
'INVALID_IBAN'
];
const validationResults = ibanCodes.map(code => ({
iban: code,
isValid: new Iban(code).isValid,
country: new Iban(code).countryCode
}));
console.log(validationResults);
// [
// { iban: 'DE89...', isValid: true, country: 'DE' },
// { iban: 'GB82...', isValid: true, country: 'GB' },
// { iban: 'INVALID...', isValid: false, country: null }
// ]📚 Package import points
import {
// IBAN utilities
Iban, IIbanLike,
// BIC/SWIFT utilities
IBicLike,
// Country commerce information
CountryInfo, ICountryInfoLike
} from '@breadstone/ziegel-intl-commerce';📚 API Documentation
For detailed API documentation, visit: API Docs
Related Packages
- @breadstone/ziegel-core: Foundation utilities and type definitions
- @breadstone/ziegel-intl: Core internationalization support
- @breadstone/ziegel-intl-units: Units of measurement and conversion
License
MIT
Issues
Please report bugs and feature requests in the Issue Tracker
Part of the ziegel Enterprise TypeScript Framework } from '@breadstone/ziegel-intl-commerce';
## API Documentation
See the generated API docs or source code for full details.
## Related Packages
- **@breadstone/ziegel-intl**: Core internationalization features
- **@breadstone/ziegel-core**: Foundation utilities
## License
MIT
## Issues
Please report bugs and feature requests in the [Issue Tracker](https://github.com/RueDeRennes/ziegel/issues).