updated some javadoc

This commit is contained in:
jstaerk
2022-09-22 11:20:10 +02:00
parent f49b401792
commit 86d7d20cab
8 changed files with 161 additions and 9 deletions

View File

@@ -2,7 +2,8 @@
======= =======
2022-09-22 2022-09-22
Removed a unneccessary dependency (ph-jaxb) Removed a unneccessary dependency (ph-jaxb).
Added some javadoc.
2.5.5 2.5.5
======= =======

View File

@@ -5,16 +5,31 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
import java.math.BigDecimal; import java.math.BigDecimal;
/***
* (absolute) allowances on item and document level
*/
public class Allowance extends Charge implements IZUGFeRDAllowanceCharge { public class Allowance extends Charge implements IZUGFeRDAllowanceCharge {
/***
* bean constructor
*/
public Allowance() { public Allowance() {
} }
/***
* create a allowance with the following amount
* @param totalAmount the money amount as bigdecimal (prob max 2 decimals)
*/
public Allowance(BigDecimal totalAmount) { public Allowance(BigDecimal totalAmount) {
super(totalAmount); super(totalAmount);
} }
/***
* Always to return false for IZUGFeRDAllowanceCharge
* @return false since its not supposed to be calculated negatively
*/
@Override @Override
public boolean isCharge() { public boolean isCharge() {
return false; return false;

View File

@@ -6,13 +6,33 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment;
* provides e.g. the IBAN to transfer money to :-) * provides e.g. the IBAN to transfer money to :-)
*/ */
public class BankDetails implements IZUGFeRDTradeSettlementPayment { public class BankDetails implements IZUGFeRDTradeSettlementPayment {
protected String IBAN, BIC, accountName=null; /**
* the bank account number
*/
protected String IBAN;
/**
* BIC, I believe it's optional
*/
protected String BIC;
/**
* the "name" of the bank account (holder)
*/
protected String accountName=null;
/***
* constructor for normal use :-)
* @param IBAN the IBAN as string
* @param BIC the BIC code as string
*/
public BankDetails(String IBAN, String BIC) { public BankDetails(String IBAN, String BIC) {
this.IBAN = IBAN; this.IBAN = IBAN;
this.BIC = BIC; this.BIC = BIC;
} }
/***
* getter for the IBAN
* @return IBAN
*/
public String getIBAN() { public String getIBAN() {
return IBAN; return IBAN;
} }
@@ -30,6 +50,10 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
return this; return this;
} }
/***
* getter for the BIC
* @return the BIC
*/
public String getBIC() { public String getBIC() {
return BIC; return BIC;
} }

View File

@@ -7,10 +7,13 @@ import com.helger.ubl22.UBL22Writer;
import java.io.File; import java.io.File;
import java.io.Serializable; import java.io.Serializable;
public class CIIToUBL {
/*** /***
* converts a CII XML file to a UBL XML file * converts a CII XML file to a UBL XML file
* thanks to Philip Helger for his library * thanks to Philip Helger for his library
*/
public class CIIToUBL {
/***
* performs the actual conversion
* @param input * @param input
* @param output * @param output
*/ */

View File

@@ -7,14 +7,35 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
import java.math.BigDecimal; import java.math.BigDecimal;
/***
* Absolute and relative charges for document and item level
*/
public class Charge implements IZUGFeRDAllowanceCharge { public class Charge implements IZUGFeRDAllowanceCharge {
/**
* the percentage, null if not relative at all
*/
protected BigDecimal percent = null; protected BigDecimal percent = null;
/**
* the absolute value if not percentage
*/
protected BigDecimal totalAmount; protected BigDecimal totalAmount;
/**
* the tax rate the charge belongs to
*/
protected BigDecimal taxPercent; protected BigDecimal taxPercent;
/**
* a simple human readable description
*/
protected String reason; protected String reason;
/**
* the category ID why this charge has been applied
*/
protected String categoryCode; protected String categoryCode;
/***
* Bean connstructor
*/
public Charge() { public Charge() {
taxPercent=BigDecimal.ZERO; taxPercent=BigDecimal.ZERO;
} }
@@ -28,16 +49,31 @@ public class Charge implements IZUGFeRDAllowanceCharge {
} }
/***
* sets the total amount to be changed to, e.g. if not specified via constructor
* @param totalAmount 2 decimal money amount
* @return fluid setter
*/
public Charge setTotalAmount(BigDecimal totalAmount) { public Charge setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount; this.totalAmount = totalAmount;
return this; return this;
} }
/***
* if relative charge: percent to increase the item
* @param percent as bigdecimal
* @return fluid setter
*/
public Charge setPercent(BigDecimal percent) { public Charge setPercent(BigDecimal percent) {
this.percent = percent; this.percent = percent;
return this; return this;
} }
/***
* charges can be applied to VAT items, in which case they take the same VAT rate
* @param taxPercent the tax percentage on the charge
* @return fluid setter
*/
public Charge setTaxPercent(BigDecimal taxPercent) { public Charge setTaxPercent(BigDecimal taxPercent) {
this.taxPercent = taxPercent; this.taxPercent = taxPercent;
return this; return this;
@@ -49,6 +85,11 @@ public class Charge implements IZUGFeRDAllowanceCharge {
return reason; return reason;
} }
/***
* Freetext (?) reason for the charge
* @param reason freetext
* @return fluid setter
*/
public Charge setReason(String reason) { public Charge setReason(String reason) {
this.reason = reason; this.reason = reason;
return this; return this;
@@ -77,6 +118,12 @@ public class Charge implements IZUGFeRDAllowanceCharge {
return taxPercent; return taxPercent;
} }
/***
* Always to return true for IZUGFeRDAllowanceCharge
* @return true since it is supposed to be calculated negatively
*/
@Override @Override
public boolean isCharge() { public boolean isCharge() {
return true; return true;
@@ -91,6 +138,11 @@ public class Charge implements IZUGFeRDAllowanceCharge {
} }
/***
* machine readable reason for this allowance/charge
* @param categoryCode usually S
* @return fluid setter
*/
public Charge setCategoryCode(String categoryCode) { public Charge setCategoryCode(String categoryCode) {
this.categoryCode = categoryCode; this.categoryCode = categoryCode;
return this; return this;

View File

@@ -13,7 +13,37 @@ import org.w3c.dom.NodeList;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class Contact implements IZUGFeRDExportableContact { public class Contact implements IZUGFeRDExportableContact {
protected String name, phone, email, zip, street, location, country; /**
* name of the contact person
*/
protected String name;
/**
* phone of the contact
*/
protected String phone;
/**
* email address
*/
protected String email;
/**
* postcode of the contact
*/
protected String zip;
/**
* street address (=name+number)
*/
protected String street;
/**
* city
*/
protected String location;
/**
* 2 character ISO code of a country
*/
protected String country;
/**
* the fax number of the contact person
*/
protected String fax = null; protected String fax = null;
/*** /***

View File

@@ -20,20 +20,47 @@ import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* The interface for allowances or charges, to be used by the pullprovider
* @author AlexanderSchmidt * @author AlexanderSchmidt
*/ */
public interface IZUGFeRDAllowanceCharge { public interface IZUGFeRDAllowanceCharge {
/***
* returns the absolute amount, even if it was relative in the first place
* @param trans the class delivering the initial value
* @return the calculated value (e.g. when percentage)
*/
BigDecimal getTotalAmount(IAbsoluteValueProvider trans); BigDecimal getTotalAmount(IAbsoluteValueProvider trans);
/***
* returns a percentage, if relative abount, or null for absolute amounts
* @return null or Percentage as Bigdecimal
*/
default BigDecimal getPercent() {return null;} default BigDecimal getPercent() {return null;}
/***
* get a description for the allowance/charge
* @return the description
*/
String getReason(); String getReason();
/***
* get the applicable tax percentage for the allowance/charge
* @return the percentage
*/
BigDecimal getTaxPercent(); BigDecimal getTaxPercent();
/***
* the category ID why this has been applied
* @return default value Standard rate=S
*/
default String getCategoryCode() { default String getCategoryCode() {
return TaxCategoryCodeTypeConstants.STANDARDRATE; return TaxCategoryCodeTypeConstants.STANDARDRATE;
} }
/***
* is this in reality a charge and now allowance
* @return true if amnount to be treated negative
*/
public boolean isCharge(); public boolean isCharge();
} }

View File

@@ -21,15 +21,15 @@ package org.mustangproject.ZUGFeRD;
public interface IZUGFeRDTradeSettlement { public interface IZUGFeRDTradeSettlement {
/*** /***
* * gets the applicableHeaderTradeSettlement
* @return zf2 xml for applicableHeaderTradeSettlement * @return zf2 xml
*/ */
String getSettlementXML(); String getSettlementXML();
/*** /***
* * gets the applicableHeaderTradePayment
* @return zf2 xml for applicableHeaderTradePayment * @return zf2 xml
*/ */
default String getPaymentXML() { default String getPaymentXML() {
return null; return null;