org.kapott.hbci.GV_Result.GVRAccInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hbci4j-adorsys Show documentation
Show all versions of hbci4j-adorsys Show documentation
HBCI4j - Home Banking Computer Interface for Java - Clone from https://github.com/hbci4j/hbci4java
/* $Id: GVRAccInfo.java,v 1.1 2011/05/04 22:37:47 willuhn Exp $
This file is part of HBCI4Java
Copyright (C) 2001-2008 Stefan Palme
HBCI4Java is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
HBCI4Java is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.kapott.hbci.GV_Result;
import org.kapott.hbci.manager.HBCIUtils;
import org.kapott.hbci.passport.HBCIPassportInternal;
import org.kapott.hbci.structures.Konto;
import org.kapott.hbci.structures.Value;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/**
* Klasse für die Ergebnisdaten einer Kontostammdaten-Abfrage
*/
public class GVRAccInfo extends HBCIJobResultImpl {
private static final BigDecimal ONE_THOUSAND = new BigDecimal("1000.00");
private List entries;
public GVRAccInfo(HBCIPassportInternal passport) {
super(passport);
entries = new ArrayList<>();
}
public void addEntry(AccInfo info) {
entries.add(info);
}
/**
* Holen aller empfangenen Kontostammdaten.
*
* @return Array mit einzelnen Konto-Informationen. Das Array ist niemals
* null
, kann aber die Länge 0
haben
*/
public AccInfo[] getEntries() {
return entries.toArray(new AccInfo[0]);
}
@Override
public String toString() {
StringBuilder ret = new StringBuilder();
String linesep = System.getProperty("line.separator");
int num = 0;
for (AccInfo entry : entries) {
num++;
ret.append("Kontoinfo #").append(num).append(linesep);
ret.append((entry).toString()).append(linesep);
}
return ret.toString().trim();
}
/**
* Informationen zu genau einem Konto
*/
public static class AccInfo {
public static final int DELIVER_TYPE_NONE = 0;
public static final int DELIVER_TYPE_POST = 1;
public static final int DELIVER_TYPE_KAD = 2;
public static final int DELIVER_TYPE_OFFICE = 3;
public static final int DELIVER_TYPE_EDV = 4;
public static final int TURNUS_DAILY = 1;
public static final int TURNUS_WEEKLY = 2;
public static final int TURNUS_MONTHLY = 3;
public static final int TURNUS_QUARTER = 4;
public static final int TURNUS_HALF = 5;
public static final int TURNUS_ANNUAL = 6;
/**
* Konto, auf das sich diese Daten beziehen
*/
public Konto account;
/**
* Kontoart - Folgende Wertebereiche sind definiert:.
*
* - 1-9 - Kontokorrent-/Girokonto
* - 10-19 - Sparkonto
* - 20-29 - Festgeldkonto (Termineinlagen)
* - 30-39 - Wertpapierdepot
* - 40-49 - Kredit-/Darlehenskonto
* - 50-59 - Kreditkartenkonto
* - 60-69 - Fondsdepot bei einer Kapitalanlagegesellschaft
* - 70-79 - Bausparvertrag
* - 80-89 - Versicherungsvertrag
* - 90-99 - Sonstige
*
* -1
, wenn diese Information nicht von der Bank
* bereitgestellt wird
*/
public int type;
/**
* Eröffnungsdatum (optional)
*/
public Date created;
/**
* 1000*Sollzins (optional)
*/
public long sollzins;
/**
* 1000*Habenzins (optional)
*/
public long habenzins;
/**
* 1000*Ãberziehungszins (optional)
*/
public long ueberzins;
/**
* Kreditlinie (optional)
*/
public Value kredit;
/**
* Referenzkonto (zB für Kreditkartenkonten) (optional)
*/
public Konto refAccount;
/**
* Versandart für Kontoauszüge. Folgende Werte sind definiert:
*
* DELIVER_TYPE_NONE
- kein Auszug
* DELIVER_TYPE_POST
- Postzustellung
* DELIVER_TYPE_KAD
- Kontoauszugsdrucker
* DELIVER_TYPE_OFFICE
- Abholung in Geschäftsstelle
* DELIVER_TYPE_EDV
- elektronische Ãbermittlung
*
*/
public int versandart;
/**
* Turnus für Kontoauszugszustellung (nur bei Postzustellung) (optional).
* Folgende Werte sind definiert:
*
* TURNUS_DAILY
- täglicher Kontoauszug
* TURNUS_WEEKLY
- wöchentlicher Kontoauszug
* TURNUS_MONTHLY
- monatlicher Kontoauszug
* TURNUS_QUARTER
- vierteljährlicher Kontoauszug
* TURNUS_HALF
- halbjährlicher Kontoauszug
* TURNUS_ANNUAL
- jährlicher Kontoauszug
*
*/
public int turnus;
/**
* Weitere Informationen (optional)
*/
public String comment;
// TODO: doku fehlt
public Address address;
public String toString() {
StringBuffer ret = new StringBuffer();
String linesep = System.getProperty("line.separator");
ret.append("Konto ").append(account.toString());
ret.append(" (art: ").append(type).append(")").append(linesep);
if (created != null)
ret.append("Eröffnungsdatum: ").append(HBCIUtils.date2StringLocal(created)).append(linesep);
ret.append("Sollzins:").append(HBCIUtils.bigDecimal2String(new BigDecimal(sollzins).divide(ONE_THOUSAND)));
ret.append(" Habenzins:").append(HBCIUtils.bigDecimal2String(new BigDecimal(habenzins).divide(ONE_THOUSAND)));
ret.append(" Ãberziehungszins:").append(HBCIUtils.bigDecimal2String(new BigDecimal(ueberzins).divide(ONE_THOUSAND)));
ret.append(" Kredit: ").append(kredit).append(linesep);
if (refAccount != null)
ret.append("Referenzkonto: ").append(refAccount.toString()).append(linesep);
ret.append("Kontoauszug Versandart:").append(versandart);
ret.append(" Turnus:").append(turnus).append(linesep);
if (comment != null)
ret.append("Bemerkungen: ").append(comment).append(linesep);
if (address != null) {
ret.append("Anschrift").append(linesep);
ret.append(address.toString()).append(linesep);
}
// TODO: Berechtigte
return ret.toString().trim();
}
// TODO public Berechtigter[] berechtigte;
// /* TODO Briefanschrift (optional) */
// TODO: doku fehlt
public static class Address {
public String name1;
public String name2;
public String street_pf;
public String plz_ort;
public String plz;
public String ort;
public String country;
public String tel;
public String fax;
public String email;
public String toString() {
StringBuffer ret = new StringBuffer();
String linesep = System.getProperty("line.separator");
ret.append(name1);
if (name2 != null) {
ret.append(" " + name2);
}
ret.append(linesep);
ret.append(street_pf).append(linesep);
if (plz_ort != null) {
ret.append(plz_ort);
} else {
ret.append(plz).append(" ").append(ort);
}
ret.append(linesep);
if (country != null) {
ret.append(country).append(linesep);
}
if (tel != null) {
ret.append("Tel: ").append(tel).append(linesep);
}
if (fax != null) {
ret.append("Fax: ").append(fax).append(linesep);
}
if (email != null) {
ret.append("Email: ").append(email).append(linesep);
}
return ret.toString();
}
}
}
}