Enhance code quality
This commit is contained in:
@@ -591,11 +591,7 @@ public class Invoice implements IExportableTransaction {
|
||||
* @return fluent setter
|
||||
*/
|
||||
public Invoice setZFAllowances(Allowance[] iza) {
|
||||
Allowances=new ArrayList<>();
|
||||
|
||||
for (IZUGFeRDAllowanceCharge cz:iza) {
|
||||
Allowances.add(cz);
|
||||
}
|
||||
Allowances=new ArrayList<>(Arrays.asList(iza));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -616,9 +612,7 @@ public class Invoice implements IExportableTransaction {
|
||||
*/
|
||||
public Invoice setZFCharges(Charge[] iza) {
|
||||
Charges=new ArrayList<>();
|
||||
for (IZUGFeRDAllowanceCharge cz:iza) {
|
||||
Charges.add(cz);
|
||||
}
|
||||
Charges.addAll(Arrays.asList(iza));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,20 +78,21 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
icnm.getAsString("Name").ifPresent(product::setName);
|
||||
icnm.getAsString("Description").ifPresent(product::setDescription);
|
||||
|
||||
icnm.getAsNodeMap("SellersItemIdentification").ifPresent(SellersItemIdentification -> {
|
||||
SellersItemIdentification.getAsString("ID").ifPresent(product::setSellerAssignedID);
|
||||
});
|
||||
icnm.getAsNodeMap("SellersItemIdentification")
|
||||
.flatMap(SellersItemIdentification -> SellersItemIdentification.getAsString("ID"))
|
||||
.ifPresent(product::setSellerAssignedID);
|
||||
|
||||
icnm.getAsNodeMap("BuyersItemIdentification").ifPresent(BuyersItemIdentification -> {
|
||||
BuyersItemIdentification.getAsString("ID").ifPresent(product::setBuyerAssignedID);
|
||||
});
|
||||
icnm.getAsNodeMap("BuyersItemIdentification")
|
||||
.flatMap(BuyersItemIdentification -> BuyersItemIdentification.getAsString("ID"))
|
||||
.ifPresent(product::setBuyerAssignedID);
|
||||
|
||||
icnm.getAsNodeMap("ClassifiedTaxCategory").flatMap(m -> m.getAsBigDecimal("Percent"))
|
||||
icnm.getAsNodeMap("ClassifiedTaxCategory")
|
||||
.flatMap(m -> m.getAsBigDecimal("Percent"))
|
||||
.ifPresent(product::setVATPercent);
|
||||
});
|
||||
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(icnm -> {
|
||||
icnm.getAsString("LineID").ifPresent(this::setId);
|
||||
});
|
||||
itemMap.getAsNodeMap("AssociatedDocumentLineDocument")
|
||||
.flatMap(icnm -> icnm.getAsString("LineID"))
|
||||
.ifPresent(this::setId);
|
||||
|
||||
itemMap.getAsNodeMap("Price").ifPresent(icnm -> {
|
||||
// ubl
|
||||
@@ -181,7 +182,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
}
|
||||
if (amountString != null) {
|
||||
izac.setTotalAmount(new BigDecimal(amountString));
|
||||
if (percentString!=null&&(percentString!="0")) {
|
||||
if (percentString!=null&&(!percentString.equals("0"))) {
|
||||
izac.setTotalAmount(new BigDecimal(amountString).divide(getQuantity()));
|
||||
}
|
||||
}
|
||||
@@ -211,11 +212,11 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
|
||||
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).forEach(this::addAdditionalReference);
|
||||
|
||||
icnm.getAsString("ReceivableSpecifiedTradeAccountingAccount").ifPresent(s -> this.accountingReference = s == null ? null : s.trim());
|
||||
icnm.getAsString("ReceivableSpecifiedTradeAccountingAccount").ifPresent(s -> this.accountingReference = s.trim());
|
||||
|
||||
icnm.getAsNodeMap("BillingSpecifiedPeriod").ifPresent(periodNode -> {
|
||||
Date start = periodNode.getAsNodeMap("StartDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
|
||||
Date end = periodNode.getAsNodeMap("EndDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
|
||||
Date start = periodNode.getAsNodeMap("StartDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(XMLTools::tryDate).orElse(null);
|
||||
Date end = periodNode.getAsNodeMap("EndDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(XMLTools::tryDate).orElse(null);
|
||||
setDetailedDeliveryPeriod(start, end);
|
||||
});
|
||||
});
|
||||
@@ -428,9 +429,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
public void setItemAllowances(ArrayList<Allowance> theAllowances) {
|
||||
if (theAllowances != null) {
|
||||
Allowances.clear();
|
||||
for (Allowance theAllowance : theAllowances) {
|
||||
Allowances.add(theAllowance);
|
||||
}
|
||||
Allowances.addAll(theAllowances);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,9 +439,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
public void setItemCharges(ArrayList<Charge> theCharges) {
|
||||
if (theCharges != null) {
|
||||
Charges.clear();
|
||||
for (Charge theCharge : theCharges) {
|
||||
Charges.add(theCharge);
|
||||
}
|
||||
Charges.addAll(theCharges);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -746,7 +746,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
if (bankDetails.isEmpty() && debitDetails.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<IZUGFeRDTradeSettlement> tradeSettlements = Stream.concat(bankDetails.stream(), debitDetails.stream()).map(IZUGFeRDTradeSettlement.class::cast).collect(Collectors.toList());
|
||||
List<IZUGFeRDTradeSettlement> tradeSettlements = Stream.concat(bankDetails.stream(), debitDetails.stream()).collect(Collectors.toList());
|
||||
|
||||
IZUGFeRDTradeSettlement[] result = new IZUGFeRDTradeSettlement[tradeSettlements.size()];
|
||||
for (int i = 0; i < tradeSettlements.size(); i++) {
|
||||
|
||||
@@ -97,12 +97,12 @@ public class DAPullProvider extends ZUGFeRD2PullProvider {
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
||||
if (currentItem.getItemAllowances() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge allowance : currentItem.getItemAllowances()) {
|
||||
allowanceChargeStr += getAllowanceChargeStr(allowance, currentItem);
|
||||
}
|
||||
}
|
||||
if (currentItem.getItemCharges() != null && currentItem.getItemCharges().length > 0) {
|
||||
if (currentItem.getItemCharges() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge charge : currentItem.getItemCharges()) {
|
||||
allowanceChargeStr += getAllowanceChargeStr(charge, currentItem);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class LineCalculator {
|
||||
|
||||
public LineCalculator(IZUGFeRDExportableItem currentItem) {
|
||||
|
||||
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
||||
if (currentItem.getItemAllowances() != null) {
|
||||
for (IZUGFeRDAllowanceCharge allowance : currentItem.getItemAllowances()) {
|
||||
BigDecimal factor=BigDecimal.ONE;
|
||||
BigDecimal singleAllowance=allowance.getTotalAmount(currentItem);
|
||||
@@ -35,7 +35,7 @@ public class LineCalculator {
|
||||
|
||||
}
|
||||
}
|
||||
if (currentItem.getItemCharges() != null && currentItem.getItemCharges().length > 0) {
|
||||
if (currentItem.getItemCharges() != null) {
|
||||
for (IZUGFeRDAllowanceCharge charge : currentItem.getItemCharges()) {
|
||||
BigDecimal factor=BigDecimal.ONE;
|
||||
BigDecimal singleCharge=charge.getTotalAmount(currentItem);
|
||||
@@ -47,7 +47,7 @@ public class LineCalculator {
|
||||
|
||||
}
|
||||
}
|
||||
if (currentItem.getItemTotalAllowances() != null && currentItem.getItemTotalAllowances().length > 0) {
|
||||
if (currentItem.getItemTotalAllowances() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge itemTotalAllowance : currentItem.getItemTotalAllowances()) {
|
||||
addAllowanceItemTotal(itemTotalAllowance.getTotalAmount(currentItem));
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
paymentTermsDescription = XMLTools.encodeXML(trans.getPaymentTermDescription());
|
||||
}
|
||||
|
||||
if ((paymentTermsDescription == null) && (trans.getDocumentCode() != CORRECTEDINVOICE)/* && (trans.getDocumentCode() != DocumentCodeTypeConstants.CREDITNOTE)*/) {
|
||||
if (paymentTermsDescription == null && !trans.getDocumentCode().equals(CORRECTEDINVOICE)/* && (trans.getDocumentCode() != DocumentCodeTypeConstants.CREDITNOTE)*/) {
|
||||
paymentTermsDescription = "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate());
|
||||
|
||||
}
|
||||
@@ -125,12 +125,12 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
if (currentItem.getItemAllowances() != null && currentItem.getItemAllowances().length > 0) {
|
||||
if (currentItem.getItemAllowances() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge allowance : currentItem.getItemAllowances()) {
|
||||
allowanceChargeStr += getAllowanceChargeStr(allowance, currentItem);
|
||||
}
|
||||
}
|
||||
if (currentItem.getItemCharges() != null && currentItem.getItemCharges().length > 0) {
|
||||
if (currentItem.getItemCharges() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge charge : currentItem.getItemCharges()) {
|
||||
allowanceChargeStr += getAllowanceChargeStr(charge, currentItem);
|
||||
|
||||
@@ -313,8 +313,9 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||
if (payment != null) {
|
||||
hasDueDate = true;
|
||||
// xml += payment.getSettlementXML();
|
||||
}
|
||||
break;
|
||||
// xml += payment.getSettlementXML();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (trans.getTradeSettlement() != null) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
|
||||
private BigDecimal sumAllowanceCharge(BigDecimal percent, IZUGFeRDAllowanceCharge[] charges) {
|
||||
BigDecimal res = BigDecimal.ZERO;
|
||||
if ((charges != null) && (charges.length > 0)) {
|
||||
if (charges != null) {
|
||||
for (IZUGFeRDAllowanceCharge currentCharge : charges) {
|
||||
if ((percent == null) || (currentCharge.getTaxPercent().compareTo(percent) == 0)) {
|
||||
res = res.add(currentCharge.getTotalAmount(this));
|
||||
@@ -212,7 +212,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
}
|
||||
|
||||
IZUGFeRDAllowanceCharge[] charges = trans.getZFCharges();
|
||||
if ((charges != null) && (charges.length > 0)) {
|
||||
if (charges != null) {
|
||||
for (IZUGFeRDAllowanceCharge currentCharge : charges) {
|
||||
BigDecimal taxPercent = currentCharge.getTaxPercent();
|
||||
if (taxPercent != null) {
|
||||
@@ -230,7 +230,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
}
|
||||
}
|
||||
IZUGFeRDAllowanceCharge[] allowances = trans.getZFAllowances();
|
||||
if ((allowances != null) && (allowances.length > 0)) {
|
||||
if (allowances != null) {
|
||||
for (IZUGFeRDAllowanceCharge currentAllowance : allowances) {
|
||||
BigDecimal taxPercent = currentAllowance.getTaxPercent();
|
||||
if (taxPercent != null) {
|
||||
@@ -286,8 +286,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
}
|
||||
|
||||
final IZUGFeRDAllowanceCharge[] charges = this.trans.getZFCharges();
|
||||
if (charges != null && charges.length > 0)
|
||||
{
|
||||
if (charges != null) {
|
||||
for (final IZUGFeRDAllowanceCharge currentCharge : charges)
|
||||
{
|
||||
final BigDecimal taxPercent = currentCharge.getTaxPercent();
|
||||
@@ -310,8 +309,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
}
|
||||
}
|
||||
final IZUGFeRDAllowanceCharge[] allowances = this.trans.getZFAllowances();
|
||||
if (allowances != null && allowances.length > 0)
|
||||
{
|
||||
if (allowances != null) {
|
||||
for (final IZUGFeRDAllowanceCharge currentAllowance : allowances)
|
||||
{
|
||||
final BigDecimal taxPercent = currentAllowance.getTaxPercent();
|
||||
|
||||
@@ -360,7 +360,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
paymentTermsDescription += discount.getAsXRechnung();
|
||||
}
|
||||
} else if ((paymentTermsDescription == null) && (trans.getDocumentCode() != DocumentCodeTypeConstants.CORRECTEDINVOICE) && (trans.getDocumentCode() != DocumentCodeTypeConstants.CREDITNOTE)) {
|
||||
} else if (paymentTermsDescription == null
|
||||
&& !trans.getDocumentCode().equals(DocumentCodeTypeConstants.CORRECTEDINVOICE)
|
||||
&& !trans.getDocumentCode().equals(DocumentCodeTypeConstants.CREDITNOTE)
|
||||
) {
|
||||
if (trans.getDueDate() != null) {
|
||||
paymentTermsDescription = "Please remit until " + germanDateFormat.format(trans.getDueDate());
|
||||
}
|
||||
@@ -434,12 +437,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ XMLTools.encodeXML(currentItem.getProduct().getBuyerAssignedID()) + "</ram:BuyerAssignedID>";
|
||||
}
|
||||
String allowanceChargeStr = "";
|
||||
if (currentItem.getProduct().getAllowances() != null && currentItem.getProduct().getAllowances().length > 0) {
|
||||
if (currentItem.getProduct().getAllowances() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge allowance : currentItem.getProduct().getAllowances()) {
|
||||
allowanceChargeStr += getAllowanceChargeStr(allowance, currentItem);
|
||||
}
|
||||
}
|
||||
if (currentItem.getProduct().getCharges() != null && currentItem.getProduct().getCharges().length > 0) {
|
||||
if (currentItem.getProduct().getCharges() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge charge : currentItem.getProduct().getCharges()) {
|
||||
allowanceChargeStr += getAllowanceChargeStr(charge, currentItem);
|
||||
|
||||
@@ -447,24 +450,24 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
String itemTotalAllowanceChargeStr = "";
|
||||
if (currentItem.getAllowances() != null && currentItem.getAllowances().length > 0) {
|
||||
if (currentItem.getAllowances() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge itemTotalAllowance : currentItem.getAllowances()) {
|
||||
itemTotalAllowanceChargeStr += getItemTotalAllowanceChargeStr(itemTotalAllowance, currentItem);
|
||||
}
|
||||
}
|
||||
if (currentItem.getCharges() != null && currentItem.getCharges().length > 0) {
|
||||
if (currentItem.getCharges() != null) {
|
||||
for (final IZUGFeRDAllowanceCharge itemTotalCharges : currentItem.getCharges()) {
|
||||
itemTotalAllowanceChargeStr += getItemTotalAllowanceChargeStr(itemTotalCharges, currentItem);
|
||||
}
|
||||
}
|
||||
|
||||
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>";
|
||||
if (currentItem.getProduct().getDescription() != null && currentItem.getProduct().getDescription().length() > 0) {
|
||||
if (currentItem.getProduct().getDescription() != null) {
|
||||
xml += "<ram:Description>" +
|
||||
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
|
||||
"</ram:Description>";
|
||||
}
|
||||
if (currentItem.getProduct().getClassifications() != null && currentItem.getProduct().getClassifications().length > 0) {
|
||||
if (currentItem.getProduct().getClassifications() != null) {
|
||||
for (IDesignatedProductClassification classification : currentItem.getProduct().getClassifications()) {
|
||||
xml += "<ram:DesignatedProductClassification>"
|
||||
+ "<ram:ClassCode listID=\"" + XMLTools.encodeXML(classification.getClassCode().getListID()) + "\"";
|
||||
@@ -718,7 +721,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((trans.getDocumentCode() == DocumentCodeTypeConstants.CORRECTEDINVOICE) || (trans.getDocumentCode() == DocumentCodeTypeConstants.CREDITNOTE)) {
|
||||
if (trans.getDocumentCode().equals(DocumentCodeTypeConstants.CORRECTEDINVOICE)
|
||||
|| trans.getDocumentCode().equals(DocumentCodeTypeConstants.CREDITNOTE)
|
||||
) {
|
||||
hasDueDate = false;
|
||||
}
|
||||
|
||||
@@ -882,7 +887,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
} else {
|
||||
xml += buildPaymentTermsXml();
|
||||
}
|
||||
if ((profile == Profiles.getByName("Extended")) && (trans.getCashDiscounts() != null) && (trans.getCashDiscounts().length > 0)) {
|
||||
if (profile == Profiles.getByName("Extended") && trans.getCashDiscounts() != null) {
|
||||
for (IZUGFeRDCashDiscount discount : trans.getCashDiscounts()
|
||||
) {
|
||||
xml += discount.getAsCII();
|
||||
|
||||
@@ -564,10 +564,9 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
||||
|
||||
// iterate over all pdf pages
|
||||
|
||||
for (Object object : doc.getPages()) {
|
||||
if (object instanceof PDPage) {
|
||||
for (PDPage page : doc.getPages()) {
|
||||
if (page != null) {
|
||||
|
||||
PDPage page = (PDPage) object;
|
||||
PDResources res = page.getResources();
|
||||
|
||||
// Check for fonts in PDXObjects:
|
||||
|
||||
@@ -213,7 +213,16 @@ public class ZUGFeRDInvoiceImporter {
|
||||
*/
|
||||
|
||||
final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
|
||||
if ((filename.equals("ZUGFeRD-invoice.xml") || (filename.equals("zugferd-invoice.xml")) || filename.equals("factur-x.xml")) || filename.equals("xrechnung.xml") || filename.equals("order-x.xml") || filename.equals("cida.xml")) {
|
||||
Set<String> validFilenames = Set.of(
|
||||
"ZUGFeRD-invoice.xml",
|
||||
"zugferd-invoice.xml",
|
||||
"factur-x.xml",
|
||||
"xrechnung.xml",
|
||||
"order-x.xml",
|
||||
"cida.xml"
|
||||
);
|
||||
|
||||
if (validFilenames.contains(filename)) {
|
||||
containsMeta = true;
|
||||
|
||||
// String embeddedFilename = filePath + filename;
|
||||
@@ -360,39 +369,31 @@ public class ZUGFeRDInvoiceImporter {
|
||||
delivery.addGlobalID(sID);
|
||||
}
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsString("StreetName").ifPresent(t -> delivery.setStreet(t));
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsString("CityName").ifPresent(t -> delivery.setLocation(t));
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsString("PostalZone").ifPresent(t -> delivery.setZIP(t));
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsNodeMap("Country").ifPresent(t -> t.getAsString("IdentificationCode").ifPresent(u -> delivery.setCountry(u)));
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsNodeMap("AddressLine").ifPresent(t -> t.getAsString("Line").ifPresent(u -> delivery.setAdditionalAddressExtension(u)));
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
||||
});
|
||||
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
||||
});
|
||||
Optional<NodeMap> addressNodeMapp = deliveryLocationNodeMap.getAsNodeMap("Address");
|
||||
addressNodeMapp.flatMap(s -> s.getAsString("StreetName"))
|
||||
.ifPresent(delivery::setStreet);
|
||||
addressNodeMapp.flatMap(s -> s.getAsString("AdditionalStreetName"))
|
||||
.ifPresent(delivery::setAdditionalAddress);
|
||||
addressNodeMapp.flatMap(s -> s.getAsString("CityName"))
|
||||
.ifPresent(delivery::setLocation);
|
||||
addressNodeMapp.flatMap(s -> s.getAsString("PostalZone"))
|
||||
.ifPresent(delivery::setZIP);
|
||||
addressNodeMapp.flatMap(s -> s.getAsNodeMap("Country")).flatMap(t -> t.getAsString("IdentificationCode"))
|
||||
.ifPresent(delivery::setCountry);
|
||||
addressNodeMapp.flatMap(s -> s.getAsNodeMap("AddressLine")).flatMap(t -> t.getAsString("Line"))
|
||||
.ifPresent(delivery::setAdditionalAddressExtension);
|
||||
addressNodeMapp.flatMap(s -> s.getAsString("AdditionalStreetName"))
|
||||
.ifPresent(delivery::setAdditionalAddress);
|
||||
addressNodeMapp.flatMap(s -> s.getAsString("AdditionalStreetName"))
|
||||
.ifPresent(delivery::setAdditionalAddress);
|
||||
});
|
||||
|
||||
|
||||
new NodeMap(deliveryNode).getAsNodeMap("DeliveryParty").ifPresent(partyMap -> {
|
||||
partyMap.getAsNodeMap("PartyName").ifPresent(s -> {
|
||||
s.getAsString("Name").ifPresent(t -> delivery.setName(t));
|
||||
});
|
||||
});
|
||||
String street, name, additionalStreet, city, postal, countrySubentity, line, country = null;
|
||||
new NodeMap(deliveryNode).getAsNodeMap("DeliveryParty")
|
||||
.flatMap(partyMap -> partyMap.getAsNodeMap("PartyName"))
|
||||
.flatMap(s -> s.getAsString("Name"))
|
||||
.ifPresent(delivery::setName);
|
||||
|
||||
zpp.setDeliveryAddress(delivery);
|
||||
|
||||
}
|
||||
@@ -431,7 +432,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"ExchangedDocument\"]|//*[local-name()=\"HeaderExchangedDocument\"]");
|
||||
NodeList ExchangedDocumentNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"GrandTotalAmount\"]|//*[local-name()=\"TaxInclusiveAmount\"]");
|
||||
BigDecimal expectedGrandTotal = null;
|
||||
NodeList totalNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
@@ -579,11 +580,11 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
|
||||
String creditorReferenceID = extractString("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]/*[local-name()=\"CreditorReferenceID\"]").trim();//BT-90
|
||||
if ((creditorReferenceID == null)||(creditorReferenceID.length()==0)) {
|
||||
if (creditorReferenceID == null || creditorReferenceID.isEmpty()) {
|
||||
//maybe it's there in UBL?
|
||||
creditorReferenceID = extractString("//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyIdentification\"]/*[local-name()=\"ID\"]").trim();
|
||||
}
|
||||
if ((creditorReferenceID != null)&&(creditorReferenceID.length()>0)) {
|
||||
if (creditorReferenceID != null && !creditorReferenceID.isEmpty()) {
|
||||
zpp.setCreditorReferenceID(creditorReferenceID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user