001/* 002 * Copyright (C) 2014 konik.io 003 * 004 * This file is part of Konik library. 005 * 006 * Konik library is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU Affero General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Konik library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU Affero General Public License for more details. 015 * 016 * You should have received a copy of the GNU Affero General Public License 017 * along with Konik library. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package io.konik.zugferd.entity.trade.item; 020 021import java.math.BigDecimal; 022 023import javax.validation.Valid; 024import javax.xml.bind.annotation.XmlElement; 025import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 026 027import io.konik.jaxb.bindable.unqualified.PercentRoundingAdapter; 028import io.konik.validator.annotation.Comfort; 029import io.konik.validator.annotation.Extended; 030import io.konik.zugferd.unece.codes.TaxCategory; 031import io.konik.zugferd.unece.codes.TaxCode; 032import io.konik.zugferd.unqualified.Amount; 033 034/** 035 * = The trade tax on an item basis. 036 */ 037public class ItemTax implements SpecifiedTax { 038 039 @XmlElement(name = "CalculatedAmount") 040 private Amount calculated; 041 042 @XmlElement(name = "TypeCode") 043 private TaxCode type; 044 045 @XmlElement(name = "ExemptionReason") 046 private String exemptionReason; 047 048 @XmlElement(name = "CategoryCode") 049 private TaxCategory category; 050 051 @XmlElement(name = "ApplicablePercent") 052 @XmlJavaTypeAdapter(PercentRoundingAdapter.class) 053 private BigDecimal percentage; 054 055 @Override 056 @Valid 057 @Extended 058 public Amount getCalculated() { 059 return calculated; 060 } 061 062 @Override 063 public SpecifiedTax setCalculated(Amount calculatedAmount) { 064 this.calculated = calculatedAmount; 065 return this; 066 } 067 068 @Comfort 069 @Override 070 public TaxCode getType() { 071 return this.type; 072 } 073 074 @Override 075 public ItemTax setType(TaxCode taxTypeCode) { 076 this.type = taxTypeCode; 077 return this; 078 } 079 080 @Override 081 @Comfort 082 public String getExemptionReason() { 083 return exemptionReason; 084 } 085 086 @Override 087 public SpecifiedTax setExemptionReason(String exemptionReason) { 088 this.exemptionReason = exemptionReason; 089 return this; 090 } 091 092 @Comfort 093 @Override 094 public TaxCategory getCategory() { 095 return this.category; 096 } 097 098 @Override 099 public SpecifiedTax setCategory(TaxCategory value) { 100 this.category = value; 101 return this; 102 } 103 104 @Override 105 public BigDecimal getPercentage() { 106 return this.percentage; 107 } 108 109 @Override 110 public SpecifiedTax setPercentage(BigDecimal applicablePercentage) { 111 this.percentage = applicablePercentage; 112 return this; 113 } 114}