PRERELEASE 10A

This commit is contained in:
sparkyx 2025-11-22 15:40:35 +01:00
commit 83efa90a33
1141 changed files with 40635 additions and 85178 deletions

2
vendor/autoload.php vendored
View file

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit1a0e4ea3fb1d108a445b9e95a7c251ad::getLoader();
return ComposerAutoloaderInit448b098c3c50cca42ba3346b6c3682c0::getLoader();

View file

@ -1,4 +1,4 @@
Copyright (c) 2017, Ben Scholzen 'DASPRiD'
Copyright (c) 2017-present, Ben Scholzen 'DASPRiD'
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -55,3 +55,8 @@ $renderer = new GDLibRenderer(400);
$writer = new Writer($renderer);
$writer->writeFile('Hello World!', 'qrcode.png');
```
## Development
To run unit tests, you need to have [Node.js](https://nodejs.org/en) and the pixelmatch library installed. Running
`npm install` will install this for you.

View file

@ -30,8 +30,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "^10.5.11 || 11.0.4",
"phpunit/phpunit": "^10.5.11 || ^11.0.4",
"spatie/phpunit-snapshot-assertions": "^5.1.5",
"spatie/pixelmatch-php": "^1.2.0",
"squizlabs/php_codesniffer": "^3.9",
"phly/keep-a-changelog": "^2.12"
},

View file

@ -25,6 +25,11 @@ final class Encoder
/** @deprecated use DEFAULT_BYTE_MODE_ENCODING */
public const DEFAULT_BYTE_MODE_ECODING = self::DEFAULT_BYTE_MODE_ENCODING;
/**
* Allowed characters for the Alphanumeric Mode.
*/
private const ALPHANUMERIC_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:';
/**
* The original table is defined in the table 5 of JISX0510:2004 (p.19).
*/
@ -115,7 +120,11 @@ final class Encoder
$headerAndDataBits->appendBitArray($headerBits);
// Find "length" of main segment and write it.
$numLetters = (Mode::BYTE() === $mode ? $dataBits->getSizeInBytes() : strlen($content));
$numLetters = match ($mode) {
Mode::BYTE() => $dataBits->getSizeInBytes(),
Mode::NUMERIC(), Mode::ALPHANUMERIC() => strlen($content),
Mode::KANJI() => iconv_strlen($content, 'utf-8'),
};
self::appendLengthInfo($numLetters, $version, $mode, $headerAndDataBits);
// Put data together into the overall payload.
@ -148,13 +157,9 @@ final class Encoder
/**
* Gets the alphanumeric code for a byte.
*/
private static function getAlphanumericCode(int $code) : int
private static function getAlphanumericCode(int $byte) : int
{
if (isset(self::ALPHANUMERIC_TABLE[$code])) {
return self::ALPHANUMERIC_TABLE[$code];
}
return -1;
return self::ALPHANUMERIC_TABLE[$byte] ?? -1;
}
/**
@ -162,30 +167,20 @@ final class Encoder
*/
private static function chooseMode(string $content, ?string $encoding = null) : Mode
{
if ('' === $content) {
return Mode::BYTE();
}
if (null !== $encoding && 0 === strcasecmp($encoding, 'SHIFT-JIS')) {
return self::isOnlyDoubleByteKanji($content) ? Mode::KANJI() : Mode::BYTE();
}
$hasNumeric = false;
$hasAlphanumeric = false;
$contentLength = strlen($content);
for ($i = 0; $i < $contentLength; ++$i) {
$char = $content[$i];
if (ctype_digit($char)) {
$hasNumeric = true;
} elseif (-1 !== self::getAlphanumericCode(ord($char))) {
$hasAlphanumeric = true;
} else {
return Mode::BYTE();
}
if (ctype_digit($content)) {
return Mode::NUMERIC();
}
if ($hasAlphanumeric) {
if (self::isOnlyAlphanumeric($content)) {
return Mode::ALPHANUMERIC();
} elseif ($hasNumeric) {
return Mode::NUMERIC();
}
return Mode::BYTE();
@ -205,7 +200,7 @@ final class Encoder
}
/**
* Checks if content only consists of double-byte kanji characters.
* Checks if content only consists of double-byte kanji characters (or is empty).
*/
private static function isOnlyDoubleByteKanji(string $content) : bool
{
@ -222,7 +217,7 @@ final class Encoder
}
for ($i = 0; $i < $length; $i += 2) {
$byte = ord($bytes[$i]) & 0xff;
$byte = ord($bytes[$i]);
if (($byte < 0x81 || $byte > 0x9f) && $byte < 0xe0 || $byte > 0xeb) {
return false;
@ -232,6 +227,14 @@ final class Encoder
return true;
}
/**
* Checks if content only consists of alphanumeric characters (or is empty).
*/
private static function isOnlyAlphanumeric(string $content) : bool
{
return strlen($content) === strspn($content, self::ALPHANUMERIC_CHARS);
}
/**
* Chooses the best mask pattern for a matrix.
*/
@ -457,7 +460,7 @@ final class Encoder
$toEncode = new SplFixedArray($numDataBytes + $numEcBytesInBlock);
for ($i = 0; $i < $numDataBytes; $i++) {
$toEncode[$i] = $dataBytes[$i] & 0xff;
$toEncode[$i] = $dataBytes[$i];
}
$ecBytes = new SplFixedArray($numEcBytesInBlock);
@ -514,31 +517,15 @@ final class Encoder
/**
* Appends bytes to a bit array in a specific mode.
*
* @throws WriterException if an invalid mode was supplied
*/
private static function appendBytes(string $content, Mode $mode, BitArray $bits, string $encoding) : void
{
switch ($mode) {
case Mode::NUMERIC():
self::appendNumericBytes($content, $bits);
break;
case Mode::ALPHANUMERIC():
self::appendAlphanumericBytes($content, $bits);
break;
case Mode::BYTE():
self::append8BitBytes($content, $bits, $encoding);
break;
case Mode::KANJI():
self::appendKanjiBytes($content, $bits);
break;
default:
throw new WriterException('Invalid mode: ' . $mode);
}
match ($mode) {
Mode::NUMERIC() => self::appendNumericBytes($content, $bits),
Mode::ALPHANUMERIC() => self::appendAlphanumericBytes($content, $bits),
Mode::BYTE() => self::append8BitBytes($content, $bits, $encoding),
Mode::KANJI() => self::appendKanjiBytes($content, $bits),
};
}
/**
@ -649,8 +636,8 @@ final class Encoder
$length = strlen($bytes);
for ($i = 0; $i < $length; $i += 2) {
$byte1 = ord($bytes[$i]) & 0xff;
$byte2 = ord($bytes[$i + 1]) & 0xff;
$byte1 = ord($bytes[$i]);
$byte2 = ord($bytes[$i + 1]);
$code = ($byte1 << 8) | $byte2;
if ($code >= 0x8140 && $code <= 0x9ffc) {

View file

@ -172,7 +172,7 @@ final class MaskUtil
$numTotalCells = $height * $width;
$darkRatio = $numDarkCells / $numTotalCells;
$fixedPercentVariances = (int) (abs($darkRatio - 0.5) * 20);
$fixedPercentVariances = (int) floor(abs($darkRatio - 0.5) * 20);
return $fixedPercentVariances * self::N4;
}

View file

@ -197,7 +197,6 @@ final class GDLibRenderer implements RendererInterface
);
}
imagedestroy($this->image);
$this->colors = [];
$this->image = null;

View file

@ -19,105 +19,4 @@ return array(
'FPDF' => $vendorDir . '/setasign/fpdf/fpdf.php',
'Override' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/Override.php',
'SQLite3Exception' => $vendorDir . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php',
'ezcBase' => $vendorDir . '/zetacomponents/base/src/base.php',
'ezcBaseAutoloadException' => $vendorDir . '/zetacomponents/base/src/exceptions/autoload.php',
'ezcBaseAutoloadOptions' => $vendorDir . '/zetacomponents/base/src/options/autoload.php',
'ezcBaseConfigurationInitializer' => $vendorDir . '/zetacomponents/base/src/interfaces/configuration_initializer.php',
'ezcBaseDoubleClassRepositoryPrefixException' => $vendorDir . '/zetacomponents/base/src/exceptions/double_class_repository_prefix.php',
'ezcBaseException' => $vendorDir . '/zetacomponents/base/src/exceptions/exception.php',
'ezcBaseExportable' => $vendorDir . '/zetacomponents/base/src/interfaces/exportable.php',
'ezcBaseExtensionNotFoundException' => $vendorDir . '/zetacomponents/base/src/exceptions/extension_not_found.php',
'ezcBaseFeatures' => $vendorDir . '/zetacomponents/base/src/features.php',
'ezcBaseFile' => $vendorDir . '/zetacomponents/base/src/file.php',
'ezcBaseFileException' => $vendorDir . '/zetacomponents/base/src/exceptions/file_exception.php',
'ezcBaseFileFindContext' => $vendorDir . '/zetacomponents/base/src/structs/file_find_context.php',
'ezcBaseFileIoException' => $vendorDir . '/zetacomponents/base/src/exceptions/file_io.php',
'ezcBaseFileNotFoundException' => $vendorDir . '/zetacomponents/base/src/exceptions/file_not_found.php',
'ezcBaseFilePermissionException' => $vendorDir . '/zetacomponents/base/src/exceptions/file_permission.php',
'ezcBaseFunctionalityNotSupportedException' => $vendorDir . '/zetacomponents/base/src/exceptions/functionality_not_supported.php',
'ezcBaseInit' => $vendorDir . '/zetacomponents/base/src/init.php',
'ezcBaseInitCallbackConfiguredException' => $vendorDir . '/zetacomponents/base/src/exceptions/init_callback_configured.php',
'ezcBaseInitInvalidCallbackClassException' => $vendorDir . '/zetacomponents/base/src/exceptions/invalid_callback_class.php',
'ezcBaseInvalidParentClassException' => $vendorDir . '/zetacomponents/base/src/exceptions/invalid_parent_class.php',
'ezcBaseMetaData' => $vendorDir . '/zetacomponents/base/src/metadata.php',
'ezcBaseMetaDataPearReader' => $vendorDir . '/zetacomponents/base/src/metadata/pear.php',
'ezcBaseMetaDataTarballReader' => $vendorDir . '/zetacomponents/base/src/metadata/tarball.php',
'ezcBaseOptions' => $vendorDir . '/zetacomponents/base/src/options.php',
'ezcBasePersistable' => $vendorDir . '/zetacomponents/base/src/interfaces/persistable.php',
'ezcBasePropertyNotFoundException' => $vendorDir . '/zetacomponents/base/src/exceptions/property_not_found.php',
'ezcBasePropertyPermissionException' => $vendorDir . '/zetacomponents/base/src/exceptions/property_permission.php',
'ezcBaseRepositoryDirectory' => $vendorDir . '/zetacomponents/base/src/structs/repository_directory.php',
'ezcBaseSettingNotFoundException' => $vendorDir . '/zetacomponents/base/src/exceptions/setting_not_found.php',
'ezcBaseSettingValueException' => $vendorDir . '/zetacomponents/base/src/exceptions/setting_value.php',
'ezcBaseStruct' => $vendorDir . '/zetacomponents/base/src/struct.php',
'ezcBaseValueException' => $vendorDir . '/zetacomponents/base/src/exceptions/value.php',
'ezcBaseWhateverException' => $vendorDir . '/zetacomponents/base/src/exceptions/whatever.php',
'ezcMail' => $vendorDir . '/zetacomponents/mail/src/mail.php',
'ezcMailAddress' => $vendorDir . '/zetacomponents/mail/src/structs/mail_address.php',
'ezcMailCharsetConverter' => $vendorDir . '/zetacomponents/mail/src/internal/charset_convert.php',
'ezcMailComposer' => $vendorDir . '/zetacomponents/mail/src/composer.php',
'ezcMailComposerOptions' => $vendorDir . '/zetacomponents/mail/src/options/composer_options.php',
'ezcMailContentDispositionHeader' => $vendorDir . '/zetacomponents/mail/src/structs/content_disposition_header.php',
'ezcMailDeliveryStatus' => $vendorDir . '/zetacomponents/mail/src/parts/delivery_status.php',
'ezcMailDeliveryStatusParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/delivery_status_parser.php',
'ezcMailException' => $vendorDir . '/zetacomponents/mail/src/exceptions/mail_exception.php',
'ezcMailFile' => $vendorDir . '/zetacomponents/mail/src/parts/fileparts/disk_file.php',
'ezcMailFileParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/file_parser.php',
'ezcMailFilePart' => $vendorDir . '/zetacomponents/mail/src/parts/file.php',
'ezcMailFileSet' => $vendorDir . '/zetacomponents/mail/src/transports/file/file_set.php',
'ezcMailHeaderFolder' => $vendorDir . '/zetacomponents/mail/src/internal/header_folder.php',
'ezcMailHeadersHolder' => $vendorDir . '/zetacomponents/mail/src/parser/headers_holder.php',
'ezcMailImapSet' => $vendorDir . '/zetacomponents/mail/src/transports/imap/imap_set.php',
'ezcMailImapSetOptions' => $vendorDir . '/zetacomponents/mail/src/options/imap_set_options.php',
'ezcMailImapTransport' => $vendorDir . '/zetacomponents/mail/src/transports/imap/imap_transport.php',
'ezcMailImapTransportOptions' => $vendorDir . '/zetacomponents/mail/src/options/imap_options.php',
'ezcMailInvalidLimitException' => $vendorDir . '/zetacomponents/mail/src/exceptions/invalid_limit.php',
'ezcMailMboxSet' => $vendorDir . '/zetacomponents/mail/src/transports/mbox/mbox_set.php',
'ezcMailMboxTransport' => $vendorDir . '/zetacomponents/mail/src/transports/mbox/mbox_transport.php',
'ezcMailMtaTransport' => $vendorDir . '/zetacomponents/mail/src/transports/mta/mta_transport.php',
'ezcMailMultipart' => $vendorDir . '/zetacomponents/mail/src/parts/multipart.php',
'ezcMailMultipartAlternative' => $vendorDir . '/zetacomponents/mail/src/parts/multiparts/multipart_alternative.php',
'ezcMailMultipartAlternativeParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/multipart_alternative_parser.php',
'ezcMailMultipartDigest' => $vendorDir . '/zetacomponents/mail/src/parts/multiparts/multipart_digest.php',
'ezcMailMultipartDigestParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/multipart_digest_parser.php',
'ezcMailMultipartMixed' => $vendorDir . '/zetacomponents/mail/src/parts/multiparts/multipart_mixed.php',
'ezcMailMultipartMixedParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/multipart_mixed_parser.php',
'ezcMailMultipartParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/multipart_parser.php',
'ezcMailMultipartRelated' => $vendorDir . '/zetacomponents/mail/src/parts/multiparts/multipart_related.php',
'ezcMailMultipartRelatedParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/multipart_related_parser.php',
'ezcMailMultipartReport' => $vendorDir . '/zetacomponents/mail/src/parts/multiparts/multipart_report.php',
'ezcMailMultipartReportParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/multipart_report_parser.php',
'ezcMailNoSuchMessageException' => $vendorDir . '/zetacomponents/mail/src/exceptions/no_such_message.php',
'ezcMailOffsetOutOfRangeException' => $vendorDir . '/zetacomponents/mail/src/exceptions/offset_out_of_range.php',
'ezcMailOptions' => $vendorDir . '/zetacomponents/mail/src/options/mail_options.php',
'ezcMailParser' => $vendorDir . '/zetacomponents/mail/src/parser/parser.php',
'ezcMailParserOptions' => $vendorDir . '/zetacomponents/mail/src/options/parser_options.php',
'ezcMailParserSet' => $vendorDir . '/zetacomponents/mail/src/parser/interfaces/parser_set.php',
'ezcMailParserShutdownHandler' => $vendorDir . '/zetacomponents/mail/src/parser/shutdown_handler.php',
'ezcMailPart' => $vendorDir . '/zetacomponents/mail/src/interfaces/part.php',
'ezcMailPartParser' => $vendorDir . '/zetacomponents/mail/src/parser/interfaces/part_parser.php',
'ezcMailPartWalkContext' => $vendorDir . '/zetacomponents/mail/src/structs/walk_context.php',
'ezcMailPop3Set' => $vendorDir . '/zetacomponents/mail/src/transports/pop3/pop3_set.php',
'ezcMailPop3Transport' => $vendorDir . '/zetacomponents/mail/src/transports/pop3/pop3_transport.php',
'ezcMailPop3TransportOptions' => $vendorDir . '/zetacomponents/mail/src/options/pop3_options.php',
'ezcMailRfc2231Implementation' => $vendorDir . '/zetacomponents/mail/src/parser/rfc2231_implementation.php',
'ezcMailRfc822Digest' => $vendorDir . '/zetacomponents/mail/src/parts/rfc822_digest.php',
'ezcMailRfc822DigestParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/rfc822_digest_parser.php',
'ezcMailRfc822Parser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/rfc822_parser.php',
'ezcMailSmtpTransport' => $vendorDir . '/zetacomponents/mail/src/transports/smtp/smtp_transport.php',
'ezcMailSmtpTransportOptions' => $vendorDir . '/zetacomponents/mail/src/options/smtp_options.php',
'ezcMailStorageSet' => $vendorDir . '/zetacomponents/mail/src/transports/storage/storage_set.php',
'ezcMailStreamFile' => $vendorDir . '/zetacomponents/mail/src/parts/fileparts/stream_file.php',
'ezcMailText' => $vendorDir . '/zetacomponents/mail/src/parts/text.php',
'ezcMailTextParser' => $vendorDir . '/zetacomponents/mail/src/parser/parts/text_parser.php',
'ezcMailTools' => $vendorDir . '/zetacomponents/mail/src/tools.php',
'ezcMailTransport' => $vendorDir . '/zetacomponents/mail/src/interfaces/transport.php',
'ezcMailTransportConnection' => $vendorDir . '/zetacomponents/mail/src/transports/transport_connection.php',
'ezcMailTransportException' => $vendorDir . '/zetacomponents/mail/src/exceptions/transport_exception.php',
'ezcMailTransportMta' => $vendorDir . '/zetacomponents/mail/src/transports/mta/transport_mta.php',
'ezcMailTransportOptions' => $vendorDir . '/zetacomponents/mail/src/options/transport_options.php',
'ezcMailTransportSmtp' => $vendorDir . '/zetacomponents/mail/src/transports/smtp/transport_smtp.php',
'ezcMailTransportSmtpException' => $vendorDir . '/zetacomponents/mail/src/exceptions/transport_smtp_exception.php',
'ezcMailVariableSet' => $vendorDir . '/zetacomponents/mail/src/transports/variable/var_set.php',
'ezcMailVirtualFile' => $vendorDir . '/zetacomponents/mail/src/parts/fileparts/virtual_file.php',
);

View file

@ -9,8 +9,5 @@ return array(
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php',
'662a729f963d39afe703c9d9b7ab4a8c' => $vendorDir . '/symfony/polyfill-php83/bootstrap.php',
'3569eecfeed3bcf0bad3c998a494ecb8' => $vendorDir . '/sabre/xml/lib/Deserializer/functions.php',
'93aa591bc4ca510c520999e34229ee79' => $vendorDir . '/sabre/xml/lib/Serializer/functions.php',
);

View file

@ -20,12 +20,9 @@ return array(
'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'Sabre\\Xml\\' => array($vendorDir . '/sabre/xml/lib'),
'Sabre\\Uri\\' => array($vendorDir . '/sabre/uri/lib'),
'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'),
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
'NumNum\\UBL\\Tests\\' => array($vendorDir . '/num-num/ubl-invoice/tests'),
'NumNum\\UBL\\' => array($vendorDir . '/num-num/ubl-invoice/src'),
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
'Metadata\\' => array($vendorDir . '/jms/metadata/src'),
'JMS\\Serializer\\' => array($vendorDir . '/jms/serializer/src'),
'GoetasWebservices\\Xsd\\XsdToPhpRuntime\\' => array($vendorDir . '/goetas-webservices/xsd2php-runtime/src'),

View file

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit1a0e4ea3fb1d108a445b9e95a7c251ad
class ComposerAutoloaderInit448b098c3c50cca42ba3346b6c3682c0
{
private static $loader;
@ -24,16 +24,16 @@ class ComposerAutoloaderInit1a0e4ea3fb1d108a445b9e95a7c251ad
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInit1a0e4ea3fb1d108a445b9e95a7c251ad', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit448b098c3c50cca42ba3346b6c3682c0', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit1a0e4ea3fb1d108a445b9e95a7c251ad', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit448b098c3c50cca42ba3346b6c3682c0', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit448b098c3c50cca42ba3346b6c3682c0::getInitializer($loader));
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit448b098c3c50cca42ba3346b6c3682c0::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View file

@ -4,16 +4,13 @@
namespace Composer\Autoload;
class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
class ComposerStaticInit448b098c3c50cca42ba3346b6c3682c0
{
public static $files = array (
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php',
'662a729f963d39afe703c9d9b7ab4a8c' => __DIR__ . '/..' . '/symfony/polyfill-php83/bootstrap.php',
'3569eecfeed3bcf0bad3c998a494ecb8' => __DIR__ . '/..' . '/sabre/xml/lib/Deserializer/functions.php',
'93aa591bc4ca510c520999e34229ee79' => __DIR__ . '/..' . '/sabre/xml/lib/Serializer/functions.php',
);
public static $prefixLengthsPsr4 = array (
@ -42,18 +39,12 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
'Symfony\\Component\\Validator\\' => 28,
'Symfony\\Component\\Process\\' => 26,
'Symfony\\Component\\Finder\\' => 25,
'Sabre\\Xml\\' => 10,
'Sabre\\Uri\\' => 10,
),
'P' =>
array (
'ParagonIE\\ConstantTime\\' => 23,
'PHPStan\\PhpDocParser\\' => 21,
),
'N' =>
array (
'NumNum\\UBL\\Tests\\' => 17,
'NumNum\\UBL\\' => 11,
'PHPMailer\\PHPMailer\\' => 20,
),
'M' =>
array (
@ -144,14 +135,6 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
array (
0 => __DIR__ . '/..' . '/symfony/finder',
),
'Sabre\\Xml\\' =>
array (
0 => __DIR__ . '/..' . '/sabre/xml/lib',
),
'Sabre\\Uri\\' =>
array (
0 => __DIR__ . '/..' . '/sabre/uri/lib',
),
'ParagonIE\\ConstantTime\\' =>
array (
0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src',
@ -160,13 +143,9 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
array (
0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src',
),
'NumNum\\UBL\\Tests\\' =>
'PHPMailer\\PHPMailer\\' =>
array (
0 => __DIR__ . '/..' . '/num-num/ubl-invoice/tests',
),
'NumNum\\UBL\\' =>
array (
0 => __DIR__ . '/..' . '/num-num/ubl-invoice/src',
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
),
'Metadata\\' =>
array (
@ -230,116 +209,15 @@ class ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad
'FPDF' => __DIR__ . '/..' . '/setasign/fpdf/fpdf.php',
'Override' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/Override.php',
'SQLite3Exception' => __DIR__ . '/..' . '/symfony/polyfill-php83/Resources/stubs/SQLite3Exception.php',
'ezcBase' => __DIR__ . '/..' . '/zetacomponents/base/src/base.php',
'ezcBaseAutoloadException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/autoload.php',
'ezcBaseAutoloadOptions' => __DIR__ . '/..' . '/zetacomponents/base/src/options/autoload.php',
'ezcBaseConfigurationInitializer' => __DIR__ . '/..' . '/zetacomponents/base/src/interfaces/configuration_initializer.php',
'ezcBaseDoubleClassRepositoryPrefixException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/double_class_repository_prefix.php',
'ezcBaseException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/exception.php',
'ezcBaseExportable' => __DIR__ . '/..' . '/zetacomponents/base/src/interfaces/exportable.php',
'ezcBaseExtensionNotFoundException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/extension_not_found.php',
'ezcBaseFeatures' => __DIR__ . '/..' . '/zetacomponents/base/src/features.php',
'ezcBaseFile' => __DIR__ . '/..' . '/zetacomponents/base/src/file.php',
'ezcBaseFileException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/file_exception.php',
'ezcBaseFileFindContext' => __DIR__ . '/..' . '/zetacomponents/base/src/structs/file_find_context.php',
'ezcBaseFileIoException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/file_io.php',
'ezcBaseFileNotFoundException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/file_not_found.php',
'ezcBaseFilePermissionException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/file_permission.php',
'ezcBaseFunctionalityNotSupportedException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/functionality_not_supported.php',
'ezcBaseInit' => __DIR__ . '/..' . '/zetacomponents/base/src/init.php',
'ezcBaseInitCallbackConfiguredException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/init_callback_configured.php',
'ezcBaseInitInvalidCallbackClassException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/invalid_callback_class.php',
'ezcBaseInvalidParentClassException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/invalid_parent_class.php',
'ezcBaseMetaData' => __DIR__ . '/..' . '/zetacomponents/base/src/metadata.php',
'ezcBaseMetaDataPearReader' => __DIR__ . '/..' . '/zetacomponents/base/src/metadata/pear.php',
'ezcBaseMetaDataTarballReader' => __DIR__ . '/..' . '/zetacomponents/base/src/metadata/tarball.php',
'ezcBaseOptions' => __DIR__ . '/..' . '/zetacomponents/base/src/options.php',
'ezcBasePersistable' => __DIR__ . '/..' . '/zetacomponents/base/src/interfaces/persistable.php',
'ezcBasePropertyNotFoundException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/property_not_found.php',
'ezcBasePropertyPermissionException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/property_permission.php',
'ezcBaseRepositoryDirectory' => __DIR__ . '/..' . '/zetacomponents/base/src/structs/repository_directory.php',
'ezcBaseSettingNotFoundException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/setting_not_found.php',
'ezcBaseSettingValueException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/setting_value.php',
'ezcBaseStruct' => __DIR__ . '/..' . '/zetacomponents/base/src/struct.php',
'ezcBaseValueException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/value.php',
'ezcBaseWhateverException' => __DIR__ . '/..' . '/zetacomponents/base/src/exceptions/whatever.php',
'ezcMail' => __DIR__ . '/..' . '/zetacomponents/mail/src/mail.php',
'ezcMailAddress' => __DIR__ . '/..' . '/zetacomponents/mail/src/structs/mail_address.php',
'ezcMailCharsetConverter' => __DIR__ . '/..' . '/zetacomponents/mail/src/internal/charset_convert.php',
'ezcMailComposer' => __DIR__ . '/..' . '/zetacomponents/mail/src/composer.php',
'ezcMailComposerOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/composer_options.php',
'ezcMailContentDispositionHeader' => __DIR__ . '/..' . '/zetacomponents/mail/src/structs/content_disposition_header.php',
'ezcMailDeliveryStatus' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/delivery_status.php',
'ezcMailDeliveryStatusParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/delivery_status_parser.php',
'ezcMailException' => __DIR__ . '/..' . '/zetacomponents/mail/src/exceptions/mail_exception.php',
'ezcMailFile' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/fileparts/disk_file.php',
'ezcMailFileParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/file_parser.php',
'ezcMailFilePart' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/file.php',
'ezcMailFileSet' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/file/file_set.php',
'ezcMailHeaderFolder' => __DIR__ . '/..' . '/zetacomponents/mail/src/internal/header_folder.php',
'ezcMailHeadersHolder' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/headers_holder.php',
'ezcMailImapSet' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/imap/imap_set.php',
'ezcMailImapSetOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/imap_set_options.php',
'ezcMailImapTransport' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/imap/imap_transport.php',
'ezcMailImapTransportOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/imap_options.php',
'ezcMailInvalidLimitException' => __DIR__ . '/..' . '/zetacomponents/mail/src/exceptions/invalid_limit.php',
'ezcMailMboxSet' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/mbox/mbox_set.php',
'ezcMailMboxTransport' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/mbox/mbox_transport.php',
'ezcMailMtaTransport' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/mta/mta_transport.php',
'ezcMailMultipart' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/multipart.php',
'ezcMailMultipartAlternative' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/multiparts/multipart_alternative.php',
'ezcMailMultipartAlternativeParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/multipart_alternative_parser.php',
'ezcMailMultipartDigest' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/multiparts/multipart_digest.php',
'ezcMailMultipartDigestParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/multipart_digest_parser.php',
'ezcMailMultipartMixed' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/multiparts/multipart_mixed.php',
'ezcMailMultipartMixedParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/multipart_mixed_parser.php',
'ezcMailMultipartParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/multipart_parser.php',
'ezcMailMultipartRelated' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/multiparts/multipart_related.php',
'ezcMailMultipartRelatedParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/multipart_related_parser.php',
'ezcMailMultipartReport' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/multiparts/multipart_report.php',
'ezcMailMultipartReportParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/multipart_report_parser.php',
'ezcMailNoSuchMessageException' => __DIR__ . '/..' . '/zetacomponents/mail/src/exceptions/no_such_message.php',
'ezcMailOffsetOutOfRangeException' => __DIR__ . '/..' . '/zetacomponents/mail/src/exceptions/offset_out_of_range.php',
'ezcMailOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/mail_options.php',
'ezcMailParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parser.php',
'ezcMailParserOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/parser_options.php',
'ezcMailParserSet' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/interfaces/parser_set.php',
'ezcMailParserShutdownHandler' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/shutdown_handler.php',
'ezcMailPart' => __DIR__ . '/..' . '/zetacomponents/mail/src/interfaces/part.php',
'ezcMailPartParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/interfaces/part_parser.php',
'ezcMailPartWalkContext' => __DIR__ . '/..' . '/zetacomponents/mail/src/structs/walk_context.php',
'ezcMailPop3Set' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/pop3/pop3_set.php',
'ezcMailPop3Transport' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/pop3/pop3_transport.php',
'ezcMailPop3TransportOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/pop3_options.php',
'ezcMailRfc2231Implementation' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/rfc2231_implementation.php',
'ezcMailRfc822Digest' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/rfc822_digest.php',
'ezcMailRfc822DigestParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/rfc822_digest_parser.php',
'ezcMailRfc822Parser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/rfc822_parser.php',
'ezcMailSmtpTransport' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/smtp/smtp_transport.php',
'ezcMailSmtpTransportOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/smtp_options.php',
'ezcMailStorageSet' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/storage/storage_set.php',
'ezcMailStreamFile' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/fileparts/stream_file.php',
'ezcMailText' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/text.php',
'ezcMailTextParser' => __DIR__ . '/..' . '/zetacomponents/mail/src/parser/parts/text_parser.php',
'ezcMailTools' => __DIR__ . '/..' . '/zetacomponents/mail/src/tools.php',
'ezcMailTransport' => __DIR__ . '/..' . '/zetacomponents/mail/src/interfaces/transport.php',
'ezcMailTransportConnection' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/transport_connection.php',
'ezcMailTransportException' => __DIR__ . '/..' . '/zetacomponents/mail/src/exceptions/transport_exception.php',
'ezcMailTransportMta' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/mta/transport_mta.php',
'ezcMailTransportOptions' => __DIR__ . '/..' . '/zetacomponents/mail/src/options/transport_options.php',
'ezcMailTransportSmtp' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/smtp/transport_smtp.php',
'ezcMailTransportSmtpException' => __DIR__ . '/..' . '/zetacomponents/mail/src/exceptions/transport_smtp_exception.php',
'ezcMailVariableSet' => __DIR__ . '/..' . '/zetacomponents/mail/src/transports/variable/var_set.php',
'ezcMailVirtualFile' => __DIR__ . '/..' . '/zetacomponents/mail/src/parts/fileparts/virtual_file.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad::$prefixesPsr0;
$loader->classMap = ComposerStaticInit1a0e4ea3fb1d108a445b9e95a7c251ad::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit448b098c3c50cca42ba3346b6c3682c0::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit448b098c3c50cca42ba3346b6c3682c0::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInit448b098c3c50cca42ba3346b6c3682c0::$prefixesPsr0;
$loader->classMap = ComposerStaticInit448b098c3c50cca42ba3346b6c3682c0::$classMap;
}, null, ClassLoader::class);
}

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '9584a3090ab8e976441fa6e8ab7798db0a361830',
'reference' => '85c7ca41f5faf3e06e561376de7d29548f047e27',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -13,16 +13,16 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '9584a3090ab8e976441fa6e8ab7798db0a361830',
'reference' => '85c7ca41f5faf3e06e561376de7d29548f047e27',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'bacon/bacon-qr-code' => array(
'pretty_version' => 'v3.0.1',
'version' => '3.0.1.0',
'reference' => 'f9cc1f52b5a463062251d666761178dbdb6b544f',
'pretty_version' => 'v3.0.3',
'version' => '3.0.3.0',
'reference' => '36a1cb2b81493fa5b82e50bf8068bf84d1542563',
'type' => 'library',
'install_path' => __DIR__ . '/../bacon/bacon-qr-code',
'aliases' => array(),
@ -47,9 +47,9 @@
'dev_requirement' => false,
),
'dasprid/enum' => array(
'pretty_version' => '1.0.6',
'version' => '1.0.6.0',
'reference' => '8dfd07c6d2cf31c8da90c53b83c026c7696dda90',
'pretty_version' => '1.0.7',
'version' => '1.0.7.0',
'reference' => 'b5874fa9ed0043116c72162ec7f4fb50e02e7cce',
'type' => 'library',
'install_path' => __DIR__ . '/../dasprid/enum',
'aliases' => array(),
@ -110,9 +110,9 @@
'dev_requirement' => false,
),
'horstoeko/zugferd' => array(
'pretty_version' => 'v1.0.115',
'version' => '1.0.115.0',
'reference' => '9bbf0c06942645001d10e88d6e26ff6d8983da2c',
'pretty_version' => 'v1.0.117',
'version' => '1.0.117.0',
'reference' => '7c2fdb58e0910e199b1fd2162ae5d33a1e62e933',
'type' => 'package',
'install_path' => __DIR__ . '/../horstoeko/zugferd',
'aliases' => array(),
@ -136,60 +136,42 @@
'aliases' => array(),
'dev_requirement' => false,
),
'num-num/ubl-invoice' => array(
'pretty_version' => 'v1.21.2',
'version' => '1.21.2.0',
'reference' => '195712b3071e23c5aaa6fe95cb9e2de55c3d1348',
'type' => 'library',
'install_path' => __DIR__ . '/../num-num/ubl-invoice',
'aliases' => array(),
'dev_requirement' => false,
),
'paragonie/constant_time_encoding' => array(
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'reference' => 'df1e7fde177501eee2037dd159cf04f5f301a512',
'pretty_version' => 'v3.1.3',
'version' => '3.1.3.0',
'reference' => 'd5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/constant_time_encoding',
'aliases' => array(),
'dev_requirement' => false,
),
'php-curl-class/php-curl-class' => array(
'pretty_version' => '12.0.0',
'version' => '12.0.0.0',
'reference' => '7a8f05efb18bb865dbce864b8fd34d4f5d920c74',
'pretty_version' => '12.0.2',
'version' => '12.0.2.0',
'reference' => '064e78f89ab897284c1d098079fd121a0aac7ad7',
'type' => 'library',
'install_path' => __DIR__ . '/../php-curl-class/php-curl-class',
'aliases' => array(),
'dev_requirement' => false,
),
'phpmailer/phpmailer' => array(
'pretty_version' => 'v7.0.0',
'version' => '7.0.0.0',
'reference' => 'c7111310c6116ba508a6a170a89eaaed2129bd42',
'type' => 'library',
'install_path' => __DIR__ . '/../phpmailer/phpmailer',
'aliases' => array(),
'dev_requirement' => false,
),
'phpstan/phpdoc-parser' => array(
'pretty_version' => '2.2.0',
'version' => '2.2.0.0',
'reference' => 'b9e61a61e39e02dd90944e9115241c7f7e76bfd8',
'pretty_version' => '2.3.0',
'version' => '2.3.0.0',
'reference' => '1e0cd5370df5dd2e556a36b9c62f62e555870495',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
'aliases' => array(),
'dev_requirement' => false,
),
'sabre/uri' => array(
'pretty_version' => '3.0.2',
'version' => '3.0.2.0',
'reference' => '38eeab6ed9eec435a2188db489d4649c56272c51',
'type' => 'library',
'install_path' => __DIR__ . '/../sabre/uri',
'aliases' => array(),
'dev_requirement' => false,
),
'sabre/xml' => array(
'pretty_version' => '4.0.6',
'version' => '4.0.6.0',
'reference' => 'a89257fd188ce30e456b841b6915f27905dfdbe3',
'type' => 'library',
'install_path' => __DIR__ . '/../sabre/xml',
'aliases' => array(),
'dev_requirement' => false,
),
'setasign/fpdf' => array(
'pretty_version' => '1.8.6',
'version' => '1.8.6.0',
@ -200,18 +182,18 @@
'dev_requirement' => false,
),
'setasign/fpdi' => array(
'pretty_version' => 'v2.6.3',
'version' => '2.6.3.0',
'reference' => '67c31f5e50c93c20579ca9e23035d8c540b51941',
'pretty_version' => 'v2.6.4',
'version' => '2.6.4.0',
'reference' => '4b53852fde2734ec6a07e458a085db627c60eada',
'type' => 'library',
'install_path' => __DIR__ . '/../setasign/fpdi',
'aliases' => array(),
'dev_requirement' => false,
),
'smalot/pdfparser' => array(
'pretty_version' => 'v2.12.0',
'version' => '2.12.0.0',
'reference' => '8440edbf58c8596074e78ada38dcb0bd041a5948',
'pretty_version' => 'v2.12.1',
'version' => '2.12.1.0',
'reference' => '98d31ba34ef5b5a98897ef4b6c3925d502ea53b1',
'type' => 'library',
'install_path' => __DIR__ . '/../smalot/pdfparser',
'aliases' => array(),
@ -227,17 +209,17 @@
'dev_requirement' => false,
),
'symfony/finder' => array(
'pretty_version' => 'v7.3.0',
'version' => '7.3.0.0',
'reference' => 'ec2344cf77a48253bbca6939aa3d2477773ea63d',
'pretty_version' => 'v7.3.5',
'version' => '7.3.5.0',
'reference' => '9f696d2f1e340484b4683f7853b273abff94421f',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/finder',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.32.0',
'version' => '1.32.0.0',
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
@ -245,8 +227,8 @@
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.32.0',
'version' => '1.32.0.0',
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => '6d857f4d76bd4b343eac26d6b539585d2bc56493',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
@ -254,67 +236,49 @@
'dev_requirement' => false,
),
'symfony/polyfill-php83' => array(
'pretty_version' => 'v1.32.0',
'version' => '1.32.0.0',
'reference' => '2fb86d65e2d424369ad2905e83b236a8805ba491',
'pretty_version' => 'v1.33.0',
'version' => '1.33.0.0',
'reference' => '17f6f9a6b1735c0f163024d959f700cfbc5155e5',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php83',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/process' => array(
'pretty_version' => 'v7.3.0',
'version' => '7.3.0.0',
'reference' => '40c295f2deb408d5e9d2d32b8ba1dd61e36f05af',
'pretty_version' => 'v7.3.4',
'version' => '7.3.4.0',
'reference' => 'f24f8f316367b30810810d4eb30c543d7003ff3b',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/process',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/translation-contracts' => array(
'pretty_version' => 'v3.6.0',
'version' => '3.6.0.0',
'reference' => 'df210c7a2573f1913b2d17cc95f90f53a73d8f7d',
'pretty_version' => 'v3.6.1',
'version' => '3.6.1.0',
'reference' => '65a8bc82080447fae78373aa10f8d13b38338977',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/validator' => array(
'pretty_version' => 'v7.3.1',
'version' => '7.3.1.0',
'reference' => 'e2f2497c869fc57446f735fbf00cff4de32ae8c3',
'pretty_version' => 'v7.3.7',
'version' => '7.3.7.0',
'reference' => '8290a095497c3fe5046db21888d1f75b54ddf39d',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/validator',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/yaml' => array(
'pretty_version' => 'v7.3.1',
'version' => '7.3.1.0',
'reference' => '0c3555045a46ab3cd4cc5a69d161225195230edb',
'pretty_version' => 'v7.3.5',
'version' => '7.3.5.0',
'reference' => '90208e2fc6f68f613eae7ca25a2458a931b1bacc',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/yaml',
'aliases' => array(),
'dev_requirement' => false,
),
'zetacomponents/base' => array(
'pretty_version' => '1.9.4',
'version' => '1.9.4.0',
'reference' => 'b6ae5f6177f6e51c5fc3514800e1c3fb076ec4be',
'type' => 'library',
'install_path' => __DIR__ . '/../zetacomponents/base',
'aliases' => array(),
'dev_requirement' => false,
),
'zetacomponents/mail' => array(
'pretty_version' => '1.10.1',
'version' => '1.10.1.0',
'reference' => '644fe50cf9f05a455cc576e2d763bc7cd967769f',
'type' => 'library',
'install_path' => __DIR__ . '/../zetacomponents/mail',
'aliases' => array(),
'dev_requirement' => false,
),
),
);

View file

@ -219,6 +219,16 @@ abstract class AbstractEnum
throw new SerializeNotSupportedException();
}
/**
* Forbid serializing enums.
*
* @throws SerializeNotSupportedException
*/
final public function __serialize() : array
{
throw new SerializeNotSupportedException();
}
/**
* Forbid unserializing enums.
*
@ -229,6 +239,16 @@ abstract class AbstractEnum
throw new UnserializeNotSupportedException();
}
/**
* Forbid unserializing enums.
*
* @throws UnserializeNotSupportedException
*/
final public function __unserialize($arg) : void
{
throw new UnserializeNotSupportedException();
}
/**
* Turns the enum into a string representation.
*

View file

@ -43,6 +43,16 @@ final class NullValue
throw new SerializeNotSupportedException();
}
/**
* Forbid serializing enums.
*
* @throws SerializeNotSupportedException
*/
final public function __serialize() : array
{
throw new SerializeNotSupportedException();
}
/**
* Forbid unserializing enums.
*
@ -52,4 +62,14 @@ final class NullValue
{
throw new UnserializeNotSupportedException();
}
/**
* Forbid unserializing enums.
*
* @throws UnserializeNotSupportedException
*/
final public function __unserialize($arg) : void
{
throw new UnserializeNotSupportedException();
}
}

View file

@ -18,7 +18,7 @@ jobs:
steps:
- name: Checkout Sources
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
token: ${{ secrets.UPDATEWIKITOKEN }}
fetch-depth: 0

View file

@ -43,7 +43,7 @@ jobs:
steps:
- name: Checkout Sources
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
@ -53,7 +53,7 @@ jobs:
coverage: xdebug
- name: Set up JDK 11
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: "11"
distribution: "temurin"
@ -243,7 +243,7 @@ jobs:
comment_mode: ${{ ((github.event.workflow_run && github.event.workflow_run.event == 'pull_request') || github.event_name == 'pull_request') && 'failures' || 'always' }}
- name: Publish Build Logs
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: Build log artifacts for ${{ matrix.operating-system }} PHP ${{ matrix.phpversion }}
path: build/logs

View file

@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout Sources
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2

View file

@ -32,7 +32,7 @@ jobs:
steps:
- name: Checkout Sources
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
@ -45,7 +45,7 @@ jobs:
coverage: xdebug
- name: Set up JDK 11
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: "11"
distribution: "temurin"
@ -238,7 +238,7 @@ jobs:
files: "build/logs/junit.xml"
- name: Publish Build Logs
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: Build log artifacts for ubuntu-24.04 PHP 8.3 (Release)
path: build/logs

View file

@ -18,7 +18,7 @@ jobs:
steps:
- name: Checkout Sources
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2

View file

@ -12,7 +12,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v9
- uses: actions/stale@v10
with:
days-before-issue-stale: 7
days-before-issue-close: 5

View file

@ -1,3 +1,28 @@
## v1.0.116
``Previous version v1.0.115``
| Type | Hash | Date | Author | Subject | Issue(s)
| :--- | :------ | :------ | :------ | :------- | :-----------:
| :new_moon: | [e22a463](https://github.com/horstoeko/zugferd/commit/e22a463) | 2025-10-14 11:50:00 CEST | Kevin Papst | code styles via phpcbf |
| :new_moon: | [b8666dd](https://github.com/horstoeko/zugferd/commit/b8666dd) | 2025-10-14 11:38:59 CEST | Kevin Papst | support DateTimeInterface where possible |
| :new_moon: | [2f79f42](https://github.com/horstoeko/zugferd/commit/2f79f42) | 2025-09-25 12:44:06 CEST | Daniel Marschall | Fixed typo in ZugferdProfiles.php |
| :new_moon: | [cad307e](https://github.com/horstoeko/zugferd/commit/cad307e) | 2025-09-06 13:27:38 CEST | HorstOeko | [ENH]Fixed Tests |
:exclamation: _There are 4 internal commit(s)_
## v1.0.115
``Previous version v1.0.114``
| Type | Hash | Date | Author | Subject | Issue(s)
| :--- | :------ | :------ | :------ | :------- | :-----------:
| :new_moon: | [ece2069](https://github.com/horstoeko/zugferd/commit/ece2069) | 2025-06-06 10:02:29 CEST | HorstOeko | ZugferdDocumentReader::getDocumentDeliveryTerms uses the wrong path | [#299](https://github.com/horstoeko/zugferd/issues/299)
| :new: | [a362777](https://github.com/horstoeko/zugferd/commit/a362777) | 2025-05-08 05:24:00 CEST | HorstOeko | [ENH] Add option to not open the attachment pane -> Added Getter | [#294](https://github.com/horstoeko/zugferd/issues/294)
| :new_moon: | [516ec9c](https://github.com/horstoeko/zugferd/commit/516ec9c) | 2025-05-07 15:50:30 CEST | HorstOeko | Add option to not open the attachment pane | [#294](https://github.com/horstoeko/zugferd/issues/294)
:exclamation: _There are 2 internal commit(s)_
## v1.0.114
``Previous version v1.0.113``

View file

@ -9,7 +9,7 @@
namespace horstoeko\zugferd;
use DateTime;
use DateTimeInterface;
use DOMXPath;
use DOMDocument;
use horstoeko\zugferd\codelists\ZugferdDocumentType;
@ -171,16 +171,16 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set main information about this document.
*
* @param string $documentNo __BT-1, From MINIMUM__ The document no issued by the seller
* @param string $documentTypeCode __BT-3, From MINIMUM__ The type of the document, See \horstoeko\codelists\ZugferdInvoiceType for details
* @param DateTime $documentDate __BT-2, From MINIMUM__ Date of invoice. The date when the document was issued by the seller
* @param string $invoiceCurrency __BT-5, From MINIMUM__ Code for the invoice currency
* @param string|null $documentName __BT-X-2, From EXTENDED__ Document Type. The documenttype (free text)
* @param string|null $documentLanguage __BT-X-4, From EXTENDED__ Language indicator. The language code in which the document was written
* @param DateTime|null $effectiveSpecifiedPeriod __BT-X-6-000, From EXTENDED__ The contractual due date of the invoice
* @param string $documentNo __BT-1, From MINIMUM__ The document no issued by the seller
* @param string $documentTypeCode __BT-3, From MINIMUM__ The type of the document, See \horstoeko\codelists\ZugferdInvoiceType for details
* @param DateTimeInterface $documentDate __BT-2, From MINIMUM__ Date of invoice. The date when the document was issued by the seller
* @param string $invoiceCurrency __BT-5, From MINIMUM__ Code for the invoice currency
* @param string|null $documentName __BT-X-2, From EXTENDED__ Document Type. The documenttype (free text)
* @param string|null $documentLanguage __BT-X-4, From EXTENDED__ Language indicator. The language code in which the document was written
* @param DateTimeInterface|null $effectiveSpecifiedPeriod __BT-X-6-000, From EXTENDED__ The contractual due date of the invoice
* @return ZugferdDocumentBuilder
*/
public function setDocumentInformation(string $documentNo, string $documentTypeCode, DateTime $documentDate, string $invoiceCurrency, ?string $documentName = null, ?string $documentLanguage = null, ?DateTime $effectiveSpecifiedPeriod = null): ZugferdDocumentBuilder
public function setDocumentInformation(string $documentNo, string $documentTypeCode, DateTimeInterface $documentDate, string $invoiceCurrency, ?string $documentName = null, ?string $documentLanguage = null, ?DateTimeInterface $effectiveSpecifiedPeriod = null): ZugferdDocumentBuilder
{
$this->getObjectHelper()->tryCall($this->getInvoiceObject()->getExchangedDocument(), "setID", $this->getObjectHelper()->getIdType($documentNo));
$this->getObjectHelper()->tryCall($this->getInvoiceObject()->getExchangedDocument(), "setName", $this->getObjectHelper()->getTextType($documentName));
@ -1910,11 +1910,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of the associated order confirmation.
*
* @param string $issuerAssignedId __BT-14, From EN 16931__ An identifier issued by the seller for a referenced sales order (Order confirmation number)
* @param DateTime|null $issueDate __BT-X-146, From EXTENDED__ Order confirmation date
* @param string $issuerAssignedId __BT-14, From EN 16931__ An identifier issued by the seller for a referenced sales order (Order confirmation number)
* @param DateTimeInterface|null $issueDate __BT-X-146, From EXTENDED__ Order confirmation date
* @return ZugferdDocumentBuilder
*/
public function setDocumentSellerOrderReferencedDocument(string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentSellerOrderReferencedDocument(string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$sellerorderrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -1926,11 +1926,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of the related buyer order.
*
* @param string $issuerAssignedId __BT-13, From MINIMUM__ An identifier issued by the buyer for a referenced order (order number)
* @param DateTime|null $issueDate __BT-X-147, From EXTENDED__ Date of order
* @param string $issuerAssignedId __BT-13, From MINIMUM__ An identifier issued by the buyer for a referenced order (order number)
* @param DateTimeInterface|null $issueDate __BT-X-147, From EXTENDED__ Date of order
* @return ZugferdDocumentBuilder
*/
public function setDocumentBuyerOrderReferencedDocument(?string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentBuyerOrderReferencedDocument(?string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$buyerorderrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -1942,11 +1942,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of the associated offer
*
* @param string $issuerAssignedId __BT-X-403, From EXTENDED__ Offer number
* @param DateTime|null $issueDate __BT-X-404, From EXTENDED__ Date of offer
* @param string $issuerAssignedId __BT-X-403, From EXTENDED__ Offer number
* @param DateTimeInterface|null $issueDate __BT-X-404, From EXTENDED__ Date of offer
* @return ZugferdDocumentBuilder
*/
public function setDocumentQuotationReferencedDocument(?string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentQuotationReferencedDocument(?string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$quotationrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -1958,11 +1958,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of the associated contract
*
* @param string $issuerAssignedId __BT-12, From BASIC WL__ The contract reference should be assigned once in the context of the specific trade relationship and for a defined period of time (contract number)
* @param DateTime|null $issueDate __BT-X-26, From EXTENDED__ Contract date
* @param string $issuerAssignedId __BT-12, From BASIC WL__ The contract reference should be assigned once in the context of the specific trade relationship and for a defined period of time (contract number)
* @param DateTimeInterface|null $issueDate __BT-X-26, From EXTENDED__ Contract date
* @return ZugferdDocumentBuilder
*/
public function setDocumentContractReferencedDocument(?string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentContractReferencedDocument(?string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$contractrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -1981,21 +1981,21 @@ class ZugferdDocumentBuilder extends ZugferdDocument
* to large attachments and / or sensitive information, e.g. for personal services, which must be separated
* from the bill
*
* @param string $issuerAssignedId __BT-122, From EN 16931__ The identifier of the tender or lot to which the invoice relates, or an identifier specified by the seller for an object on which the invoice is based, or an identifier of the document on which the invoice is based.
* @param string $typeCode __BT-122-0, From EN 16931__ Type of referenced document (See codelist UNTDID 1001)
* - Code 916 "reference paper" is used to reference the identification of the
* document on which the invoice is based - Code 50 "Price / sales catalog response"
* is used to reference the tender or the lot - Code 130 "invoice data sheet" is used
* to reference an identifier for an object specified by the seller.
* @param string|null $uriId __BT-124, From EN 16931__ A means of locating the resource, including the primary access method intended for it, e.g. http:// or ftp://. The storage location of the external document must be used if the buyer requires further information as
* supporting documents for the invoiced amounts. External documents are not part of the invoice. Invoice processing should be possible without access to external documents. Access to external documents can entail certain risks.
* @param string|array|null $name __BT-123, From EN 16931__ A description of the document, e.g. Hourly billing, usage or consumption report, etc.
* @param string|null $refTypeCode __BT-18-1, From ENN 16931__ The identifier for the identification scheme of the identifier of the item invoiced. If it is not clear to the recipient which scheme is used for the identifier, an identifier of the scheme should be used, which must be selected from UNTDID 1153 in accordance with the code list entries.
* @param DateTime|null $issueDate __BT-X-149, From EXTENDED__ Document date
* @param string|null $binaryDataFilename __BT-125, From EN 16931__ Contains a file name of an attachment document embedded as a binary object
* @param string $issuerAssignedId __BT-122, From EN 16931__ The identifier of the tender or lot to which the invoice relates, or an identifier specified by the seller for an object on which the invoice is based, or an identifier of the document on which the invoice is based.
* @param string $typeCode __BT-122-0, From EN 16931__ Type of referenced document (See codelist UNTDID 1001)
* - Code 916 "reference paper" is used to reference the identification of the
* document on which the invoice is based - Code 50 "Price / sales catalog response"
* is used to reference the tender or the lot - Code 130 "invoice data sheet" is used
* to reference an identifier for an object specified by the seller.
* @param string|null $uriId __BT-124, From EN 16931__ A means of locating the resource, including the primary access method intended for it, e.g. http:// or ftp://. The storage location of the external document must be used if the buyer requires further information as
* supporting documents for the invoiced amounts. External documents are not part of the invoice. Invoice processing should be possible without access to external documents. Access to external documents can entail certain risks.
* @param string|array|null $name __BT-123, From EN 16931__ A description of the document, e.g. Hourly billing, usage or consumption report, etc.
* @param string|null $refTypeCode __BT-18-1, From ENN 16931__ The identifier for the identification scheme of the identifier of the item invoiced. If it is not clear to the recipient which scheme is used for the identifier, an identifier of the scheme should be used, which must be selected from UNTDID 1153 in accordance with the code list entries.
* @param DateTimeInterface|null $issueDate __BT-X-149, From EXTENDED__ Document date
* @param string|null $binaryDataFilename __BT-125, From EN 16931__ Contains a file name of an attachment document embedded as a binary object
* @return ZugferdDocumentBuilder
*/
public function addDocumentAdditionalReferencedDocument(string $issuerAssignedId, string $typeCode, ?string $uriId = null, $name = null, ?string $refTypeCode = null, ?DateTime $issueDate = null, ?string $binaryDataFilename = null): ZugferdDocumentBuilder
public function addDocumentAdditionalReferencedDocument(string $issuerAssignedId, string $typeCode, ?string $uriId = null, $name = null, ?string $refTypeCode = null, ?DateTimeInterface $issueDate = null, ?string $binaryDataFilename = null): ZugferdDocumentBuilder
{
$additionalrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, $uriId, null, $typeCode, $name, $refTypeCode, $issueDate, $binaryDataFilename);
@ -2066,12 +2066,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
* - reference is made from a final invoice to previous partial invoices
* - reference is made from a final invoice to previous invoices for advance payments. *
*
* @param string $issuerAssignedId __BT-25, From BASIC WL__ The identification of an invoice previously sent by the seller
* @param string|null $typeCode __BT-X-555, From EXTENDED__ Type of previous invoice (code)
* @param DateTime|null $issueDate __BT-26, From BASIC WL__ Date of the previous invoice
* @param string $issuerAssignedId __BT-25, From BASIC WL__ The identification of an invoice previously sent by the seller
* @param string|null $typeCode __BT-X-555, From EXTENDED__ Type of previous invoice (code)
* @param DateTimeInterface|null $issueDate __BT-26, From BASIC WL__ Date of the previous invoice
* @return ZugferdDocumentBuilder
*/
public function setDocumentInvoiceReferencedDocument(string $issuerAssignedId, ?string $typeCode = null, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentInvoiceReferencedDocument(string $issuerAssignedId, ?string $typeCode = null, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$invoicerefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, $typeCode, null, null, $issueDate, null);
@ -2088,12 +2088,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
* - reference is made from a final invoice to previous partial invoices
* - reference is made from a final invoice to previous invoices for advance payments. *
*
* @param string $issuerAssignedId __BT-25, From BASIC WL__ The identification of an invoice previously sent by the seller
* @param string|null $typeCode __BT-X-555, From EXTENDED__ Type of previous invoice (code)
* @param DateTime|null $issueDate __BT-26, From BASIC WL__ Date of the previous invoice
* @param string $issuerAssignedId __BT-25, From BASIC WL__ The identification of an invoice previously sent by the seller
* @param string|null $typeCode __BT-X-555, From EXTENDED__ Type of previous invoice (code)
* @param DateTimeInterface|null $issueDate __BT-26, From BASIC WL__ Date of the previous invoice
* @return ZugferdDocumentBuilder
*/
public function addDocumentInvoiceReferencedDocument(string $issuerAssignedId, ?string $typeCode = null, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function addDocumentInvoiceReferencedDocument(string $issuerAssignedId, ?string $typeCode = null, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$invoicerefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, $typeCode, null, null, $issueDate, null);
@ -2121,11 +2121,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Details of the associated end customer order
*
* @param string $issuerAssignedId __BT-X-150, From EXTENDED__ Order number of the end customer
* @param DateTime|null $issueDate __BT-X-151, From EXTENDED__ Date of the order issued by the end customer
* @param string $issuerAssignedId __BT-X-150, From EXTENDED__ Order number of the end customer
* @param DateTimeInterface|null $issueDate __BT-X-151, From EXTENDED__ Date of the order issued by the end customer
* @return ZugferdDocumentBuilder
*/
public function addDocumentUltimateCustomerOrderReferencedDocument(string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function addDocumentUltimateCustomerOrderReferencedDocument(string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$additionalrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -2137,10 +2137,10 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set detailed information on the actual delivery
*
* @param DateTime|null $date __BT-72, From BASIC WL__ Actual delivery time
* @param DateTimeInterface|null $date __BT-72, From BASIC WL__ Actual delivery time
* @return ZugferdDocumentBuilder
*/
public function setDocumentSupplyChainEvent(?DateTime $date): ZugferdDocumentBuilder
public function setDocumentSupplyChainEvent(?DateTimeInterface $date): ZugferdDocumentBuilder
{
$supplyChainevent = $this->getObjectHelper()->getSupplyChainEventType($date);
@ -2152,11 +2152,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set Detailed information on the actual delivery
*
* @param string $issuerAssignedId __BT-16, From BASIC WL__ Shipping notification reference
* @param DateTime|null $issueDate __BT-X-200, From EXTENDED__ Shipping notification date
* @param string $issuerAssignedId __BT-16, From BASIC WL__ Shipping notification reference
* @param DateTimeInterface|null $issueDate __BT-X-200, From EXTENDED__ Shipping notification date
* @return ZugferdDocumentBuilder
*/
public function setDocumentDespatchAdviceReferencedDocument(?string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentDespatchAdviceReferencedDocument(?string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$despatchddvicerefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -2168,11 +2168,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set detailed information on the associated goods receipt notification
*
* @param string $issuerAssignedId __BT-15, From EN 16931__ An identifier for a referenced goods receipt notification (Goods receipt number)
* @param DateTime|null $issueDate __BT-X-201, From EXTENDED__ Goods receipt date
* @param string $issuerAssignedId __BT-15, From EN 16931__ An identifier for a referenced goods receipt notification (Goods receipt number)
* @param DateTimeInterface|null $issueDate __BT-X-201, From EXTENDED__ Goods receipt date
* @return ZugferdDocumentBuilder
*/
public function setDocumentReceivingAdviceReferencedDocument(string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentReceivingAdviceReferencedDocument(string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$receivingadvicerefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -2184,11 +2184,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set detailed information on the associated delivery bill
*
* @param string $issuerAssignedId __BT-X-202, From EXTENDED__ Delivery slip number
* @param DateTime|null $issueDate __BT-X-203, From EXTENDED__ Delivery slip date
* @param string $issuerAssignedId __BT-X-202, From EXTENDED__ Delivery slip number
* @param DateTimeInterface|null $issueDate __BT-X-203, From EXTENDED__ Delivery slip date
* @return ZugferdDocumentBuilder
*/
public function setDocumentDeliveryNoteReferencedDocument(string $issuerAssignedId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentDeliveryNoteReferencedDocument(string $issuerAssignedId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$deliverynoterefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, null, null, null, null, $issueDate, null);
@ -2371,42 +2371,38 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Add a VAT breakdown (at document level)
*
* @param string $categoryCode __BT-118, From BASIC WL__ Coded description of a sales tax category
*
* The following entries from UNTDID 5305 are used (details in brackets):
* - Standard rate (sales tax is due according to the normal procedure)
* - Goods to be taxed according to the zero rate (sales tax is charged with a percentage of zero)
* - Tax exempt (USt./IGIC/IPSI)
* - Reversal of the tax liability (the rules for reversing the tax liability at USt./IGIC/IPSI apply)
* - VAT exempt for intra-community deliveries of goods (USt./IGIC/IPSI not levied due to rules on intra-community deliveries)
* - Free export item, tax not levied (VAT / IGIC/IPSI not levied due to export outside the EU)
* - Services outside the tax scope (sales are not subject to VAT / IGIC/IPSI)
* - Canary Islands general indirect tax (IGIC tax applies)
* - IPSI (tax for Ceuta / Melilla) applies.
*
* The codes for the VAT category are as follows:
* - S = sales tax is due at the normal rate
* - Z = goods to be taxed according to the zero rate
* - E = tax exempt
* - AE = reversal of tax liability
* - K = VAT is not shown for intra-community deliveries
* - G = tax not levied due to export outside the EU
* - O = Outside the tax scope
* - L = IGIC (Canary Islands)
* - M = IPSI (Ceuta / Melilla)
* @param string $typeCode __BT-118-0, From BASIC WL__ Coded description of a sales tax category. Note: Fixed value = "VAT"
* @param float $basisAmount __BT-116, From BASIC WL__ Tax base amount, Each sales tax breakdown must show a category-specific tax base amount.
* @param float $calculatedAmount __BT-117, From BASIC WL__ The total amount to be paid for the relevant VAT category. Note: Calculated by multiplying the amount to be taxed according to the sales tax category by the sales tax rate applicable for the sales tax category concerned
* @param float|null $rateApplicablePercent __BT-119, From BASIC WL__ The sales tax rate, expressed as the percentage applicable to the sales tax category in question. Note: The code of the sales tax category and the category-specific sales tax rate must correspond to one another. The value to be given is the percentage. For example, the value 20 is given for 20% (and not 0.2)
* @param string|null $exemptionReason __BT-120, From BASIC WL__ Reason for tax exemption (free text)
* @param string|null $exemptionReasonCode __BT-121, From BASIC WL__ Reason given in code form for the exemption of the amount from VAT. Note: Code list issued and maintained by the Connecting Europe Facility.
* @param float|null $lineTotalBasisAmount __BT-X-262, From EXTENDED__ An amount used as the basis for calculating sales tax, duty or customs duty
* @param float|null $allowanceChargeBasisAmount __BT-X-263, From EXTENDED__ Total amount Additions and deductions to the tax rate at document level
* @param DateTime|null $taxPointDate __BT-7-00, From EN 16931__ Date on which tax is due. This is not used in Germany. Instead, the delivery and service date must be specified.
* @param string|null $dueDateTypeCode __BT-8, From BASIC WL__ The code for the date on which the VAT becomes relevant for settlement for the seller and for the buyer
* @param string $categoryCode __BT-118, From BASIC WL__ Coded description of a sales tax category
* The following entries from UNTDID 5305 are used (details in
* brackets): - Standard rate (sales tax is due according to the
* normal procedure) - Goods to be taxed according to the zero rate
* (sales tax is charged with a percentage of zero) - Tax exempt
* (USt./IGIC/IPSI) - Reversal of the tax liability (the rules for
* reversing the tax liability at USt./IGIC/IPSI apply) - VAT exempt
* for intra-community deliveries of goods (USt./IGIC/IPSI not levied
* due to rules on intra-community deliveries) - Free export item, tax
* not levied (VAT / IGIC/IPSI not levied due to export outside the
* EU) - Services outside the tax scope (sales are not subject to VAT
* / IGIC/IPSI) - Canary Islands general indirect tax (IGIC tax
* applies) - IPSI (tax for Ceuta / Melilla) applies. The codes for
* the VAT category are as follows: - S = sales tax is due at the
* normal rate - Z = goods to be taxed according to the zero rate - E
* = tax exempt - AE = reversal of tax liability - K = VAT is not
* shown for intra-community deliveries - G = tax not levied due to
* export outside the EU - O = Outside the tax scope - L = IGIC
* (Canary Islands) - M = IPSI (Ceuta / Melilla)
* @param string $typeCode __BT-118-0, From BASIC WL__ Coded description of a sales tax category. Note: Fixed value = "VAT"
* @param float $basisAmount __BT-116, From BASIC WL__ Tax base amount, Each sales tax breakdown must show a category-specific tax base amount.
* @param float $calculatedAmount __BT-117, From BASIC WL__ The total amount to be paid for the relevant VAT category. Note: Calculated by multiplying the amount to be taxed according to the sales tax category by the sales tax rate applicable for the sales tax category concerned
* @param float|null $rateApplicablePercent __BT-119, From BASIC WL__ The sales tax rate, expressed as the percentage applicable to the sales tax category in question. Note: The code of the sales tax category and the category-specific sales tax rate must correspond to one another. The value to be given is the percentage. For example, the value 20 is given for 20% (and not 0.2)
* @param string|null $exemptionReason __BT-120, From BASIC WL__ Reason for tax exemption (free text)
* @param string|null $exemptionReasonCode __BT-121, From BASIC WL__ Reason given in code form for the exemption of the amount from VAT. Note: Code list issued and maintained by the Connecting Europe Facility.
* @param float|null $lineTotalBasisAmount __BT-X-262, From EXTENDED__ An amount used as the basis for calculating sales tax, duty or customs duty
* @param float|null $allowanceChargeBasisAmount __BT-X-263, From EXTENDED__ Total amount Additions and deductions to the tax rate at document level
* @param DateTimeInterface|null $taxPointDate __BT-7-00, From EN 16931__ Date on which tax is due. This is not used in Germany. Instead, the delivery and service date must be specified.
* @param string|null $dueDateTypeCode __BT-8, From BASIC WL__ The code for the date on which the VAT becomes relevant for settlement for the seller and for the buyer
* @return ZugferdDocumentBuilder
*/
public function addDocumentTax(string $categoryCode, string $typeCode, float $basisAmount, float $calculatedAmount, ?float $rateApplicablePercent = null, ?string $exemptionReason = null, ?string $exemptionReasonCode = null, ?float $lineTotalBasisAmount = null, ?float $allowanceChargeBasisAmount = null, ?DateTime $taxPointDate = null, ?string $dueDateTypeCode = null): ZugferdDocumentBuilder
public function addDocumentTax(string $categoryCode, string $typeCode, float $basisAmount, float $calculatedAmount, ?float $rateApplicablePercent = null, ?string $exemptionReason = null, ?string $exemptionReasonCode = null, ?float $lineTotalBasisAmount = null, ?float $allowanceChargeBasisAmount = null, ?DateTimeInterface $taxPointDate = null, ?string $dueDateTypeCode = null): ZugferdDocumentBuilder
{
$tax = $this->getObjectHelper()->getTradeTaxType($categoryCode, $typeCode, $basisAmount, $calculatedAmount, $rateApplicablePercent, $exemptionReason, $exemptionReasonCode, $lineTotalBasisAmount, $allowanceChargeBasisAmount, $taxPointDate, $dueDateTypeCode);
@ -2451,12 +2447,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Get detailed information on the billing period
*
* @param DateTime|null $startDate __BT-73, From BASIC WL__ Start of the billing period
* @param DateTime|null $endDate __BT-74, From BASIC WL__ End of the billing period
* @param string|null $description __BT-X-264, From EXTENDED__ Further information of the billing period (Obsolete)
* @param DateTimeInterface|null $startDate __BT-73, From BASIC WL__ Start of the billing period
* @param DateTimeInterface|null $endDate __BT-74, From BASIC WL__ End of the billing period
* @param string|null $description __BT-X-264, From EXTENDED__ Further information of the billing period (Obsolete)
* @return ZugferdDocumentBuilder
*/
public function setDocumentBillingPeriod(?DateTime $startDate, ?DateTime $endDate, ?string $description): ZugferdDocumentBuilder
public function setDocumentBillingPeriod(?DateTimeInterface $startDate, ?DateTimeInterface $endDate, ?string $description): ZugferdDocumentBuilder
{
$period = $this->getObjectHelper()->getSpecifiedPeriodType($startDate, $endDate, null, $description);
@ -2560,13 +2556,13 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Add a payment term
*
* @param string|null $description __BT-20, From _BASIC WL__ A text description of the payment terms that apply to the payment amount due (including a description of possible penalties). Note: This element can contain multiple lines and multiple conditions.
* @param DateTime|null $dueDate __BT-9, From BASIC WL__ The date by which payment is due Note: The payment due date reflects the net payment due date. In the case of partial payments, this indicates the first due date of a net payment. The corresponding description of more complex payment terms can be given in BT-20.
* @param string|null $directDebitMandateID __BT-89, From BASIC WL__ Unique identifier assigned by the payee to reference the direct debit authorization.
* @param float|null $partialPaymentAmount __BT-X-275, From EXTENDED__ Amount of the partial payment
* @param string|null $description __BT-20, From _BASIC WL__ A text description of the payment terms that apply to the payment amount due (including a description of possible penalties). Note: This element can contain multiple lines and multiple conditions.
* @param DateTimeInterface|null $dueDate __BT-9, From BASIC WL__ The date by which payment is due Note: The payment due date reflects the net payment due date. In the case of partial payments, this indicates the first due date of a net payment. The corresponding description of more complex payment terms can be given in BT-20.
* @param string|null $directDebitMandateID __BT-89, From BASIC WL__ Unique identifier assigned by the payee to reference the direct debit authorization.
* @param float|null $partialPaymentAmount __BT-X-275, From EXTENDED__ Amount of the partial payment
* @return ZugferdDocumentBuilder
*/
public function addDocumentPaymentTerm(?string $description = null, ?DateTime $dueDate = null, ?string $directDebitMandateID = null, ?float $partialPaymentAmount = null): ZugferdDocumentBuilder
public function addDocumentPaymentTerm(?string $description = null, ?DateTimeInterface $dueDate = null, ?string $directDebitMandateID = null, ?float $partialPaymentAmount = null): ZugferdDocumentBuilder
{
$paymentTerms = $this->getObjectHelper()->getTradePaymentTermsType($description, $dueDate, $directDebitMandateID, $partialPaymentAmount);
@ -2580,15 +2576,15 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Add discount Terms to last added payment term
*
* @param float|null $calculationPercent __BT-X-286, From EXTENDED__ Percentage of the down payment
* @param DateTime|null $basisDateTime __BT-X-282, From EXTENDED__ Due date reference date
* @param float|null $basisPeriodMeasureValue __BT-X-283, From EXTENDED__ Maturity period (basis)
* @param string|null $basisPeriodMeasureUnitCode __BT-X-284, From EXTENDED__ Maturity period (unit)
* @param float|null $basisAmount __BT-X-285, From EXTENDED__ Base amount of the payment discount
* @param float|null $actualDiscountAmount __BT-X-287, From EXTENDED__ Amount of the payment discount
* @param float|null $calculationPercent __BT-X-286, From EXTENDED__ Percentage of the down payment
* @param DateTimeInterface|null $basisDateTime __BT-X-282, From EXTENDED__ Due date reference date
* @param float|null $basisPeriodMeasureValue __BT-X-283, From EXTENDED__ Maturity period (basis)
* @param string|null $basisPeriodMeasureUnitCode __BT-X-284, From EXTENDED__ Maturity period (unit)
* @param float|null $basisAmount __BT-X-285, From EXTENDED__ Base amount of the payment discount
* @param float|null $actualDiscountAmount __BT-X-287, From EXTENDED__ Amount of the payment discount
* @return ZugferdDocumentBuilder
*/
public function addDiscountTermsToPaymentTerms(?float $calculationPercent = null, ?DateTime $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $actualDiscountAmount = null): ZugferdDocumentBuilder
public function addDiscountTermsToPaymentTerms(?float $calculationPercent = null, ?DateTimeInterface $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $actualDiscountAmount = null): ZugferdDocumentBuilder
{
$discountTerms = $this->getObjectHelper()->getTradePaymentDiscountTermsType($basisDateTime, $basisPeriodMeasureValue, $basisPeriodMeasureUnitCode, $basisAmount, $calculationPercent, $actualDiscountAmount);
@ -2600,15 +2596,15 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Add penalty Terms to last added payment term
*
* @param float|null $calculationPercent __BT-X-280, From EXTENDED__ Percentage of the payment surcharge
* @param DateTime|null $basisDateTime __BT-X-276, From EXTENDED__ Due date reference date
* @param float|null $basisPeriodMeasureValue __BT-X-277, From EXTENDED__ Maturity period (basis)
* @param string|null $basisPeriodMeasureUnitCode __BT-X-278, From EXTENDED__ Maturity period (unit)
* @param float|null $basisAmount __BT-X-279, From EXTENDED__ Basic amount of the payment surcharge
* @param float|null $actualPenaltyAmount __BT-X-281, From EXTENDED__ Amount of the payment surcharge
* @param float|null $calculationPercent __BT-X-280, From EXTENDED__ Percentage of the payment surcharge
* @param DateTimeInterface|null $basisDateTime __BT-X-276, From EXTENDED__ Due date reference date
* @param float|null $basisPeriodMeasureValue __BT-X-277, From EXTENDED__ Maturity period (basis)
* @param string|null $basisPeriodMeasureUnitCode __BT-X-278, From EXTENDED__ Maturity period (unit)
* @param float|null $basisAmount __BT-X-279, From EXTENDED__ Basic amount of the payment surcharge
* @param float|null $actualPenaltyAmount __BT-X-281, From EXTENDED__ Amount of the payment surcharge
* @return ZugferdDocumentBuilder
*/
public function addPenaltyTermsToPaymentTerms(?float $calculationPercent = null, ?DateTime $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $actualPenaltyAmount = null): ZugferdDocumentBuilder
public function addPenaltyTermsToPaymentTerms(?float $calculationPercent = null, ?DateTimeInterface $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $actualPenaltyAmount = null): ZugferdDocumentBuilder
{
$penaltyTerms = $this->getObjectHelper()->getTradePaymentPenaltyTermsType($basisDateTime, $basisPeriodMeasureValue, $basisPeriodMeasureUnitCode, $basisAmount, $calculationPercent, $actualPenaltyAmount);
@ -2620,15 +2616,15 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Add a payment term in XRechnung-Style (in the Form #SKONTO#TAGE=14#PROZENT=1.00#BASISBETRAG=2.53#)
*
* @param string $description __BT-20, From _EN 16931 XRECHNUNG__ Text to add
* @param int[] $paymentDiscountDays __BT-20, BR-DE-18, From _EN 16931 XRECHNUNG__ Array of Payment discount days (array of integer)
* @param float[] $paymentDiscountPercents __BT-20, BR-DE-18, From _EN 16931 XRECHNUNG__ Array of Payment discount percents (array of decimal)
* @param float[] $paymentDiscountBaseAmounts __BT-20, BR-DE-18, From _EN 16931 XRECHNUNG__ Array of Payment discount base amounts (array of decimal)
* @param DateTime|null $dueDate __BT-9, From EN 16931 XRECHNUNG__ The date by which payment is due Note: The payment due date reflects the net payment due date. In the case of partial payments, this indicates the first due date of a net payment. The corresponding description of more complex payment terms can be given in BT-20.
* @param string|null $directDebitMandateID __BT-89, From EN 16931 XRECHNUNG__ Unique identifier assigned by the payee to reference the direct debit authorization.
* @param string $description __BT-20, From _EN 16931 XRECHNUNG__ Text to add
* @param int[] $paymentDiscountDays __BT-20, BR-DE-18, From _EN 16931 XRECHNUNG__ Array of Payment discount days (array of integer)
* @param float[] $paymentDiscountPercents __BT-20, BR-DE-18, From _EN 16931 XRECHNUNG__ Array of Payment discount percents (array of decimal)
* @param float[] $paymentDiscountBaseAmounts __BT-20, BR-DE-18, From _EN 16931 XRECHNUNG__ Array of Payment discount base amounts (array of decimal)
* @param DateTimeInterface|null $dueDate __BT-9, From EN 16931 XRECHNUNG__ The date by which payment is due Note: The payment due date reflects the net payment due date. In the case of partial payments, this indicates the first due date of a net payment. The corresponding description of more complex payment terms can be given in BT-20.
* @param string|null $directDebitMandateID __BT-89, From EN 16931 XRECHNUNG__ Unique identifier assigned by the payee to reference the direct debit authorization.
* @return ZugferdDocumentBuilder
*/
public function addDocumentPaymentTermXRechnung(string $description, array $paymentDiscountDays = [], array $paymentDiscountPercents = [], array $paymentDiscountBaseAmounts = [], ?DateTime $dueDate = null, ?string $directDebitMandateID = null): ZugferdDocumentBuilder
public function addDocumentPaymentTermXRechnung(string $description, array $paymentDiscountDays = [], array $paymentDiscountPercents = [], array $paymentDiscountBaseAmounts = [], ?DateTimeInterface $dueDate = null, ?string $directDebitMandateID = null): ZugferdDocumentBuilder
{
$paymentTermsDescription = [];
@ -2895,12 +2891,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of a sales order reference.
*
* @param string $issuerAssignedId __BT-X-537, From EXTENDED__ Document number of a sales order reference
* @param string $lineId __BT-X-538, From EXTENDED__ An identifier for a position within a sales order.
* @param DateTime|null $issueDate __BT-X-539, From EXTENDED__ Date of sales order
* @param string $issuerAssignedId __BT-X-537, From EXTENDED__ Document number of a sales order reference
* @param string $lineId __BT-X-538, From EXTENDED__ An identifier for a position within a sales order.
* @param DateTimeInterface|null $issueDate __BT-X-539, From EXTENDED__ Date of sales order
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionSellerOrderReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentPositionSellerOrderReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$sellerorderrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
$positionagreement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeAgreement");
@ -2913,12 +2909,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of the related buyer order position.
*
* @param string $issuerAssignedId __BT-X-21, From EXTENDED__ An identifier issued by the buyer for a referenced order (order number)
* @param string $lineId __BT-132, From EN 16931__ An identifier for a position within an order placed by the buyer. Note: Reference is made to the order reference at the document level.
* @param DateTime|null $issueDate __BT-X-22, From EXTENDED__ Date of order
* @param string $issuerAssignedId __BT-X-21, From EXTENDED__ An identifier issued by the buyer for a referenced order (order number)
* @param string $lineId __BT-132, From EN 16931__ An identifier for a position within an order placed by the buyer. Note: Reference is made to the order reference at the document level.
* @param DateTimeInterface|null $issueDate __BT-X-22, From EXTENDED__ Date of order
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionBuyerOrderReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentPositionBuyerOrderReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$buyerorderrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
$positionagreement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeAgreement");
@ -2931,12 +2927,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of the associated offer position.
*
* @param string $issuerAssignedId __BT-X-310, From EXTENDED__ Offer number
* @param string $lineId __BT-X-311, From EXTENDED__ Position identifier within the offer
* @param DateTime|null $issueDate __BT-X-312, From EXTENDED__ Date of offder
* @param string $issuerAssignedId __BT-X-310, From EXTENDED__ Offer number
* @param string $lineId __BT-X-311, From EXTENDED__ Position identifier within the offer
* @param DateTimeInterface|null $issueDate __BT-X-312, From EXTENDED__ Date of offder
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionQuotationReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentPositionQuotationReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$quotationrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
$positionagreement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeAgreement");
@ -2949,12 +2945,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set details of the related contract position.
*
* @param string $issuerAssignedId __BT-X-24, From EXTENDED__ The contract reference should be assigned once in the context of the specific trade relationship and for a defined period of time (contract number)
* @param string $lineId __BT-X-25, From EXTENDED__ Identifier of the according contract position
* @param DateTime|null $issueDate __BT-X-26, From EXTENDED__ Contract date
* @param string $issuerAssignedId __BT-X-24, From EXTENDED__ The contract reference should be assigned once in the context of the specific trade relationship and for a defined period of time (contract number)
* @param string $lineId __BT-X-25, From EXTENDED__ Identifier of the according contract position
* @param DateTimeInterface|null $issueDate __BT-X-26, From EXTENDED__ Contract date
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionContractReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentPositionContractReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$contractrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
$positionagreement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeAgreement");
@ -2973,17 +2969,17 @@ class ZugferdDocumentBuilder extends ZugferdDocument
* to large attachments and / or sensitive information, e.g. for personal services, which must be separated
* from the bill
*
* @param string $issuerAssignedId __BT-X-27, From EXTENDED__ The identifier of the tender or lot to which the invoice relates, or an identifier specified by the seller for an object on which the invoice is based, or an identifier of the document on which the invoice is based.
* @param string $typeCode __BT-X-30, From EXTENDED__ Type of referenced document (See codelist UNTDID 1001)
* @param string|null $uriId __BT-X-28, From EXTENDED__ The Uniform Resource Locator (URL) at which the external document is available. A means of finding the resource including the primary access method intended for it, e.g. http: // or ftp: //. The location of the external document must be used if the buyer needs additional information to support the amounts billed. External documents are not part of the invoice. Access to external documents can involve certain risks.
* @param string|null $lineId __BT-X-29, From EXTENDED__ The referenced position identifier in the additional document
* @param string|null $name __BT-X-299, From EXTENDED__ A description of the document, e.g. Hourly billing, usage or consumption report, etc.
* @param string|null $refTypeCode __BT-X-32, From EXTENDED__ The identifier for the identification scheme of the identifier of the item invoiced. If it is not clear to the recipient which scheme is used for the identifier, an identifier of the scheme should be used, which must be selected from UNTDID 1153 in accordance with the code list entries.
* @param DateTime|null $issueDate __BT-X-33, From EXTENDED__ Document date
* @param string|null $binaryDataFilename __BT-X-31, From EXTENDED__ Contains a file name of an attachment document embedded as a binary object
* @param string $issuerAssignedId __BT-X-27, From EXTENDED__ The identifier of the tender or lot to which the invoice relates, or an identifier specified by the seller for an object on which the invoice is based, or an identifier of the document on which the invoice is based.
* @param string $typeCode __BT-X-30, From EXTENDED__ Type of referenced document (See codelist UNTDID 1001)
* @param string|null $uriId __BT-X-28, From EXTENDED__ The Uniform Resource Locator (URL) at which the external document is available. A means of finding the resource including the primary access method intended for it, e.g. http: // or ftp: //. The location of the external document must be used if the buyer needs additional information to support the amounts billed. External documents are not part of the invoice. Access to external documents can involve certain risks.
* @param string|null $lineId __BT-X-29, From EXTENDED__ The referenced position identifier in the additional document
* @param string|null $name __BT-X-299, From EXTENDED__ A description of the document, e.g. Hourly billing, usage or consumption report, etc.
* @param string|null $refTypeCode __BT-X-32, From EXTENDED__ The identifier for the identification scheme of the identifier of the item invoiced. If it is not clear to the recipient which scheme is used for the identifier, an identifier of the scheme should be used, which must be selected from UNTDID 1153 in accordance with the code list entries.
* @param DateTimeInterface|null $issueDate __BT-X-33, From EXTENDED__ Document date
* @param string|null $binaryDataFilename __BT-X-31, From EXTENDED__ Contains a file name of an attachment document embedded as a binary object
* @return ZugferdDocumentBuilder
*/
public function addDocumentPositionAdditionalReferencedDocument(string $issuerAssignedId, string $typeCode, ?string $uriId = null, ?string $lineId = null, ?string $name = null, ?string $refTypeCode = null, ?DateTime $issueDate = null, ?string $binaryDataFilename = null): ZugferdDocumentBuilder
public function addDocumentPositionAdditionalReferencedDocument(string $issuerAssignedId, string $typeCode, ?string $uriId = null, ?string $lineId = null, ?string $name = null, ?string $refTypeCode = null, ?DateTimeInterface $issueDate = null, ?string $binaryDataFilename = null): ZugferdDocumentBuilder
{
$addrefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, $uriId, $lineId, $typeCode, $name, $refTypeCode, $issueDate, $binaryDataFilename);
$positionagreement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeAgreement");
@ -2996,12 +2992,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Add a referennce of a associated end customer order.
*
* @param string $issuerAssignedId __BT-X-43, From EXTENDED__ Order number of the end customer
* @param string $lineId __BT-X-44, From EXTENDED__ Order item (end customer)
* @param DateTime|null $issueDate __BT-X-45, From EXTENDED__ Document date of end customer order
* @param string $issuerAssignedId __BT-X-43, From EXTENDED__ Order number of the end customer
* @param string $lineId __BT-X-44, From EXTENDED__ Order item (end customer)
* @param DateTimeInterface|null $issueDate __BT-X-45, From EXTENDED__ Document date of end customer order
* @return ZugferdDocumentBuilder
*/
public function addDocumentPositionUltimateCustomerOrderReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function addDocumentPositionUltimateCustomerOrderReferencedDocument(string $issuerAssignedId, string $lineId, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$ultimaterefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
$positionagreement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeAgreement");
@ -3396,10 +3392,10 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Detailed information on the actual delivery on position level.
*
* @param DateTime|null $date __BT-X-85, From EXTENDED__ Actual delivery date
* @param DateTimeInterface|null $date __BT-X-85, From EXTENDED__ Actual delivery date
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionSupplyChainEvent(?DateTime $date): ZugferdDocumentBuilder
public function setDocumentPositionSupplyChainEvent(?DateTimeInterface $date): ZugferdDocumentBuilder
{
$positiondelivery = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeDelivery");
$supplyChainevent = $this->getObjectHelper()->getSupplyChainEventType($date);
@ -3412,12 +3408,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Detailed information on the associated shipping notification on position level.
*
* @param string $issuerAssignedId __BT-X-86, From EXTENDED__ Shipping notification number
* @param string|null $lineId __BT-X-87, From EXTENDED__ Shipping notification position
* @param DateTime|null $issueDate __BT-X-88, From EXTENDED__ Date of Shipping notification number
* @param string $issuerAssignedId __BT-X-86, From EXTENDED__ Shipping notification number
* @param string|null $lineId __BT-X-87, From EXTENDED__ Shipping notification position
* @param DateTimeInterface|null $issueDate __BT-X-88, From EXTENDED__ Date of Shipping notification number
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionDespatchAdviceReferencedDocument(string $issuerAssignedId, ?string $lineId = null, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentPositionDespatchAdviceReferencedDocument(string $issuerAssignedId, ?string $lineId = null, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$positiondelivery = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeDelivery");
$despatchddvicerefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
@ -3430,12 +3426,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Detailed information on the associated goods receipt notification.
*
* @param string $issuerAssignedId __BT-X-89, From EXTENDED__ Goods receipt number
* @param string|null $lineId __BT-X-90, From EXTENDED__ Goods receipt position
* @param DateTime|null $issueDate __BT-X-91, From EXTENDED__ Date of Goods receipt
* @param string $issuerAssignedId __BT-X-89, From EXTENDED__ Goods receipt number
* @param string|null $lineId __BT-X-90, From EXTENDED__ Goods receipt position
* @param DateTimeInterface|null $issueDate __BT-X-91, From EXTENDED__ Date of Goods receipt
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionReceivingAdviceReferencedDocument(string $issuerAssignedId, ?string $lineId = null, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentPositionReceivingAdviceReferencedDocument(string $issuerAssignedId, ?string $lineId = null, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$positiondelivery = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeDelivery");
$receivingadvicerefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
@ -3448,12 +3444,12 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Detailed information on the associated delivery bill on position level.
*
* @param string $issuerAssignedId __BT-X-92, From EXTENDED__ Delivery note number
* @param string|null $lineId __BT-X-93, From EXTENDED__ Delivery note position
* @param DateTime|null $issueDate __BT-X-94, From EXTENDED__ Date of Delivery note
* @param string $issuerAssignedId __BT-X-92, From EXTENDED__ Delivery note number
* @param string|null $lineId __BT-X-93, From EXTENDED__ Delivery note position
* @param DateTimeInterface|null $issueDate __BT-X-94, From EXTENDED__ Date of Delivery note
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionDeliveryNoteReferencedDocument(string $issuerAssignedId, ?string $lineId = null, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function setDocumentPositionDeliveryNoteReferencedDocument(string $issuerAssignedId, ?string $lineId = null, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$positiondelivery = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeDelivery");
$deliverynoterefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineId, null, null, null, $issueDate, null);
@ -3487,11 +3483,11 @@ class ZugferdDocumentBuilder extends ZugferdDocument
/**
* Set information about the period relevant for the invoice item. Also known as the invoice line delivery period.
*
* @param DateTime|null $startDate __BT-134, From BASIC__ Start of the billing period
* @param DateTime|null $endDate __BT-135, From BASIC__ End of the billing period
* @param DateTimeInterface|null $startDate __BT-134, From BASIC__ Start of the billing period
* @param DateTimeInterface|null $endDate __BT-135, From BASIC__ End of the billing period
* @return ZugferdDocumentBuilder
*/
public function setDocumentPositionBillingPeriod(?DateTime $startDate, ?DateTime $endDate): ZugferdDocumentBuilder
public function setDocumentPositionBillingPeriod(?DateTimeInterface $startDate, ?DateTimeInterface $endDate): ZugferdDocumentBuilder
{
$positionsettlement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeSettlement");
$period = $this->getObjectHelper()->getSpecifiedPeriodType($startDate, $endDate, null, null);
@ -3567,13 +3563,13 @@ class ZugferdDocumentBuilder extends ZugferdDocument
* - reference is made from a final invoice to previous partial invoices
* - reference is made from a final invoice to previous invoices for advance payments. *
*
* @param string $issuerAssignedId __BT-X-331, From EXTENDED__ The identification of an invoice previously sent by the seller
* @param string $lineid __BT-X-540, From EXTENDED__ Identification of the invoice item
* @param string|null $typeCode __BT-X-332, From EXTENDED__ Type of previous invoice (code)
* @param DateTime|null $issueDate __BT-X-333, From EXTENDED__ Date of the previous invoice
* @param string $issuerAssignedId __BT-X-331, From EXTENDED__ The identification of an invoice previously sent by the seller
* @param string $lineid __BT-X-540, From EXTENDED__ Identification of the invoice item
* @param string|null $typeCode __BT-X-332, From EXTENDED__ Type of previous invoice (code)
* @param DateTimeInterface|null $issueDate __BT-X-333, From EXTENDED__ Date of the previous invoice
* @return ZugferdDocumentBuilder
*/
public function addDocumentPositionInvoiceReferencedDocument(string $issuerAssignedId, string $lineid, ?string $typeCode = null, ?DateTime $issueDate = null): ZugferdDocumentBuilder
public function addDocumentPositionInvoiceReferencedDocument(string $issuerAssignedId, string $lineid, ?string $typeCode = null, ?DateTimeInterface $issueDate = null): ZugferdDocumentBuilder
{
$positionsettlement = $this->getObjectHelper()->tryCallAndReturn($this->currentPosition, "getSpecifiedLineTradeSettlement");
$invoicerefdoc = $this->getObjectHelper()->getReferencedDocumentType($issuerAssignedId, null, $lineid, $typeCode, null, null, $issueDate, null);

View file

@ -10,6 +10,7 @@
namespace horstoeko\zugferd;
use DateTime;
use DateTimeInterface;
use horstoeko\mimedb\MimeDb;
use horstoeko\stringmanagement\FileUtils;
use horstoeko\stringmanagement\StringUtils;
@ -203,10 +204,10 @@ class ZugferdObjectHelper
/**
* Get formatted issue date
*
* @param DateTime|null $dateTime
* @param DateTimeInterface|null $dateTime
* @return object|null
*/
public function getFormattedDateTimeType(?DateTime $dateTime = null): ?object
public function getFormattedDateTimeType(?DateTimeInterface $dateTime = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -225,10 +226,10 @@ class ZugferdObjectHelper
/**
* Get formatted issue date
*
* @param DateTime|null $dateTime
* @param DateTimeInterface|null $dateTime
* @return object|null
*/
public function getDateTimeType(?DateTime $dateTime = null): ?object
public function getDateTimeType(?DateTimeInterface $dateTime = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -247,10 +248,10 @@ class ZugferdObjectHelper
/**
* Get date
*
* @param DateTime|null $dateTime
* @param DateTimeInterface|null $dateTime
* @return object|null
*/
public function getDateType(?DateTime $dateTime = null): ?object
public function getDateType(?DateTimeInterface $dateTime = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -439,13 +440,13 @@ class ZugferdObjectHelper
/**
* Get Specified Period type
*
* @param DateTime|null $startDate
* @param DateTime|null $endDate
* @param DateTime|null $completeDate
* @param string|null $description
* @param DateTimeInterface|null $startDate
* @param DateTimeInterface|null $endDate
* @param DateTimeInterface|null $completeDate
* @param string|null $description
* @return object|null
*/
public function getSpecifiedPeriodType(?DateTime $startDate = null, ?DateTime $endDate = null, ?DateTime $completeDate = null, ?string $description = null): ?object
public function getSpecifiedPeriodType(?DateTimeInterface $startDate = null, ?DateTimeInterface $endDate = null, ?DateTimeInterface $completeDate = null, ?string $description = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -487,17 +488,17 @@ class ZugferdObjectHelper
/**
* Get a reference document object
*
* @param string|null $issuerAssignedId
* @param string|null $uriId
* @param string|null $lineId
* @param string|null $typeCode
* @param string|array|null $name
* @param string|null $refTypeCode
* @param DateTime|null $issueDate
* @param string|null $binaryDataFilename
* @param string|null $issuerAssignedId
* @param string|null $uriId
* @param string|null $lineId
* @param string|null $typeCode
* @param string|array|null $name
* @param string|null $refTypeCode
* @param DateTimeInterface|null $issueDate
* @param string|null $binaryDataFilename
* @return object|null
*/
public function getReferencedDocumentType(?string $issuerAssignedId = null, ?string $uriId = null, ?string $lineId = null, ?string $typeCode = null, $name = null, ?string $refTypeCode = null, ?DateTime $issueDate = null, ?string $binaryDataFilename = null): ?object
public function getReferencedDocumentType(?string $issuerAssignedId = null, ?string $uriId = null, ?string $lineId = null, ?string $typeCode = null, $name = null, ?string $refTypeCode = null, ?DateTimeInterface $issueDate = null, ?string $binaryDataFilename = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -823,10 +824,10 @@ class ZugferdObjectHelper
/**
* Undocumented function
*
* @param DateTime|null $date
* @param DateTimeInterface|null $date
* @return object|null
*/
public function getSupplyChainEventType(?DateTime $date = null): ?object
public function getSupplyChainEventType(?DateTimeInterface $date = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -951,13 +952,13 @@ class ZugferdObjectHelper
/**
* Get instance of TradePaymentTermsType
*
* @param null|string $description
* @param null|DateTime $dueDate
* @param null|string $directDebitMandateID
* @param null|float $partialPaymentAmount
* @param null|string $description
* @param null|DateTimeInterface $dueDate
* @param null|string $directDebitMandateID
* @param null|float $partialPaymentAmount
* @return null|object
*/
public function getTradePaymentTermsType(?string $description = null, ?DateTime $dueDate = null, ?string $directDebitMandateID = null, ?float $partialPaymentAmount = null): ?object
public function getTradePaymentTermsType(?string $description = null, ?DateTimeInterface $dueDate = null, ?string $directDebitMandateID = null, ?float $partialPaymentAmount = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -976,15 +977,15 @@ class ZugferdObjectHelper
/**
* Get instance of TradePaymentDiscountTermsType
*
* @param DateTime|null $basisDateTime
* @param float|null $basisPeriodMeasureValue
* @param string|null $basisPeriodMeasureUnitCode
* @param float|null $basisAmount
* @param float|null $calculationPercent
* @param float|null $actualDiscountAmount
* @param DateTimeInterface|null $basisDateTime
* @param float|null $basisPeriodMeasureValue
* @param string|null $basisPeriodMeasureUnitCode
* @param float|null $basisAmount
* @param float|null $calculationPercent
* @param float|null $actualDiscountAmount
* @return object|null
*/
public function getTradePaymentDiscountTermsType(?DateTime $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $calculationPercent = null, ?float $actualDiscountAmount = null): ?object
public function getTradePaymentDiscountTermsType(?DateTimeInterface $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $calculationPercent = null, ?float $actualDiscountAmount = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -1004,15 +1005,15 @@ class ZugferdObjectHelper
/**
* Get instance of TradePaymentPenaltyTermsType
*
* @param DateTime|null $basisDateTime
* @param float|null $basisPeriodMeasureValue
* @param string|null $basisPeriodMeasureUnitCode
* @param float|null $basisAmount
* @param float|null $calculationPercent
* @param float|null $actualPenaltyAmount
* @param DateTimeInterface|null $basisDateTime
* @param float|null $basisPeriodMeasureValue
* @param string|null $basisPeriodMeasureUnitCode
* @param float|null $basisAmount
* @param float|null $calculationPercent
* @param float|null $actualPenaltyAmount
* @return object|null
*/
public function getTradePaymentPenaltyTermsType(?DateTime $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $calculationPercent = null, ?float $actualPenaltyAmount = null): ?object
public function getTradePaymentPenaltyTermsType(?DateTimeInterface $basisDateTime = null, ?float $basisPeriodMeasureValue = null, ?string $basisPeriodMeasureUnitCode = null, ?float $basisAmount = null, ?float $calculationPercent = null, ?float $actualPenaltyAmount = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -1033,20 +1034,20 @@ class ZugferdObjectHelper
* Get instance of TradeTaxType
* Sales tax breakdown, Umsatzsteueraufschlüsselung
*
* @param string|null $categoryCode
* @param string|null $typeCode
* @param float|null $basisAmount
* @param float|null $calculatedAmount
* @param float|null $rateApplicablePercent
* @param string|null $exemptionReason
* @param string|null $exemptionReasonCode
* @param float|null $lineTotalBasisAmount
* @param float|null $allowanceChargeBasisAmount
* @param DateTime|null $taxPointDate
* @param string|null $dueDateTypeCode
* @param string|null $categoryCode
* @param string|null $typeCode
* @param float|null $basisAmount
* @param float|null $calculatedAmount
* @param float|null $rateApplicablePercent
* @param string|null $exemptionReason
* @param string|null $exemptionReasonCode
* @param float|null $lineTotalBasisAmount
* @param float|null $allowanceChargeBasisAmount
* @param DateTimeInterface|null $taxPointDate
* @param string|null $dueDateTypeCode
* @return object|null
*/
public function getTradeTaxType(?string $categoryCode = null, ?string $typeCode = null, ?float $basisAmount = null, ?float $calculatedAmount = null, ?float $rateApplicablePercent = null, ?string $exemptionReason = null, ?string $exemptionReasonCode = null, ?float $lineTotalBasisAmount = null, ?float $allowanceChargeBasisAmount = null, ?DateTime $taxPointDate = null, ?string $dueDateTypeCode = null): ?object
public function getTradeTaxType(?string $categoryCode = null, ?string $typeCode = null, ?float $basisAmount = null, ?float $calculatedAmount = null, ?float $rateApplicablePercent = null, ?string $exemptionReason = null, ?string $exemptionReasonCode = null, ?float $lineTotalBasisAmount = null, ?float $allowanceChargeBasisAmount = null, ?DateTimeInterface $taxPointDate = null, ?string $dueDateTypeCode = null): ?object
{
if (self::isAllNullOrEmpty(func_get_args())) {
return null;
@ -1436,13 +1437,13 @@ class ZugferdObjectHelper
/**
* Undocumented function
*
* @param string|null $sourceCurrencyCode
* @param string|null $targetCurrencyCode
* @param float|null $rate
* @param DateTime|null $rateDateTime
* @param string|null $sourceCurrencyCode
* @param string|null $targetCurrencyCode
* @param float|null $rate
* @param DateTimeInterface|null $rateDateTime
* @return object|null
*/
public function getTaxApplicableTradeCurrencyExchangeType(?string $sourceCurrencyCode = null, ?string $targetCurrencyCode = null, ?float $rate = null, ?DateTime $rateDateTime = null): ?object
public function getTaxApplicableTradeCurrencyExchangeType(?string $sourceCurrencyCode = null, ?string $targetCurrencyCode = null, ?float $rate = null, ?DateTimeInterface $rateDateTime = null): ?object
{
if (self::isOneNullOrEmpty(func_get_args())) {
return null;

View file

@ -42,6 +42,8 @@ class ZugferdProfileResolver
try {
libxml_clear_errors();
$xmldocument = new SimpleXMLElement($xmlContent);
$xmldocument->registerXPathNamespace("rsm", "urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100");
$xmldocument->registerXPathNamespace("ram", "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100");
$typeelement = $xmldocument->xpath('/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID');
if (libxml_get_last_error()) {
throw new ZugferdUnknownXmlContentException();

View file

@ -71,7 +71,7 @@ class ZugferdProfiles
public const PROFILE_XRECHNUNG_2_3 = 9;
/**
* Internal constant that identifies the XRECHNUNG profile version 2.3 (germany only)
* Internal constant that identifies the XRECHNUNG profile version 3.0 (germany only)
*/
public const PROFILE_XRECHNUNG_3 = 10;

View file

@ -232,7 +232,7 @@ class KositValidatorTest extends TestCase
$kositValidator->setValidatorDownloadUrl("dummy");
$this->assertSame("https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2024-10-31/validator-configuration-xrechnung_3.0.2_2024-10-31.zip", $this->getPrivatePropertyFromObject($kositValidator, 'validatorScenarioDownloadUrl')->getValue($kositValidator));
$this->assertSame("https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2025-03-21/validator-configuration-xrechnung_3.0.2_2025-03-21.zip", $this->getPrivatePropertyFromObject($kositValidator, 'validatorScenarioDownloadUrl')->getValue($kositValidator));
}
public function testSetValidatorAppZipFilename(): void
@ -550,7 +550,7 @@ class KositValidatorTest extends TestCase
$this->assertInitialValues($kositValidator);
$kositValidator->setValidatorScenarioDownloadUrl('https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2024-10-31/validator-configuration-xrechnung_3.0.2_2024-10-31-unknown.zip');
$kositValidator->setValidatorScenarioDownloadUrl('https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2025-03-21/validator-configuration-xrechnung_3.0.2_2024-10-31-unknown.zip');
$filenameAppZip = $this->getPrivateMethodFromObject($kositValidator, 'resolveAppZipFilename')->invokeArgs($kositValidator, []);
$filenameScenarioZip = $this->getPrivateMethodFromObject($kositValidator, 'resolveScenatioZipFilename')->invokeArgs($kositValidator, []);
@ -720,7 +720,7 @@ class KositValidatorTest extends TestCase
$this->assertNotSame("", $this->getPrivatePropertyFromObject($kositValidator, 'baseDirectory')->getValue($kositValidator));
$this->assertSame(sys_get_temp_dir(), $this->getPrivatePropertyFromObject($kositValidator, 'baseDirectory')->getValue($kositValidator));
$this->assertSame("https://github.com/itplr-kosit/validator/releases/download/v1.5.0/validator-1.5.0-distribution.zip", $this->getPrivatePropertyFromObject($kositValidator, 'validatorDownloadUrl')->getValue($kositValidator));
$this->assertSame("https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2024-10-31/validator-configuration-xrechnung_3.0.2_2024-10-31.zip", $this->getPrivatePropertyFromObject($kositValidator, 'validatorScenarioDownloadUrl')->getValue($kositValidator));
$this->assertSame("https://github.com/itplr-kosit/validator-configuration-xrechnung/releases/download/release-2025-03-21/validator-configuration-xrechnung_3.0.2_2025-03-21.zip", $this->getPrivatePropertyFromObject($kositValidator, 'validatorScenarioDownloadUrl')->getValue($kositValidator));
$this->assertSame("validator.zip", $this->getPrivatePropertyFromObject($kositValidator, 'validatorAppZipFilename')->getValue($kositValidator));
$this->assertSame("validator-configuration.zip", $this->getPrivatePropertyFromObject($kositValidator, 'validatorScenarioZipFilename')->getValue($kositValidator));
$this->assertSame("validationtool-1.5.0-standalone.jar", $this->getPrivatePropertyFromObject($kositValidator, 'validatorAppJarFilename')->getValue($kositValidator));
@ -732,10 +732,10 @@ class KositValidatorTest extends TestCase
$this->assertSame(0, $this->getPrivatePropertyFromObject($kositValidator, 'remoteModePort')->getValue($kositValidator));
$this->assertStringStartsWith(sys_get_temp_dir(), $this->getPrivateMethodFromObject($kositValidator, 'resolveBaseDirectory')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('/validator.zip', $this->getPrivateMethodFromObject($kositValidator, 'resolveAppZipFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('/validator-configuration.zip', $this->getPrivateMethodFromObject($kositValidator, 'resolveScenatioZipFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('/validationtool-1.5.0-standalone.jar', $this->getPrivateMethodFromObject($kositValidator, 'resolveAppJarFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('/scenarios.xml', $this->getPrivateMethodFromObject($kositValidator, 'resolveAppScenarioFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('validator.zip', $this->getPrivateMethodFromObject($kositValidator, 'resolveAppZipFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('validator-configuration.zip', $this->getPrivateMethodFromObject($kositValidator, 'resolveScenatioZipFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('validationtool-1.5.0-standalone.jar', $this->getPrivateMethodFromObject($kositValidator, 'resolveAppJarFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('scenarios.xml', $this->getPrivateMethodFromObject($kositValidator, 'resolveAppScenarioFilename')->invokeArgs($kositValidator, []));
$this->assertStringStartsWith(sys_get_temp_dir(), $this->getPrivateMethodFromObject($kositValidator, 'resolveFileToValidateFilename')->invokeArgs($kositValidator, []));
$this->assertStringEndsWith('.xml', $this->getPrivateMethodFromObject($kositValidator, 'resolveFileToValidateFilename')->invokeArgs($kositValidator, []));
}

View file

@ -1,15 +0,0 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

View file

@ -1,83 +0,0 @@
## Composer
.idea
composer.phar
/vendor/
## Linux
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
## macOS
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
## Windows
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# Generated XML files from tests
/tests/*.xml
# Test cache
.phpunit.result.cache
# Editors
.vscode/

View file

@ -1,261 +0,0 @@
# Changelog for v1.21.2
#### Bug fixes
- <cbc:MultiplierFactorNumeric> in AllowanceCharge should not crash when the system uses localized number output
- documentTypeCode in AdditionalDocumentReference should not be limited to int values - Thanks [@tgeorgel](https://github.com/tgeorgel)
# Changelog for v1.21.1
#### Bug fixes
- <cac:Price> <cbc:PriceAmount> should not be rounded to zero decimals
# Changelog for v1.21.0
### New features & improvements
- Add missing ICD Code list. See also https://docs.peppol.eu/poacc/billing/3.0/codelist/ICD/
- Make <cac:ClassifiedTaxCategory> <cbc:Percent> optional - Thanks [@chipco](https://github.com/chipco)
- Add <cac:AccountingContact> to <Invoice> - Thanks [@tgeorgel](https://github.com/tgeorgel)
- Add <cbc:ID> to <cac:Contact> - Thanks [@tgeorgel](https://github.com/tgeorgel)
- Allow both <cbc:DocumentTypeCode> and <cbc:DocumentType> to be present in <cac:AdditionalDocumentReference> - Thanks [@tgeorgel](https://github.com/tgeorgel)
# Changelog for v1.20.0
### New features & improvements
- General change: don't round numbers to two decimals, always use the amount of provided decimals
# Changelog for v1.19.1
### New features & improvements
- Add `<cbc:PayableRoundingAmount />` to `<cac:LegalMonetaryTotal>` - Thanks [@ronaldsgailis](https://github.com/ronaldsgailis)
# Changelog for v1.19.0
### New features & improvements
- Add `<cac:CommodityClassification />` to `<cac:Item>`
-
# Changelog for v1.18.2
### New features & improvements
- Add `<cac:ProjectReference />` to `<Invoice>`
#### Bug fixes
- Fix Amount, BaseAmount, TaxCategory tag sort in `<cac:AllowanceCharge />`
- Fix parameter type for `<cac:AllowanceCharge>` on `<cac:InvoiceLine>` to array
# Changelog for v1.18.1
#### Bug fixes
- Fix Creditnote `<cac:BillingReference>` validation issues, this tag should be optional
# Changelog for 1.18.0
### New features & improvements
- Support for `<cav:Item>` `<cac:StandardItemIdentification>` --> `cbc:IDPeppol` Scheme identifier - Thanks [@dragonfly4](https://github.com/dragonfly4)
- Support to add `<cac:Attachment>` content without having to use an external file ref but by adding it as a fileStream/fileContents - Thanks [@dietercoopman](https://github.com/dietercoopman), [@bagulho](https://github.com/bagulho)
- Add `<cbc:CompanyLegalForm>` to `<cac:PartyLegalEntity>` - Thanks [@vsadrn](https://github.com/vsadrn)
- Improved `UNCL4461` support for `<cac:PaymentMeans>` - Thanks [@TSimkus](https://github.com/TSimkus), [@TecsiAron](https://github.com/TecsiAron)
- Add `<cac:OrderLineReference>` support for `<cac:InvoiceLine>` - Thanks [@TSimkus](https://github.com/TSimkus)
- Add `<cac:AllowanceCharge>` to `<cac:InvoiceLine>` - Thanks [@TSimkus](https://github.com/TSimkus)
- Add support for `<cac:BillingReference>` in Creditnotes - Thanks [@UlusoftConsultancy](https://github.com/UlusoftConsultancy)
- Add `<cbc:ChargeTotalAmount>` to `<cac:LegalMonetaryTotal>` - Thanks [@Quazz](https://github.com/Quazz)
- Add support for TaxExemptionReason and TaxExemptionReasonCode to `<cac:ClassifiedTaxCategory>` - Thanks [@bagulho](https://github.com/bagulho)
### Breaking changes
- Add support to include multiple `PaymentMeans` - Thanks [@Quazz](https://github.com/Quazz)
#### Bug fixes
- Fix `InvoiceTypeCode` documentation dead link - Thanks [@TSimkus](https://github.com/TSimkus)
- Changed `<cbc:MultiplierFactorNumeric />` type from `int` to `float` - Thanks [@TSimkus](https://github.com/TSimkus)
# Changelog for version 1.17.0
### New features & improvements
- Add list of `VatExemptionCode` options
# Changelog for version 1.16.0
### New features & improvements
- Add `<cac:StandardItemIdentification>` to `<cac:Item>`
- Add `<cac:PayeeParty>` to `<Invoice>`
# Changelog for version 1.15.5
### New features & improvements
- Don't output an InvoiceLine `<cac:TaxScheme />` when no `<cac:Price />` was set
- Don't output `<cac:Item>` under InvoiceLine unless explicitely set
# Changelog for version v1.15.4
### New features & improvements
- Added UNCL5305 codes to be used in various implementations
- Improved default result for UNCL5305 code in `TaxCategory->getId()` if `TaxCategory->setId()` was not used
# Changelog for version v1.15.3
### New features & improvements
- Added more EAS codes to be used in various implementations
# Changelog for version v1.15.2
### New features & improvements
- Added `EASCode` list with additional EAS codes to be used in various implementations
# Changelog for version v1.15.1
### New features & improvements
- Add `PrepaidAmount` to `LegalMonetaryTotal`
- Add `IssueDate` to `OrderReference`
- Add `ICDCode` list to be used in various other places
- Fixed LegalMonetaryTotal which contained a syntax error
# Changelog for version v1.15
### New features & improvements
- Added the possibility to use `AdditionalDocumentReference` without `Attachment` - Thanks [@pjcarly](https://github.com/pjcarly)
- Added `DocumentTypeCode` on `AdditionalDocumentReference`
- Added setter/getter `InvoicePeriod` `DescriptionCode` (VAT date code UNCL2005 subset) - Thanks [@markovic131](https://github.com/markovic131)
- Added `PartyIdentificationSchemeName` to `Party` - Thanks [@tgeorgel](https://github.com/tgeorgel)
- Added deprecation warning for setAdditionalDocumentReference
- Fixed `ContractDocumentReference` XML position - Thanks [@markovic131](https://github.com/markovic131)
- Fixed `Name` position in `TaxScheme` - Thanks [@tgeorgel](https://github.com/tgeorgel)
- Fixed `InvoicePeriod`, `OrderReference`, `ContractDocumentReference` sorting
- Fixed DocumentType which is not a CommonAggregateComponent - Thanks [@christopheg](https://github.com/christopheg)
# Changelog for version 1.14
### New features & improvements
- Add support for the `CreditNote` root tag and `CreditNoteLine` tags - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Added `DocumentDescription` in `AdditionalDocumentReference` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Added `ExternalReference` (`URI`) as an alternative for an `EmbeddedDocumentBinaryObject` in `Attachment` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Fixed the appearing order of `Name` and `Percent` in `ClassifiedTaxCategory` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Added `ProfileID` to `Invoice` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Added support for multiple `AdditionalDocumentReference` children to `Invoice` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Made `Description` optional in `Item` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Added `EndpointID` to `Party` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Made `PartyName` optional in `Party` - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
- Added PHP 8 support in `composer.json` - Thanks [@antal-levente](https://github.com/antal-levente)
- Added `Address->CountrySubentity()` - Thanks [@antal-levente](https://github.com/antal-levente)
- Fixed `xmlSerialize()` compatibility warnings - Thanks [@antal-levente](https://github.com/antal-levente)
- Fixed number_format null values warning - Thanks [@antal-levente](https://github.com/antal-levente)
- Add support for `cac:PartyIdentification` `schemeId` attribute
- Add support for `cac:AllowanceCharge` in `Price` tag
### Breaking changes
- Changed `InvoiceLine`'s default `UnitCode` from `'MON'` to `UnitCode::UNIT` (in order to match `Price`'s default UnitCode) - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
### Breaking changes
- Changed `InvoiceLine`'s default `UnitCode` from `'MON'` to `UnitCode::UNIT` (in order to match `Price`'s default UnitCode) - Thanks [@JorisDebonnet](https://github.com/JorisDebonnet)
# Changelog for version 1.13
### New features & improvements
- Add `<cac:AccountingCost>` child node for `<cac:InvoiceLine>`
# Changelog for version 1.12
### New features & improvements
- PHP8 Support — Thanks [@ChristianVermeulen](https://github.com/ChristianVermeulen)
# Changelog for version 1.11
### New features & improvements
- Added new ContractDocumentReference class & tag `<cac:ContractDocumentReference />` to Invoice — Thanks [@mabjavaid](https://github.com/mabjavaid)
- Remove duplicate validation for `id` on invoice — Thanks [@mabjavaid](https://github.com/mabjavaid)
- Added new cac:PartyIdentification tag to cac:Party
# Changelog for version 1.10.2
### New features & improvements
- Added AdditionalStreetName in Address.php — Thanks [@jbputit](https://github.com/jbputit)
# Changelog for version 1.10.1
### New features & improvements
- Added year, month and piece as additional units in UnitCode.php — Thanks [@jbputit](https://github.com/jbputit)
- Added possibility to set InvoicePeriod in InvoiceLine — Thanks [@jbputit](https://github.com/jbputit)
# Changelog for version 1.10
### New features & improvements
- Added new OrderReferen class & tag `<cac:OrderReference>` to Invoice — Thanks [@jbputit](https://github.com/jbputit)
# Changelog for version 1.9.6
### New features & improvements
- Support for `<cbc:SupplierAssignedAccountID>` in `<cac:AccountingCustomerParty>` Thanks [@eborned](https://github.com/eborned)
# Changelog for version 1.9.5
### New features & improvements
- Add `<cac:BuyersItemIdentification>` child node for `<cac:Item>` Thanks [@eborned](https://github.com/eborned)
# Changelog for version 1.9.4
### New features & improvements
- Bugfix: Fix order of `<cbc:DueDate>` node in `<Invoice>`
# Changelog for version 1.9.3
### New features & improvements
- Bugfix: Use correct number formatting when `<cbc:InvoicedQuantity>` in `<cac:InvoiceLine>` contains a float value
- Bugfix: Use correct number formatting when `<cbc:BaseQuantity>` in `<cac:Price>` contains a float value
- Bugfix: Use correct number formatting when `<cbc:PriceAmount>` in `<cac:Price>` contains a float value
# Changelog for version 1.9.2
### New features & improvements
- Add `<cbc:InstructionNote>` to `<cac:PaymentMeans>` for non structured payment instructions
# Changelog for version 1.9.1
### New features & improvements
- Bugfix in `<cac:Party>`, set correct order for child nodes `<cac:PartyLegalEntity>` & `<cac:Contact>` Thanks [@stedekay](https://github.com/stedekay)
# Changelog for version 1.9
### New features & improvements
- Added return type declarations in every class
- Added `PartyTaxScheme`
- Added `Party->setPartyTaxScheme()`
### Breaking changes
- `Party->setTaxCompanyName(string)` has been removed since `PartyTaxScheme` has been added
- `Party->setTaxCompanyId(string)` has been removed since `PartyTaxScheme` has been added
- `Party->setTaxScheme(string)` has been removed since `PartyTaxScheme` has been added

View file

@ -1,60 +0,0 @@
# Contributing to ubl-invoice
Are you missing a feature and would you like to add it to the library? Great! Any contributions to this library are welcome. We try to be responsive and release new, non-breaking features as fast as possible.
## Reporting issues
This package uses the [GitHub issue tracker](https://github.com/num-num/ubl-invoice/issues) to track bugs and features. Before submitting a bug report or feature request, check to make sure it hasn't already been submitted.
## Contributing code
If you want to add additional tags, attributes or functionality to the library, please feel free to create a [pull request](https://github.com/num-num/ubl-invoice/pulls) with your changes.
Please try to follow this workflow:
- Fork the project
- Create a new branch forked from the master branch with a title for your feature (e.g. feature-that-i-want)
- Commit all your code into this branch until you are happy with your contribution
- Document your changes in the **changelog/next-release.md** file ⚠️
- If possible; try to add unit tests for your contribution
- Create a pull request with your commits
## Formatting ⚠️
Please try to follow [PSR-12](https://www.php-fig.org/psr/psr-12/) rules when writing code. A PSR-12 compliant [phpcs.xml](phpcs.xml) is provided, so if your editor supports [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), your editor should automatically warn you if you are deviating from PSR-12 compliant formatting.
You can also check code style manually by running `composer phpcs` in the projects' root folder on your disk.
```zsh
$ cd ubl-invoice
$ composer phpcs
```
The project also has PHPStan integrated for code checking, which can be triggered with:
```zsh
$ cd ubl-invoice
$ composer phpstan
```
## Unit testing ⚠️
### A note on unit testing
Although unit testing is included, this repository does not provide exhaustive unit testing for *all* possibilities the library offers. This is definitely a long-term goal. So please try to add unit tests for new functionality that you add.
### Running the unit tests
To run the complete suite of unit tests
```zsh
$ cd ubl-invoice
$ composer test
```
To run a single unit test
```zsh
$ cd ubl-invoice
$ composer test tests/SimpleInvoiceTest.php
```

View file

@ -1,24 +0,0 @@
The MIT License
Copyright (c) 2018 Num•Num
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,31 +0,0 @@
# UBL-Invoice
A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files. Please feel free to [contribute](https://github.com/num-num/ubl-invoice/pulls) if you are missing features or tags.
[![Latest Version on Packagist](https://img.shields.io/packagist/v/num-num/ubl-invoice.svg?style=rounded-square)](https://packagist.org/packages/num-num/ubl-invoice)
[![Total Downloads](https://img.shields.io/packagist/dt/num-num/ubl-invoice.svg?style=rounded-square)](https://packagist.org/packages/num-num/ubl-invoice)
![Num•Num UBL Invoice](https://i.imgur.com/JPyFBYQ.png)
## Installation and usage
This package requires PHP 7.4 or higher and is fully compatible with PHP8. Installation can be done through [composer](https://www.getcomposer.org).
```zsh
$ composer require num-num/ubl-invoice
```
## Contributing
This library is not 100% UBL/Peppol feature-complete, in the sense that it doesn't (yet) support **all** UBL XML tags & functionality. "Yet" being the keyword, since this definitely is the long-term goal. All common UBL tags that are required for most invoices are present in the library. This includes tags for discounts, cash discounts, special vat rates, etc...
If you are missing functionality, please feel free to add it :-) Adding additional tags & attributes is fairly straight-forward. Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
## Examples & documentation
This repository does not have a documentation website at this moment. For now, please check out some code examples by checking the unit tests in the `tests` folder.
## Changelog
A changelog is available since version v1.9.0. If you are upgrading a minor version (1.x) or major version, please check the changelog to see if you need to implement any breaking changes...

View file

@ -1,56 +0,0 @@
{
"name": "num-num/ubl-invoice",
"description": "A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files",
"keywords": [
"ubl",
"invoice",
"ublinvoice",
"ubl invoice",
"efff",
"electronic invoice",
"digital invoice",
"xml",
"xml invoice",
"peppol",
"peppol bis",
"peppolbis",
"peppol invoice",
"e-invoice",
"einvoice",
"euinvoice"
],
"homepage": "https://github.com/num-num/ubl-invoice",
"license": "MIT",
"authors": [
{
"name": "Bert Devriese",
"email": "bert@numnum.be",
"homepage": "https://www.numnum.be",
"role": "Developer"
}
],
"require": {
"php": "^7.3 || ^8.0",
"sabre/xml": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "^3.7",
"phpstan/phpstan": "^1.10"
},
"autoload": {
"psr-4": {
"NumNum\\UBL\\": [
"src"
],
"NumNum\\UBL\\Tests\\": [
"tests"
]
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"phpstan": "vendor/bin/phpstan analyse src tests",
"phpcs": "vendor/bin/phpcs -n --standard=phpcs.xml ./src/"
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,350 +0,0 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PSR12" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
<description>The PSR-12 coding standard.</description>
<arg name="tab-width" value="4"/>
<!-- 2. General -->
<!-- 2.1 Basic Coding Standard -->
<!-- Code MUST follow all rules outlined in PSR-1. -->
<rule ref="PSR1"/>
<!-- The term 'StudlyCaps' in PSR-1 MUST be interpreted as PascalCase where the first letter of each word is capitalized including the very first letter. -->
<!-- 2.2 Files -->
<!-- All PHP files MUST use the Unix LF (linefeed) line ending only. -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!-- All PHP files MUST end with a non-blank line, terminated with a single LF. -->
<rule ref="PSR2.Files.EndFileNewline"/>
<!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
<rule ref="PSR2.Files.ClosingTag"/>
<!-- 2.3 Lines -->
<!-- There MUST NOT be a hard limit on line length.
The soft limit on line length MUST be 120 characters.
Lines SHOULD NOT be longer than 80 characters; lines longer than that SHOULD be split into multiple subsequent lines of no more than 80 characters each. -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<!-- There MUST NOT be trailing whitespace at the end of lines.
Blank lines MAY be added to improve readability and to indicate related blocks of code except where explicitly forbidden. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
<severity>0</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<severity>0</severity>
</rule>
<!-- There MUST NOT be more than one statement per line. -->
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<!-- 2.4 Indenting -->
<!-- Code MUST use an indent of 4 spaces for each indent level, and MUST NOT use tabs for indenting. -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="ignoreIndentationTokens" type="array">
<element value="T_COMMENT"/>
<element value="T_DOC_COMMENT_OPEN_TAG"/>
</property>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- 2.5 Keywords and Types -->
<!-- All PHP reserved keywords and types [1][2] MUST be in lower case.
Any new types and keywords added to future PHP versions MUST be in lower case. -->
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.PHP.LowerCaseType"/>
<!-- Short form of type keywords MUST be used i.e. bool instead of boolean, int instead of integer etc. -->
<!-- checked by PSR12.Keywords.ShortFormTypeKeywords -->
<!-- 3. Declare Statements, Namespace, and Import Statements -->
<!-- The header of a PHP file may consist of a number of different blocks. If present, each of the blocks below MUST be separated by a single blank line, and MUST NOT contain a blank line. Each block MUST be in the order listed below, although blocks that are not relevant may be omitted.
Opening php tag.
File-level docblock.
One or more declare statements.
The namespace declaration of the file.
One or more class-based use import statements.
One or more function-based use import statements.
One or more constant-based use import statements.
The remainder of the code in the file. -->
<!-- checked by PSR12.Files.FileHeader -->
<!-- When a file contains a mix of HTML and PHP, any of the above sections may still be used. If so, they MUST be present at the top of the file, even if the remainder of the code consists of a closing PHP tag and then a mixture of HTML and PHP. -->
<!-- When the opening php tag is on the first line of the file, it MUST be on its own line with no other statements unless it is a file containing markup outside of PHP opening and closing tags. -->
<!-- Import statements MUST never begin with a leading backslash as they must always be fully qualified. -->
<!-- checked by PSR12.Files.ImportStatement -->
<!-- Compound namespaces with a depth of more than two MUST NOT be used. -->
<!-- checked by PSR12.Namespaces.CompoundNamespaceDepth -->
<!-- When wishing to declare strict types in files containing markup outside PHP opening and closing tags, the declaration MUST be on the first line of the file and include an opening PHP tag, the strict types declaration and closing tag. -->
<!-- Declare statements MUST contain no spaces and MUST be exactly declare(strict_types=1) (with an optional semi-colon terminator). -->
<!-- Block declare statements are allowed and MUST be formatted as below. -->
<!-- checked by PSR12.Files.DeclareStatement -->
<!-- 4. Classes, Properties, and Methods -->
<!-- Any closing brace MUST NOT be followed by any comment or statement on the same line. -->
<!-- checked by PSR12.Classes.ClosingBrace -->
<!-- When instantiating a new class, parentheses MUST always be present even when there are no arguments passed to the constructor. -->
<!-- checked by PSR12.Classes.ClassInstantiation -->
<!-- 4.1 Extends and Implements -->
<!-- The extends and implements keywords MUST be declared on the same line as the class name. -->
<!-- The opening brace for the class MUST go on its own line; the closing brace for the class MUST go on the next line after the body. -->
<!-- Opening braces MUST be on their own line and MUST NOT be preceded or followed by a blank line. -->
<!-- Closing braces MUST be on their own line and MUST NOT be preceded by a blank line. -->
<!-- Lists of implements and, in the case of interfaces, extends MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one interface per line. -->
<rule ref="PSR2.Classes.ClassDeclaration"/>
<!-- 4.2 Using traits -->
<!-- The use keyword used inside the classes to implement traits MUST be declared on the next line after the opening brace. -->
<!-- Each individual trait that is imported into a class MUST be included one-per-line and each inclusion MUST have its own use import statement. -->
<!-- When the class has nothing after the use import statement, the class closing brace MUST be on the next line after the use import statement. Otherwise, it MUST have a blank line after the use import statement. -->
<!-- When using the insteadof and as operators they must be used as follows taking note of indentation, spacing, and new lines. -->
<!-- checked by PSR12.Traits.UseDeclaration -->
<!-- 4.3 Properties and Constants -->
<!-- Visibility MUST be declared on all properties. -->
<!-- The var keyword MUST NOT be used to declare a property. -->
<!-- There MUST NOT be more than one property declared per statement. -->
<!-- Property names MUST NOT be prefixed with a single underscore to indicate protected or private visibility.
That is, an underscore prefix explicitly has no meaning. -->
<!-- There MUST be a space between type declaration and property name. -->
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<!-- Visibility MUST be declared on all constants if your project PHP minimum version supports constant visibilities (PHP 7.1 or later). -->
<!-- checked by PSR12.Properties.ConstantVisibility -->
<!-- 4.4 Methods and Functions -->
<!-- Visibility MUST be declared on all methods. -->
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
<!-- Method names MUST NOT be prefixed with a single underscore to indicate protected or private visibility. That is, an underscore prefix explicitly has no meaning. -->
<rule ref="PSR2.Methods.MethodDeclaration"/>
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
<type>error</type>
<message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
</rule>
<!-- Method and function names MUST NOT be declared with space after the method name. The opening brace MUST go on its own line, and the closing brace MUST go on the next line following the body. There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. -->
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
<rule ref="Squiz.Functions.FunctionDeclaration"/>
<rule ref="Squiz.Functions.LowercaseFunctionKeywords"/>
<!-- 4.5 Method and Function Arguments -->
<!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
<!-- When using the reference operator & before an argument, there MUST NOT be a space after it. -->
<!-- There MUST NOT be a space between the variadic three dot operator and the argument name. -->
<!-- When combining both the reference operator and the variadic three dot operator, there MUST NOT be any space between the two of them. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<!-- Method and function arguments with default values MUST go at the end of the argument list. -->
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line.
When the argument list is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
<!-- When you have a return type declaration present, there MUST be one space after the colon followed by the type declaration. The colon and declaration MUST be on the same line as the argument list closing parenthesis with no spaces between the two characters. -->
<!-- checked by PSR12.Functions.ReturnTypeDeclaration -->
<!-- In nullable type declarations, there MUST NOT be a space between the question mark and the type. -->
<!-- checked by PSR12.Functions.NullableTypeDeclaration -->
<!-- 4.6 abstract, final, and static -->
<!-- When present, the abstract and final declarations MUST precede the visibility declaration. -->
<!-- When present, the static declaration MUST come after the visibility declaration. -->
<!-- checked by PSR2.Methods.MethodDeclaration included above -->
<!-- 4.7 Method and Function Calls -->
<!-- When making a method or function call, there MUST NOT be a space between the method or function name and the opening parenthesis, there MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
<!-- Argument lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument per line. A single argument being split across multiple lines (as might be the case with an anonymous function or array) does not constitute splitting the argument list itself. -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<rule ref="PSR2.Methods.FunctionCallSignature"/>
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket">
<severity>0</severity>
</rule>
<rule ref="PSR2.Methods.FunctionCallSignature.OpeningIndent">
<severity>0</severity>
</rule>
<!-- 5. Control Structures -->
<!-- The general style rules for control structures are as follows:
There MUST be one space after the control structure keyword
There MUST NOT be a space after the opening parenthesis
There MUST NOT be a space before the closing parenthesis
There MUST be one space between the closing parenthesis and the opening brace
The structure body MUST be indented once
The body MUST be on the next line after the opening brace
The closing brace MUST be on the next line after the body
The body of each structure MUST be enclosed by braces. This standardizes how the structures look and reduces the likelihood of introducing errors as new lines get added to the body. -->
<rule ref="Squiz.ControlStructures.ControlSignature"/>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen"/>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose"/>
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace"/>
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<!-- exclude this message as it is already checked in Generic.PHP.LowerCaseKeyword -->
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
<severity>0</severity>
</rule>
<!-- 5.1 if, elseif, else -->
<!-- else and elseif are on the same line as the closing brace from the earlier body. -->
<!-- checked by Squiz.ControlStructures.ControlSignature included above -->
<!-- The keyword elseif SHOULD be used instead of else if so that all control keywords look like single words. -->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
<!-- checked by Squiz.ControlStructures.ControlSignature -->
<!-- 5.2 switch, case -->
<!-- The case statement MUST be indented once from switch, and the break keyword (or other terminating keywords) MUST be indented at the same level as the case body. There MUST be a comment such as // no break when fall-through is intentional in a non-empty case body. -->
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
<!-- checked by Squiz.ControlStructures.ControlSignature -->
<!-- 5.3.1 while -->
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
<!-- checked by Squiz.ControlStructures.ControlSignature -->
<!-- 5.3.2 do while -->
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first condition MUST be on the next line. Boolean operators between conditions MUST always be at the beginning or at the end of the line, not a mix of both. -->
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
<!-- checked by Squiz.ControlStructures.ControlSignature -->
<!-- 5.4 for -->
<!-- Expressions in parentheses MAY be split across multiple lines, where each subsequent line is indented at least once. When doing so, the first expression MUST be on the next line. The closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
<!-- checked by PSR12.ControlStructures.ControlStructureSpacing -->
<!-- checked by PSR12.ControlStructures.BooleanOperatorPlacement -->
<!-- checked by Squiz.ControlStructures.ControlSignature -->
<!-- 5.5 foreach -->
<!-- exclude these messages as they are already checked by PSR2.ControlStructures.ControlStructureSpacing -->
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
<severity>0</severity>
</rule>
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
<severity>0</severity>
</rule>
<!-- 5.6 try, catch, finally -->
<!-- 6. Operators -->
<!-- When space is permitted around an operator, multiple spaces MAY be used for readability purposes. -->
<!-- All operators not described here are left undefined. -->
<!-- 6.1. Unary operators -->
<!-- The increment/decrement operators MUST NOT have any space between the operator and operand. -->
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
<!-- Type casting operators MUST NOT have any space within the parentheses. -->
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
<!-- 6.2. Binary operators -->
<!-- All binary arithmetic, comparison, assignment, bitwise, logical, string, and type operators MUST be preceded and followed by at least one space. -->
<!-- checked by PSR12.Operators.OperatorSpacing -->
<!-- 6.3. Ternary operators -->
<!-- The conditional operator, also known simply as the ternary operator, MUST be preceded and followed by at least one space around both the ? and : characters. -->
<!-- When the middle operand of the conditional operator is omitted, the operator MUST follow the same style rules as other binary comparison operators. -->
<!-- checked by PSR12.Operators.OperatorSpacing -->
<!-- 7. Closures -->
<!-- Closures MUST be declared with a space after the function keyword, and a space before and after the use keyword. -->
<!-- The opening brace MUST go on the same line, and the closing brace MUST go on the next line following the body. -->
<!-- There MUST NOT be a space after the opening parenthesis of the argument list or variable list, and there MUST NOT be a space before the closing parenthesis of the argument list or variable list. -->
<!-- In the argument list and variable list, there MUST NOT be a space before each comma, and there MUST be one space after each comma. -->
<!-- Closure arguments with default values MUST go at the end of the argument list. -->
<!-- Argument lists and variable lists MAY be split across multiple lines, where each subsequent line is indented once. When doing so, the first item in the list MUST be on the next line, and there MUST be only one argument or variable per line. -->
<!-- When the ending list (whether of arguments or variables) is split across multiple lines, the closing parenthesis and opening brace MUST be placed together on their own line with one space between them. -->
<!-- checked by Squiz.Functions.MultiLineFunctionDeclaration -->
<!-- If a return type is present, it MUST follow the same rules as with normal functions and methods; if the use keyword is present, the colon MUST follow the use list closing parentheses with no spaces between the two characters. -->
<!-- checked by PSR12.Functions.ReturnTypeDeclaration -->
<!-- 8. Anonymous Classes -->
<!-- Anonymous Classes MUST follow the same guidelines and principles as closures in the above section. -->
<!-- The opening brace MAY be on the same line as the class keyword so long as the list of implements interfaces does not wrap. If the list of interfaces wraps, the brace MUST be placed on the line immediately following the last interface. -->
<!-- checked by PSR12.Classes.AnonClassDeclaration -->
</ruleset>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="NumNum UBL-invoice Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

View file

@ -1,140 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class AdditionalDocumentReference implements XmlSerializable
{
private $id;
private $documentType;
private $documentTypeCode;
private $documentDescription;
private $attachment;
/**
* @return string
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string $id
* @return AdditionalDocumentReference
*/
public function setId(string $id): AdditionalDocumentReference
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getDocumentType(): ?string
{
return $this->documentType;
}
/**
* @param string $documentType
* @return AdditionalDocumentReference
*/
public function setDocumentType(string $documentType): AdditionalDocumentReference
{
$this->documentType = $documentType;
return $this;
}
/**
* @return int|string|null
*/
public function getDocumentTypeCode()
{
return $this->documentTypeCode;
}
/**
* @param int|string $documentTypeCode
* @return AdditionalDocumentReference
*/
public function setDocumentTypeCode($documentTypeCode): AdditionalDocumentReference
{
$this->documentTypeCode = $documentTypeCode;
return $this;
}
/**
* @return string
*/
public function getDocumentDescription(): ?string
{
return $this->documentDescription;
}
/**
* @param string $documentDescription
* @return AdditionalDocumentReference
*/
public function setDocumentDescription(string $documentDescription): AdditionalDocumentReference
{
$this->documentDescription = $documentDescription;
return $this;
}
/**
* @return Attachment
*/
public function getAttachment(): ?Attachment
{
return $this->attachment;
}
/**
* @param Attachment $attachment
* @return AdditionalDocumentReference
*/
public function setAttachment(Attachment $attachment): AdditionalDocumentReference
{
$this->attachment = $attachment;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$writer->write([ Schema::CBC . 'ID' => $this->id ]);
if ($this->documentTypeCode !== null) {
$writer->write([
Schema::CBC . 'DocumentTypeCode' => $this->documentTypeCode
]);
}
if ($this->documentType !== null) {
$writer->write([
Schema::CBC . 'DocumentType' => $this->documentType
]);
}
if ($this->documentDescription !== null) {
$writer->write([
Schema::CBC . 'DocumentDescription' => $this->documentDescription
]);
}
if ($this->attachment !== null) {
$writer->write([
Schema::CAC . 'Attachment' => $this->attachment
]);
}
}
}

View file

@ -1,189 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class Address implements XmlSerializable
{
private $streetName;
private $additionalStreetName;
private $buildingNumber;
private $cityName;
private $postalZone;
private $countrySubentity;
private $country;
/**
* @return string
*/
public function getStreetName(): ?string
{
return $this->streetName;
}
/**
* @param string $streetName
* @return Address
*/
public function setStreetName(?string $streetName): Address
{
$this->streetName = $streetName;
return $this;
}
/**
* @return string
*/
public function getAdditionalStreetName(): ?string
{
return $this->additionalStreetName;
}
/**
* @param string $additionalStreetName
* @return Address
*/
public function setAdditionalStreetName(?string $additionalStreetName): Address
{
$this->additionalStreetName = $additionalStreetName;
return $this;
}
/**
/**
* @return string
*/
public function getBuildingNumber(): ?string
{
return $this->buildingNumber;
}
/**
* @param string $buildingNumber
* @return Address
*/
public function setBuildingNumber(?string $buildingNumber): Address
{
$this->buildingNumber = $buildingNumber;
return $this;
}
/**
* @return string
*/
public function getCityName(): ?string
{
return $this->cityName;
}
/**
* @param string $cityName
* @return Address
*/
public function setCityName(?string $cityName): Address
{
$this->cityName = $cityName;
return $this;
}
/**
* @return string
*/
public function getPostalZone(): ?string
{
return $this->postalZone;
}
/**
* @param string $postalZone
* @return Address
*/
public function setPostalZone(?string $postalZone): Address
{
$this->postalZone = $postalZone;
return $this;
}
/**
* @return string
*/
public function getCountrySubentity(): ?string
{
return $this->countrySubentity;
}
/**
* @param string $subentity
* @return Address
*/
public function setCountrySubentity(string $countrySubentity): Address
{
$this->countrySubentity = $countrySubentity;
return $this;
}
/**
* @return Country
*/
public function getCountry(): ?Country
{
return $this->country;
}
/**
* @param Country $country
* @return Address
*/
public function setCountry(Country $country): Address
{
$this->country = $country;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->streetName !== null) {
$writer->write([
Schema::CBC . 'StreetName' => $this->streetName
]);
}
if ($this->additionalStreetName !== null) {
$writer->write([
Schema::CBC . 'AdditionalStreetName' => $this->additionalStreetName
]);
}
if ($this->buildingNumber !== null) {
$writer->write([
Schema::CBC . 'BuildingNumber' => $this->buildingNumber
]);
}
if ($this->cityName !== null) {
$writer->write([
Schema::CBC . 'CityName' => $this->cityName,
]);
}
if ($this->postalZone !== null) {
$writer->write([
Schema::CBC . 'PostalZone' => $this->postalZone,
]);
}
if ($this->countrySubentity !== null) {
$writer->write([
Schema::CBC . 'CountrySubentity' => $this->countrySubentity,
]);
}
if ($this->country !== null) {
$writer->write([
Schema::CAC . 'Country' => $this->country,
]);
}
}
}

View file

@ -1,227 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class AllowanceCharge implements XmlSerializable
{
private $chargeIndicator;
private $allowanceChargeReasonCode;
private $allowanceChargeReason;
private $multiplierFactorNumeric;
private $baseAmount;
private $amount;
private $taxTotal;
private $taxCategory;
/**
* @return bool
*/
public function isChargeIndicator(): bool
{
return $this->chargeIndicator;
}
/**
* @param bool $chargeIndicator
* @return AllowanceCharge
*/
public function setChargeIndicator(bool $chargeIndicator): AllowanceCharge
{
$this->chargeIndicator = $chargeIndicator;
return $this;
}
/**
* @return int
*/
public function getAllowanceChargeReasonCode(): ?int
{
return $this->allowanceChargeReasonCode;
}
/**
* @param int $allowanceChargeReasonCode
* @return AllowanceCharge
*/
public function setAllowanceChargeReasonCode(?int $allowanceChargeReasonCode): AllowanceCharge
{
$this->allowanceChargeReasonCode = $allowanceChargeReasonCode;
return $this;
}
/**
* @return string
*/
public function getAllowanceChargeReason(): ?string
{
return $this->allowanceChargeReason;
}
/**
* @param string $allowanceChargeReason
* @return AllowanceCharge
*/
public function setAllowanceChargeReason(?string $allowanceChargeReason): AllowanceCharge
{
$this->allowanceChargeReason = $allowanceChargeReason;
return $this;
}
/**
* @return float
*/
public function getMultiplierFactorNumeric(): ?float
{
return $this->multiplierFactorNumeric;
}
/**
* @param float $multiplierFactorNumeric
* @return AllowanceCharge
*/
public function setMultiplierFactorNumeric(?float $multiplierFactorNumeric): AllowanceCharge
{
$this->multiplierFactorNumeric = $multiplierFactorNumeric;
return $this;
}
/**
* @return float
*/
public function getBaseAmount(): ?float
{
return $this->baseAmount;
}
/**
* @param float $baseAmount
* @return AllowanceCharge
*/
public function setBaseAmount(?float $baseAmount): AllowanceCharge
{
$this->baseAmount = $baseAmount;
return $this;
}
/**
* @return float
*/
public function getAmount(): ?float
{
return $this->amount;
}
/**
* @param float $amount
* @return AllowanceCharge
*/
public function setAmount(?float $amount): AllowanceCharge
{
$this->amount = $amount;
return $this;
}
/**
* @return TaxCategory
*/
public function getTaxCategory(): ?TaxCategory
{
return $this->taxCategory;
}
/**
* @param TaxCategory $taxCategory
* @return AllowanceCharge
*/
public function setTaxCategory(?TaxCategory $taxCategory): AllowanceCharge
{
$this->taxCategory = $taxCategory;
return $this;
}
/**
* @return TaxCategory
*/
public function getTaxtotal(): ?TaxTotal
{
return $this->taxTotal;
}
/**
* @param TaxTotal $taxTotal
* @return AllowanceCharge
*/
public function setTaxtotal(?TaxTotal $taxTotal): AllowanceCharge
{
$this->taxTotal = $taxTotal;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$writer->write([
Schema::CBC . 'ChargeIndicator' => $this->chargeIndicator ? 'true' : 'false',
]);
if ($this->allowanceChargeReasonCode !== null) {
$writer->write([
Schema::CBC . 'AllowanceChargeReasonCode' => $this->allowanceChargeReasonCode
]);
}
if ($this->allowanceChargeReason !== null) {
$writer->write([
Schema::CBC . 'AllowanceChargeReason' => $this->allowanceChargeReason
]);
}
if ($this->multiplierFactorNumeric !== null) {
$writer->write([
Schema::CBC . 'MultiplierFactorNumeric' => NumberFormatter::format($this->baseAmount)
]);
}
$writer->write([
[
'name' => Schema::CBC . 'Amount',
'value' => NumberFormatter::format($this->amount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
]);
if ($this->baseAmount !== null) {
$writer->write([
[
'name' => Schema::CBC . 'BaseAmount',
'value' => NumberFormatter::format($this->baseAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
]
]);
}
if ($this->taxCategory !== null) {
$writer->write([
Schema::CAC . 'TaxCategory' => $this->taxCategory
]);
}
if ($this->taxTotal !== null) {
$writer->write([
Schema::CAC . 'TaxTotal' => $this->taxTotal
]);
}
}
}

View file

@ -1,180 +0,0 @@
<?php
namespace NumNum\UBL;
use Exception;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use InvalidArgumentException;
class Attachment implements XmlSerializable
{
private $filePath;
private $externalReference;
private $fileStream;
private $fileName;
private $mimeType;
/**
* @throws Exception exception when the mime type cannot be determined
* @return string
*/
public function getFilePathMimeType(): string
{
if (($mime_type = mime_content_type($this->filePath)) !== false) {
return $mime_type;
}
throw new Exception('Could not determine mime_type of '.$this->filePath);
}
/**
* @return string
*/
public function getFilePath(): ?string
{
return $this->filePath;
}
/**
* @param string $filePath
* @return Attachment
*/
public function setFilePath(string $filePath): Attachment
{
$this->filePath = $filePath;
return $this;
}
/**
* @return string
*/
public function getExternalReference(): ?string
{
return $this->externalReference;
}
/**
* @param string $externalReference
* @return Attachment
*/
public function setExternalReference(string $externalReference): Attachment
{
$this->externalReference = $externalReference;
return $this;
}
public function getFileStream(): ?string
{
return $this->fileStream;
}
/**
* @param string $fileStream Base64 encoded filestream
* @param string $fileName
* @return Attachment
*/
public function setFileStream(string $fileStream, string $fileName, ?string $mimeType): Attachment
{
$this->fileStream = $fileStream;
$this->fileName = $fileName;
$this->mimeType = $mimeType;
return $this;
}
/**
* @return string
*/
public function getFileName(): string
{
return $this->fileName;
}
/**
* @param string $fileName
* @return Attachment
*/
public function setFileName(string $fileName): Attachment
{
$this->fileName = $fileName;
return $this;
}
/**
* @return ?string
*/
public function getMimeType(): ?string
{
return $this->mimeType;
}
/**
* @param ?string $mimeType
* @return Attachment
*/
public function setMimeType(?string $mimeType): Attachment
{
$this->mimeType = $mimeType;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->filePath === null && $this->externalReference === null && $this->fileStream === null) {
throw new InvalidArgumentException('Attachment must have a filePath, an externalReference, or a fileContent');
}
if ($this->fileStream !== null && $this->mimeType === null) {
throw new InvalidArgumentException('Using fileStream, you need to define a mimeType by also using setFileMimeType');
}
if ($this->filePath !== null && !file_exists($this->filePath)) {
throw new InvalidArgumentException('Attachment at filePath does not exist');
}
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
if (!empty($this->filePath)) {
$fileContents = base64_encode(file_get_contents($this->filePath));
$fileName = basename($this->filePath);
$mimeType = $this->getFilePathMimeType();
} else {
$fileContents = $this->fileStream;
$fileName = $this->fileName;
$mimeType = $this->mimeType;
}
$writer->write([
'name' => Schema::CBC . 'EmbeddedDocumentBinaryObject',
'value' => $fileContents,
'attributes' => [
'mimeCode' => $mimeType,
'filename' => $fileName,
]
]);
if ($this->externalReference) {
$writer->writeElement(
Schema::CAC . 'ExternalReference',
[ Schema::CBC . 'URI' => $this->externalReference ]
);
}
}
}

View file

@ -1,57 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use InvalidArgumentException;
class BillingReference implements XmlSerializable
{
private $invoiceDocumentReference;
/**
*
* @return ?InvoiceDocumentReference
*/
public function getInvoiceDocumentReference(): ?InvoiceDocumentReference
{
return $this->invoiceDocumentReference;
}
/**
*
* @return BillingReference
*/
public function setInvoiceDocumentReference($invoiceDocumentReference): BillingReference
{
$this->invoiceDocumentReference = $invoiceDocumentReference;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->invoiceDocumentReference === null) {
throw new InvalidArgumentException('Missing billingreference invoicedocumentreference');
}
}
/**
* The xmlSerialize method is called during xml writing.
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([Schema::CAC . 'InvoiceDocumentReference' => $this->invoiceDocumentReference]);
}
}

View file

@ -1,239 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use InvalidArgumentException;
class ClassifiedTaxCategory implements XmlSerializable
{
private $id;
private $name;
private $percent;
private $taxScheme;
private $taxExemptionReason;
private $taxExemptionReasonCode;
private $schemeID;
private $schemeName;
/**
* @return string
*/
public function getId(): ?string
{
if (!empty($this->id)) {
return $this->id;
}
if ($this->getPercent() !== null) {
return ($this->getPercent() > 0)
? UNCL5305::STANDARD_RATE
: UNCL5305::ZERO_RATED_GOODS;
}
return null;
}
/**
* @param string $id
* @return ClassifiedTaxCategory
*/
public function setId(?string $id): ClassifiedTaxCategory
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return ClassifiedTaxCategory
*/
public function setName(?string $name): ClassifiedTaxCategory
{
$this->name = $name;
return $this;
}
/**
* @return float
*/
public function getPercent(): ?float
{
return $this->percent;
}
/**
* @param float $percent
* @return ClassifiedTaxCategory
*/
public function setPercent(?float $percent): ClassifiedTaxCategory
{
$this->percent = $percent;
return $this;
}
/**
* @return TaxScheme
*/
public function getTaxScheme(): ?TaxScheme
{
return $this->taxScheme;
}
/**
* @param TaxScheme $taxScheme
* @return ClassifiedTaxCategory
*/
public function setTaxScheme(?TaxScheme $taxScheme): ClassifiedTaxCategory
{
$this->taxScheme = $taxScheme;
return $this;
}
/**
* @return string
*/
public function getSchemeID(): ?string
{
return $this->schemeID;
}
/**
* @param string $id
* @return ClassifiedTaxCategory
*/
public function setSchemeID(?string $id): ClassifiedTaxCategory
{
$this->schemeID = $id;
return $this;
}
/**
* @return string
*/
public function getSchemeName(): ?string
{
return $this->schemeName;
}
/**
* @param string $name
* @return ClassifiedTaxCategory
*/
public function setSchemeName(?string $name): ClassifiedTaxCategory
{
$this->schemeName = $name;
return $this;
}
/**
* @return string
*/
public function getTaxExemptionReason(): ?string
{
return $this->taxExemptionReason;
}
/**
* @param string $taxExemptionReason
* @return ClassifiedTaxCategory
*/
public function setTaxExemptionReason(?string $taxExemptionReason): ClassifiedTaxCategory
{
$this->taxExemptionReason = $taxExemptionReason;
return $this;
}
/**
* @return string
*/
public function getTaxExemptionReasonCode(): ?string
{
return $this->taxExemptionReasonCode;
}
/**
* @param string $taxExemptionReasonCode
* @return ClassifiedTaxCategory
*/
public function setTaxExemptionReasonCode(?string $taxExemptionReasonCode): ClassifiedTaxCategory
{
$this->taxExemptionReasonCode = $taxExemptionReasonCode;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->getId() === null) {
throw new InvalidArgumentException('Missing taxcategory id');
}
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$schemeAttributes = [];
if ($this->schemeID !== null) {
$schemeAttributes['schemeID'] = $this->schemeID;
}
if ($this->schemeName !== null) {
$schemeAttributes['schemeName'] = $this->schemeName;
}
$writer->write([
'name' => Schema::CBC . 'ID',
'value' => $this->getId(),
'attributes' => $schemeAttributes
]);
if ($this->name !== null) {
$writer->write([
Schema::CBC . 'Name' => $this->name,
]);
}
if ($this->percent !== null) {
$writer->write([
Schema::CBC . 'Percent' => number_format($this->percent, 2, '.', ''),
]);
}
if ($this->taxExemptionReasonCode !== null) {
$writer->write([
Schema::CBC . 'TaxExemptionReasonCode' => $this->taxExemptionReasonCode,
Schema::CBC . 'TaxExemptionReason' => $this->taxExemptionReason,
]);
}
if ($this->taxScheme !== null) {
$writer->write([Schema::CAC . 'TaxScheme' => $this->taxScheme]);
} else {
$writer->write([
Schema::CAC . 'TaxScheme' => null,
]);
}
}
}

View file

@ -1,90 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class CommodityClassification implements XmlSerializable
{
private $itemClassificationCode;
private $itemClassificationListId;
private $itemClassificationListVersionId;
/**
* @return string
*/
public function getItemClassificationCode(): ?string
{
return $this->itemClassificationCode;
}
/**
* @param string $itemClassificationCode
* @return CommodityClassification
*/
public function setItemClassificationCode(?string $itemClassificationCode): CommodityClassification
{
$this->itemClassificationCode = $itemClassificationCode;
return $this;
}
/**
* @return ?string
*/
public function getItemClassificationListId(): ?string
{
return $this->itemClassificationListId;
}
/**
* @param ?string $itemClassificationListId
* @return CommodityClassification
*/
public function setItemClassificationListId(?string $itemClassificationListId): CommodityClassification
{
$this->itemClassificationListId = $itemClassificationListId;
return $this;
}
/**
* @return ?string
*/
public function getItemClassificationListVersionId(): ?string
{
return $this->itemClassificationListVersionId;
}
/**
* @param ?string $itemClassificationListVersionId
* @return CommodityClassification
*/
public function setItemClassificationListVersionId(?string $itemClassificationListVersionId): CommodityClassification
{
$this->itemClassificationListVersionId = $itemClassificationListVersionId;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$attributes = [
'listID' => $this->itemClassificationListId ?? '',
];
if (!empty($this->itemClassificationListVersionId)) {
$attributes['listVersionID'] = $this->itemClassificationListVersionId;
}
$writer->write([
'name' => Schema::CBC . 'ItemClassificationCode',
'value' => $this->itemClassificationCode ?? '',
'attributes' => $attributes
]);
}
}

View file

@ -1,144 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class Contact implements XmlSerializable
{
private $id;
private $name;
private $telephone;
private $telefax;
private $electronicMail;
/**
* @return string
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string $id
* @return Contact
*/
public function setId(string $id): Contact
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param mixed $name
* @return Contact
*/
public function setName($name): Contact
{
$this->name = $name;
return $this;
}
/**
* @return mixed
*/
public function getTelephone(): ?string
{
return $this->telephone;
}
/**
* @param string $telephone
* @return Contact
*/
public function setTelephone(?string $telephone): Contact
{
$this->telephone = $telephone;
return $this;
}
/**
* @return string
*/
public function getTelefax(): ?string
{
return $this->telefax;
}
/**
* @param string $telefax
* @return Contact
*/
public function setTelefax(?string $telefax): Contact
{
$this->telefax = $telefax;
return $this;
}
/**
* @return string
*/
public function getElectronicMail(): ?string
{
return $this->electronicMail;
}
/**
* @param string $electronicMail
* @return Contact
*/
public function setElectronicMail(?string $electronicMail): Contact
{
$this->electronicMail = $electronicMail;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->id !== null) {
$writer->write([
Schema::CBC . 'ID' => $this->id
]);
}
if ($this->name !== null) {
$writer->write([
Schema::CBC . 'Name' => $this->name
]);
}
if ($this->telephone !== null) {
$writer->write([
Schema::CBC . 'Telephone' => $this->telephone
]);
}
if ($this->telefax !== null) {
$writer->write([
Schema::CBC . 'Telefax' => $this->telefax
]);
}
if ($this->electronicMail !== null) {
$writer->write([
Schema::CBC . 'ElectronicMail' => $this->electronicMail
]);
}
}
}

View file

@ -1,42 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class ContractDocumentReference implements XmlSerializable
{
private $id;
/**
* @return string
*/
public function getId(): string
{
return $this->id;
}
/**
* @param string $id
* @return ContractDocumentReference
*/
public function setId(string $id): ContractDocumentReference
{
$this->id = $id;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->id !== null) {
$writer->write([ Schema::CBC . 'ID' => $this->id ]);
}
}
}

View file

@ -1,69 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class Country implements XmlSerializable
{
private $identificationCode;
private $listId;
/**
* @return mixed
*/
public function getIdentificationCode(): ?string
{
return $this->identificationCode;
}
/**
* @param mixed $identificationCode
* @return Country
*/
public function setIdentificationCode(?string $identificationCode): Country
{
$this->identificationCode = $identificationCode;
return $this;
}
/**
* @return mixed
*/
public function getListId(): ?string
{
return $this->listId;
}
/**
* @param mixed $listId
* @return Country
*/
public function setListId(?string $listId): Country
{
$this->listId = $listId;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$attributes = [];
if (!empty($this->listId)) {
$attributes['listID'] = 'ISO3166-1:Alpha2';
}
$writer->write([
'name' => Schema::CBC . 'IdentificationCode',
'value' => $this->identificationCode,
'attributes' => $attributes
]);
}
}

View file

@ -1,30 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class CreditNote extends Invoice implements XmlSerializable
{
public $xmlTagName = 'CreditNote';
protected $invoiceTypeCode = InvoiceTypeCode::CREDIT_NOTE;
/**
* @return CreditNoteLine[]
*/
public function getCreditNoteLines(): ?array
{
return $this->invoiceLines;
}
/**
* @param CreditNoteLine[] $creditNoteLines
* @return CreditNote
*/
public function setCreditNoteLines(array $creditNoteLines): CreditNote
{
$this->invoiceLines = $creditNoteLines;
return $this;
}
}

View file

@ -1,27 +0,0 @@
<?php
namespace NumNum\UBL;
class CreditNoteLine extends InvoiceLine
{
public $xmlTagName = 'CreditNoteLine';
protected $isCreditNoteLine = true;
/**
* @return float
*/
public function getCreditedQuantity(): ?float
{
return $this->invoicedQuantity;
}
/**
* @param ?float $creditedQuantity
* @return CreditNoteLine
*/
public function setCreditedQuantity(?float $creditedQuantity): CreditNoteLine
{
$this->invoicedQuantity = $creditedQuantity;
return $this;
}
}

View file

@ -1,93 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use DateTime;
class Delivery implements XmlSerializable
{
private $actualDeliveryDate;
private $deliveryLocation;
private $deliveryParty;
/**
* @return DateTime
*/
public function getActualDeliveryDate()
{
return $this->actualDeliveryDate;
}
/**
* @param DateTime $actualDeliveryDate
* @return Delivery
*/
public function setActualDeliveryDate($actualDeliveryDate): Delivery
{
$this->actualDeliveryDate = $actualDeliveryDate;
return $this;
}
/**
* @return Address
*/
public function getDeliveryLocation()
{
return $this->deliveryLocation;
}
/**
* @param Address $deliveryLocation
* @return Delivery
*/
public function setDeliveryLocation($deliveryLocation): Delivery
{
$this->deliveryLocation = $deliveryLocation;
return $this;
}
/**
* @return Party
*/
public function getDeliveryParty()
{
return $this->deliveryParty;
}
/**
* @param Party $deliveryParty
* @return Delivery
*/
public function setDeliveryParty($deliveryParty): Delivery
{
$this->deliveryParty = $deliveryParty;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->actualDeliveryDate != null) {
$writer->write([
Schema::CBC . 'ActualDeliveryDate' => $this->actualDeliveryDate->format('Y-m-d')
]);
}
if ($this->deliveryLocation != null) {
$writer->write([
Schema::CAC . 'DeliveryLocation' => [ Schema::CAC . 'Address' => $this->deliveryLocation ]
]);
}
if ($this->deliveryParty != null) {
$writer->write([
Schema::CAC . 'DeliveryParty' => $this->deliveryParty
]);
}
}
}

View file

@ -1,109 +0,0 @@
<?php
namespace NumNum\UBL;
/**
* All possible ICD Identificiation Codes that can be used
* To extend, see also:
* https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/
* https://docs.peppol.eu/edelivery/codelists/v7.4/Peppol%20Code%20Lists%20-%20Participant%20identifier%20schemes%20v7.4.html
*/
class EASCode
{
const SIRENE = "0002";
const ORGANISATIONSNUMMER = "0007";
const SIRET_CODE = "0009";
const LY_TUNNUS = "0037";
const DUNS_NUMBER = "0060";
const EAN_LOCATION_CODE = "0088";
const DANISH_CHAMBER_OF_COMMERCE_SCHEME_EDIRA = "0096";
const FTI_EDIFORUM_ITALIA_EDIRA = "0097";
const KVK_NETHERLANDS_EDIRA = "0106";
const DIRECTORATES_OF_THE_EUROPEAN_COMMISSION = "0130";
const SIA_OBJECT_IDENTIFIERS = "0135";
const SECETI_OBJECT_IDENTIFIERS = "0142";
const AUSTRALIAN_BUSINESS_NUMBER_SCHEME = "0151";
const SWISS_UIDB = "0183";
const DIGSTORG = "0184";
const CORPORATE_NUMBER_OF_THE_SOCIAL_SECURITY_AND_TAX_NUMBER_SYSTEM = "0188";
const DUTCH_ORIGINATOR_IDENTIFICATION_NUMBER = "0190";
const CENTRE_OF_REGISTERS_AND_INFORMATION_SYSTEMS_OF_THE_MINISTRY_OF_JUSTICE = "0191";
const ENHETSREGISTERET_VED_BRONNOYSUNDREGISTERNE = "0192";
const UBL_BE_PARTY_IDENTIFIER = "0193";
const SINGAPORE_UEN_IDENTIFIER = "0195";
const ICELAND_LEGAL_ID_FOR_INDIVIDUALS_AND_LEGAL_ENTITIES = "0196";
const ERSTORG = "0198";
const LEGAL_ENTITY_IDENTIFIER_LEI = "0199";
const LEGAL_ENTITY_CODE_LITHUANIA = "0200";
const CODICE_UNIVOCO_UNITÀ_ORGANIZZATIVA_IPA = "0201";
const INDIRIZZO_DI_POSTA_ELETTRONICA_CERTIFICATA = "0202";
const LEITWEG_ID = "0204";
const ENTERPRISE_NUMBER = "0208";
const GS1_IDENTIFICATION_KEYS = "0209";
const CODICE_FISCALE = "0210";
const PARTITA_IVA = "0211";
const FINNISH_ORGANIZATION_IDENTIFIER = "0212";
const FINNISH_ORGANIZATION_VALUE_ADD_TAX_IDENTIFIER = "0213";
const NET_SERVICE_ID = "0215";
const OVTCODE = "0216";
const REGISTERED_NUMBER_OF_THE_QUALIFIED_INVOICE_ISSUER_JAPAN = "0221";
const NATIONAL_EINVOICING_FRAMEWORK_MALAYSIA = "0230";
const DANISH_MINISTRY_OF_THE_INTERIOR_AND_HEALTH = "9901";
/** @deprecated */
const NORWEGIAN_VAT_NUMBER = "9909";
const HUNGARY_VAT_NUMBER = "9910";
/** @deprecated */
const NATIONAL_MINISTRIES_OF_ECONOMY = "9912";
const BUSINESS_REGISTERS_NETWORK = "9913";
const ÖSTERREICHISCHE_UMSATZSTEUER_IDENTIFIKATIONSNUMMER = "9914";
const ÖSTERREICHISCHES_VERWALTUNGS_BZW_ORGANISATIONSKENNZEICHEN = "9915";
/** @deprecated */
const FIRMENIDENTIFIKATIONSNUMMER_AUSTRIA = "9916";
/** @deprecated */
const ICELANDIC_NATIONAL_REGISTRY = "9917";
const SOCIETY_FOR_WORLDWIDE_INTERBANK_FINANCIAL_TELECOMMUNICATION_SWIFT = "9918";
const KENNZIFFER_DES_UNTERNEHMENSREGISTERS = "9919";
const AGENCIA_ESPAÑOLA_DE_ADMINISTRACIÓN_TRIBUTARIA = "9920";
/** @deprecated */
const INDICE_DELLE_PUBBLICHE_AMMINISTRAZIONI_ITALIA = "9921";
const ANDORRA_VATNUMBER = "9922";
const ALBANIA_VATNUMBER = "9923";
const BOSNIA_AND_HERZEGOVINA_VATNUMBER = "9924";
const BELGIUM_VATNUMBER = "9925";
const BULGARIA_VATNUMBER = "9926";
const SWITZERLAND_VATNUMBER = "9927";
const CYPRUS_VATNUMBER = "9928";
const CZECH_REPUBLIC_VATNUMBER = "9929";
const GERMANY_VATNUMBER = "9930";
const ESTONIA_VATNUMBER = "9931";
const UNITED_KINGDOM_VATNUMBER = "9932";
const GREECE_VATNUMBER = "9933";
const CROATIA_VATNUMBER = "9934";
const IRELAND_VATNUMBER = "9935";
const LIECHTENSTEIN_VATNUMBER = "9936";
const LITHUANIA_VATNUMBER = "9937";
const LUXEMBURG_VATNUMBER = "9938";
const LATVIA_VATNUMBER = "9939";
const MONACO_VATNUMBER = "9940";
const MONTENEGRO_VATNUMBER = "9941";
const MACEDONIA_VATNUMBER = "9942";
const MALTA_VATNUMBER = "9943";
const NETHERLANDS_VATNUMBER = "9944";
const POLAND_VATNUMBER = "9945";
const PORTUGAL_VATNUMBER = "9946";
const ROMANIA_VATNUMBER = "9947";
const SERBIA_VATNUMBER = "9948";
const SLOVENIA_VATNUMBER = "9949";
const SLOVAKIA_VATNUMBER = "9950";
const SAN_MARINO_VATNUMBER = "9951";
const TURKEY_VATNUMBER = "9952";
const VATICAN_VATNUMBER = "9953";
/** @deprecated */
const DUTCH_ORIGINATORS_IDENTIFICATION_NUMBER = "9954";
/** @deprecated */
const BELGIAN_CROSSROAD_BANK_OF_ENTERPRISE_NUMBER = "9956";
const FRANCE_VATNUMBER = "9957";
/** @deprecated */
const GERMAN_LEITWEG_ID = "9958";
const EIN_USA_EMPLOYER_IDENTIFICATION_NUMBER = "9959";
}

View file

@ -1,36 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class FinancialInstitutionBranch implements XmlSerializable
{
private $id;
/**
* @return string
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string $id
* @return FinancialInstitutionBranch
*/
public function setId(?string $id): FinancialInstitutionBranch
{
$this->id = $id;
return $this;
}
public function xmlSerialize(Writer $writer): void
{
$writer->write([
Schema::CBC . 'ID' => $this->id
]);
}
}

View file

@ -1,44 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Service;
class Generator
{
public static $currencyID;
public static function invoice(Invoice $invoice, $currencyId = 'EUR')
{
self::$currencyID = $currencyId;
$xmlService = new Service();
$xmlService->namespaceMap = [
'urn:oasis:names:specification:ubl:schema:xsd:' . $invoice->xmlTagName . '-2' => '',
'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc',
'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac'
];
return $xmlService->write($invoice->xmlTagName, [
$invoice
]);
}
public static function creditNote(CreditNote $creditNote, $currencyId = 'EUR')
{
self::$currencyID = $currencyId;
$xmlService = new Service();
$xmlService->namespaceMap = [
'urn:oasis:names:specification:ubl:schema:xsd:' . $creditNote->xmlTagName . '-2' => '',
'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2' => 'cbc',
'urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2' => 'cac'
];
return $xmlService->write($creditNote->xmlTagName, [
$creditNote
]);
}
}

View file

@ -1,244 +0,0 @@
<?php
namespace NumNum\UBL;
/**
* All possible ICD Identificiation Codes that can be used
* To extend, see also: https://docs.peppol.eu/poacc/billing/3.0/codelist/ICD/
*/
class ICDCode
{
public const SIRENE = "0002";
public const BELGIAN_FINANCIAL_INSTITUTIONS = "0003";
public const NBS_OSI_NETWORK = "0004";
public const USA_FED_GOV_OSI_NETWORK = "0005";
public const USA_DOD_OSI_NETWORK = "0006";
public const ORGANISATIONSNUMMER = "0007";
public const LE_NUMERO_NATIONAL = "0008";
public const SIRET_CODE = "0009";
public const ORGANIZATIONAL_IDENTIFIERS = "0010";
public const OSI_AMATEUR_RADIO_ORGANIZATIONS = "0011";
public const EUROPEAN_COMPUTER_MANUFACTURERS_ASSOCIATION = "0012";
public const VSA_FTP_CODE = "0013";
public const NIST_OSI_IMPLEMENTERS_WORKSHOP = "0014";
public const ELECTRONIC_DATA_INTERCHANGE = "0015";
public const EWOS_OBJECT_IDENTIFIERS = "0016";
public const COMMON_LANGUAGE = "0017";
public const SNA_OSI_NETWORK = "0018";
public const AIR_TRANSPORT_INDUSTRY_SERVICES = "0019";
public const EUROPEAN_LABORATORY_FOR_PARTICLE_PHYSICS = "0020";
public const SOCIETY_FOR_WORLDWIDE_INTERBANK_FINANCIAL_TELECOMMUNICATION = "0021";
public const OSF_DISTRIBUTED_COMPUTING_OBJECT_IDENTIFICATION = "0022";
public const NORDUNET = "0023";
public const DIGITAL_EQUIPMENT_CORPORATION_DEC = "0024";
public const OSI_ASIA_OCEANIA_WORKSHOP = "0025";
public const NATO_ISO_6523_ICDE = "0026";
public const AERONAUTICAL_TELECOMMUNICATIONS_NETWORK_ATN = "0027";
public const INTERNATIONAL_STANDARD_ISO_6523 = "0028";
public const ALL_UNION_CLASSIFIER_ENTERPRISES_ORGANISATIONS = "0029";
public const ATT_OSI_NETWORK = "0030";
public const EDI_PARTNER_IDENTIFICATION_CODE = "0031";
public const TELECOM_AUSTRALIA = "0032";
public const SGW_OSI_INTERNETWORK = "0033";
public const REUTER_OPEN_ADDRESS_STANDARD = "0034";
public const ISO_6523_ICD_BP = "0035";
public const TELETRUST_OBJECT_IDENTIFIERS = "0036";
public const LY_TUNNUS = "0037";
public const AUSTRALIAN_GOSIP_NETWORK = "0038";
public const OZ_DOD_OSI_NETWORK = "0039";
public const UNILEVER_GROUP_COMPANIES = "0040";
public const CITICORP_GLOBAL_INFORMATION_NETWORK = "0041";
public const DBP_TELEKOM_OBJECT_IDENTIFIERS = "0042";
public const HYDRONETT = "0043";
public const THAI_INDUSTRIAL_STANDARDS_INSTITUTE_TISI = "0044";
public const ICI_COMPANY_IDENTIFICATION_SYSTEM = "0045";
public const FUNLOC = "0046";
public const BULL_ODI_DSA_UNIX_NETWORK = "0047";
public const OSINZ = "0048";
public const AUCKLAND_AREA_HEALTH = "0049";
public const FIRMENICH = "0050";
public const AGFA_DIS = "0051";
public const SMPTE = "0052";
public const MIGROS_NETWORK_M_NETOPZ = "0053";
public const ISO6523_ICDPCR = "0054";
public const ENERGY_NET = "0055";
public const NOKIA_OBJECT_IDENTIFIERS_NOI = "0056";
public const SAINT_GOBAIN = "0057";
public const SIEMENS_CORPORATE_NETWORK = "0058";
public const DANZNET = "0059";
public const DUNS = "0060";
public const SOFFEX_OSI = "0061";
public const KPN_OVN = "0062";
public const ASCOMOSINET = "0063";
public const UTC_UNIFORME_TRANSPORT_CODE = "0064";
public const SOLVAY_OSI_CODING = "0065";
public const ROCHE_CORPORATE_NETWORK = "0066";
public const ZELLWEGEROSINET = "0067";
public const INTEL_CORPORATION_OSI = "0068";
public const SITA_OBJECT_IDENTIFIER_TREE = "0069";
public const DAIMLERCHRYSLER_CORPORATE_NETWORK = "0070";
public const LEGO_OSI_NETWORK = "0071";
public const NAVISTAR_OSI_NETWORK = "0072";
public const ICD_FORMATTED_ATM_ADDRESS = "0073";
public const ARINC = "0074";
public const ALCANET_ALCATEL_ALSTHOM_CORPORATE_NETWORK = "0075";
public const SISTEMA_ITALIANO_UNINFO = "0076";
public const SISTEMA_ITALIANO_UNINFO_NETWORK = "0077";
public const MITEL_TERMINAL_SWITCHING_EQUIPMENT = "0078";
public const ATM_FORUM = "0079";
public const UK_NATIONAL_HEALTH_SERVICE_SCHEME = "0080";
public const INTERNATIONAL_NSAP = "0081";
public const NORWEGIAN_TELECOMMUNICATIONS_AUTHORITY = "0082";
public const ATM_LTD_CORPORATE_NETWORK = "0083";
public const ATHENS_CHAMBER_OF_COMMERCE = "0084";
public const SWISS_CHAMBERS_OF_COMMERCE = "0085";
public const USCIB = "0086";
public const BELGIAN_CHAMBERS_OF_COMMERCE = "0087";
public const EAN_LOCATION_CODE = "0088";
public const BRITISH_CHAMBERS_OF_COMMERCE = "0089";
public const INTERNET_IP_ADDRESSING = "0090";
public const CISCO_SYSTEMS_OSI_NETWORK = "0091";
public const CODE_0093 = "0093";
public const DEUTSCHER_INDUSTRIE_UND_HANDELSTAG = "0094";
public const HEWLETT_PACKARD_COMPANY_INTERNAL_AM_NETWORK = "0095";
public const DANISH_CHAMBER_OF_COMMERCE = "0096";
public const FTI_EDIFORUM_ITALIA = "0097";
public const CHAMBER_OF_COMMERCE_TEL_AVIV_JAFFA = "0098";
public const SIEMENS_SUPERVISORY_SYSTEMS_NETWORK = "0099";
public const PNG_ICD_SCHEME = "0100";
public const SOUTH_AFRICAN_CODE_ALLOCATION = "0101";
public const HEAG = "0102";
public const CODE_0104 = "0104";
public const PORTUGUESE_CHAMBER_OF_COMMERCE = "0105";
public const DUTCH_CHAMBER_OF_COMMERCE = "0106";
public const SWEDISH_CHAMBERS_OF_COMMERCE = "0107";
public const AUSTRALIAN_CHAMBERS_OF_COMMERCE = "0108";
public const BELLSOUTH_ICD_AESA = "0109";
public const BELL_ATLANTIC = "0110";
public const OBJECT_IDENTIFIERS_IEEE = "0111";
public const ISO_REGISTER_FOR_STANDARDS_PRODUCING_ORGANIZATIONS = "0112";
public const ORIGINNET = "0113";
public const CHECK_POINT_SOFTWARE_TECHNOLOGIES = "0114";
public const PACIFIC_BELL_DATA_COMMUNICATIONS_NETWORK = "0115";
public const PSS_OBJECT_IDENTIFIERS = "0116";
public const STENTOR_ICD_CODING_SYSTEM = "0117";
public const ATM_NETWORK_ZN96 = "0118";
public const MCI_OSI_NETWORK = "0119";
public const ADVANTIS = "0120";
public const AFFABLE_SOFTWARE_DATA_INTERCHANGE_CODES = "0121";
public const BB_DATA_GMBH = "0122";
public const BASF_COMPANY_ATM_NETWORK = "0123";
public const IOTA_IDENTIFIERS_FOR_ORGANIZATIONS = "0124";
public const HENKEL_CORPORATE_NETWORK = "0125";
public const GTE_OSI_NETWORK = "0126";
public const DRESDNER_BANK_CORPORATE_NETWORK = "0127";
public const BCNR_SWISS_CLEARING_BANK_NUMBER = "0128";
public const BPI_SWISS_BUSINESS_PARTNER_IDENTIFICATION = "0129";
public const DIRECTORATES_OF_THE_EUROPEAN_COMMISSION = "0130";
public const CHINA_NATIONAL_ORGANIZATION_CODE = "0131";
public const CERTICOM_OBJECT_IDENTIFIERS = "0132";
public const TC68_OID = "0133";
public const INFONET_SERVICES_CORPORATION = "0134";
public const SIA_OBJECT_IDENTIFIERS = "0135";
public const CABLE_WIRELESS_GLOBAL_ATM_END_SYSTEM_ADDRESS_PLAN = "0136";
public const GLOBAL_AESA_SCHEME = "0137";
public const FRANCE_TELECOM_ATM_END_SYSTEM_ADDRESS_PLAN = "0138";
public const SAVVIS_COMMUNICATIONS_AESA = "0139";
public const TOSHIBA_TOPAS_CODE = "0140";
public const NATO_COMMERCIAL_AND_GOV_ENTITY_SYSTEM = "0141";
public const SECETI_OBJECT_IDENTIFIERS = "0142";
public const EINSTEINET_AG = "0143";
public const DODAAC = "0144";
public const DGCP_ADMINISTRATIVE_ACCOUNTING_IDENTIFICATION = "0145";
public const DGI_CODE = "0146";
public const STANDARD_COMPANY_CODE = "0147";
public const ITU_DATA_NETWORK_IDENTIFICATION_CODES = "0148";
public const GLOBAL_BUSINESS_IDENTIFIER = "0149";
public const MADGE_NETWORKS_ICD_ATM_ADDRESSING = "0150";
public const AUSTRALIAN_BUSINESS_NUMBER_ABN = "0151";
public const EDIRA_SCHEME_IDENTIFIER_CODE = "0152";
public const CONCERT_GLOBAL_NETWORK_SERVICES_ICD_AESA = "0153";
public const CZECH_ICO_IDENTIFICATION_NUMBER = "0154";
public const GLOBAL_CROSSING_AESA = "0155";
public const AUNA = "0156";
public const ATM_INTERCONNECTION_KPN_TELECOM = "0157";
public const SLOVAK_ICO_IDENTIFICATION_NUMBER = "0158";
public const ACTALIS_OBJECT_IDENTIFIERS = "0159";
public const GTIN_GLOBAL_TRADE_ITEM_NUMBER = "0160";
public const ECCMA_OPEN_TECHNICAL_DIRECTORY = "0161";
public const CEN_ISSS_OBJECT_IDENTIFIER_SCHEME = "0162";
public const US_EPA_FACILITY_IDENTIFIER = "0163";
public const TELUS_CORPORATION = "0164";
public const FIEIE_OBJECT_IDENTIFIERS = "0165";
public const SWISSGUIDE_IDENTIFIER_SCHEME = "0166";
public const PRIORITY_TELECOM_ATM_END_SYSTEM_ADDRESS_PLAN = "0167";
public const VODAFONE_IRELAND_OSI_ADDRESSING = "0168";
public const SWISS_FEDERAL_BUSINESS_IDENTIFICATION_NUMBER = "0169";
public const TEIKOKU_COMPANY_CODE = "0170";
public const LUXEMBOURG_CP_CPS_INDEX = "0171";
public const PROLIST = "0172";
public const ECLASS = "0173";
public const STEPNEXUS = "0174";
public const SIEMENS_AG = "0175";
public const PARADINE_GMBH = "0176";
public const ODETTE_INTERNATIONAL = "0177";
public const ROUTE1_MOBINET = "0178";
public const PENANGO_OBJECT_IDENTIFIERS = "0179";
public const LITHUANIAN_MILITARY_PKI = "0180";
public const SWISS_UNIQUE_BUSINESS_IDENTIFICATION_NUMBER = "0183";
public const DIGSTORG = "0184";
public const PERCEVAL_OBJECT_CODE = "0185";
public const TRUSTPOINT_OBJECT_IDENTIFIERS = "0186";
public const AMAZON_UNIQUE_IDENTIFICATION_SCHEME = "0187";
public const JAPAN_CORPORATE_NUMBER = "0188";
public const EUROPEAN_BUSINESS_IDENTIFIER_EBID = "0189";
public const ORGANISATIE_IDENTIFICATIE_NUMMER_OIN = "0190";
public const ESTONIA_COMPANY_CODE = "0191";
public const NORWAY_ORGANISASJONSNUMMER = "0192";
public const UBL_BE_PARTY_IDENTIFIER = "0193";
public const KOIOS_OPEN_TECHNICAL_DICTIONARY = "0194";
public const SINGAPORE_NATIONWIDE_EINVOICE_FRAMEWORK = "0195";
public const ICELANDIC_IDENTIFIER = "0196";
public const APPLIA_PI_STANDARD = "0197";
public const ERSTORG = "0198";
public const LEGAL_ENTITY_IDENTIFIER_LEI = "0199";
public const LEGAL_ENTITY_CODE_LITHUANIA = "0200";
public const CODICE_UNIVOCO_UNITA_ORGANIZZATIVA_IPA = "0201";
public const INDIRIZZO_POSTA_ELETTRONICA_CERTIFICATA = "0202";
public const EDELIVERY_NETWORK_PARTICIPANT_IDENTIFIER = "0203";
public const LEITWEG_ID = "0204";
public const CODDEST = "0205";
public const REGISTRE_DU_COMMERCE_ET_DE_L_INDUSTRIE_RCI = "0206";
public const PILOG_ONTOLOGY_CODIFICATION_IDENTIFIER_POCI = "0207";
public const ENTERPRISE_NUMBER = "0208";
public const CODE_0209 = "0209";
public const CODICE_FISCALE = "0210";
public const PARTITA_IVA = "0211";
public const FINNISH_ORGANIZATION_IDENTIFIER = "0212";
public const FINNISH_ORGANIZATION_VAT_IDENTIFIER = "0213";
public const TRADEPLACE_TRADEPI_STANDARD = "0214";
public const NET_SERVICE_ID = "0215";
public const OVTCODE = "0216";
public const NETHERLANDS_CHAMBER_OF_COMMERCE_ESTABLISHMENT_NUMBER = "0217";
public const UNIFIED_REGISTRATION_NUMBER_LATVIA = "0218";
public const TAXPAYER_REGISTRATION_CODE_LATVIA = "0219";
public const REGISTER_OF_NATURAL_PERSONS_LATVIA = "0220";
public const QUALIFIED_INVOICE_ISSUER_NUMBER_JAPAN = "0221";
public const METADATA_REGISTRY_SUPPORT = "0222";
public const EU_BASED_COMPANY = "0223";
public const FTCTC_CODE_ROUTAGE = "0224";
public const FRCTC_ELECTRONIC_ADDRESS = "0225";
public const FRCTC_PARTICULIER = "0226";
public const NON_EU_BASED_COMPANY = "0227";
public const RIDET = "0228";
public const TAHITI = "0229";
public const NATIONAL_EINVOICING_FRAMEWORK_MALAYSIA = "0230";
public const SINGLE_TAXABLE_COMPANY_FRANCE = "0231";
public const NOBB_PRODUCT_NUMBER = "0232";
public const CODE_0233 = "0233";
public const TOIMITUSOSOITE_ID = "0234";
public const UAE_TAX_IDENTIFICATION_NUMBER = "0235";
public const CODE_0236 = "0236";
public const CPR_DANISH_PERSON_CIVIL_REGISTRATION_NUMBER = "0237";
public const PPF_PDP_EINVOICING_PLATFORM_FRANCE = "0238";
}

View file

@ -1,826 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use DateTime;
use InvalidArgumentException;
class Invoice implements XmlSerializable
{
public $xmlTagName = 'Invoice';
private $UBLVersionID = '2.1';
private $customizationID = '1.0';
private $profileID;
private $id;
private $copyIndicator;
private $issueDate;
protected $invoiceTypeCode = InvoiceTypeCode::INVOICE;
private $note;
private $taxPointDate;
private $dueDate;
private $paymentTerms;
private $accountingSupplierParty;
private $accountingCustomerParty;
private $accountingCustomerPartyContact;
private $payeeParty;
private $supplierAssignedAccountID;
/** @var PaymentMeans[] $paymentMeans */
private $paymentMeans;
private $taxTotal;
private $legalMonetaryTotal;
/** @var InvoiceLine[] $invoiceLines */
protected $invoiceLines;
private $allowanceCharges;
private $additionalDocumentReferences = [];
private $projectReference;
private $documentCurrencyCode = 'EUR';
private $buyerReference;
private $accountingCostCode;
private $invoicePeriod;
private $billingReference;
private $delivery;
private $orderReference;
private $contractDocumentReference;
/**
* @return string
*/
public function getUBLVersionID(): ?string
{
return $this->UBLVersionID;
}
/**
* @param string $UBLVersionID
* eg. '2.0', '2.1', '2.2', ...
* @return Invoice
*/
public function setUBLVersionID(?string $UBLVersionID): Invoice
{
$this->UBLVersionID = $UBLVersionID;
return $this;
}
/**
* @return mixed
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param mixed $id
* @return Invoice
*/
public function setId(?string $id): Invoice
{
$this->id = $id;
return $this;
}
/**
* @param mixed $customizationID
* @return Invoice
*/
public function setCustomizationID(?string $customizationID): Invoice
{
$this->customizationID = $customizationID;
return $this;
}
/**
* @param mixed $profileID
* @return Invoice
*/
public function setProfileID(?string $profileID): Invoice
{
$this->profileID = $profileID;
return $this;
}
/**
* @return bool
*/
public function isCopyIndicator(): bool
{
return $this->copyIndicator;
}
/**
* @param bool $copyIndicator
* @return Invoice
*/
public function setCopyIndicator(bool $copyIndicator): Invoice
{
$this->copyIndicator = $copyIndicator;
return $this;
}
/**
* @return DateTime
*/
public function getIssueDate(): ?DateTime
{
return $this->issueDate;
}
/**
* @param DateTime $issueDate
* @return Invoice
*/
public function setIssueDate(DateTime $issueDate): Invoice
{
$this->issueDate = $issueDate;
return $this;
}
/**
* @return DateTime
*/
public function getDueDate(): ?DateTime
{
return $this->dueDate;
}
/**
* @param DateTime $dueDate
* @return Invoice
*/
public function setDueDate(DateTime $dueDate): Invoice
{
$this->dueDate = $dueDate;
return $this;
}
/**
* @param mixed $currencyCode
* @return Invoice
*/
public function setDocumentCurrencyCode(string $currencyCode = 'EUR'): Invoice
{
$this->documentCurrencyCode = $currencyCode;
return $this;
}
/**
* @return string
*/
public function getInvoiceTypeCode(): ?string
{
return $this->invoiceTypeCode;
}
/**
* @param string $invoiceTypeCode
* See also: src/InvoiceTypeCode.php
* @return Invoice
*/
public function setInvoiceTypeCode(string $invoiceTypeCode): Invoice
{
$this->invoiceTypeCode = $invoiceTypeCode;
return $this;
}
/**
* @return string
*/
public function getNote()
{
return $this->note;
}
/**
* @param string $note
* @return Invoice
*/
public function setNote(string $note)
{
$this->note = $note;
return $this;
}
/**
* @return DateTime
*/
public function getTaxPointDate(): ?DateTime
{
return $this->taxPointDate;
}
/**
* @param DateTime $taxPointDate
* @return Invoice
*/
public function setTaxPointDate(DateTime $taxPointDate): Invoice
{
$this->taxPointDate = $taxPointDate;
return $this;
}
/**
* @return PaymentTerms
*/
public function getPaymentTerms(): ?PaymentTerms
{
return $this->paymentTerms;
}
/**
* @param PaymentTerms $paymentTerms
* @return Invoice
*/
public function setPaymentTerms(PaymentTerms $paymentTerms): Invoice
{
$this->paymentTerms = $paymentTerms;
return $this;
}
/**
* @return Party
*/
public function getAccountingSupplierParty(): ?Party
{
return $this->accountingSupplierParty;
}
/**
* @param Party $accountingSupplierParty
* @return Invoice
*/
public function setAccountingSupplierParty(Party $accountingSupplierParty): Invoice
{
$this->accountingSupplierParty = $accountingSupplierParty;
return $this;
}
/**
* @return Party
*/
public function getSupplierAssignedAccountID(): ?string
{
return $this->supplierAssignedAccountID;
}
/**
* @param string $supplierAssignedAccountID
* @return Invoice
*/
public function setSupplierAssignedAccountID(string $supplierAssignedAccountID): Invoice
{
$this->supplierAssignedAccountID = $supplierAssignedAccountID;
return $this;
}
/**
* @return Party
*/
public function getAccountingCustomerParty(): ?Party
{
return $this->accountingCustomerParty;
}
/**
* @param Party $accountingCustomerParty
* @return Invoice
*/
public function setAccountingCustomerParty(Party $accountingCustomerParty): Invoice
{
$this->accountingCustomerParty = $accountingCustomerParty;
return $this;
}
/**
* @return ?Contact
*/
public function getAccountingCustomerPartyContact(): ?Contact
{
return $this->accountingCustomerPartyContact;
}
/**
* @param Contact $accountingCustomerPartyContact
* @return Invoice
*/
public function setAccountingCustomerPartyContact(Contact $accountingCustomerPartyContact): Invoice
{
$this->accountingCustomerPartyContact = $accountingCustomerPartyContact;
return $this;
}
/**
* @return Party
*/
public function getPayeeParty(): ?Party
{
return $this->payeeParty;
}
/**
* @param Party $payeeParty
* @return Invoice
*/
public function setPayeeParty(Party $payeeParty): Invoice
{
$this->payeeParty = $payeeParty;
return $this;
}
/**
* @return PaymentMeans[]
*/
public function getPaymentMeans(): ?array
{
return $this->paymentMeans;
}
/**
* @param PaymentMeans[] $paymentMeans
* @return Invoice
*/
public function setPaymentMeans(array $paymentMeans): Invoice
{
$this->paymentMeans = $paymentMeans;
return $this;
}
/**
* @return TaxTotal
*/
public function getTaxTotal(): ?TaxTotal
{
return $this->taxTotal;
}
/**
* @param TaxTotal $taxTotal
* @return Invoice
*/
public function setTaxTotal(TaxTotal $taxTotal): Invoice
{
$this->taxTotal = $taxTotal;
return $this;
}
/**
* @return LegalMonetaryTotal
*/
public function getLegalMonetaryTotal(): ?LegalMonetaryTotal
{
return $this->legalMonetaryTotal;
}
/**
* @param LegalMonetaryTotal $legalMonetaryTotal
* @return Invoice
*/
public function setLegalMonetaryTotal(LegalMonetaryTotal $legalMonetaryTotal): Invoice
{
$this->legalMonetaryTotal = $legalMonetaryTotal;
return $this;
}
/**
* @return InvoiceLine[]
*/
public function getInvoiceLines(): ?array
{
return $this->invoiceLines;
}
/**
* @param InvoiceLine[] $invoiceLines
* @return Invoice
*/
public function setInvoiceLines(array $invoiceLines): Invoice
{
$this->invoiceLines = $invoiceLines;
return $this;
}
/**
* @return AllowanceCharge[]
*/
public function getAllowanceCharges(): ?array
{
return $this->allowanceCharges;
}
/**
* @param AllowanceCharge[] $allowanceCharges
* @return Invoice
*/
public function setAllowanceCharges(array $allowanceCharges): Invoice
{
$this->allowanceCharges = $allowanceCharges;
return $this;
}
/**
* @return AdditionalDocumentReference
* @deprecated Deprecated since v1.16 - Replace implementation with setAdditionalDocumentReference or addAdditionalDocumentReference to add/set a single AdditionalDocumentReference
*/
public function getAdditionalDocumentReference(): ?AdditionalDocumentReference
{
return $this->additionalDocumentReferences[0] ?? null;
}
/**
* @return array<AdditionalDocumentReference>
*/
public function getAdditionalDocumentReferences(): array
{
return $this->additionalDocumentReferences ?? [];
}
/**
* @param AdditionalDocumentReference $additionalDocumentReference
* @return Invoice
*/
public function setAdditionalDocumentReference(AdditionalDocumentReference $additionalDocumentReference): Invoice
{
$this->additionalDocumentReferences = [$additionalDocumentReference];
return $this;
}
/**
* @param AdditionalDocumentReference $additionalDocumentReference
* @return Invoice
*/
public function setAdditionalDocumentReferences(array $additionalDocumentReference): Invoice
{
$this->additionalDocumentReferences = $additionalDocumentReference;
return $this;
}
/**
* @param AdditionalDocumentReference $additionalDocumentReference
* @return Invoice
*/
public function addAdditionalDocumentReference(AdditionalDocumentReference $additionalDocumentReference): Invoice
{
$this->additionalDocumentReferences[] = $additionalDocumentReference;
return $this;
}
/**
* @param ProjectReference $projectReference
* @return Invoice
*/
public function setProjectReference(ProjectReference $projectReference): Invoice
{
$this->projectReference = $projectReference;
return $this;
}
/**
* @return ProjectReference projectReference
*/
public function getProjectReference(): ?ProjectReference
{
return $this->projectReference;
}
/**
* @param string $buyerReference
* @return Invoice
*/
public function setBuyerReference(string $buyerReference): Invoice
{
$this->buyerReference = $buyerReference;
return $this;
}
/**
* @return string buyerReference
*/
public function getBuyerReference(): ?string
{
return $this->buyerReference;
}
/**
* @return mixed
*/
public function getAccountingCostCode(): ?string
{
return $this->accountingCostCode;
}
/**
* @param mixed $accountingCostCode
* @return Invoice
*/
public function setAccountingCostCode(string $accountingCostCode): Invoice
{
$this->accountingCostCode = $accountingCostCode;
return $this;
}
/**
* @return InvoicePeriod
*/
public function getInvoicePeriod(): ?InvoicePeriod
{
return $this->invoicePeriod;
}
/**
* @param InvoicePeriod $invoicePeriod
* @return Invoice
*/
public function setInvoicePeriod(InvoicePeriod $invoicePeriod): Invoice
{
$this->invoicePeriod = $invoicePeriod;
return $this;
}
/**
* Get the reference to the invoice that is being credited
*
* @return ?BillingReference
*/
public function getBillingReference(): ?BillingReference
{
return $this->billingReference;
}
/**
* Set the reference to the invoice that is being credited
*
* @return CreditNote
*/
public function setBillingReference($billingReference): CreditNote
{
$this->billingReference = $billingReference;
return $this;
}
/**
* @return Delivery
*/
public function getDelivery(): ?Delivery
{
return $this->delivery;
}
/**
* @param Delivery $delivery
* @return Invoice
*/
public function setDelivery(Delivery $delivery): Invoice
{
$this->delivery = $delivery;
return $this;
}
/**
* @return OrderReference
*/
public function getOrderReference(): ?OrderReference
{
return $this->orderReference;
}
/**
* @param OrderReference $orderReference
* @return Invoice
*/
public function setOrderReference(OrderReference $orderReference): Invoice
{
$this->orderReference = $orderReference;
return $this;
}
/**
* @return ContractDocumentReference
*/
public function getContractDocumentReference(): ?ContractDocumentReference
{
return $this->contractDocumentReference;
}
/**
* @param string $ContractDocumentReference
* @return Invoice
*/
public function setContractDocumentReference(ContractDocumentReference $contractDocumentReference): Invoice
{
$this->contractDocumentReference = $contractDocumentReference;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @return void
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
*/
public function validate()
{
if ($this->id === null) {
throw new InvalidArgumentException('Missing invoice id');
}
if (!$this->issueDate instanceof DateTime) {
throw new InvalidArgumentException('Invalid invoice issueDate');
}
if ($this->invoiceTypeCode === null) {
throw new InvalidArgumentException('Missing invoice invoiceTypeCode');
}
if ($this->accountingSupplierParty === null) {
throw new InvalidArgumentException('Missing invoice accountingSupplierParty');
}
if ($this->accountingCustomerParty === null) {
throw new InvalidArgumentException('Missing invoice accountingCustomerParty');
}
if ($this->invoiceLines === null) {
throw new InvalidArgumentException('Missing invoice lines');
}
if ($this->legalMonetaryTotal === null) {
throw new InvalidArgumentException('Missing invoice LegalMonetaryTotal');
}
}
/**
* The xmlSerialize method is called during xml writing.
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([
Schema::CBC . 'UBLVersionID' => $this->UBLVersionID,
Schema::CBC . 'CustomizationID' => $this->customizationID,
]);
if ($this->profileID !== null) {
$writer->write([
Schema::CBC . 'ProfileID' => $this->profileID
]);
}
$writer->write([
Schema::CBC . 'ID' => $this->id
]);
if ($this->copyIndicator !== null) {
$writer->write([
Schema::CBC . 'CopyIndicator' => $this->copyIndicator ? 'true' : 'false'
]);
}
$writer->write([
Schema::CBC . 'IssueDate' => $this->issueDate->format('Y-m-d'),
]);
if ($this->dueDate !== null && $this->xmlTagName === 'Invoice') {
$writer->write([
Schema::CBC . 'DueDate' => $this->dueDate->format('Y-m-d')
]);
}
if ($this->invoiceTypeCode !== null) {
$writer->write([
Schema::CBC . $this->xmlTagName . 'TypeCode' => $this->invoiceTypeCode
]);
}
if ($this->note !== null) {
$writer->write([
Schema::CBC . 'Note' => $this->note
]);
}
if ($this->taxPointDate !== null) {
$writer->write([
Schema::CBC . 'TaxPointDate' => $this->taxPointDate->format('Y-m-d')
]);
}
$writer->write([
Schema::CBC . 'DocumentCurrencyCode' => $this->documentCurrencyCode,
]);
if ($this->accountingCostCode !== null) {
$writer->write([
Schema::CBC . 'AccountingCostCode' => $this->accountingCostCode
]);
}
if ($this->buyerReference != null) {
$writer->write([
Schema::CBC . 'BuyerReference' => $this->buyerReference
]);
}
if ($this->invoicePeriod != null) {
$writer->write([
Schema::CAC . 'InvoicePeriod' => $this->invoicePeriod
]);
}
if ($this->orderReference != null) {
$writer->write([
Schema::CAC . 'OrderReference' => $this->orderReference
]);
}
if ($this->billingReference != null) {
$writer->write([
Schema::CAC . 'BillingReference' => $this->billingReference
]);
}
if ($this->contractDocumentReference !== null) {
$writer->write([
Schema::CAC . 'ContractDocumentReference' => $this->contractDocumentReference,
]);
}
if (!empty($this->additionalDocumentReferences)) {
foreach ($this->additionalDocumentReferences as $additionalDocumentReference) {
$writer->write([
Schema::CAC . 'AdditionalDocumentReference' => $additionalDocumentReference
]);
}
}
if ($this->projectReference != null) {
$writer->write([
Schema::CAC . 'ProjectReference' => $this->projectReference
]);
}
$customerParty = array_filter([
Schema::CBC . 'SupplierAssignedAccountID' => $this->supplierAssignedAccountID,
Schema::CAC . 'Party' => $this->accountingCustomerParty,
Schema::CAC . 'AccountingContact' => $this->accountingCustomerPartyContact,
]);
$writer->write([
Schema::CAC . 'AccountingSupplierParty' => [Schema::CAC . 'Party' => $this->accountingSupplierParty],
Schema::CAC . 'AccountingCustomerParty' => $customerParty,
]);
if ($this->payeeParty != null) {
$writer->write([
Schema::CAC . 'PayeeParty' => $this->payeeParty
]);
}
if ($this->delivery != null) {
$writer->write([
Schema::CAC . 'Delivery' => $this->delivery
]);
}
if ($this->paymentMeans !== null) {
foreach($this->paymentMeans as $paymentMeans) {
$writer->write([
Schema::CAC . $paymentMeans->xmlTagName => $paymentMeans
]);
}
}
if ($this->paymentTerms !== null) {
$writer->write([
Schema::CAC . 'PaymentTerms' => $this->paymentTerms
]);
}
if ($this->allowanceCharges !== null) {
foreach ($this->allowanceCharges as $allowanceCharge) {
$writer->write([
Schema::CAC . 'AllowanceCharge' => $allowanceCharge
]);
}
}
if ($this->taxTotal !== null) {
$writer->write([
Schema::CAC . 'TaxTotal' => $this->taxTotal
]);
}
$writer->write([
Schema::CAC . 'LegalMonetaryTotal' => $this->legalMonetaryTotal
]);
foreach ($this->invoiceLines as $invoiceLine) {
$writer->write([
Schema::CAC . $invoiceLine->xmlTagName => $invoiceLine
]);
}
}
}

View file

@ -1,96 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use DateTime;
use InvalidArgumentException;
class InvoiceDocumentReference implements XmlSerializable
{
private $originalInvoiceId;
private $issueDate;
/**
* Get the id of the invoice that is being credited
* @return string
*/
public function getOriginalInvoiceId(): ?string
{
return $this->originalInvoiceId;
}
/**
* Set the id of the invoice that is being credited
*
* @return InvoiceDocumentReference
*/
public function setOriginalInvoiceId(string $invoiceRef): InvoiceDocumentReference
{
$this->originalInvoiceId = $invoiceRef;
return $this;
}
/**
* Get the issue date of the original invoice that is being credited
*
* @return ?DateTime
*/
public function getIssueDate(): ?DateTime
{
return $this->issueDate;
}
/**
* Set the issue date of the original invoice that is being credited
*
* @return InvoiceDocumentReference
*/
public function setIssueDate(DateTime $issueDate): InvoiceDocumentReference
{
$this->issueDate = $issueDate;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->originalInvoiceId === null) {
throw new InvalidArgumentException('Missing invoicedocumentreference originalinvoiceid');
}
}
/**
* The xmlSerialize method is called during xml writing.
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([
[
'name' => Schema::CBC . 'ID',
'value' => $this->originalInvoiceId
]
]);
if ($this->issueDate != null)
{
$writer->write([
[
'name' => Schema::CBC . 'IssueDate',
'value' => $this->issueDate->format('Y-m-d')
]
]);
}
}
}

View file

@ -1,367 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class InvoiceLine implements XmlSerializable
{
public $xmlTagName = 'InvoiceLine';
private $id;
protected $invoicedQuantity;
private $lineExtensionAmount;
private $unitCode = UnitCode::UNIT;
private $unitCodeListId;
private $taxTotal;
private $invoicePeriod;
private $orderLineReference;
private $note;
private $item;
private $price;
private $accountingCostCode;
private $accountingCost;
/** @var AllowanceCharge[] $allowanceCharges */
private $allowanceCharges;
// See CreditNoteLine.php
protected $isCreditNoteLine = false;
/**
* @return string
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string $id
* @return InvoiceLine
*/
public function setId(?string $id): InvoiceLine
{
$this->id = $id;
return $this;
}
/**
* @return float
*/
public function getInvoicedQuantity(): ?float
{
return $this->invoicedQuantity;
}
/**
* @param ?float $invoicedQuantity
* @return InvoiceLine
*/
public function setInvoicedQuantity(?float $invoicedQuantity): InvoiceLine
{
$this->invoicedQuantity = $invoicedQuantity;
return $this;
}
/**
* @return float
*/
public function getLineExtensionAmount(): ?float
{
return $this->lineExtensionAmount;
}
/**
* @param float $lineExtensionAmount
* @return InvoiceLine
*/
public function setLineExtensionAmount(?float $lineExtensionAmount): InvoiceLine
{
$this->lineExtensionAmount = $lineExtensionAmount;
return $this;
}
/**
* @return TaxTotal
*/
public function getTaxTotal(): ?TaxTotal
{
return $this->taxTotal;
}
/**
* @param TaxTotal $taxTotal
* @return InvoiceLine
*/
public function setTaxTotal(?TaxTotal $taxTotal): InvoiceLine
{
$this->taxTotal = $taxTotal;
return $this;
}
/**
* @return string
*/
public function getNote(): ?string
{
return $this->note;
}
/**
* @param string $note
* @return InvoiceLine
*/
public function setNote(?string $note): InvoiceLine
{
$this->note = $note;
return $this;
}
/**
* @return InvoicePeriod
*/
public function getInvoicePeriod(): ?InvoicePeriod
{
return $this->invoicePeriod;
}
/**
* @param InvoicePeriod $invoicePeriod
* @return InvoiceLine
*/
public function setInvoicePeriod(?InvoicePeriod $invoicePeriod)
{
$this->invoicePeriod = $invoicePeriod;
return $this;
}
/**
* @return string
*/
public function getOrderLineReference(): ?OrderLineReference
{
return $this->orderLineReference;
}
/**
* @param ?string $orderLineReference
* @return OrderLineReference
*/
public function setOrderLineReference(?OrderLineReference $orderLineReference): InvoiceLine
{
$this->orderLineReference = $orderLineReference;
return $this;
}
/**
* @return Item
*/
public function getItem(): ?Item
{
return $this->item;
}
/**
* @param Item $item
* @return InvoiceLine
*/
public function setItem(Item $item): InvoiceLine
{
$this->item = $item;
return $this;
}
/**
* @return Price
*/
public function getPrice(): ?Price
{
return $this->price;
}
/**
* @param Price $price
* @return InvoiceLine
*/
public function setPrice(?Price $price): InvoiceLine
{
$this->price = $price;
return $this;
}
/**
* @return string
*/
public function getUnitCode(): ?string
{
return $this->unitCode;
}
/**
* @param string $unitCode
* @return InvoiceLine
*/
public function setUnitCode(?string $unitCode): InvoiceLine
{
$this->unitCode = $unitCode;
return $this;
}
/**
* @return string
*/
public function getUnitCodeListId(): ?string
{
return $this->unitCodeListId;
}
/**
* @param string $unitCodeListId
* @return InvoiceLine
*/
public function setUnitCodeListId(?string $unitCodeListId)
{
$this->unitCodeListId = $unitCodeListId;
return $this;
}
/**
* @return string
*/
public function getAccountingCostCode(): ?string
{
return $this->accountingCostCode;
}
/**
* @param string $accountingCostCode
* @return InvoiceLine
*/
public function setAccountingCostCode(?string $accountingCostCode): InvoiceLine
{
$this->accountingCostCode = $accountingCostCode;
return $this;
}
/**
* @return string
*/
public function getAccountingCost(): ?string
{
return $this->accountingCost;
}
/**
* @param string $accountingCost
* @return InvoiceLine
*/
public function setAccountingCost(?string $accountingCost): InvoiceLine
{
$this->accountingCost = $accountingCost;
return $this;
}
/**
* @return AllowanceCharge[]
*/
public function getAllowanceCharges(): ?array
{
return $this->allowanceCharges;
}
/**
* @param AllowanceCharge[] $allowanceCharges
* @return InvoiceLine
*/
public function setAllowanceCharges(array $allowanceCharges): InvoiceLine
{
$this->allowanceCharges = $allowanceCharges;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$writer->write([
Schema::CBC . 'ID' => $this->id
]);
if (!empty($this->getNote())) {
$writer->write([
Schema::CBC . 'Note' => $this->getNote()
]);
}
$invoicedQuantityAttributes = [
'unitCode' => $this->unitCode,
];
if (!empty($this->getUnitCodeListId())) {
$invoicedQuantityAttributes['unitCodeListID'] = $this->getUnitCodeListId();
}
$writer->write([
'name' => Schema::CBC .
($this->isCreditNoteLine ? 'CreditedQuantity' : 'InvoicedQuantity'),
'value' => NumberFormatter::format($this->invoicedQuantity),
'attributes' => $invoicedQuantityAttributes
]);
$writer->write([
'name' => Schema::CBC . 'LineExtensionAmount',
'value' => NumberFormatter::format($this->lineExtensionAmount ?? 0, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
]);
if ($this->accountingCostCode !== null) {
$writer->write([
Schema::CBC . 'AccountingCostCode' => $this->accountingCostCode
]);
}
if ($this->accountingCost !== null) {
$writer->write([
Schema::CBC . 'AccountingCost' => $this->accountingCost
]);
}
if ($this->invoicePeriod !== null) {
$writer->write([
Schema::CAC . 'InvoicePeriod' => $this->invoicePeriod
]);
}
if ($this->orderLineReference !== null) {
$writer->write([
Schema::CAC . 'OrderLineReference' => $this->orderLineReference
]);
}
if ($this->allowanceCharges !== null) {
foreach ($this->allowanceCharges as $allowanceCharge) {
$writer->write([
Schema::CAC . 'AllowanceCharge' => $allowanceCharge
]);
}
}
if ($this->taxTotal !== null) {
$writer->write([
Schema::CAC . 'TaxTotal' => $this->taxTotal
]);
}
if ($this->item !== null) {
$writer->write([
Schema::CAC . 'Item' => $this->item,
]);
}
if ($this->price !== null) {
$writer->write([
Schema::CAC . 'Price' => $this->price
]);
}
}
}

View file

@ -1,109 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use DateTime;
use InvalidArgumentException;
class InvoicePeriod implements XmlSerializable
{
private $startDate;
private $endDate;
private $descriptionCode;
/**
* @return DateTime
*/
public function getStartDate(): ?DateTime
{
return $this->startDate;
}
/**
* @param DateTime $startDate
* @return InvoicePeriod
*/
public function setStartDate(?DateTime $startDate): InvoicePeriod
{
$this->startDate = $startDate;
return $this;
}
/**
* @return DateTime
*/
public function getEndDate(): ?DateTime
{
return $this->endDate;
}
/**
* @param DateTime $endDate
* @return InvoicePeriod
*/
public function setEndDate(?DateTime $endDate): InvoicePeriod
{
$this->endDate = $endDate;
return $this;
}
/**
* @return int
*/
public function getDescriptionCode(): ?int
{
return $this->descriptionCode;
}
/**
* @param Integer $descriptionCode
* @return InvoicePeriod
*/
public function setDescriptionCode(?int $descriptionCode): InvoicePeriod
{
$this->descriptionCode = $descriptionCode;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->descriptionCode === null && ($this->startDate === null && $this->endDate === null)) {
throw new InvalidArgumentException('Missing startDate or endDate or descriptionCode');
}
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
if ($this->startDate != null) {
$writer->write([
Schema::CBC . 'StartDate' => $this->startDate->format('Y-m-d'),
]);
}
if ($this->endDate != null) {
$writer->write([
Schema::CBC . 'EndDate' => $this->endDate->format('Y-m-d'),
]);
}
if ($this->descriptionCode !== null) {
$writer->write([
Schema::CBC . 'DescriptionCode' => $this->descriptionCode,
]);
}
}
}

View file

@ -1,17 +0,0 @@
<?php
namespace NumNum\UBL;
/**
* All possible Unit Codes that can be used
* To extend, see also: https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL1001-inv/
*/
class InvoiceTypeCode
{
const INVOICE = 380;
const CREDIT_NOTE = 381;
const DEBIT_NOTE = 383;
const CORRECTED_INVOICE = 384;
const ADVANCE_INVOICE = 386;
const SELF_BILLING_INVOICE = 389;
}

View file

@ -1,205 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class Item implements XmlSerializable
{
private $description;
private $name;
private $buyersItemIdentification;
private $sellersItemIdentification;
private $standardItemIdentification;
private $standardItemIdentificationAttributes = [];
private $commodityClassification;
private $classifiedTaxCategory;
/**
* @return string
*/
public function getDescription(): ?string
{
return $this->description;
}
/**
* @param string $description
* @return Item
*/
public function setDescription(?string $description): Item
{
$this->description = $description;
return $this;
}
/**
* @return mixed
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param mixed $name
* @return Item
*/
public function setName(?string $name): Item
{
$this->name = $name;
return $this;
}
/**
* @return mixed
*/
public function getSellersItemIdentification(): ?string
{
return $this->sellersItemIdentification;
}
/**
* @param mixed $sellersItemIdentification
* @return Item
*/
public function setSellersItemIdentification(?string $sellersItemIdentification): Item
{
$this->sellersItemIdentification = $sellersItemIdentification;
return $this;
}
/**
* @return mixed
*/
public function getStandardItemIdentification(): ?string
{
return $this->standardItemIdentification;
}
/**
* @param mixed $standardItemIdentification
* @return Item
*/
public function setStandardItemIdentification(?string $standardItemIdentification, $attributes = null): Item
{
$this->standardItemIdentification = $standardItemIdentification;
if (isset($attributes)) {
$this->standardItemIdentificationAttributes = $attributes;
}
return $this;
}
/**
* @return CommodityClassification
*/
public function getCommodityClassification(): ?CommodityClassification
{
return $this->commodityClassification;
}
/**
* @param mixed $commodityClassification
* @return Item
*/
public function setCommodityClassification(CommodityClassification $commodityClassification): Item
{
$this->commodityClassification = $commodityClassification;
return $this;
}
/**
* @return mixed
*/
public function getBuyersItemIdentification(): ?string
{
return $this->buyersItemIdentification;
}
/**
* @param mixed $buyersItemIdentification
* @return Item
*/
public function setBuyersItemIdentification(?string $buyersItemIdentification): Item
{
$this->buyersItemIdentification = $buyersItemIdentification;
return $this;
}
/**
* @return ClassifiedTaxCategory
*/
public function getClassifiedTaxCategory(): ?ClassifiedTaxCategory
{
return $this->classifiedTaxCategory;
}
/**
* @param ClassifiedTaxCategory $classifiedTaxCategory
* @return Item
*/
public function setClassifiedTaxCategory(?ClassifiedTaxCategory $classifiedTaxCategory): Item
{
$this->classifiedTaxCategory = $classifiedTaxCategory;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if (!empty($this->getDescription())) {
$writer->write([
Schema::CBC . 'Description' => $this->description
]);
}
$writer->write([
Schema::CBC . 'Name' => $this->name
]);
if (!empty($this->getBuyersItemIdentification())) {
$writer->write([
Schema::CAC . 'BuyersItemIdentification' => [
Schema::CBC . 'ID' => $this->buyersItemIdentification
],
]);
}
if (!empty($this->getSellersItemIdentification())) {
$writer->write([
Schema::CAC . 'SellersItemIdentification' => [
Schema::CBC . 'ID' => $this->sellersItemIdentification
],
]);
}
if (!empty($this->getStandardItemIdentification())) {
$writer->write([
Schema::CAC . 'StandardItemIdentification' => [
Schema::CBC . 'ID' => [
'value' => $this->standardItemIdentification,
'attributes' => $this->standardItemIdentificationAttributes
]
]
]);
}
if (!empty($this->getCommodityClassification())) {
$writer->write([
Schema::CAC . 'CommodityClassification' => $this->commodityClassification
]);
}
if (!empty($this->getClassifiedTaxCategory())) {
$writer->write([
Schema::CAC . 'ClassifiedTaxCategory' => $this->classifiedTaxCategory
]);
}
}
}

View file

@ -1,99 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class LegalEntity implements XmlSerializable
{
private $registrationName;
private $companyId;
private $companyIdAttributes;
private $companyLegalForm;
private $companyLegalFormAttributes;
/**
* @return string
*/
public function getRegistrationName(): ?string
{
return $this->registrationName;
}
/**
* @param string $registrationName
* @return LegalEntity
*/
public function setRegistrationName(?string $registrationName): LegalEntity
{
$this->registrationName = $registrationName;
return $this;
}
/**
* @return string
*/
public function getCompanyId(): ?string
{
return $this->companyId;
}
/**
* @param string $companyId
* @return LegalEntity
*/
public function setCompanyId(?string $companyId, $attributes = null): LegalEntity
{
$this->companyId = $companyId;
if (isset($attributes)) {
$this->companyIdAttributes = $attributes;
}
return $this;
}
/**
*
* @param string $legalForm
* @return LegalEntity
*/
public function setCompanyLegalForm(?string $legalForm, $attributes = null) : LegalEntity
{
$this->companyLegalForm = $legalForm;
if (isset($attributes)) {
$this->companyLegalFormAttributes = $attributes;
}
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$writer->write([
Schema::CBC . 'RegistrationName' => $this->registrationName,
]);
if ($this->companyId !== null) {
$writer->write([
[
'name' => Schema::CBC . 'CompanyID',
'value' => $this->companyId,
'attributes' => $this->companyIdAttributes,
],
]);
}
if ($this->companyLegalForm !== null) {
$writer->write([
[
'name' => Schema::CBC . 'CompanyLegalForm',
'value' => $this->companyLegalForm,
'attributes' => $this->companyLegalFormAttributes
]
]);
}
}
}

View file

@ -1,245 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class LegalMonetaryTotal implements XmlSerializable
{
private $lineExtensionAmount = 0;
private $taxExclusiveAmount = 0;
private $taxInclusiveAmount = 0;
private $allowanceTotalAmount = 0;
private $chargeTotalAmount = 0;
private $prepaidAmount;
private $payableAmount = 0;
private $payableRoundingAmount;
/**
* @return float
*/
public function getLineExtensionAmount(): ?float
{
return $this->lineExtensionAmount;
}
/**
* @param float $lineExtensionAmount
* @return LegalMonetaryTotal
*/
public function setLineExtensionAmount(?float $lineExtensionAmount): LegalMonetaryTotal
{
$this->lineExtensionAmount = $lineExtensionAmount;
return $this;
}
/**
* @return float
*/
public function getTaxExclusiveAmount(): ?float
{
return $this->taxExclusiveAmount;
}
/**
* @param float $taxExclusiveAmount
* @return LegalMonetaryTotal
*/
public function setTaxExclusiveAmount(?float $taxExclusiveAmount): LegalMonetaryTotal
{
$this->taxExclusiveAmount = $taxExclusiveAmount;
return $this;
}
/**
* @return float
*/
public function getTaxInclusiveAmount(): ?float
{
return $this->taxInclusiveAmount;
}
/**
* @param float $taxInclusiveAmount
* @return LegalMonetaryTotal
*/
public function setTaxInclusiveAmount(?float $taxInclusiveAmount): LegalMonetaryTotal
{
$this->taxInclusiveAmount = $taxInclusiveAmount;
return $this;
}
/**
* @return float
*/
public function getAllowanceTotalAmount(): ?float
{
return $this->allowanceTotalAmount;
}
/**
* @param float $allowanceTotalAmount
* @return LegalMonetaryTotal
*/
public function setAllowanceTotalAmount(?float $allowanceTotalAmount): LegalMonetaryTotal
{
$this->allowanceTotalAmount = $allowanceTotalAmount;
return $this;
}
/**
* @return float
*/
public function getChargeTotalAmount(): ?float
{
return $this->chargeTotalAmount;
}
/**
* @param float $chargeTotalAmount
* @return LegalMonetaryTotal
*/
public function setChargeTotalAmount(?float $chargeTotalAmount): LegalMonetaryTotal
{
$this->chargeTotalAmount = $chargeTotalAmount;
return $this;
}
/**
* @return ?float
*/
public function getPrepaidAmount(): ?float
{
return $this->prepaidAmount;
}
/**
* @param ?float $prepaidAmount
* @return LegalMonetaryTotal
*/
public function setPrepaidAmount(?float $prepaidAmount): LegalMonetaryTotal
{
$this->prepaidAmount = $prepaidAmount;
return $this;
}
/**
* @return float
*/
public function getPayableAmount(): ?float
{
return $this->payableAmount;
}
/**
* @param float $payableAmount
* @return LegalMonetaryTotal
*/
public function setPayableAmount(?float $payableAmount): LegalMonetaryTotal
{
$this->payableAmount = $payableAmount;
return $this;
}
public function getPayableRoundingAmount(): ?float
{
return $this->payableRoundingAmount;
}
/**
* @param float|null $payableRoundingAmount
* @return LegalMonetaryTotal
*/
public function setPayableRoundingAmount(?float $payableRoundingAmount): LegalMonetaryTotal
{
$this->payableRoundingAmount = $payableRoundingAmount;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$writer->write([
[
'name' => Schema::CBC . 'LineExtensionAmount',
'value' => NumberFormatter::format($this->lineExtensionAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'TaxExclusiveAmount',
'value' => NumberFormatter::format($this->taxExclusiveAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'TaxInclusiveAmount',
'value' => NumberFormatter::format($this->taxInclusiveAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'AllowanceTotalAmount',
'value' => NumberFormatter::format($this->allowanceTotalAmount,2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'ChargeTotalAmount',
'value' => NumberFormatter::format($this->chargeTotalAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
]
]);
if ($this->prepaidAmount !== null) {
$writer->write([
[
'name' => Schema::CBC . 'PrepaidAmount',
'value' => NumberFormatter::format($this->prepaidAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
]
]);
}
if ($this->payableRoundingAmount !== null) {
$writer->write([
[
'name' => Schema::CBC . 'PayableRoundingAmount',
'value' => NumberFormatter::format($this->payableRoundingAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
]);
}
$writer->write([
[
'name' => Schema::CBC . 'PayableAmount',
'value' => NumberFormatter::format($this->payableAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
]);
}
}

View file

@ -1,33 +0,0 @@
<?php
namespace NumNum\UBL;
class NumberFormatter
{
/**
* Format numbers and optionally preserve decimals
*
* @param int|float $number
* @param int|null $decimals
* @param string $decimalSeparator
* @param string $thousandsSeparator
* @return void
*/
public static function format($number, ?int $decimals = null, string $decimalSeparator = '.', string $thousandsSeparator = '')
{
if ($decimals == null) {
// Convert to string to detect decimals
// Get the current decimal point character according to the locale
$locale = localeconv();
$decimalPoint = $locale['decimal_point'] ?? '.';
// Convert to string to detect decimals
$parts = explode($decimalPoint, (string)$number);
// Count decimals, if any
$decimals = isset($parts[1]) ? strlen(rtrim($parts[1], '0')) : 0;
}
return number_format($number, $decimals, $decimalSeparator, $thousandsSeparator);
}
}

View file

@ -1,55 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use InvalidArgumentException;
use Sabre\Xml\XmlSerializable;
/**
* @see https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-InvoiceLine/cac-OrderLineReference/
*/
class OrderLineReference implements XmlSerializable
{
private $lineId;
/**
* @return string
*/
public function getLineId(): ?string
{
return $this->lineId;
}
/**
* @param string $lineId
* @return OrderLineReference
*/
public function setLineId(?string $lineId): OrderLineReference
{
$this->lineId = $lineId;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @return void
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
*/
public function validate()
{
if ($this->lineId === null) {
throw new InvalidArgumentException('Missing OrderLineReference LineID');
}
}
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([
Schema::CBC . 'LineID' => $this->lineId
]);
}
}

View file

@ -1,89 +0,0 @@
<?php
namespace NumNum\UBL;
use DateTime;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class OrderReference implements XmlSerializable
{
private $id;
private $salesOrderId;
private $issueDate;
/**
* @return string
*/
public function getId(): string
{
return $this->id;
}
/**
* @param string $id
* @return OrderReference
*/
public function setId(string $id): OrderReference
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getSalesOrderId(): string
{
return $this->salesOrderId;
}
/**
* @return DateTime
*/
public function getIssueDate(): ?DateTime
{
return $this->issueDate;
}
/**
* @param DateTime $issueDate
* @return OrderReference
*/
public function setIssueDate(DateTime $issueDate): OrderReference
{
$this->issueDate = $issueDate;
return $this;
}
/**
* @param string $salesOrderId
* @return OrderReference
*/
public function setSalesOrderId(string $salesOrderId): OrderReference
{
$this->salesOrderId = $salesOrderId;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->id !== null) {
$writer->write([Schema::CBC . 'ID' => $this->id]);
}
if ($this->salesOrderId !== null) {
$writer->write([Schema::CBC . 'SalesOrderID' => $this->salesOrderId]);
}
if ($this->issueDate !== null) {
$writer->write([
Schema::CBC . 'IssueDate' => $this->issueDate->format('Y-m-d'),
]);
}
}
}

View file

@ -1,276 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class Party implements XmlSerializable
{
private $name;
private $partyIdentificationId;
private $partyIdentificationSchemeId;
private $partyIdentificationSchemeName;
private $postalAddress;
private $physicalLocation;
private $contact;
private $partyTaxScheme;
private $legalEntity;
private $endpointID;
private $endpointID_schemeID;
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return Party
*/
public function setName(?string $name): Party
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getPartyIdentificationId(): ?string
{
return $this->partyIdentificationId;
}
/**
* @param string $partyIdentificationId
* @return Party
*/
public function setPartyIdentificationId(?string $partyIdentificationId): Party
{
$this->partyIdentificationId = $partyIdentificationId;
return $this;
}
/**
* @return string
*/
public function getPartyIdentificationSchemeId(): ?string
{
return $this->partyIdentificationSchemeId;
}
/**
* @param string $partyIdentificationSchemeId
* @return Party
*/
public function setPartyIdentificationSchemeId(?string $partyIdentificationSchemeId): Party
{
$this->partyIdentificationSchemeId = $partyIdentificationSchemeId;
return $this;
}
/**
* @return string
*/
public function getPartyIdentificationSchemeName(): ?string
{
return $this->partyIdentificationSchemeName;
}
/**
* @param string $partyIdentificationSchemeName
* @return Party
*/
public function setPartyIdentificationSchemeName(?string $partyIdentificationSchemeName): Party
{
$this->partyIdentificationSchemeName = $partyIdentificationSchemeName;
return $this;
}
/**
* @return Address
*/
public function getPostalAddress(): ?Address
{
return $this->postalAddress;
}
/**
* @param Address $postalAddress
* @return Party
*/
public function setPostalAddress(?Address $postalAddress): Party
{
$this->postalAddress = $postalAddress;
return $this;
}
/**
* @return LegalEntity
*/
public function getLegalEntity(): ?LegalEntity
{
return $this->legalEntity;
}
/**
* @param LegalEntity $legalEntity
* @return Party
*/
public function setLegalEntity(?LegalEntity $legalEntity): Party
{
$this->legalEntity = $legalEntity;
return $this;
}
/**
* @return Address
*/
public function getPhysicalLocation(): ?Address
{
return $this->physicalLocation;
}
/**
* @param Address $physicalLocation
* @return Party
*/
public function setPhysicalLocation(?Address $physicalLocation): Party
{
$this->physicalLocation = $physicalLocation;
return $this;
}
/**
* @return PartyTaxScheme
*/
public function getPartyTaxScheme(): ?PartyTaxScheme
{
return $this->partyTaxScheme;
}
/**
* @param PartyTaxScheme $partyTaxScheme
* @return Party
*/
public function setPartyTaxScheme(PartyTaxScheme $partyTaxScheme)
{
$this->partyTaxScheme = $partyTaxScheme;
return $this;
}
/**
* @return Contact
*/
public function getContact(): ?Contact
{
return $this->contact;
}
/**
* @param Contact $contact
* @return Party
*/
public function setContact(?Contact $contact): Party
{
$this->contact = $contact;
return $this;
}
/**
* @param $endpointID
* @param int|string $schemeID See list at https://docs.peppol.eu/poacc/billing/3.0/codelist/eas/
* @return Party
*/
public function setEndpointID($endpointID, $schemeID): Party
{
$this->endpointID = $endpointID;
$this->endpointID_schemeID = $schemeID;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->endpointID !== null && $this->endpointID_schemeID !== null) {
$writer->write([
[
'name' => Schema::CBC . 'EndpointID',
'value' => $this->endpointID,
'attributes' => [
'schemeID' => is_numeric($this->endpointID_schemeID)
? sprintf('%04d', +$this->endpointID_schemeID)
: $this->endpointID_schemeID
]
]
]);
}
if ($this->partyIdentificationId !== null) {
$partyIdentificationAttributes = [];
if (!empty($this->getPartyIdentificationSchemeId())) {
$partyIdentificationAttributes['schemeID'] = $this->getPartyIdentificationSchemeId();
}
if (!empty($this->getPartyIdentificationSchemeName())) {
$partyIdentificationAttributes['schemeName'] = $this->getPartyIdentificationSchemeName();
}
$writer->write([
Schema::CAC . 'PartyIdentification' => [
[
'name' => Schema::CBC . 'ID',
'value' => $this->partyIdentificationId,
'attributes' => $partyIdentificationAttributes
]
],
]);
}
if ($this->name !== null) {
$writer->write([
Schema::CAC . 'PartyName' => [
Schema::CBC . 'Name' => $this->name
]
]);
}
$writer->write([
Schema::CAC . 'PostalAddress' => $this->postalAddress
]);
if ($this->physicalLocation !== null) {
$writer->write([
Schema::CAC . 'PhysicalLocation' => [Schema::CAC . 'Address' => $this->physicalLocation]
]);
}
if ($this->partyTaxScheme !== null) {
$writer->write([
Schema::CAC . 'PartyTaxScheme' => $this->partyTaxScheme
]);
}
if ($this->legalEntity !== null) {
$writer->write([
Schema::CAC . 'PartyLegalEntity' => $this->legalEntity
]);
}
if ($this->contact !== null) {
$writer->write([
Schema::CAC . 'Contact' => $this->contact
]);
}
}
}

View file

@ -1,107 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use InvalidArgumentException;
class PartyTaxScheme implements XmlSerializable
{
private $registrationName;
private $companyId;
private $taxScheme;
/**
* @return string
*/
public function getRegistrationName(): ?string
{
return $this->registrationName;
}
/**
* @param string $registrationName
* @return PartyTaxScheme
*/
public function setRegistrationName($registrationName): PartyTaxScheme
{
$this->registrationName = $registrationName;
return $this;
}
/**
* @return string
*/
public function getCompanyId(): ?string
{
return $this->companyId;
}
/**
* @param string $companyId
* @return PartyTaxScheme
*/
public function setCompanyId($companyId): PartyTaxScheme
{
$this->companyId = $companyId;
return $this;
}
/**
* @param TaxScheme $taxScheme.
* @return mixed
*/
public function getTaxScheme(): ?TaxScheme
{
return $this->taxScheme;
}
/**
* @param TaxScheme $taxScheme
* @return PartyTaxScheme
*/
public function setTaxScheme(TaxScheme $taxScheme): PartyTaxScheme
{
$this->taxScheme = $taxScheme;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @return void
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
*/
public function validate()
{
if ($this->taxScheme === null) {
throw new InvalidArgumentException('Missing TaxScheme');
}
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->registrationName !== null) {
$writer->write([
Schema::CBC . 'RegistrationName' => $this->registrationName
]);
}
if ($this->companyId !== null) {
$writer->write([
Schema::CBC . 'CompanyID' => $this->companyId
]);
}
$writer->write([
Schema::CAC . 'TaxScheme' => $this->taxScheme
]);
}
}

View file

@ -1,91 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class PayeeFinancialAccount implements XmlSerializable
{
private $id;
private $name;
private $financialInstitutionBranch;
/**
* @return string
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string $id
* @return PayeeFinancialAccount
*/
public function setId(?string $id): PayeeFinancialAccount
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return PayeeFinancialAccount
*/
public function setName(?string $name): PayeeFinancialAccount
{
$this->name = $name;
return $this;
}
/**
* @return FinancialInstitutionBranch
*/
public function getFinancialInstitutionBranch(): ?FinancialInstitutionBranch
{
return $this->financialInstitutionBranch;
}
/**
* @param FinancialInstitutionBranch $financialInstitutionBranch
* @return PayeeFinancialAccount
*/
public function setFinancialInstitutionBranch(?FinancialInstitutionBranch $financialInstitutionBranch): PayeeFinancialAccount
{
$this->financialInstitutionBranch = $financialInstitutionBranch;
return $this;
}
public function xmlSerialize(Writer $writer): void
{
$writer->write([
'name' => Schema::CBC . 'ID',
'value' => $this->id,
'attributes' => [
//'schemeID' => 'IBAN'
]
]);
if ($this->getName() !== null) {
$writer->write([
Schema::CBC . 'Name' => $this->getName()
]);
}
if ($this->getFinancialInstitutionBranch() !== null) {
$writer->write([
Schema::CAC . 'FinancialInstitutionBranch' => $this->getFinancialInstitutionBranch()
]);
}
}
}

View file

@ -1,172 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use DateTime;
class PaymentMeans implements XmlSerializable
{
public $xmlTagName = 'PaymentMeans';
private $paymentMeansCode = UNCL4461::INSTRUMENT_NOT_DEFINED;
private $paymentMeansCodeAttributes = [
'listID' => 'UN/ECE 4461',
'listName' => 'Payment Means',
'listURI' => 'http://docs.oasis-open.org/ubl/os-UBL-2.0-update/cl/gc/default/PaymentMeansCode-2.0.gc'];
private $paymentDueDate;
private $instructionId;
private $instructionNote;
private $paymentId;
private $payeeFinancialAccount;
/**
* @return string
*/
public function getPaymentMeansCode(): ?string
{
return $this->paymentMeansCode;
}
/**
* @param string $paymentMeansCode
* @return PaymentMeans
*/
public function setPaymentMeansCode(?string $paymentMeansCode, $attributes = null): PaymentMeans
{
$this->paymentMeansCode = $paymentMeansCode;
if (isset($attributes)) {
$this->paymentMeansCodeAttributes = $attributes;
}
return $this;
}
/**
* @return DateTime
*/
public function getPaymentDueDate(): ?DateTime
{
return $this->paymentDueDate;
}
/**
* @param DateTime $paymentDueDate
* @return PaymentMeans
*/
public function setPaymentDueDate(?DateTime $paymentDueDate): PaymentMeans
{
$this->paymentDueDate = $paymentDueDate;
return $this;
}
/**
* @return string
*/
public function getInstructionId(): ?string
{
return $this->instructionId;
}
/**
* @param string $instructionId
* @return PaymentMeans
*/
public function setInstructionId(?string $instructionId): PaymentMeans
{
$this->instructionId = $instructionId;
return $this;
}
/**
* @return string
*/
public function getInstructionNote(): ?string
{
return $this->instructionNote;
}
/**
* @param string $instructionNote
* @return PaymentMeans
*/
public function setInstructionNote(?string $instructionNote): PaymentMeans
{
$this->instructionNote = $instructionNote;
return $this;
}
/**
* @return string
*/
public function getPaymentId(): ?string
{
return $this->paymentId;
}
/**
* @param string $paymentId
* @return PaymentMeans
*/
public function setPaymentId(?string $paymentId): PaymentMeans
{
$this->paymentId = $paymentId;
return $this;
}
/**
* @return mixed
*/
public function getPayeeFinancialAccount(): ?PayeeFinancialAccount
{
return $this->payeeFinancialAccount;
}
/**
* @param mixed $payeeFinancialAccount
* @return PaymentMeans
*/
public function setPayeeFinancialAccount(?PayeeFinancialAccount $payeeFinancialAccount): PaymentMeans
{
$this->payeeFinancialAccount = $payeeFinancialAccount;
return $this;
}
public function xmlSerialize(Writer $writer): void
{
$writer->write([
'name' => Schema::CBC . 'PaymentMeansCode',
'value' => $this->paymentMeansCode,
'attributes' => $this->paymentMeansCodeAttributes
]);
if ($this->getPaymentDueDate() !== null) {
$writer->write([
Schema::CBC . 'PaymentDueDate' => $this->getPaymentDueDate()->format('Y-m-d')
]);
}
if ($this->getInstructionId() !== null) {
$writer->write([
Schema::CBC . 'InstructionID' => $this->getInstructionId()
]);
}
if ($this->getInstructionNote() !== null) {
$writer->write([
Schema::CBC . 'InstructionNote' => $this->getInstructionNote()
]);
}
if ($this->getPaymentId() !== null) {
$writer->write([
Schema::CBC . 'PaymentID' => $this->getPaymentId()
]);
}
if ($this->getPayeeFinancialAccount() !== null) {
$writer->write([
Schema::CAC . 'PayeeFinancialAccount' => $this->getPayeeFinancialAccount()
]);
}
}
}

View file

@ -1,113 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class PaymentTerms implements XmlSerializable
{
private $note;
private $settlementDiscountPercent;
private $amount;
private $settlementPeriod;
/**
* @return string
*/
public function getNote(): ?string
{
return $this->note;
}
/**
* @param string $note
* @return PaymentTerms
*/
public function setNote(?string $note): PaymentTerms
{
$this->note = $note;
return $this;
}
/**
* @return float
*/
public function getSettlementDiscountPercent(): ?float
{
return $this->settlementDiscountPercent;
}
/**
* @param float $settlementDiscountPercent
* @return PaymentTerms
*/
public function setSettlementDiscountPercent(?float $settlementDiscountPercent): PaymentTerms
{
$this->settlementDiscountPercent = $settlementDiscountPercent;
return $this;
}
/**
* @return float
*/
public function getAmount(): ?float
{
return $this->amount;
}
/**
* @param float $amount
* @return PaymentTerms
*/
public function setAmount(?float $amount): PaymentTerms
{
$this->amount = $amount;
return $this;
}
/**
* @return SettlementPeriod
*/
public function getSettlementPeriod(): ?SettlementPeriod
{
return $this->settlementPeriod;
}
/**
* @param SettlementPeriod $settlementPeriod
* @return PaymentTerms
*/
public function setSettlementPeriod(?SettlementPeriod $settlementPeriod): PaymentTerms
{
$this->settlementPeriod = $settlementPeriod;
return $this;
}
public function xmlSerialize(Writer $writer): void
{
if ($this->note !== null) {
$writer->write([ Schema::CBC . 'Note' => $this->note ]);
}
if ($this->settlementDiscountPercent !== null) {
$writer->write([ Schema::CBC . 'SettlementDiscountPercent' => $this->settlementDiscountPercent ]);
}
if ($this->amount !== null) {
$writer->write([
[
'name' => Schema::CBC . 'Amount',
'value' => NumberFormatter::format($this->amount, 2),
'attributes' => [
'currencyID' => 'EUR'
]
]
]);
}
if ($this->settlementPeriod !== null) {
$writer->write([ Schema::CAC . 'SettlementPeriod' => $this->settlementPeriod ]);
}
}
}

View file

@ -1,145 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class Price implements XmlSerializable
{
private $priceAmount;
private $baseQuantity;
private $unitCode = UnitCode::UNIT;
private $unitCodeListId;
private $allowanceCharge;
/**
* @return float
*/
public function getPriceAmount(): ?float
{
return $this->priceAmount;
}
/**
* @param float $priceAmount
* @return Price
*/
public function setPriceAmount(?float $priceAmount): Price
{
$this->priceAmount = $priceAmount;
return $this;
}
/**
* @return float
*/
public function getBaseQuantity(): ?float
{
return $this->baseQuantity;
}
/**
* @param float $baseQuantity
* @return Price
*/
public function setBaseQuantity(?float $baseQuantity): Price
{
$this->baseQuantity = $baseQuantity;
return $this;
}
/**
* @return string
*/
public function getUnitCode(): ?string
{
return $this->unitCode;
}
/**
* @param string $unitCode
* See also: src/UnitCode.php
* @return Price
*/
public function setUnitCode(?string $unitCode): Price
{
$this->unitCode = $unitCode;
return $this;
}
/**
* @return string
*/
public function getUnitCodeListId(): ?string
{
return $this->unitCodeListId;
}
/**
* @param string $unitCodeListId
* @return Price
*/
public function setUnitCodeListId(?string $unitCodeListId): Price
{
$this->unitCodeListId = $unitCodeListId;
return $this;
}
/**
* @return AllowanceCharge
*/
public function getAllowanceCharge(): ?AllowanceCharge
{
return $this->allowanceCharge;
}
/**
* @param AllowanceCharge $allowanceCharge
* @return Price
*/
public function setAllowanceCharge(?AllowanceCharge $allowanceCharge): Price
{
$this->allowanceCharge = $allowanceCharge;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$baseQuantityAttributes = [
'unitCode' => $this->unitCode,
];
if (!empty($this->getUnitCodeListId())) {
$baseQuantityAttributes['unitCodeListID'] = $this->getUnitCodeListId();
}
$writer->write([
[
'name' => Schema::CBC . 'PriceAmount',
'value' => NumberFormatter::format($this->priceAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'BaseQuantity',
'value' => NumberFormatter::format($this->baseQuantity),
'attributes' => $baseQuantityAttributes
]
]);
if ($this->allowanceCharge !== null) {
$writer->write([
Schema::CAC . 'AllowanceCharge' => $this->allowanceCharge,
]);
}
}
}

View file

@ -1,43 +0,0 @@
<?php
namespace NumNum\UBL;
use DateTime;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class ProjectReference implements XmlSerializable
{
private $id;
/**
* @return string
*/
public function getId(): string
{
return $this->id;
}
/**
* @param string $id
* @return ProjectReference
*/
public function setId(string $id): ProjectReference
{
$this->id = $id;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
if ($this->id !== null) {
$writer->write([Schema::CBC . 'ID' => $this->id]);
}
}
}

View file

@ -1,9 +0,0 @@
<?php
namespace NumNum\UBL;
class Schema
{
const CBC = '{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}';
const CAC = '{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}';
}

View file

@ -1,93 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use DateTime;
use InvalidArgumentException;
class SettlementPeriod implements XmlSerializable
{
private $startDate;
private $endDate;
/**
* @return DateTime
*/
public function getStartDate(): ?DateTime
{
return $this->startDate;
}
/**
* @param DateTime $startDate
* @return SettlementPeriod
*/
public function setStartDate(DateTime $startDate): SettlementPeriod
{
$this->startDate = $startDate;
return $this;
}
/**
* @return DateTime
*/
public function getEndDate(): ?DateTime
{
return $this->endDate;
}
/**
* @param DateTime $endDate
* @return SettlementPeriod
*/
public function setEndDate(DateTime $endDate): SettlementPeriod
{
$this->endDate = $endDate;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->startDate === null) {
throw new InvalidArgumentException('Missing startDate');
}
if ($this->endDate === null) {
throw new InvalidArgumentException('Missing endDate');
}
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([
Schema::CBC . 'StartDate' => $this->startDate->format('Y-m-d'),
Schema::CBC . 'EndDate' => $this->endDate->format('Y-m-d'),
]);
$writer->write([
[
'name' => Schema::CBC . 'DurationMeasure',
'value' => $this->endDate->diff($this->startDate)->format('%d'),
'attributes' => [
'unitCode' => 'DAY'
]
]
]);
}
}

View file

@ -1,208 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use InvalidArgumentException;
class TaxCategory implements XmlSerializable
{
private $id;
private $idAttributes = [
'schemeID' => UNCL5305::UNCL5305,
'schemeName' => 'Duty or tax or fee category'
];
private $name;
private $percent;
private $taxScheme;
private $taxExemptionReason;
private $taxExemptionReasonCode;
/**
* @return string
*/
public function getId(): ?string
{
if (!empty($this->id)) {
return $this->id;
}
// Default behaviour, overrrule by using setId()
if ($this->getPercent() !== null) {
return ($this->getPercent() > 0)
? UNCL5305::STANDARD_RATE
: UNCL5305::ZERO_RATED_GOODS;
}
return null;
}
/**
* @param string $id
* @param array $attributes
* @return TaxCategory
*/
public function setId(?string $id, $attributes = null): TaxCategory
{
$this->id = $id;
if (isset($attributes)) {
$this->idAttributes = $attributes;
}
return $this;
}
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return TaxCategory
*/
public function setName(?string $name): TaxCategory
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getPercent(): ?float
{
return $this->percent;
}
/**
* @param string $percent
* @return TaxCategory
*/
public function setPercent(?float $percent): TaxCategory
{
$this->percent = $percent;
return $this;
}
/**
* @return string
*/
public function getTaxScheme(): ?TaxScheme
{
return $this->taxScheme;
}
/**
* @param TaxScheme $taxScheme
* @return TaxCategory
*/
public function setTaxScheme(?TaxScheme $taxScheme): TaxCategory
{
$this->taxScheme = $taxScheme;
return $this;
}
/**
* @return string
*/
public function getTaxExemptionReason(): ?string
{
return $this->taxExemptionReason;
}
/**
* @param string $taxExemptionReason
* @return TaxCategory
*/
public function setTaxExemptionReason(?string $taxExemptionReason): TaxCategory
{
$this->taxExemptionReason = $taxExemptionReason;
return $this;
}
/**
* @return string
*/
public function getTaxExemptionReasonCode(): ?string
{
return $this->taxExemptionReasonCode;
}
/**
* @param string $taxExemptionReason
* @return TaxCategory
*/
public function setTaxExemptionReasonCode(?string $taxExemptionReasonCode): TaxCategory
{
$this->taxExemptionReasonCode = $taxExemptionReasonCode;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->getId() === null) {
throw new InvalidArgumentException('Missing taxcategory id');
}
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([
[
'name' => Schema::CBC . 'ID',
'value' => $this->getId(),
'attributes' => $this->idAttributes,
],
]);
if ($this->name !== null) {
$writer->write([
Schema::CBC . 'Name' => $this->name,
]);
}
if ($this->percent !== null) {
$writer->write([
Schema::CBC . 'Percent' => number_format($this->percent, 2, '.', ''),
]);
}
if ($this->taxExemptionReasonCode !== null) {
$writer->write([
Schema::CBC . 'TaxExemptionReasonCode' => $this->taxExemptionReasonCode,
]);
}
if ($this->taxExemptionReason !== null) {
$writer->write([
Schema::CBC . 'TaxExemptionReason' => $this->taxExemptionReason,
]);
}
if ($this->taxScheme !== null) {
$writer->write([Schema::CAC . 'TaxScheme' => $this->taxScheme]);
} else {
$writer->write([
Schema::CAC . 'TaxScheme' => null,
]);
}
}
}

View file

@ -1,114 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
class TaxScheme implements XmlSerializable
{
private $id;
private $name;
private $taxTypeCode;
private $currencyCode;
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* @param string $id
* @return TaxScheme
*/
public function setId(string $id): TaxScheme
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return TaxScheme
*/
public function setName(?string $name)
{
$this->name = $name;
return $this;
}
/**
* @return string
*/
public function getTaxTypeCode(): ?string
{
return $this->taxTypeCode;
}
/**
* @param string $taxTypeCode
* @return TaxScheme
*/
public function setTaxTypeCode(?string $taxTypeCode)
{
$this->taxTypeCode = $taxTypeCode;
return $this;
}
/**
* @return string
*/
public function getCurrencyCode(): ?string
{
return $this->currencyCode;
}
/**
* @param string $currencyCode
* @return TaxScheme
*/
public function setCurrencyCode(?string $currencyCode)
{
$this->currencyCode = $currencyCode;
return $this;
}
/**
* The xmlSerialize method is called during xml writing.
*
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$writer->write([
Schema::CBC . 'ID' => $this->id
]);
if ($this->name !== null) {
$writer->write([
Schema::CBC . 'Name' => $this->name
]);
}
if ($this->taxTypeCode !== null) {
$writer->write([
Schema::CBC . 'TaxTypeCode' => $this->taxTypeCode
]);
}
if ($this->currencyCode !== null) {
$writer->write([
Schema::CBC . 'CurrencyCode' => $this->currencyCode
]);
}
}
}

View file

@ -1,146 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use InvalidArgumentException;
class TaxSubTotal implements XmlSerializable
{
private $taxableAmount;
private $taxAmount;
private $taxCategory;
private $percent;
/**
* @return mixed
*/
public function getTaxableAmount(): ?float
{
return $this->taxableAmount;
}
/**
* @param mixed $taxableAmount
* @return TaxSubTotal
*/
public function setTaxableAmount(?float $taxableAmount): TaxSubTotal
{
$this->taxableAmount = $taxableAmount;
return $this;
}
/**
* @return mixed
*/
public function getTaxAmount(): ?float
{
return $this->taxAmount;
}
/**
* @param mixed $taxAmount
* @return TaxSubTotal
*/
public function setTaxAmount(?float $taxAmount): TaxSubTotal
{
$this->taxAmount = $taxAmount;
return $this;
}
/**
* @return TaxCategory
*/
public function getTaxCategory(): ?TaxCategory
{
return $this->taxCategory;
}
/**
* @param TaxCategory $taxCategory
* @return TaxSubTotal
*/
public function setTaxCategory(TaxCategory $taxCategory): TaxSubTotal
{
$this->taxCategory = $taxCategory;
return $this;
}
/**
* @return float
*/
public function getPercent(): ?float
{
return $this->percent;
}
/**
* @param float $percent
* @return TaxSubTotal
*/
public function setPercent(?float $percent): TaxSubTotal
{
$this->percent = $percent;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->taxableAmount === null) {
throw new InvalidArgumentException('Missing taxsubtotal taxableAmount');
}
if ($this->taxAmount === null) {
throw new InvalidArgumentException('Missing taxsubtotal taxamount');
}
if ($this->taxCategory === null) {
throw new InvalidArgumentException('Missing taxsubtotal taxcategory');
}
}
/**
* The xmlSerialize method is called during xml writing.
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([
[
'name' => Schema::CBC . 'TaxableAmount',
'value' => NumberFormatter::format($this->taxableAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
[
'name' => Schema::CBC . 'TaxAmount',
'value' => NumberFormatter::format($this->taxAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
]
]);
if ($this->percent !== null) {
$writer->write([
Schema::CBC . 'Percent' => $this->percent
]);
}
$writer->write([
Schema::CAC . 'TaxCategory' => $this->taxCategory
]);
}
}

View file

@ -1,87 +0,0 @@
<?php
namespace NumNum\UBL;
use Sabre\Xml\Writer;
use Sabre\Xml\XmlSerializable;
use InvalidArgumentException;
class TaxTotal implements XmlSerializable
{
private $taxAmount;
private $taxSubTotals = [];
/**
* @return mixed
*/
public function getTaxAmount(): ?float
{
return $this->taxAmount;
}
/**
* @param mixed $taxAmount
* @return TaxTotal
*/
public function setTaxAmount(?float $taxAmount): TaxTotal
{
$this->taxAmount = $taxAmount;
return $this;
}
/**
* @return array
*/
public function getTaxSubTotals(): array
{
return $this->taxSubTotals;
}
/**
* @param TaxSubTotal $taxSubTotal
* @return TaxTotal
*/
public function addTaxSubTotal(TaxSubTotal $taxSubTotal): TaxTotal
{
$this->taxSubTotals[] = $taxSubTotal;
return $this;
}
/**
* The validate function that is called during xml writing to valid the data of the object.
*
* @throws InvalidArgumentException An error with information about required data that is missing to write the XML
* @return void
*/
public function validate()
{
if ($this->taxAmount === null) {
throw new InvalidArgumentException('Missing taxtotal taxamount');
}
}
/**
* The xmlSerialize method is called during xml writing.
* @param Writer $writer
* @return void
*/
public function xmlSerialize(Writer $writer): void
{
$this->validate();
$writer->write([
[
'name' => Schema::CBC . 'TaxAmount',
'value' => NumberFormatter::format($this->taxAmount, 2),
'attributes' => [
'currencyID' => Generator::$currencyID
]
],
]);
foreach ($this->taxSubTotals as $taxSubTotal) {
$writer->write([Schema::CAC . 'TaxSubtotal' => $taxSubTotal]);
}
}
}

View file

@ -1,93 +0,0 @@
<?php
namespace NumNum\UBL;
/**
* All possible Payment Means Codes that can be used
* To extend, see also: https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL4461/
*/
class UNCL4461
{
const INSTRUMENT_NOT_DEFINED = "1";
const AUTOMATED_CLEARING_HOUSE_CREDIT = "2";
const AUTOMATED_CLEARING_HOUSE_DEBIT = "3";
const ACH_DEMAND_DEBIT_REVERSAL = "4";
const ACH_DEMAND_CREDIT_REVERSAL = "5";
const ACH_DEMAND_CREDIT = "6";
const ACH_DEMAND_DEBIT = "7";
const HOLD = "8";
const NATIONAL_OR_REGIONAL_CLEARING = "9";
const IN_CASH = "10";
const ACH_SAVINGS_CREDIT_REVERSAL = "11";
const ACH_SAVINGS_DEBIT_REVERSAL = "12";
const ACH_SAVINGS_CREDIT = "13";
const ACH_SAVINGS_DEBIT = "14";
const BOOKENTRY_CREDIT = "15";
const BOOKENTRY_DEBIT = "16";
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_CREDIT = "17";
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_DEBIT = "18";
const ACH_DEMAND_CORPORATE_TRADE_PAYMENT_CREDIT = "19";
const CHEQUE = "20";
const BANKERS_DRAFT = "21";
const CERTIFIED_BANKERS_DRAFT = "22";
const BANK_CHEQUE_ISSUED_BY_A_BANKING_OR_SIMILAR_ESTABLISHMENT = "23";
const BILL_OF_EXCHANGE_AWAITING_ACCEPTANCE = "24";
const CERTIFIED_CHEQUE = "25";
const LOCAL_CHEQUE = "26";
const ACH_DEMAND_CORPORATE_TRADE_PAYMENT_DEBIT = "27";
const ACH_DEMAND_CORPORATE_TRADE_EXCHANGE_CREDIT = "28";
const ACH_DEMAND_CORPORATE_TRADE_EXCHANGE_DEBIT = "29";
const CREDIT_TRANSFER = "30";
const DEBIT_TRANSFER = "31";
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_CREDIT = "32";
const ACH_DEMAND_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_DEBIT = "33";
const ACH_PREARRANGED_PAYMENT_AND_DEPOSIT = "34";
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_CREDIT = "35";
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_DEBIT = "36";
const ACH_SAVINGS_CORPORATE_TRADE_PAYMENT_CREDIT = "37";
const ACH_SAVINGS_CORPORATE_TRADE_PAYMENT_DEBIT = "38";
const ACH_SAVINGS_CORPORATE_TRADE_EXCHANGE_CREDIT = "39";
const ACH_SAVINGS_CORPORATE_TRADE_EXCHANGE_DEBIT = "40";
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_CREDIT = "41";
const PAYMENT_TO_BANK_ACCOUNT = "42";
const ACH_SAVINGS_CASH_CONCENTRATION_OR_DISBURSEMENT_PLUS_DEBIT = "43";
const ACCEPTED_BILL_OF_EXCHANGE = "44";
const REFERENCED_HOME_BANKING_CREDIT_TRANSFER = "45";
const INTERBANK_DEBIT_TRANSFER = "46";
const HOME_BANKING_DEBIT_TRANSFER = "47";
const BANK_CARD = "48";
const DIRECT_DEBIT = "49";
const PAYMENT_BY_POSTGIRO = "50";
const FR_NORME_6_97_TELEREGLEMENT_CFONB = "51";
const URGENT_COMMERCIAL_PAYMENT = "52";
const URGENT_TREASURY_PAYMENT = "53";
const CREDIT_CARD = "54";
const DEBIT_CARD = "55";
const BANKGIRO = "56";
const STANDING_AGREEMENT = "57";
const SEPA_CREDIT_TRANSFER = "58";
const SEPA_DIRECT_DEBIT = "59";
const PROMISSORY_NOTE = "60";
const PROMISSORY_NOTE_SIGNED_BY_THE_DEBTOR = "61";
const PROMISSORY_NOTE_SIGNED_BY_THE_DEBTOR_AND_ENDORSED_BY_A_BANK = "62";
const PROMISSORY_NOTE_SIGNED_BY_THE_DEBTOR_AND_ENDORSED_BY_A_THIRD_PARTY = "63";
const PROMISSORY_NOTE_SIGNED_BY_A_BANK = "64";
const PROMISSORY_NOTE_SIGNED_BY_A_BANK_AND_ENDORSED_BY_ANOTHER_BANK = "65";
const PROMISSORY_NOTE_SIGNED_BY_A_THIRD_PARTY = "66";
const PROMISSORY_NOTE_SIGNED_BY_A_THIRD_PARTY_AND_ENDORSED_BY_A_BANK = "67";
const ONLINE_PAYMENT_SERVICE = "68";
const BILL_DRAWN_BY_THE_CREDITOR_ON_THE_DEBTOR = "70";
const BILL_DRAWN_BY_THE_CREDITOR_ON_A_BANK = "74";
const BILL_DRAWN_BY_THE_CREDITOR_ENDORSED_BY_ANOTHER_BANK = "75";
const BILL_DRAWN_BY_THE_CREDITOR_ON_A_BANK_AND_ENDORSED_BY_A_THIRD_PARTY = "76";
const BILL_DRAWN_BY_THE_CREDITOR_ON_A_THIRD_PARTY = "77";
const BILL_DRAWN_BY_CREDITOR_ON_THIRD_PARTY_ACCEPTED_AND_ENDORSED_BY_BANK = "78";
const NOT_TRANSFERABLE_BANKERS_DRAFT = "91";
const NOT_TRANSFERABLE_LOCAL_CHEQUE = "92";
const REFERENCE_GIRO = "93";
const URGENT_GIRO = "94";
const FREE_FORMAT_GIRO = "95";
const REQUESTED_METHOD_FOR_PAYMENT_WAS_NOT_USED = "96";
const CLEARING_BETWEEN_PARTNERS = "97";
const MUTUALLY_DEFINED = "ZZZ";
}

View file

@ -1,25 +0,0 @@
<?php
namespace NumNum\UBL;
/**
* All possible UNCL5305 Codes that can be used
* To extend, see also:
* https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL5305/
* https://github.com/OpenPEPPOL/peppol-bis-invoice-3/blob/master/structure/codelist/UNCL5305.xml
*/
class UNCL5305
{
public const UNCL5305 = 'UNCL5305';
public const VAT_REVERSE_CHARGE = 'AE';
public const EXEMPT_FROM_TAX = 'E';
public const STANDARD_RATE = 'S';
public const ZERO_RATED_GOODS = 'Z';
public const FREE_EXPORT_ITEM = 'G';
public const OUTSIDE_TAX_SCOPE = 'O';
public const EEA_GOODS_AND_SERVICES = 'K';
public const CANARY_ISLANDS_INDIRECT_TAX = 'L';
public const CEUTA_AND_MELILLA = 'M';
public const TRANSFERRED_VAT_ITALY = 'B';
}

View file

@ -1,31 +0,0 @@
<?php
namespace NumNum\UBL;
/**
* All possible Unit Codes that can be used
* To extend, see also: http://tfig.unece.org/contents/recommendation-20.htm
*/
class UnitCode
{
const UNIT = 'C62';
const PIECE = 'H87';
const ARE = 'ARE';
const HECTARE = 'HAR';
const SQUARE_METRE = 'MTK';
const SQUARE_KILOMETRE = 'KMK';
const SQUARE_FOOT = 'FTK';
const SQUARE_YARD = 'YDK';
const SQUARE_MILE = 'MIK';
const LITRE = 'LTR';
const SECOND = 'SEC';
const MINUTE = 'MIN';
const HOUR = 'HUR';
const DAY = 'DAY';
const MONTH = 'MON';
const YEAR = 'ANN';
}

View file

@ -1,353 +0,0 @@
<?php
namespace NumNum\UBL;
/**
* All possible Vat Exemption Codes that can be used
* To extend, see also:
* https://docs.peppol.eu/poacc/billing/3.0/codelist/vatex/
*/
class VatExemptionCode
{
/*
* Exempt based on article 79, point c of Council Directive 2006/112/EC
* Exemptions relating to repayment of expenditures. Remark, Repayment of expenditure is not an exemption in the sense of the VAT Directive but may be handled as such in the context of the EN16931.
*/
public const VATEX_EU_79_C = 'VATEX-EU-79-C';
/*
* Exempt based on article 132 of Council Directive 2006/112/EC
* Exemptions for certain activities in public interest.
*/
public const VATEX_EU_132 = 'VATEX-EU-132';
/*
* Exempt based on article 132, section 1 (a) of Council Directive 2006/112/EC
* The supply by the public postal services of services other than passenger transport and telecommunications services, and the supply of goods incidental thereto.
*/
public const VATEX_EU_132_1A = 'VATEX-EU-132-1A';
/*
* Exempt based on article 132, section 1 (b) of Council Directive 2006/112/EC
* Hospital and medical care and closely related activities undertaken by bodies governed by public law or, under social conditions comparable with those applicable to bodies governed by public law, by hospitals, centres for medical treatment or diagnosis and other duly recognised establishments of a similar nature
*/
public const VATEX_EU_132_1B = 'VATEX-EU-132-1B';
/*
* Exempt based on article 132, section 1 (c) of Council Directive 2006/112/EC
* The provision of medical care in the exercise of the medical and paramedical professions as defined by the Member State concerned.
*/
public const VATEX_EU_132_1C = 'VATEX-EU-132-1C';
/*
* Exempt based on article 132, section 1 (d) of Council Directive 2006/112/EC
* The supply of human organs, blood and milk.
*/
public const VATEX_EU_132_1D = 'VATEX-EU-132-1D';
/*
* Exempt based on article 132, section 1 (e) of Council Directive 2006/112/EC
* The supply of services by dental technicians in their professional capacity and the supply of dental prostheses by dentists and dental technicians.
*/
public const VATEX_EU_132_1E = 'VATEX-EU-132-1E';
/*
* Exempt based on article 132, section 1 (f) of Council Directive 2006/112/EC
* The supply of services by independent groups of persons, who are carrying on an activity which is exempt from VAT or in relation to which they are not taxable persons, for the purpose of rendering their members the services directly necessary for the exercise of that activity, where those groups merely claim from their members exact reimbursement of their share of the joint expenses, provided that such exemption is not likely to cause distortion of competition.
*/
public const VATEX_EU_132_1F = 'VATEX-EU-132-1F';
/*
* Exempt based on article 132, section 1 (g) of Council Directive 2006/112/EC
* The supply of services and of goods closely linked to welfare and social security work, including those supplied by old people's homes, by bodies governed by public law or by other bodies recognised by the Member State concerned as being devoted to social wellbeing.
*/
public const VATEX_EU_132_1G = 'VATEX-EU-132-1G';
/*
* Exempt based on article 132, section 1 (h) of Council Directive 2006/112/EC
* "The supply of services and of goods closely linked to the protection of children and young persons by bodies governed by public law or by other organisations recognised by the Member State concerned as being devoted to social wellbeing"
*/
public const VATEX_EU_132_1H = 'VATEX-EU-132-1H';
/*
* Exempt based on article 132, section 1 (i) of Council Directive 2006/112/EC
* " The provision of children's or young people's education, school or university education, vocational training or retraining, including the supply of services and of goods closely related thereto, by bodies governed by public law having such as their aim or by other organisations recognised by the Member State concerned as having similar objects."
*/
public const VATEX_EU_132_1I = 'VATEX-EU-132-1I';
/*
* Exempt based on article 132, section 1 (j) of Council Directive 2006/112/EC
* Tuition given privately by teachers and covering school or university education.
*/
public const VATEX_EU_132_1J = 'VATEX-EU-132-1J';
/*
* Exempt based on article 132, section 1 (k) of Council Directive 2006/112/EC
* The supply of staff by religious or philosophical institutions for the purpose of the activities referred to in points (b), (g), (h) and (i) and with a view to spiritual welfare.
*/
public const VATEX_EU_132_1K = 'VATEX-EU-132-1K';
/*
* Exempt based on article 132, section 1 (l) of Council Directive 2006/112/EC
* The supply of services, and the supply of goods closely linked thereto, to their members in their common interest in return for a subscription fixed in accordance with their rules by non-profitmaking organisations with aims of a political, trade-union, religious, patriotic, philosophical, philanthropic or civic nature, provided that this exemption is not likely to cause distortion of competition.
*/
public const VATEX_EU_132_1L = 'VATEX-EU-132-1L';
/*
* Exempt based on article 132, section 1 (m) of Council Directive 2006/112/EC
* The supply of certain services closely linked to sport or physical education by non-profit-making organisations to persons taking part in sport or physical education.
*/
public const VATEX_EU_132_1M = 'VATEX-EU-132-1M';
/*
* Exempt based on article 132, section 1 (n) of Council Directive 2006/112/EC
* The supply of certain cultural services, and the supply of goods closely linked thereto, by bodies governed by public law or by other cultural bodies recognised by the Member State concerned.
*/
public const VATEX_EU_132_1N = 'VATEX-EU-132-1N';
/*
* Exempt based on article 132, section 1 (o) of Council Directive 2006/112/EC
* "The supply of services and goods, by organisations whose activities are exempt pursuant to points (b), (g), (h), (i), (l), (m) and (n), in connection with fund-raising events organised exclusively for their own benefit, provided that exemption is not likely to cause distortion of competition."
*/
public const VATEX_EU_132_1O = 'VATEX-EU-132-1O';
/*
* Exempt based on article 132, section 1 (p) of Council Directive 2006/112/EC
* The supply of transport services for sick or injured persons in vehicles specially designed for the purpose, by duly authorised bodies.
*/
public const VATEX_EU_132_1P = 'VATEX-EU-132-1P';
/*
* Exempt based on article 132, section 1 (q) of Council Directive 2006/112/EC
* The activities, other than those of a commercial nature, carried out by public radio and television bodies.
*/
public const VATEX_EU_132_1Q = 'VATEX-EU-132-1Q';
/*
* Exempt based on article 143 of Council Directive 2006/112/EC
* Exemptions on importation.
*/
public const VATEX_EU_143 = 'VATEX-EU-143';
/*
* Exempt based on article 143, section 1 (a) of Council Directive 2006/112/EC
* The final importation of goods of which the supply by a taxable person would in all circumstances be exempt within their respective territory.
*/
public const VATEX_EU_143_1A = 'VATEX-EU-143-1A';
/*
* Exempt based on article 143, section 1 (b) of Council Directive 2006/112/EC
* The final importation of goods governed by Council Directives 69/169/EEC (1), 83/181/EEC (2) and 2006/79/EC (3).
*/
public const VATEX_EU_143_1B = 'VATEX-EU-143-1B';
/*
* Exempt based on article 143, section 1 (c) of Council Directive 2006/112/EC
* The final importation of goods, in free circulation from a third territory forming part of the Community customs territory, which would be entitled to exemption under point (b) if they had been imported within the meaning of the first paragraph of Article 30
*/
public const VATEX_EU_143_1C = 'VATEX-EU-143-1C';
/*
* Exempt based on article 143, section 1 (d) of Council Directive 2006/112/EC
* The importation of goods dispatched or transported from a third territory or a third country into a Member State other than that in which the dispatch or transport of the goods ends, where the supply of such goods by the importer designated or recognised under Article 201 as liable for payment of VAT is exempt under Article 138.
*/
public const VATEX_EU_143_1D = 'VATEX-EU-143-1D';
/*
* Exempt based on article 143, section 1 (e) of Council Directive 2006/112/EC
* The reimportation, by the person who exported them, of goods in the state in which they were exported, where those goods are exempt from customs duties.
*/
public const VATEX_EU_143_1E = 'VATEX-EU-143-1E';
/*
* Exempt based on article 143, section 1 (f) of Council Directive 2006/112/EC
* The importation, under diplomatic and consular arrangements, of goods which are exempt from customs duties.
*/
public const VATEX_EU_143_1F = 'VATEX-EU-143-1F';
/*
* Exempt based on article 143, section 1 (fa) of Council Directive 2006/112/EC
* "The importation of goods by the European Community, the European Atomic Energy Community, the European Central Bank or the European Investment Bank, or by the bodies set up by the Communities to which the Protocol of 8 April 1965 on the privileges and immunities of the European Communities applies, within the limits and under the conditions of that Protocol and the agreements for its implementation or the headquarters agreements, in so far as it does not lead to distortion of competition"
*/
public const VATEX_EU_143_1FA = 'VATEX-EU-143-1FA';
/*
* Exempt based on article 143, section 1 (g) of Council Directive 2006/112/EC
* " The importation of goods by international bodies, other than those referred to in point (fa), recognised as such by the public authorities of the host Member State, or by members of such bodies, within the limits and under the conditions laid down by the international conventions establishing the bodies or by headquarters agreements"
*/
public const VATEX_EU_143_1G = 'VATEX-EU-143-1G';
/*
* Exempt based on article 143, section 1 (h) of Council Directive 2006/112/EC
* The importation of goods, into Member States party to the North Atlantic Treaty, by the armed forces of other States party to that Treaty for the use of those forces or the civilian staff accompanying them or for supplying their messes or canteens where such forces take part in the common defence effort.
*/
public const VATEX_EU_143_1H = 'VATEX-EU-143-1H';
/*
* Exempt based on article 143, section 1 (i) of Council Directive 2006/112/EC
* The importation of goods by the armed forces of the United Kingdom stationed in the island of Cyprus pursuant to the Treaty of Establishment concerning the Republic of Cyprus, dated 16 August 1960, which are for the use of those forces or the civilian staff accompanying them or for supplying their messes or canteens.
*/
public const VATEX_EU_143_1I = 'VATEX-EU-143-1I';
/*
* Exempt based on article 143, section 1 (j) of Council Directive 2006/112/EC
* The importation into ports, by sea fishing undertakings, of their catches, unprocessed or after undergoing preservation for marketing but before being supplied.
*/
public const VATEX_EU_143_1J = 'VATEX-EU-143-1J';
/*
* Exempt based on article 143, section 1 (k) of Council Directive 2006/112/EC
* The importation of gold by central banks.
*/
public const VATEX_EU_143_1K = 'VATEX-EU-143-1K';
/*
* Exempt based on article 143, section 1 (l) of Council Directive 2006/112/EC
* The importation of gas through a natural gas system or any network connected to such a system or fed in from a vessel transporting gas into a natural gas system or any upstream pipeline network, of electricity or of heat or cooling energy through heating or cooling networks.
*/
public const VATEX_EU_143_1L = 'VATEX-EU-143-1L';
/*
* Exempt based on article 148 of Council Directive 2006/112/EC
* Exemptions related to international transport.
*/
public const VATEX_EU_148 = 'VATEX-EU-148';
/*
* Exempt based on article 148, section (a) of Council Directive 2006/112/EC
* Fuel supplies for commercial international transport vessels
*/
public const VATEX_EU_148_A = 'VATEX-EU-148-A';
/*
* Exempt based on article 148, section (b) of Council Directive 2006/112/EC
* Fuel supplies for fighting ships in international transport.
*/
public const VATEX_EU_148_B = 'VATEX-EU-148-B';
/*
* Exempt based on article 148, section (c) of Council Directive 2006/112/EC
* Maintenance, modification, chartering and hiring of international transport vessels.
*/
public const VATEX_EU_148_C = 'VATEX-EU-148-C';
/*
* Exempt based on article 148, section (d) of Council Directive 2006/112/EC
* Supply to of other services to commercial international transport vessels.
*/
public const VATEX_EU_148_D = 'VATEX-EU-148-D';
/*
* Exempt based on article 148, section (e) of Council Directive 2006/112/EC
* Fuel supplies for aircraft on international routes.
*/
public const VATEX_EU_148_E = 'VATEX-EU-148-E';
/*
* Exempt based on article 148, section (f) of Council Directive 2006/112/EC
* Maintenance, modification, chartering and hiring of aircraft on international routes.
*/
public const VATEX_EU_148_F = 'VATEX-EU-148-F';
/*
* Exempt based on article 148, section (g) of Council Directive 2006/112/EC
* Supply to of other services to aircraft on international routes.
*/
public const VATEX_EU_148_G = 'VATEX-EU-148-G';
/*
* Exempt based on article 151 of Council Directive 2006/112/EC
* Exemptions relating to certain Transactions treated as exports.
*/
public const VATEX_EU_151 = 'VATEX-EU-151';
/*
* Exempt based on article 151, section 1 (a) of Council Directive 2006/112/EC
* The supply of goods or services under diplomatic and consular arrangements.
*/
public const VATEX_EU_151_1A = 'VATEX-EU-151-1A';
/*
* Exempt based on article 151, section 1 (aa) of Council Directive 2006/112/EC
* The supply of goods or services to the European Community, the European Atomic Energy Community, the European Central Bank or the European Investment Bank, or to the bodies set up by the Communities to which the Protocol of 8 April 1965 on the privileges and immunities of the European Communities applies, within the limits and under the conditions of that Protocol and the agreements for its implementation or the headquarters agreements, in so far as it does not lead to distortion of competition.
*/
public const VATEX_EU_151_1AA = 'VATEX-EU-151-1AA';
/*
* Exempt based on article 151, section 1 (b) of Council Directive 2006/112/EC
* The supply of goods or services to international bodies, other than those referred to in point (aa), recognised as such by the public authorities of the host Member States, and to members of such bodies, within the limits and under the conditions laid down by the international conventions establishing the bodies or by headquarters agreements.
*/
public const VATEX_EU_151_1B = 'VATEX-EU-151-1B';
/*
* Exempt based on article 151, section 1 (c) of Council Directive 2006/112/EC
* The supply of goods or services within a Member State which is a party to the North Atlantic Treaty, intended either for the armed forces of other States party to that Treaty for the use of those forces, or of the civilian staff accompanying them, or for supplying their messes or canteens when such forces take part in the common defence effort.
*/
public const VATEX_EU_151_1C = 'VATEX-EU-151-1C';
/*
* Exempt based on article 151, section 1 (d) of Council Directive 2006/112/EC
* The supply of goods or services to another Member State, intended for the armed forces of any State which is a party to the North Atlantic Treaty, other than the Member State of destination itself, for the use of those forces, or of the civilian staff accompanying them, or for supplying their messes or canteens when such forces take part in the common defence effort.
*/
public const VATEX_EU_151_1D = 'VATEX-EU-151-1D';
/*
* Exempt based on article 151, section 1 (e) of Council Directive 2006/112/EC
* The supply of goods or services to the armed forces of the United Kingdom stationed in the island of Cyprus pursuant to the Treaty of Establishment concerning the Republic of Cyprus, dated 16 August 1960, which are for the use of those forces, or of the civilian staff accompanying them, or for supplying their messes or canteens.
*/
public const VATEX_EU_151_1E = 'VATEX-EU-151-1E';
/*
* Exempt based on article 309 of Council Directive 2006/112/EC
* Travel agents performed outside of EU.
*/
public const VATEX_EU_309 = 'VATEX-EU-309';
/*
* Reverse charge
* Supports EN 16931-1 rule BR-AE-10 - Only use with VAT category code AE
*/
public const VATEX_EU_AE = 'VATEX-EU-AE';
/*
* Intra-Community acquisition from second hand means of transport
* Second-hand means of transport - Indication that VAT has been paid according to the relevant transitional arrangements - Only use with VAT category code E
*/
public const VATEX_EU_D = 'VATEX-EU-D';
/*
* Intra-Community acquisition of second hand goods
* Second-hand goods - Indication that the VAT margin scheme for second-hand goods has been applied. - Only use with VAT category code E
*/
public const VATEX_EU_F = 'VATEX-EU-F';
/*
* Export outside the EU
* Supports EN 16931-1 rule BR-G-10 - Only use with VAT category code G
*/
public const VATEX_EU_G = 'VATEX-EU-G';
/*
* Intra-Community acquisition of works of art
* Works of art - Indication that the VAT margin scheme for works of art has been applied. - Only use with VAT category code E
*/
public const VATEX_EU_I = 'VATEX-EU-I';
/*
* Intra-Community supply
* Supports EN 16931-1 rule BR-IC-10 - Only use with VAT category code K
*/
public const VATEX_EU_IC = 'VATEX-EU-IC';
/*
* Not subject to VAT
* Supports EN 16931-1 rule BR-O-10 - Only use with VAT category code O
*/
public const VATEX_EU_O = 'VATEX-EU-O';
/*
* Intra-Community acquisition of collectors items and antiques
* Collectors' items and antiques - Indication that the VAT margin scheme for collectors items and antiques has been applied. - Only use with VAT category code E
*/
public const VATEX_EU_J = 'VATEX-EU-J';
}

View file

@ -1,124 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 credit note document
*/
class BillingReferenceCreditNoteTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-CreditNote-2.1.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID')
->setBuyersItemIdentification('BUYERID');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// Invoice Line(s)
$creditNoteLine = (new \NumNum\UBL\CreditNoteLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$creditNoteLines = [$creditNoteLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
$billingReference = (new \NumNum\UBL\BillingReference())
->setInvoiceDocumentReference((new \NumNum\UBL\InvoiceDocumentReference())
->setOriginalInvoiceId(1234)
->setIssueDate(new \DateTime()));
// Invoice object
$creditNote = (new \NumNum\UBL\CreditNote())
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setBillingReference($billingReference)
->setCreditNoteLines($creditNoteLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal)
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::CREDIT_NOTE);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->creditNote($creditNote);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/SimpleCreditNoteTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,128 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use NumNum\UBL\InvoiceTypeCode;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.2 invoice document
*/
class ContractDocumentReferenceTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// Invoice Line(s)
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines = [$invoiceLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
$contractDocumentReference = (new \NumNum\UBL\ContractDocumentReference())
->setId("123Test");
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime('-31 days'))
->setEndDate(new \DateTime());
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setUBLVersionID('2.2')
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE)
->setDueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal)
->setContractDocumentReference($contractDocumentReference)
->setBuyerReference("SomeReference")
->setInvoicePeriod($invoicePeriod);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/ContractDocumentReferenceTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,158 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class DocumentTypeTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client contact node
$clientContact = (new \NumNum\UBL\Contact())
->setName('Client name')
->setElectronicMail('email@client.com')
->setTelephone('0032 472 123 456')
->setTelefax('0032 9 1234 567');
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address)
->setContact($clientContact);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLines = [];
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCost('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCostCode('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Attachment
$attachment = (new \NumNum\UBL\Attachment())
->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf');
$additionalDocumentReference = new \NumNum\UBL\AdditionalDocumentReference();
$additionalDocumentReference->setId('SomeID');
$additionalDocumentReference->setDocumentType("CommercialInvoice");
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setSupplierAssignedAccountID('10001')
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal)
->setAdditionalDocumentReference($additionalDocumentReference);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/EmptyAttachmentTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,118 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use NumNum\UBL\InvoiceTypeCode;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.2 invoice document
*/
class DueDateTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// Invoice Line(s)
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines = [$invoiceLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setUBLVersionID('2.2')
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE)
->setDueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/DueDateTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,202 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use NumNum\UBL\UNCL4461;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class EN16931Test extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
private $xslfile = 'vendor/num-num/ubl-invoice/tests/EN16931-UBL-validation.xslt';
/** @test */
public function testIfXMLIsValid()
{
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId('VAT');
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt 1')
->setAdditionalStreetName('Building A')
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
$financialInstitutionBranch = (new \NumNum\UBL\FinancialInstitutionBranch())
->setId('RABONL2U');
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount())
->setFinancialInstitutionBranch($financialInstitutionBranch)
->setName('Customer Account Holder')
->setId('NL00RABO0000000000');
$paymentMeans = (new \NumNum\UBL\PaymentMeans())
->setPayeeFinancialAccount($payeeFinancialAccount)
->setPaymentMeansCode(UNCL4461::DEBIT_TRANSFER, [])
->setPaymentId('our invoice 1234');
// Supplier company node
$supplierLegalEntity = (new \NumNum\UBL\LegalEntity())
->setRegistrationName('Supplier Company Name')
->setCompanyId('BE123456789');
$supplierPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
->setTaxScheme($taxScheme)
->setCompanyId('BE123456789');
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setLegalEntity($supplierLegalEntity)
->setPartyTaxScheme($supplierPartyTaxScheme)
->setPartyIdentificationId('BE123456789')
->setPostalAddress($address);
// Client company node
$clientLegalEntity = (new \NumNum\UBL\LegalEntity())
->setRegistrationName('Client Company Name')
->setCompanyId('Client Company Registration');
$clientPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
->setTaxScheme($taxScheme)
->setCompanyId('BE123456789');
$clientCompany = (new \NumNum\UBL\Party())
->setName('Client Company Name')
->setLegalEntity($clientLegalEntity)
->setPartyTaxScheme($clientPartyTaxScheme)
->setPartyIdentificationId('BE123456789')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2.1)
->setPayableRoundingAmount(0)
->setTaxInclusiveAmount(10 + 2.1)
->setLineExtensionAmount(10)
->setTaxExclusiveAmount(10);
$classifiedTaxCategory = (new \NumNum\UBL\ClassifiedTaxCategory())
->setId('S')
->setPercent(21.00)
->setTaxScheme($taxScheme);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setClassifiedTaxCategory($classifiedTaxCategory)
->setDescription('Product Description');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setInvoicePeriod($invoicePeriod)
->setLineExtensionAmount(10)
->setInvoicedQuantity(1);
$invoiceLines = [$invoiceLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId('S', [])
->setPercent(21.00)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Payment Terms
$paymentTerms = (new \NumNum\UBL\PaymentTerms())
->setNote('30 days net');
// Delivery
$deliveryLocation = (new \NumNum\UBL\Address())
->setCountry($country);
$delivery = (new \NumNum\UBL\Delivery())
->setActualDeliveryDate(new \DateTime())
->setDeliveryLocation($deliveryLocation);
$orderReference = (new \NumNum\UBL\OrderReference())
->setId('5009567')
->setSalesOrderId('tRST-tKhM');
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setCustomizationID('urn:cen.eu:en16931:2017')
->setId(1234)
->setIssueDate(new \DateTime())
->setNote('invoice note')
->setDelivery($delivery)
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setPaymentTerms($paymentTerms)
->setInvoicePeriod($invoicePeriod)
->setPaymentMeans([$paymentMeans])
->setBuyerReference('BUYER_REF')
->setOrderReference($orderReference)
->setTaxTotal($taxTotal);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/EN16931Test.xml');
// $this->assertEquals(true, $dom->schemaValidate($this->schema));
// Use webservice at peppol.helger.com to verify the result
$wsdl = "http://peppol.helger.com/wsdvs?wsdl=1";
$client = new \SoapClient($wsdl);
$response = $client->validate(['XML' => $outputXMLString, 'VESID' => 'eu.cen.en16931:ubl:1.3.1']);
// Output validation warnings if present
if ($response->mostSevereErrorLevel == 'WARN' && isset($response->Result[1]->Item)) {
foreach ($response->Result[1]->Item as $responseWarning) {
// fwrite(STDERR, '*** '.$responseWarning->errorText."\n");
fwrite(STDERR, '*** '.json_encode($responseWarning)."\n");
}
}
$this->assertEquals('SUCCESS', $response->mostSevereErrorLevel);
}
}

View file

@ -1,161 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class EmptyAttachmentTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client contact node
$clientContact = (new \NumNum\UBL\Contact())
->setName('Client name')
->setElectronicMail('email@client.com')
->setTelephone('0032 472 123 456')
->setTelefax('0032 9 1234 567');
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address)
->setContact($clientContact);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLines = [];
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCost('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCostCode('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Attachment
$attachment = (new \NumNum\UBL\Attachment())
->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf');
$additionalDocumentReference = new \NumNum\UBL\AdditionalDocumentReference();
$additionalDocumentReference->setId('SomeID');
$additionalDocumentReference->setDocumentTypeCode(130);
// Not adding an attachment to AdditionalDocumentReference should not trigger an error
// $additionalDocumentReference->setAttachment($attachment);
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setSupplierAssignedAccountID('10001')
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal)
->setAdditionalDocumentReference($additionalDocumentReference);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/EmptyAttachmentTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,171 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class MultiplePaymentMeansTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client contact node
$clientContact = (new \NumNum\UBL\Contact())
->setName('Client name')
->setElectronicMail('email@client.com')
->setTelephone('0032 472 123 456')
->setTelefax('0032 9 1234 567');
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address)
->setContact($clientContact);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
$commodityClassification = (new \NumNum\UBL\CommodityClassification())
->setItemClassificationCode('123456')
->setItemClassificationListId('urn:ean.ucc:eanucc:2:2')
->setItemClassificationListVersionId('16');
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID')
->setCommodityClassification($commodityClassification);
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLines = [];
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCost('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCostCode('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
$paymentMeans = [];
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount)->setId('RO123456789012345');
$paymentMeans[] = (new \NumNum\UBL\PaymentMeans())
->setPaymentMeansCode(31)
->setPaymentDueDate(new \DateTime())
->setPayeeFinancialAccount($payeeFinancialAccount);
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount)->setId('RO544456789067890');
$paymentMeans[] = (new \NumNum\UBL\PaymentMeans())
->setPaymentMeansCode(31)
->setPaymentDueDate(new \DateTime())
->setPayeeFinancialAccount($payeeFinancialAccount);
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setSupplierAssignedAccountID('10001')
->setPaymentMeans($paymentMeans)
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/MultiplePaymentMeansTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,35 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use NumNum\UBL\NumberFormatter;
use PHPUnit\Framework\TestCase;
/**
* Test the NumberFormatter class
*/
class NumberFormatterTest extends TestCase
{
/**
* @dataProvider formattedNumbersProvider
*/
public function testNumberFormatterRounding($number, string $formattedNumber, ?int $decimals)
{
$result = NumberFormatter::format($number, $decimals);
return $this->assertEqualsCanonicalizing($formattedNumber, $result);
}
public function formattedNumbersProvider(): array
{
return [
[0.0, '0', null],
[0.1, '0.1', null],
[0.1200500, '0.12005', null],
[1.2345678, '1.2345678', null],
[1.236789, '1.236789', null],
[1.236789, '1.24', 2],
[1, '1.00', 2],
[1.000, '1', null],
];
}
}

View file

@ -1,128 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.2 invoice document
*/
class PartyIdentificationSchemeNameTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address)
->setPartyIdentificationSchemeName("SomeScheme");
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// Invoice Line(s)
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines = [$invoiceLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
$contractDocumentReference = (new \NumNum\UBL\ContractDocumentReference())
->setId("123Test");
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime('-31 days'))
->setEndDate(new \DateTime());
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setUBLVersionID('2.2')
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::INVOICE)
->setDueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal)
->setContractDocumentReference($contractDocumentReference)
->setBuyerReference("SomeReference")
->setInvoicePeriod($invoicePeriod);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/PartyIdentificationSchemeNameTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,192 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use NumNum\UBL\UNCL4461;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class ProjectReferenceTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
private $xslfile = 'vendor/num-num/ubl-invoice/tests/EN16931-UBL-validation.xslt';
/** @test */
public function testIfXMLIsValid()
{
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId('VAT');
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt 1')
->setAdditionalStreetName('Building A')
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
$financialInstitutionBranch = (new \NumNum\UBL\FinancialInstitutionBranch())
->setId('RABONL2U');
$payeeFinancialAccount = (new \NumNum\UBL\PayeeFinancialAccount())
->setFinancialInstitutionBranch($financialInstitutionBranch)
->setName('Customer Account Holder')
->setId('NL00RABO0000000000');
$paymentMeans = (new \NumNum\UBL\PaymentMeans())
->setPayeeFinancialAccount($payeeFinancialAccount)
->setPaymentMeansCode(UNCL4461::DEBIT_TRANSFER, [])
->setPaymentId('our invoice 1234');
// Supplier company node
$supplierLegalEntity = (new \NumNum\UBL\LegalEntity())
->setRegistrationName('Supplier Company Name')
->setCompanyId('BE123456789');
$supplierPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
->setTaxScheme($taxScheme)
->setCompanyId('BE123456789');
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setLegalEntity($supplierLegalEntity)
->setPartyTaxScheme($supplierPartyTaxScheme)
->setPartyIdentificationId('BE123456789')
->setPostalAddress($address);
// Client company node
$clientLegalEntity = (new \NumNum\UBL\LegalEntity())
->setRegistrationName('Client Company Name')
->setCompanyId('Client Company Registration');
$clientPartyTaxScheme = (new \NumNum\UBL\PartyTaxScheme())
->setTaxScheme($taxScheme)
->setCompanyId('BE123456789');
$clientCompany = (new \NumNum\UBL\Party())
->setName('Client Company Name')
->setLegalEntity($clientLegalEntity)
->setPartyTaxScheme($clientPartyTaxScheme)
->setPartyIdentificationId('BE123456789')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2.1)
->setAllowanceTotalAmount(0)
->setTaxInclusiveAmount(10 + 2.1)
->setLineExtensionAmount(10)
->setTaxExclusiveAmount(10);
$classifiedTaxCategory = (new \NumNum\UBL\ClassifiedTaxCategory())
->setId('S')
->setPercent(21.00)
->setTaxScheme($taxScheme);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setClassifiedTaxCategory($classifiedTaxCategory)
->setDescription('Product Description');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setInvoicePeriod($invoicePeriod)
->setLineExtensionAmount(10)
->setInvoicedQuantity(1);
$invoiceLines = [$invoiceLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId('S', [])
->setPercent(21.00)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Payment Terms
$paymentTerms = (new \NumNum\UBL\PaymentTerms())
->setNote('30 days net');
// Delivery
$deliveryLocation = (new \NumNum\UBL\Address())
->setCountry($country);
$delivery = (new \NumNum\UBL\Delivery())
->setActualDeliveryDate(new \DateTime())
->setDeliveryLocation($deliveryLocation);
$orderReference = (new \NumNum\UBL\OrderReference())
->setId('5009567')
->setSalesOrderId('tRST-tKhM');
// Test Project Reference
$projectReference = (new \NumNum\UBL\ProjectReference())
->setId('Project1234');
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setCustomizationID('urn:cen.eu:en16931:2017')
->setId(1234)
->setIssueDate(new \DateTime())
->setNote('invoice note')
->setDelivery($delivery)
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setPaymentTerms($paymentTerms)
->setInvoicePeriod($invoicePeriod)
->setPaymentMeans([$paymentMeans])
->setBuyerReference('BUYER_REF')
->setOrderReference($orderReference)
->setTaxTotal($taxTotal)
->setProjectReference($projectReference);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/ProjectReferenceTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,117 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 credit note document
*/
class SimpleCreditNoteTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-CreditNote-2.1.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID')
->setBuyersItemIdentification('BUYERID');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// Invoice Line(s)
$creditNoteLine = (new \NumNum\UBL\CreditNoteLine())
->setId(0)
->setItem($productItem)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$creditNoteLines = [$creditNoteLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Invoice object
$creditNote = (new \NumNum\UBL\CreditNote())
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setCreditNoteLines($creditNoteLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal)
->setInvoiceTypeCode(\NumNum\UBL\InvoiceTypeCode::CREDIT_NOTE);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->creditNote($creditNote);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/SimpleCreditNoteTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,155 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class SimpleInvoiceTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client contact node
$clientContact = (new \NumNum\UBL\Contact())
->setName('Client name')
->setElectronicMail('email@client.com')
->setTelephone('0032 472 123 456')
->setTelefax('0032 9 1234 567');
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address)
->setContact($clientContact);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLines = [];
$orderLineReference = (new \NumNum\UBL\OrderLineReference)
->setLineId('#ABC123');
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCost('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCostCode('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setSupplierAssignedAccountID('10001')
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/SimpleInvoiceTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,162 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class SimpleInvoiceWithFilePathPdfTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client contact node
$clientContact = (new \NumNum\UBL\Contact())
->setName('Client name')
->setElectronicMail('email@client.com')
->setTelephone('0032 472 123 456')
->setTelefax('0032 9 1234 567');
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address)
->setContact($clientContact);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLines = [];
$orderLineReference = (new \NumNum\UBL\OrderLineReference)
->setLineId('#ABC123');
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCost('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCostCode('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
$attachment = (new \NumNum\UBL\Attachment())
->setFilePath(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf');
$additionalDocumentReference = (new \NumNum\UBL\AdditionalDocumentReference())
->setAttachment($attachment);
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setId(1234)
->setAdditionalDocumentReference($additionalDocumentReference)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setSupplierAssignedAccountID('10001')
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/SimpleInvoiceWithFilePathPdfTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,167 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.1 invoice document
*/
class SimpleInvoiceWithInlinePdfTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client contact node
$clientContact = (new \NumNum\UBL\Contact())
->setName('Client name')
->setElectronicMail('email@client.com')
->setTelephone('0032 472 123 456')
->setTelefax('0032 9 1234 567');
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address)
->setContact($clientContact);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description')
->setSellersItemIdentification('SELLERID');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// InvoicePeriod
$invoicePeriod = (new \NumNum\UBL\InvoicePeriod())
->setStartDate(new \DateTime());
// Invoice Line(s)
$invoiceLines = [];
$orderLineReference = (new \NumNum\UBL\OrderLineReference)
->setLineId('#ABC123');
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCost('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
$invoiceLines[] = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setInvoicePeriod($invoicePeriod)
->setPrice($price)
->setAccountingCostCode('Product 123')
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1)
->setOrderLineReference($orderLineReference);
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Example if you have some inline or in-memory filestream/file contents
$fileStream = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'SampleInvoice.pdf'); // this would be your file contents
$base64EncodedFileStream = base64_encode($fileStream);
$attachment = (new \NumNum\UBL\Attachment())
->setFileStream($base64EncodedFileStream, 'Invoice.pdf', 'application/pdf');
$additionalDocumentReference = (new \NumNum\UBL\AdditionalDocumentReference())
->setAttachment($attachment);
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setId(1234)
->setAdditionalDocumentReference($additionalDocumentReference)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setSupplierAssignedAccountID('10001')
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/SimpleInvoiceWithInlinePdfTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -1,119 +0,0 @@
<?php
namespace NumNum\UBL\Tests;
use PHPUnit\Framework\TestCase;
/**
* Test an UBL2.2 invoice document
*/
class SimpleUBL22InvoiceTest extends TestCase
{
private $schema = 'http://docs.oasis-open.org/ubl/os-UBL-2.2/xsd/maindoc/UBL-Invoice-2.2.xsd';
/** @test */
public function testIfXMLIsValid()
{
// Address country
$country = (new \NumNum\UBL\Country())
->setIdentificationCode('BE')
->setListId('ISO3166-1:Alpha2');
// Full address
$address = (new \NumNum\UBL\Address())
->setStreetName('Korenmarkt')
->setBuildingNumber(1)
->setCityName('Gent')
->setPostalZone('9000')
->setCountry($country);
// Supplier company node
$supplierCompany = (new \NumNum\UBL\Party())
->setName('Supplier Company Name')
->setPhysicalLocation($address)
->setPostalAddress($address);
// Client company node
$clientCompany = (new \NumNum\UBL\Party())
->setName('My client')
->setPostalAddress($address);
$legalMonetaryTotal = (new \NumNum\UBL\LegalMonetaryTotal())
->setPayableAmount(10 + 2)
->setAllowanceTotalAmount(0);
// Tax scheme
$taxScheme = (new \NumNum\UBL\TaxScheme())
->setId(0);
// Product
$productItem = (new \NumNum\UBL\Item())
->setName('Product Name')
->setDescription('Product Description');
// Price
$price = (new \NumNum\UBL\Price())
->setBaseQuantity(1)
->setUnitCode(\NumNum\UBL\UnitCode::UNIT)
->setUnitCodeListId('UNECERec20')
->setPriceAmount(10);
// Invoice Line tax totals
$lineTaxTotal = (new \NumNum\UBL\TaxTotal())
->setTaxAmount(2.1);
// Invoice Line(s)
$invoiceLine = (new \NumNum\UBL\InvoiceLine())
->setId(0)
->setItem($productItem)
->setUnitCode('C62')
->setUnitCodeListID('UNECERec20')
->setPrice($price)
->setTaxTotal($lineTaxTotal)
->setInvoicedQuantity(1);
$invoiceLines = [$invoiceLine];
// Total Taxes
$taxCategory = (new \NumNum\UBL\TaxCategory())
->setId(0)
->setName('VAT21%')
->setPercent(.21)
->setTaxScheme($taxScheme);
$taxSubTotal = (new \NumNum\UBL\TaxSubTotal())
->setTaxableAmount(10)
->setTaxAmount(2.1)
->setTaxCategory($taxCategory);
$taxTotal = (new \NumNum\UBL\TaxTotal())
->addTaxSubTotal($taxSubTotal)
->setTaxAmount(2.1);
// Invoice object
$invoice = (new \NumNum\UBL\Invoice())
->setUBLVersionID('2.2')
->setId(1234)
->setCopyIndicator(false)
->setIssueDate(new \DateTime())
->setAccountingSupplierParty($supplierCompany)
->setAccountingCustomerParty($clientCompany)
->setInvoiceLines($invoiceLines)
->setLegalMonetaryTotal($legalMonetaryTotal)
->setTaxTotal($taxTotal);
// Test created object
// Use \NumNum\UBL\Generator to generate an XML string
$generator = new \NumNum\UBL\Generator();
$outputXMLString = $generator->invoice($invoice);
// Create PHP Native DomDocument object, that can be
// used to validate the generate XML
$dom = new \DOMDocument;
$dom->loadXML($outputXMLString);
$dom->save('./tests/SimpleUBL22InvoiceTest.xml');
$this->assertEquals(true, $dom->schemaValidate($this->schema));
}
}

View file

@ -40,8 +40,10 @@
"php": "^8"
},
"require-dev": {
"phpunit/phpunit": "^9",
"vimeo/psalm": "^4|^5"
"infection/infection": "^0",
"nikic/php-fuzzer": "^0",
"phpunit/phpunit": "^9|^10|^11",
"vimeo/psalm": "^4|^5|^6"
},
"autoload": {
"psr-4": {
@ -52,5 +54,14 @@
"psr-4": {
"ParagonIE\\ConstantTime\\Tests\\": "tests/"
}
},
"scripts": {
"mutation-test": "infection"
},
"config": {
"process-timeout": 0,
"allow-plugins": {
"infection/extension-installer": true
}
}
}

Some files were not shown because too many files have changed in this diff Show more