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