Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue: Using addDocumentAllowanceCharge with Code SERVICE_OUTSIDE_SCOPE_OF_TAX never passes validation because Taxtype is omitted if you pass no VAT rate #195

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

c-schmitz
Copy link
Contributor

@c-schmitz c-schmitz commented Dec 3, 2024

Description

When trying to set a document allowance with tax code SERVICE_OUTSIDE_SCOPE_OF_TAX and zero rate, it would never pass Zugferd validation.

The problem is that SERVICE_OUTSIDE_SCOPE_OF_TAX does not allow a rate to be set at all.

But if I null the rate in $document->addDocumentAllowanceCharge() the resulting XML would also not pass the validation as no tax information will be set, at all.

Issue type

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Before patch:

Neither
$document->addDocumentAllowanceCharge(abs($item->net_price_for_item), false, ZugferdDutyTaxFeeCategories::SERVICE_OUTSIDE_SCOPE_OF_TAX, "VAT", null, null, null, null, null, null, ZugferdAllowanceCodes::DISCOUNT);

nor

$document->addDocumentAllowanceCharge(abs($item->net_price_for_item), false, ZugferdDutyTaxFeeCategories::SERVICE_OUTSIDE_SCOPE_OF_TAX, "VAT", 0, null, null, null, null, null, ZugferdAllowanceCodes::DISCOUNT);

resulted in a valid document.

After applying the patch

$document->addDocumentAllowanceCharge(abs($item->net_price_for_item), false, ZugferdDutyTaxFeeCategories::SERVICE_OUTSIDE_SCOPE_OF_TAX, "VAT", null, null, null, null, null, null, ZugferdAllowanceCodes::DISCOUNT);

tests valid (and is IMHO the correct behaviour as no tax rate should be applied)

Test Configuration:

Using Mustang Project and online Zugferd validators to confirm my findings.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

…DE_SCOPE_OF_TAX never passes validation as the Taxtype is omitted if you pass no VAT rate
@c-schmitz c-schmitz changed the title Fixed issue: Using addDocumentAllowanceCharge with Code SERVICE_OUTSIDE_SCOPE_OF_TAX never passes validation bcause Taxtype is omitted if you pass no VAT rate Fixed issue: Using addDocumentAllowanceCharge with Code SERVICE_OUTSIDE_SCOPE_OF_TAX never passes validation because Taxtype is omitted if you pass no VAT rate Dec 3, 2024
@horstoeko
Copy link
Owner

Hi @c-schmitz,

thank you for your contribution... Merging....

Kind regards

@horstoeko horstoeko merged commit 1e5ffc9 into horstoeko:master Dec 3, 2024
Repository owner locked as resolved and limited conversation to collaborators Dec 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants