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