corrected some unit tests
This commit is contained in:
@@ -23,10 +23,12 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
|||||||
* the "name" of the bank account (holder)
|
* the "name" of the bank account (holder)
|
||||||
*/
|
*/
|
||||||
protected String accountName = null;
|
protected String accountName = null;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* bean constructor
|
* bean constructor
|
||||||
*/
|
*/
|
||||||
public BankDetails() { }
|
public BankDetails() {
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* constructor for IBAN only :-)
|
* constructor for IBAN only :-)
|
||||||
@@ -35,6 +37,7 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
|||||||
public BankDetails(String IBAN) {
|
public BankDetails(String IBAN) {
|
||||||
this.IBAN = IBAN;
|
this.IBAN = IBAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* constructor for normal use :-)
|
* constructor for normal use :-)
|
||||||
* @param IBAN the IBAN as string
|
* @param IBAN the IBAN as string
|
||||||
@@ -58,6 +61,7 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
|||||||
* identify the IBAN. Of course you will specify your own IBAN in full length but
|
* identify the IBAN. Of course you will specify your own IBAN in full length but
|
||||||
* if you deduct from a customer's account you may e.g. leave out the first or last
|
* if you deduct from a customer's account you may e.g. leave out the first or last
|
||||||
* digits so that nobody spying on the invoice gets to know the complete number
|
* digits so that nobody spying on the invoice gets to know the complete number
|
||||||
|
*
|
||||||
* @param IBAN the "IBAN ID", i.e. the IBAN or parts of it
|
* @param IBAN the "IBAN ID", i.e. the IBAN or parts of it
|
||||||
* @return fluent setter
|
* @return fluent setter
|
||||||
*/
|
*/
|
||||||
@@ -84,26 +88,28 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* getOwn... methods will be removed in the future in favor of Tradeparty (e.g. Sender) class
|
/*
|
||||||
* */
|
I'd really like to get rid of all those getOwn... methods some time but in this case they are in the interface :-(
|
||||||
// @Override
|
*/
|
||||||
// @Deprecated
|
@Override
|
||||||
// @JsonIgnore
|
@Deprecated
|
||||||
// public String getOwnBIC() {
|
@JsonIgnore
|
||||||
// return getBIC();
|
public String getOwnBIC() {
|
||||||
// }
|
return getBIC();
|
||||||
//
|
}
|
||||||
// @Override
|
|
||||||
// @Deprecated
|
@Override
|
||||||
// @JsonIgnore
|
@Deprecated
|
||||||
// public String getOwnIBAN() {
|
@JsonIgnore
|
||||||
// return getIBAN();
|
public String getOwnIBAN() {
|
||||||
// }
|
return getIBAN();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set Holder
|
* set Holder
|
||||||
|
*
|
||||||
* @param name account name (usually account holder if != sender)
|
* @param name account name (usually account holder if != sender)
|
||||||
* @return fluent setter
|
* @return fluent setter
|
||||||
*/
|
*/
|
||||||
@@ -118,5 +124,4 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,11 +347,7 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
|
|||||||
if (settlement instanceof IZUGFeRDTradeSettlementDebit) {
|
if (settlement instanceof IZUGFeRDTradeSettlementDebit) {
|
||||||
return ((IZUGFeRDTradeSettlementDebit) settlement).getIBAN();
|
return ((IZUGFeRDTradeSettlementDebit) settlement).getIBAN();
|
||||||
}
|
}
|
||||||
if (settlement instanceof BankDetails) {
|
|
||||||
return ((BankDetails) settlement).getIBAN();
|
|
||||||
}
|
|
||||||
if (settlement instanceof IZUGFeRDTradeSettlementPayment) {
|
if (settlement instanceof IZUGFeRDTradeSettlementPayment) {
|
||||||
|
|
||||||
return ((IZUGFeRDTradeSettlementPayment) settlement).getOwnIBAN();
|
return ((IZUGFeRDTradeSettlementPayment) settlement).getOwnIBAN();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
public void setID(String id) {
|
public void setID(String id) {
|
||||||
String ud = id;
|
String ud = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* This will parse a XML into the given invoice object
|
* This will parse a XML into the given invoice object
|
||||||
* @param zpp the invoice to be altered
|
* @param zpp the invoice to be altered
|
||||||
@@ -306,51 +307,51 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//UBL...
|
//UBL...
|
||||||
XPathExpression shipExUBL = xpath.compile("//*[local-name()=\"Delivery\"]");
|
XPathExpression shipExUBL = xpath.compile("//*[local-name()=\"Delivery\"]");
|
||||||
Node deliveryNode = (Node) shipExUBL.evaluate(getDocument(), XPathConstants.NODE);
|
Node deliveryNode = (Node) shipExUBL.evaluate(getDocument(), XPathConstants.NODE);
|
||||||
|
|
||||||
if (deliveryNode != null) {
|
if (deliveryNode != null) {
|
||||||
TradeParty delivery = new TradeParty();
|
TradeParty delivery = new TradeParty();
|
||||||
NodeMap nodeMap = new NodeMap(deliveryNode).getAsNodeMap("DeliveryLocation").get();
|
new NodeMap(deliveryNode).getAsNodeMap("DeliveryLocation").ifPresent(
|
||||||
|
deliveryLocationNodeMap -> {
|
||||||
|
|
||||||
if (nodeMap != null) {
|
deliveryLocationNodeMap.getNode("ID").ifPresent(s -> {
|
||||||
nodeMap.getNode("ID").ifPresent(s -> {
|
|
||||||
SchemedID sID = new SchemedID().setScheme(s.getAttributes().getNamedItem("schemeID").getTextContent()).setId(s.getTextContent());
|
SchemedID sID = new SchemedID().setScheme(s.getAttributes().getNamedItem("schemeID").getTextContent()).setId(s.getTextContent());
|
||||||
delivery.addGlobalID(sID);
|
delivery.addGlobalID(sID);
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsString("StreetName").ifPresent(t -> delivery.setStreet(t));
|
s.getAsString("StreetName").ifPresent(t -> delivery.setStreet(t));
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsString("CityName").ifPresent(t -> delivery.setLocation(t));
|
s.getAsString("CityName").ifPresent(t -> delivery.setLocation(t));
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsString("PostalZone").ifPresent(t -> delivery.setZIP(t));
|
s.getAsString("PostalZone").ifPresent(t -> delivery.setZIP(t));
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsNodeMap("Country").ifPresent(t -> t.getAsString("IdentificationCode").ifPresent(u -> delivery.setCountry(u)));
|
s.getAsNodeMap("Country").ifPresent(t -> t.getAsString("IdentificationCode").ifPresent(u -> delivery.setCountry(u)));
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsNodeMap("AddressLine").ifPresent(t -> t.getAsString("Line").ifPresent(u -> delivery.setAdditionalAddressExtension(u)));
|
s.getAsNodeMap("AddressLine").ifPresent(t -> t.getAsString("Line").ifPresent(u -> delivery.setAdditionalAddressExtension(u)));
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
||||||
});
|
});
|
||||||
nodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
|
||||||
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
s.getAsString("AdditionalStreetName").ifPresent(t -> delivery.setAdditionalAddress(t));
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
|
|
||||||
NodeMap partyMap = new NodeMap(deliveryNode).getAsNodeMap("DeliveryParty").get();
|
new NodeMap(deliveryNode).getAsNodeMap("DeliveryParty").ifPresent(partyMap -> {
|
||||||
if (partyMap!=null) {
|
partyMap.getAsNodeMap("PartyName").ifPresent(s -> {
|
||||||
partyMap.getAsNodeMap("PartyName").ifPresent(s->{s.getAsString("Name").ifPresent(t->delivery.setName(t));});
|
s.getAsString("Name").ifPresent(t -> delivery.setName(t));
|
||||||
}
|
});
|
||||||
|
});
|
||||||
String street, name, additionalStreet, city, postal, countrySubentity, line, country = null;
|
String street, name, additionalStreet, city, postal, countrySubentity, line, country = null;
|
||||||
/*
|
/*
|
||||||
String idx = extractString("//*[local-name()=\"DeliveryLocation\"]/*[local-name() = \"ID\"]");
|
String idx = extractString("//*[local-name()=\"DeliveryLocation\"]/*[local-name() = \"ID\"]");
|
||||||
@@ -508,15 +509,33 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (subjectCode) {
|
switch (subjectCode) {
|
||||||
case "AAI": includedNotes.add(IncludedNote.generalNote(content)); break;
|
case "AAI":
|
||||||
case "REG": includedNotes.add(IncludedNote.regulatoryNote(content)); break;
|
includedNotes.add(IncludedNote.generalNote(content));
|
||||||
case "ABL": includedNotes.add(IncludedNote.legalNote(content)); break;
|
break;
|
||||||
case "CUS": includedNotes.add(IncludedNote.customsNote(content)); break;
|
case "REG":
|
||||||
case "SUR": includedNotes.add(IncludedNote.sellerNote(content)); break;
|
includedNotes.add(IncludedNote.regulatoryNote(content));
|
||||||
case "TXD": includedNotes.add(IncludedNote.taxNote(content)); break;
|
break;
|
||||||
case "ACY": includedNotes.add(IncludedNote.introductionNote(content)); break;
|
case "ABL":
|
||||||
case "AAK": includedNotes.add(IncludedNote.discountBonusNote(content)); break;
|
includedNotes.add(IncludedNote.legalNote(content));
|
||||||
default: includedNotes.add(IncludedNote.unspecifiedNote(content)); break;
|
break;
|
||||||
|
case "CUS":
|
||||||
|
includedNotes.add(IncludedNote.customsNote(content));
|
||||||
|
break;
|
||||||
|
case "SUR":
|
||||||
|
includedNotes.add(IncludedNote.sellerNote(content));
|
||||||
|
break;
|
||||||
|
case "TXD":
|
||||||
|
includedNotes.add(IncludedNote.taxNote(content));
|
||||||
|
break;
|
||||||
|
case "ACY":
|
||||||
|
includedNotes.add(IncludedNote.introductionNote(content));
|
||||||
|
break;
|
||||||
|
case "AAK":
|
||||||
|
includedNotes.add(IncludedNote.discountBonusNote(content));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
includedNotes.add(IncludedNote.unspecifiedNote(content));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zpp.addNotes(includedNotes);
|
zpp.addNotes(includedNotes);
|
||||||
|
|||||||
Reference in New Issue
Block a user