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 io.konik.zugferd.unece.codes.PaymentMeansCode;
022
023import java.util.ArrayList;
024import java.util.List;
025
026import javax.validation.Valid;
027import javax.validation.executable.ValidateOnExecution;
028import javax.xml.bind.annotation.XmlAccessType;
029import javax.xml.bind.annotation.XmlAccessorType;
030import javax.xml.bind.annotation.XmlElement;
031import javax.xml.bind.annotation.XmlType;
032
033/**
034 * = The Payment Means
035 * 
036 * Detailed information on the means of payment.
037 */
038@XmlAccessorType(XmlAccessType.FIELD)
039@XmlType(name = "TradeSettlementPaymentMeansType", propOrder = { "code", "information", "payerAccount", "payeeAccount",
040      "payerInstitution", "payeeInstitution" })
041@ValidateOnExecution
042public class PaymentMeans {
043
044   @Valid
045   @XmlElement(name = "TypeCode")
046   private PaymentMeansCode code;
047
048   @XmlElement(name = "Information")
049   private List<String> information;
050
051   @Valid
052   @XmlElement(name = "PayerPartyDebtorFinancialAccount")
053   private FinancialAccount payerAccount;
054
055   @Valid
056   @XmlElement(name = "PayeePartyCreditorFinancialAccount")
057   private FinancialAccount payeeAccount;
058
059   @Valid
060   @XmlElement(name = "PayerSpecifiedDebtorFinancialInstitution")
061   private FinancialInstitution payerInstitution;
062
063   @Valid
064   @XmlElement(name = "PayeeSpecifiedCreditorFinancialInstitution")
065   private FinancialInstitution payeeInstitution;
066
067   /**
068    * Gets the +UNCL 4461+ type code.
069    * 
070    * Profile:: COMFORT
071    * 
072    * @return the UNCL 4461 type code
073    * @see http://www.unece.org/trade/untdid/d13b/tred/tred4461.htm[UN/EDIFACT 4461 Payment means code^]
074    */
075   public PaymentMeansCode getCode() {
076      return code;
077   }
078
079   /**
080    * Sets the +UNCL 4461+ code.
081    *
082    * Profile:: *COMFORT*
083    * 
084    * @param paymentMeansCode the new UNCL 4461 payment means code
085    * @return the trade settlement payment means
086    * @see http://www.unece.org/trade/untdid/d13b/tred/tred4461.htm[UN/EDIFACT 4461 Payment means code^]
087    */
088   public PaymentMeans setCode(PaymentMeansCode paymentMeansCode) {
089      this.code = paymentMeansCode;
090      return this;
091   }
092
093   /**
094    * Gets the free text payment method information.
095    * 
096    * Profile:: COMFORT
097    * 
098    * Example:: +Cash, Credit Card+
099    * 
100    * @return the information
101    */
102   public List<String> getInformation() {
103      if (information == null) {
104         information = new ArrayList<String>();
105      }
106      return this.information;
107   }
108
109   /**
110    * Adds the free text payment method information.
111    * 
112    * Profile:: COMFORT
113    * 
114    * Example:: +Cash, Credit Card+
115    *
116    * @param additionalInformation the additional information
117    * @return the payment means
118    */
119   public PaymentMeans addInformation(String additionalInformation) {
120      getInformation().add(additionalInformation);
121      return this;
122   }
123
124   /**
125    * Gets the payer/buyer debtor financial account.
126    * 
127    * Profile:: COMFORT
128    * 
129    * 
130    * @return the payer party debtor financial account
131    */
132   public FinancialAccount getPayerAccount() {
133      return payerAccount;
134   }
135
136   /**
137    * Sets the payer/buyer party debtor financial account.
138    * 
139    * Profile:: COMFORT
140    * 
141    * 
142    * @param payerAccount the payer account
143    * @return the trade settlement payment means
144    */
145   public PaymentMeans setPayerAccount(FinancialAccount payerAccount) {
146      this.payerAccount = payerAccount;
147      return this;
148   }
149
150   /**
151    * Gets the payee/seller party creditor financial account.
152    * 
153    * Profile:: BASIC
154    * 
155    * 
156    * @return the payee party creditor financial account
157    */
158   public FinancialAccount getPayeeAccount() {
159      return payeeAccount;
160   }
161
162   /**
163    * Sets the payee/seller party creditor financial account.
164    * 
165    * Profile:: BASIC
166    * 
167    * 
168    * @param payeeAccount the payee account
169    * @return the trade settlement payment means
170    */
171   public PaymentMeans setPayeeAccount(FinancialAccount payeeAccount) {
172      this.payeeAccount = payeeAccount;
173      return this;
174   }
175
176   /**
177    * Gets the payer/buyer specified debtor financial institution.
178    * 
179    * Profile:: COMFORT
180    * 
181    * 
182    * @return the payer specified debtor financial institution
183    */
184   public FinancialInstitution getPayerInstitution() {
185      return payerInstitution;
186   }
187
188   /**
189    * Sets the payer/buyer specified debtor financial institution.
190    * 
191    * Profile:: COMFORT
192    * 
193    * 
194    * @param payerInstitution the payer institution
195    * @return the trade settlement payment means
196    */
197   public PaymentMeans setPayerInstitution(FinancialInstitution payerInstitution) {
198      this.payerInstitution = payerInstitution;
199      return this;
200   }
201
202   /**
203    * Gets the payee/seller specified creditor financial institution.
204    * 
205    * Profile:: BASIC
206    * 
207    * 
208    * @return the payee specified creditor financial institution
209    */
210   public FinancialInstitution getPayeeInstitution() {
211      return payeeInstitution;
212   }
213
214   /**
215    * Sets the payee/seller specified creditor financial institution.
216    * 
217    * Profile:: BASIC
218    * 
219    * 
220    * @param payeeInstitution the payee institution
221    * @return the trade settlement payment means
222    */
223   public PaymentMeans setPayeeInstitution(FinancialInstitution payeeInstitution) {
224      this.payeeInstitution = payeeInstitution;
225      return this;
226   }
227
228}