001/* Copyright (C) 2014 konik.io 002 * 003 * This file is part of the Konik library. 004 * 005 * The Konik library is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * The Konik library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with the Konik library. If not, see <http://www.gnu.org/licenses/>. 017 */ 018package io.konik.zugferd.entity; 019 020import io.konik.validator.annotation.Comfort; 021import io.konik.zugferd.unece.codes.TaxCategory; 022import io.konik.zugferd.unece.codes.TaxCode; 023 024import javax.validation.constraints.NotNull; 025import javax.xml.bind.annotation.XmlTransient; 026import javax.xml.bind.annotation.XmlType; 027import java.io.Serializable; 028import java.math.BigDecimal; 029 030/** 031 * = The trade tax 032 * 033 * 034 * image::http://yuml.me/0d095a59[Tax Class diagram,link="http://yuml.me/edit/0d095a59"] 035 * 036 * The complexity of this hierarchy is also result of the validation path, as we can not override constraints. 037 */ 038@XmlTransient 039@XmlType(name = "TradeTaxType", propOrder = { "calculated", "type", "exemptionReason", "basis", "lineTotal","allowanceCharge", "category", "percentage" }) 040/* 041HIRACHY TOP DOWN 042as AppliedTradeTax|CategoryTradeTax TypeCode, CategoryCode, ApplicablePercent 043 as ApplicableTradeTax in ITEM +CalculatedAmount, +ExemptionReason 044 as ApplicableTradeTax in TRADE +BasisAmount, +LineTotalBasisAmount, +AllowanceChargeBasisAmount 045 */ 046public interface Tax extends Serializable { 047 /** 048 * Gets the UNCL 5153 tax type code. 049 * 050 * @return the type code 051 */ 052 TaxCode getType(); 053 054 /** 055 * Sets the UNCL 5153 tax type code. 056 * 057 * @param taxTypeCode the tax type code 058 * @return the tax 059 * @see <a href="http://www.unece.org/trade/untdid/d98b/uncl/uncl5153.htm">UNCL 5153</a> 060 */ 061 Tax setType(TaxCode taxTypeCode); 062 063 /** 064 * Gets the tax category. 065 * 066 * @return the category code 067 */ 068 TaxCategory getCategory(); 069 070 /** 071 * Sets the tax category. 072 * 073 * @param taxCategory the new tax category code 074 * @return the tax 075 */ 076 Tax setCategory(TaxCategory taxCategory); 077 078 /** 079 * Gets the applicable tax percentage. 080 * 081 * @return the applicable tax percentage 082 */ 083 @NotNull(groups = Comfort.class) 084 BigDecimal getPercentage(); 085 086 /** 087 * Sets the applicable tax percentage. 088 * 089 * @param taxPercentage the new applicable tax percentage 090 * @return the tax 091 */ 092 Tax setPercentage(BigDecimal taxPercentage); 093}