Releases: Media24si/eslog2
Releases · Media24si/eslog2
Refactor of the work in progress with some breaking changes
Additions and modifications
Business
- The
iban
property is now checked prior to adding theiban
element to the XML. This solves some validation issues when theiban
property is not set. - The
registrationNumber
property is now checked prior to adding theregistrationNumber
element to the XML. This solves some validation issues when theregistrationNumber
property is not set.
Envelope
- Updated the
issuer
andrecipient
properties from the$invoice
passed in the Envelope class, due to changes to the Invoice class. The correct values are nowseller
andbuyer
respectively.
Invoice
- Added the
addDocumentAllowance
function that takes a class ofInvoiceDiscount
as a parameter. The logic is similar to the existingTaxSummary
. - Removed the
globalDiscountAmount
andglobalDiscountPercentage
properties along with their setters, since the discounts on a document can be multiple not just one. - Added the
seller
property along with its settersetSeller
to better follow document rules. This has replaced theissuer
property and the respective setter. - Added the
buyer
property along with its settersetBuyer
to better follow document rules. This has replaced therecipient
property and the respective setter. - Added the
setSumOfAllowances
function that stores the sum of all document allowances. - Added a new
paidAmount
property along with its settersetPaidAmount
to store the amount already paid for the document. This property is optional. - Added a new
roundingAmount
property along with its settersetRoundingAmount
to store a rounding amount value for the document if applicable. This property is optional. - Added a new
amountDueForPayment
property along with its settersetAmountDueForPayment
to store the amount due for payment for the document if applicable. This property is optional. If it is not set thetotalWithTax
property will be used instead.
InvoiceItem
- Added a new line item unit constant
UNIT_THOUSAND
for theunit
property. This is used when theunit
is measured in items of 1000. - Added the
addItemAllowance
function that takes a class ofInvoiceItemDiscount
as a parameter. The logic is similar to the existingTaxSummary
. - Removed the
discountAmount
anddiscountPercentage
properties along with their setters, since the discounts on a line item can be multiple not just one. - Removed the
quantityType
property along with its setter, since it is not used anywhere in the code - the type is always fixed to47
. - Added a new property
priceWithoutTaxBeforeDiscounts
along with its settersetPriceWithoutTaxBeforeDiscounts
to store the price of the line item before any discounts are applied. - Added a new property
itemPriceDiscount
along with its settersetItemPriceDiscount
to store the discount amount for the line item. This property is optional.
TaxSummary
- Added a bunch of code constants for all possible vat categories. These are used in the
setCategoryCode
function. - Renamed the
base
property tobaseAmount
along with its settersetBaseAmount
.
Segments
- Added segment helper classes to generate commonly used segments from the eSlog2.0 document.
- Current segments are:
- Allowance
- AllowanceInformation
- DateTimePeriod
- Identifier
- MonetaryAmount
- PercentageDetail
Breaking changes
Invoice
issuer
renamed toseller
to better follow document rules. Setters have been updated accordingly fromsetIssuer
tosetSeller
.recipient
renamed tobuyer
to better follow document rules. Setters have been updated accordingly fromsetRecipient
tosetBuyer
.- Removed the
$globalDiscountAmount
and$globalDiscountPercentage
variables along with their setters, since the discounts on a document can be multiple not just one. - Replaced the removed variables with a new function
addDocumentAllowance
that takes a class ofInvoiceDiscount
as a parameter. The logic is similar to the existingTaxSummary
.
An example of the new way to add a discount to the document:
$eInvoice->addDocumentAllowance(
(new \Media24si\eSlog2\InvoiceDiscount())
->setReason('Loyal customer discount')
->setReasonCode(95)
->setAmount(100)
->setPercentage(10)
->setBaseAmount(1000)
->setVatRate(22)
->setVatCategoryCode(\Media24si\eSlog2\TaxSummary::CODE_STANDARD_RATE)
);
InvoiceItem
- Removed the
$discountAmount
and$discountPercentage
variables along with their setters, since the discounts on a line item can be multiple not just one. - Replaced the removed variables with a new function
addItemAllowance
that takes a class ofInvoiceItemDiscount
as a parameter. The logic is similar to the existingTaxSummary
.
An example of the new way to add a discount to a line item:
$invoiceItem->addItemAllowance(
(new \Media24si\eSlog2\InvoiceItemDiscount())
->setReason('Loyal customer item discount')
->setReasonCode(95)
->setPercentage(10)
->setAmount(250)
->setBaseAmount(2500)
);
TaxSummary
- Renamed the
$base
variable with$baseAmount
. Setter has been updated accordingly fromsetBase
tosetBaseAmount
. - Renamed the
$type
variable to$categoryCode
. Setter has been updated accordingly fromsetType
tosetCategoryCode
.
Initial work in progress version
Initial work in progress version.
Tagged since v0.2.0 will have significant breaking changes.