UBL updates

This commit is contained in:
Bharti
2024-11-18 10:58:21 +01:00
parent 69228a4a76
commit 135a577c9f
3 changed files with 81 additions and 119 deletions

View File

@@ -84,19 +84,19 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
/*** /***
* getOwn... methods will be removed in the future in favor of Tradeparty (e.g. Sender) class * getOwn... methods will be removed in the future in favor of Tradeparty (e.g. Sender) class
* */ * */
@Override // @Override
@Deprecated // @Deprecated
@JsonIgnore // @JsonIgnore
public String getOwnBIC() { // public String getOwnBIC() {
return getBIC(); // return getBIC();
} // }
//
@Override // @Override
@Deprecated // @Deprecated
@JsonIgnore // @JsonIgnore
public String getOwnIBAN() { // public String getOwnIBAN() {
return getIBAN(); // return getIBAN();
} // }
/** /**

View File

@@ -2,6 +2,7 @@ package org.mustangproject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -16,6 +17,8 @@ import org.w3c.dom.NodeList;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import static org.apache.fop.fonts.type1.AdobeStandardEncoding.a;
/*** /***
* A organisation, i.e. usually a company * A organisation, i.e. usually a company
*/ */
@@ -95,37 +98,15 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
NodeList partyTaxScheme = party.item(partyIndex).getChildNodes(); NodeList partyTaxScheme = party.item(partyIndex).getChildNodes();
for (int partyTaxSchemeIndex = 0; partyTaxSchemeIndex < partyTaxScheme.getLength(); partyTaxSchemeIndex++) { for (int partyTaxSchemeIndex = 0; partyTaxSchemeIndex < partyTaxScheme.getLength(); partyTaxSchemeIndex++) {
if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName() != null) { if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName() != null) {
if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName().equals("CompanyID")) { if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName().equals("CompanyID")){
setTaxID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent()); setTaxID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
}
}
} }
} }
}
}
// if (currentTopElementName.equals("PartyTaxScheme")) {
// NodeList partyTaxScheme = party.item(partyIndex).getChildNodes();
// for (int partyTaxSchemeIndex = 0; partyTaxSchemeIndex < partyTaxScheme.getLength(); partyTaxSchemeIndex++) {
// if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName() != null) {
// if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName().equals("TaxScheme")) {
// NodeList taxScheme = partyTaxScheme.item(partyTaxSchemeIndex).getChildNodes();
// for (int taxSchemeIndex = 0 ; taxSchemeIndex < taxScheme.getLength(); taxSchemeIndex++) {
// if (taxScheme.item(taxSchemeIndex).getLocalName() != null) {
// if(taxScheme.item(taxSchemeIndex).getLocalName().equals("ID")){
// if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName().equals("CompanyID")) {
// setTaxID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
// } else {
// setVATID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
// }
// }
// }
// }
// }
//
// }
// }
// }
/* /*
UBL only: formally it can have a name as well but BT27 party name *should* be stored in UBL only: formally it can have a name as well but BT27 party name *should* be stored in
so overwrite if one exists so overwrite if one exists
@@ -209,8 +190,6 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
} }
} }
} }
} }
if (currentUBLChild.equals("GlobalID")) { if (currentUBLChild.equals("GlobalID")) {
@@ -252,29 +231,6 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
} }
} }
if (currentUBLChild.equals("PartyTaxScheme")) {
NodeList taxChilds = nodes.item(nodeIndex).getChildNodes();
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
if (taxChilds.item(taxChildIndex).getLocalName() != null) {
if ((taxChilds.item(taxChildIndex).getLocalName().equals("TaxScheme"))) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("CompanyID")) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("ID")) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("CompanyID")) {
setVATID(taxChilds.item(taxChildIndex).getTextContent());
}
// setTaxID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("ID").getNodeValue().equals("FC")) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("CompanyID")) {
setTaxID(taxChilds.item(taxChildIndex).getTextContent());
}
}
}
}
}
}
}
}
} }
} }
} }

View File

@@ -587,11 +587,17 @@ public class ZUGFeRDInvoiceImporter {
if (sellerOrderIssuerAssignedID != null) { if (sellerOrderIssuerAssignedID != null) {
zpp.setSellerOrderReferencedDocumentID(sellerOrderIssuerAssignedID); zpp.setSellerOrderReferencedDocumentID(sellerOrderIssuerAssignedID);
} }
else {
zpp.setSellerOrderReferencedDocumentID(extractString("//*[local-name()=\"OrderReference\"]/*[local-name()=\"SalesOrderID\"]"));
}
if (despatchAdviceReferencedDocument != null) { if (despatchAdviceReferencedDocument != null) {
zpp.setDespatchAdviceReferencedDocumentID(despatchAdviceReferencedDocument); zpp.setDespatchAdviceReferencedDocumentID(despatchAdviceReferencedDocument);
} }
else {
zpp.setDespatchAdviceReferencedDocumentID(extractString("//*[local-name()=\"DespatchDocumentReference\"]/*[local-name()=\"ID\"]"));
}
zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]|//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyName\"]").trim()); //zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]|//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyName\"]").trim());
xpr = xpath.compile("//*[local-name()=\"BuyerReference\"]"); xpr = xpath.compile("//*[local-name()=\"BuyerReference\"]");
String buyerReference = null; String buyerReference = null;