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 io.konik.jaxb.bindable.unqualified.PercentRoundingAdapter; 022import io.konik.validator.annotation.Comfort; 023import io.konik.validator.annotation.Extended; 024import io.konik.zugferd.unece.codes.TaxCategory; 025import io.konik.zugferd.unece.codes.TaxCode; 026import io.konik.zugferd.unqualified.Amount; 027 028import java.math.BigDecimal; 029 030import javax.validation.Valid; 031import javax.xml.bind.annotation.XmlElement; 032import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 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 056 @Override 057 @Valid 058 @Extended 059 public Amount getCalculated() { 060 return calculated; 061 } 062 063 @Override 064 public SpecifiedTax setCalculated(Amount calculatedAmount) { 065 this.calculated = calculatedAmount; 066 return this; 067 } 068 069 @Comfort 070 @Override 071 public TaxCode getType() { 072 return this.type; 073 } 074 075 @Override 076 public ItemTax setType(TaxCode taxTypeCode) { 077 this.type = taxTypeCode; 078 return this; 079 } 080 081 @Override 082 @Comfort 083 public String getExemptionReason() { 084 return exemptionReason; 085 } 086 087 @Override 088 public SpecifiedTax setExemptionReason(String exemptionReason) { 089 this.exemptionReason = exemptionReason; 090 return this; 091 } 092 093 @Comfort 094 @Override 095 public TaxCategory getCategory() { 096 return this.category; 097 } 098 099 @Override 100 public SpecifiedTax setCategory(TaxCategory value) { 101 this.category = value; 102 return this; 103 } 104 105 @Override 106 public BigDecimal getPercentage() { 107 return this.percentage; 108 } 109 110 @Override 111 public SpecifiedTax setPercentage(BigDecimal applicablePercentage) { 112 this.percentage = applicablePercentage; 113 return this; 114 } 115}