Skip to content

Commit

Permalink
Merge pull request #573 from janrosendahl/feature/CategoryCode
Browse files Browse the repository at this point in the history
Feature/category code
  • Loading branch information
jstaerk authored Dec 3, 2024
2 parents 1e25b2f + 419af1d commit 7c9f172
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion library/src/main/java/org/mustangproject/DirectDebit.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
* bean constructor
*/
public DirectDebit() {

this.IBAN = "";
this.mandate = "";
}

/***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ public LineCalculator(IZUGFeRDExportableItem currentItem) {
BigDecimal multiplicator = vatPercent.divide(BigDecimal.valueOf(100));
priceGross = currentItem.getPrice(); // see https://github.com/ZUGFeRD/mustangproject/issues/159
price = priceGross.subtract(allowance).add(charge);
itemTotalNetAmount = currentItem.getQuantity().multiply(getPrice()).divide(currentItem.getBasisQuantity(), 18, RoundingMode.HALF_UP)
// Division/Zero occurred here.
// Used the setScale only because that's also done in getBasisQuantity
BigDecimal basisQuantity = currentItem.getBasisQuantity().compareTo(BigDecimal.ZERO) == 0
? BigDecimal.ONE.setScale(4)
: currentItem.getBasisQuantity();
itemTotalNetAmount = currentItem.getQuantity().multiply(getPrice()).divide(basisQuantity, 18, RoundingMode.HALF_UP)
.subtract(allowanceItemTotal).setScale(2, RoundingMode.HALF_UP);
itemTotalVATAmount = itemTotalNetAmount.multiply(multiplicator);

}

public BigDecimal getPrice() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,15 @@ public List<Item> getLineItemList() {
node = getNodeByName(node.getChildNodes(), "CalculatedAmount");
lineItem.setTax(XMLTools.tryBigDecimal(node));
}

node = getNodeByName(nn.getChildNodes(), "ApplicableTradeTax");
if (node != null) {
node = getNodeByName(node.getChildNodes(), "CategoryCode");
if(node != null){
lineItem.getProduct().setTaxCategoryCode(XMLTools.getNodeValue(node));
}
}

node = getNodeByName(nn.getChildNodes(), "BillingSpecifiedPeriod");
if (node != null) {
final Node start = getNodeByName(node.getChildNodes(), "StartDateTime");
Expand Down

0 comments on commit 7c9f172

Please sign in to comment.