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; 020 021import java.util.ArrayList; 022import java.util.List; 023 024import javax.validation.Valid; 025import javax.xml.bind.annotation.XmlAccessType; 026import javax.xml.bind.annotation.XmlAccessorType; 027import javax.xml.bind.annotation.XmlElement; 028import javax.xml.bind.annotation.XmlType; 029 030import com.neovisionaries.i18n.CurrencyCode; 031 032/** 033 * = The Trade Settlement 034 * 035 * Contains payment related information. 036 */ 037@XmlAccessorType(XmlAccessType.FIELD) 038@XmlType(name = "SupplyChainTradeSettlementType", propOrder = { "paymentReference", "currency", "invoicee", 039 "paymentMeans", "tradeTax", "billingPeriod", "allowanceCharge", "serviceCharge", "paymentTerms", 040 "monetarySummation", "bookingReference" }) 041public class Settlement { 042 043 /** The payment reference or reason for payment */ 044 @XmlElement(name = "PaymentReference") 045 private String paymentReference; 046 047 /** The invoice currency code. */ 048 @XmlElement(name = "InvoiceCurrencyCode") 049 private CurrencyCode currency; 050 051 /** The invoicee trade party. */ 052 @Valid 053 @XmlElement(name = "InvoiceeTradeParty") 054 private TradeParty invoicee; 055 056 /** The specified trade settlement payment means. */ 057 @Valid 058 @XmlElement(name = "SpecifiedTradeSettlementPaymentMeans") 059 private List<PaymentMeans> paymentMeans; 060 061 /** The applicable trade tax. */ 062 @Valid 063 @XmlElement(name = "ApplicableTradeTax") 064 private List<Tax> tradeTax; 065 066 /** The billing period. */ 067 @Valid 068 @XmlElement(name = "BillingSpecifiedPeriod") 069 private Period billingPeriod; 070 071 /** The trade allowance charge. */ 072 @Valid 073 @XmlElement(name = "SpecifiedTradeAllowanceCharge") 074 private List<AllowanceCharge> allowanceCharge; 075 076 /** The logistics service charge. */ 077 @Valid 078 @XmlElement(name = "SpecifiedLogisticsServiceCharge") 079 private List<LogisticsServiceCharge> serviceCharge; 080 081 /** The trade payment terms. */ 082 @Valid 083 @XmlElement(name = "SpecifiedTradePaymentTerms") 084 private List<PaymentTerm> paymentTerms; 085 086 /** The trade settlement monetary summation. */ 087 @Valid 088 @XmlElement(name = "SpecifiedTradeSettlementMonetarySummation") 089 private MonetarySummation monetarySummation; 090 091 /** The receivable specified trade accounting account. */ 092 @XmlElement(name = "ReceivableSpecifiedTradeAccountingAccount") 093 private Account bookingReference; 094 095 /** 096 * Gets the payment reference. 097 * 098 * Can be same as invoice number. 099 * 100 * Profile:: BASIC 101 * 102 * 103 * @return the payment reference 104 */ 105 public String getPaymentReference() { 106 return paymentReference; 107 } 108 109 /** 110 * Sets the payment reference or note to payee 111 * 112 * Can be same as invoice number. 113 * 114 * Profile:: BASIC 115 * 116 * 117 * @param referenceText the reference text 118 * @return the trade settlement 119 */ 120 public Settlement setPaymentReference(String referenceText) { 121 this.paymentReference = referenceText; 122 return this; 123 } 124 125 /** 126 * Gets the invoice currency code 127 * 128 * Profile:: BASIC. 129 * 130 * @return the +ISO 4217 3A+ currency code 131 */ 132 public CurrencyCode getCurrency() { 133 return currency; 134 } 135 136 /** 137 * Sets the invoice currency code. 138 * Profile:: BASIC 139 * 140 * @param currency the new currency 141 * @return the trade settlement 142 */ 143 144 public Settlement setCurrency(CurrencyCode currency) { 145 this.currency = currency; 146 return this; 147 } 148 149 /** 150 * Gets the invoicee trade party. 151 * 152 * Profile:: COMFORT 153 * 154 * 155 * @return the invoicee trade party 156 */ 157 public TradeParty getInvoicee() { 158 return invoicee; 159 } 160 161 /** 162 * Sets the invoicee trade party. 163 * 164 * Profile:: COMFORT 165 * 166 * 167 * @param invoicee the new invoicee trade party 168 * @return the supply chain trade settlement 169 */ 170 public Settlement setInvoicee(TradeParty invoicee) { 171 this.invoicee = invoicee; 172 return this; 173 } 174 175 /** 176 * Gets the specified trade settlement payment means. 177 * 178 * @return the specified trade settlement payment means 179 */ 180 public List<PaymentMeans> getPaymentMeans() { 181 if (paymentMeans == null) { 182 paymentMeans = new ArrayList<PaymentMeans>(); 183 } 184 return this.paymentMeans; 185 } 186 187 /** 188 * Adds the payment method. 189 * 190 * @param newPaymentMethod the new payment method 191 * @return the supply chain trade settlement 192 */ 193 public Settlement addPaymentMeans(PaymentMeans newPaymentMethod) { 194 getPaymentMeans().add(newPaymentMethod); 195 return this; 196 } 197 198 /** 199 * Gets the applicable trade tax. 200 * 201 * @return the applicable trade tax 202 */ 203 public List<Tax> getTradeTax() { 204 if (tradeTax == null) { 205 tradeTax = new ArrayList<Tax>(); 206 } 207 return this.tradeTax; 208 } 209 210 /** 211 * Adds a trade tax. 212 * 213 * @param additionalTradeTax 214 * @return the trade settlement 215 */ 216 public Settlement addTradeTax(Tax additionalTradeTax) { 217 getTradeTax().add(additionalTradeTax); 218 return this; 219 } 220 221 /** 222 * Gets the billing specified period. 223 * 224 * Profile:: COMFORT 225 * 226 * 227 * @return the billing specified period 228 */ 229 public Period getBillingPeriod() { 230 return billingPeriod; 231 } 232 233 /** 234 * Sets the billing specified period. 235 * 236 * Profile:: COMFORT 237 * 238 * 239 * @param billingPeriod the new billing specified period 240 * @return the supply chain trade settlement 241 */ 242 public Settlement setBillingPeriod(Period billingPeriod) { 243 this.billingPeriod = billingPeriod; 244 return this; 245 } 246 247 /** 248 * Gets the trade allowance charge. 249 * 250 * Profile:: COMFORT 251 * 252 * 253 * @return the specified trade allowance charge 254 */ 255 public List<AllowanceCharge> getAllowanceCharge() { 256 if (allowanceCharge == null) { 257 allowanceCharge = new ArrayList<AllowanceCharge>(); 258 } 259 return this.allowanceCharge; 260 } 261 262 /** 263 * Adds the trade allowance charge. 264 * 265 * Profile:: COMFORT 266 * 267 * 268 * @param additionalAllowanceCharge an additional allowance charge 269 * @return the trade settlement 270 */ 271 public Settlement addAllowanceCharge(AllowanceCharge additionalAllowanceCharge) { 272 getAllowanceCharge().add(additionalAllowanceCharge); 273 return this; 274 } 275 276 /** 277 * Gets the specified logistics service charge. 278 * 279 * Profile:: COMFORT 280 * 281 * 282 * @return the specified logistics service charge 283 */ 284 public List<LogisticsServiceCharge> getServiceCharge() { 285 if (serviceCharge == null) { 286 serviceCharge = new ArrayList<LogisticsServiceCharge>(); 287 } 288 return this.serviceCharge; 289 } 290 291 /** 292 * Adds the specified logistics service charge. 293 * 294 * Profile:: COMFORT 295 * 296 * 297 * @param logisticsServiceCharge the logistics service charge 298 * @return the trade settlement 299 */ 300 public Settlement addServiceCharge(LogisticsServiceCharge logisticsServiceCharge) { 301 getServiceCharge().add(logisticsServiceCharge); 302 return this; 303 } 304 305 /** 306 * Gets the specified trade payment terms. 307 * 308 * Profile:: COMFORT 309 * 310 * 311 * @return the specified trade payment terms 312 */ 313 public List<PaymentTerm> getPaymentTerms() { 314 if (paymentTerms == null) { 315 paymentTerms = new ArrayList<PaymentTerm>(); 316 } 317 return this.paymentTerms; 318 } 319 320 /** 321 * Adds a Payment Term 322 * Profile:: COMFORT. 323 * 324 * @param additionalPaymentTerm the additional payment term 325 * @return the trade settlement 326 */ 327 public Settlement addPaymentTerm(PaymentTerm additionalPaymentTerm) { 328 getPaymentTerms().add(additionalPaymentTerm); 329 return this; 330 } 331 332 /** 333 * Gets the trade settlement monetary summation. 334 * 335 * Profile:: BASIC 336 * 337 * 338 * @return the specified trade settlement monetary summation 339 */ 340 public MonetarySummation getMonetarySummation() { 341 return monetarySummation; 342 } 343 344 /** 345 * Sets the trade settlement monetary summation. 346 * 347 * Profile:: BASIC 348 * 349 * 350 * @param monetarySummation the new monetary summation 351 * @return the supply chain trade settlement 352 */ 353 public Settlement setMonetarySummation(MonetarySummation monetarySummation) { 354 this.monetarySummation = monetarySummation; 355 return this; 356 } 357 358 /** 359 * Gets the booking reference account. 360 * Profile:: EXTENDED 361 * 362 * @return the account of the booking reference 363 */ 364 public Account getBookingReference() { 365 return bookingReference; 366 } 367 368 /** 369 * Sets the booking reference account. 370 * Profile:: EXTENDED 371 * 372 * @param bookingReference the booking reference account. 373 * @return the trade 374 */ 375 public Settlement setBookingReference(Account bookingReference) { 376 this.bookingReference = bookingReference; 377 return this; 378 } 379 380}