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