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.validator.annotation.NotBlank; 022import io.konik.zugferd.unqualified.Amount; 023 024import javax.validation.Valid; 025import javax.xml.bind.annotation.XmlElement; 026import javax.xml.bind.annotation.XmlType; 027import java.io.Serializable; 028import java.util.ArrayList; 029import java.util.List; 030 031/** 032 * = The Logistics Service Charge 033 * 034 * Represents the transport and packaging costs. 035 */ 036@Comfort 037@XmlType(name = "LogisticsServiceChargeType", propOrder = { "description", "amount", "tradeTax" }) 038public class LogisticsServiceCharge implements Serializable { 039 040 @XmlElement(name = "Description") 041 private String description; 042 043 @XmlElement(name = "AppliedAmount") 044 private Amount amount; 045 046 @XmlElement(name = "AppliedTradeTax") 047 private List<AppliedTax> tradeTax; 048 049 /** 050 * Gets human readable description of the charge type 051 * 052 * Example:: Shipping and handling charges 053 * 054 * @return the description 055 */ 056 @NotBlank 057 public String getDescription() { 058 return description; 059 } 060 061 /** 062 * Sets human readable description of the charge type 063 * 064 * Example:: Shipping and handling charges 065 * 066 * @param description the new description 067 * @return the logistics service charge 068 */ 069 public LogisticsServiceCharge setDescription(String description) { 070 this.description = description; 071 return this; 072 } 073 074 /** 075 * Gets amount of the logistics service charge. 076 * 077 * @return the logistics service charge amount 078 */ 079 @Valid 080 public Amount getAmount() { 081 return amount; 082 } 083 084 /** 085 * Sets amount of the logistics service charge. 086 * 087 * @param amount the new logistics service charge amount 088 * @return the logistics service charge 089 */ 090 public LogisticsServiceCharge setAmount(Amount amount) { 091 this.amount = amount; 092 return this; 093 } 094 095 /** 096 * Gets the applied trade tax for the logistics service charge amount 097 * 098 * @return the applied trade tax 099 */ 100 @Valid 101 public List<AppliedTax> getTradeTax() { 102 if (tradeTax == null) { 103 tradeTax = new ArrayList<AppliedTax>(); 104 } 105 return this.tradeTax; 106 } 107 108 /** 109 * Adds a trade tax for the logistics service charge amount 110 * 111 * @param additionalTradeTax the additional trade tax 112 * @return the logistics service charge 113 */ 114 public LogisticsServiceCharge addTradeTax(AppliedTax additionalTradeTax) { 115 getTradeTax().add(additionalTradeTax); 116 return this; 117 } 118 119}