don't mention tax numbers for shiptotradeparties
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
- *validator not to XR error on ZF files (only notices)
|
- *validator not to XR error on ZF files (only notices)
|
||||||
- xmp errors may not show correctly in log
|
- xmp errors may not show correctly in log
|
||||||
### 2.0.1 done
|
### 2.0.1 done
|
||||||
|
- do not list tax numbers for shiptotradeparties
|
||||||
- do not expect dueDate for corrected invoices
|
- do not expect dueDate for corrected invoices
|
||||||
- XR test now includes guideline ID #172
|
- XR test now includes guideline ID #172
|
||||||
- BigDecimal specific refactoring PR #192 Thanks to weclapp-dev
|
- BigDecimal specific refactoring PR #192 Thanks to weclapp-dev
|
||||||
|
|||||||
@@ -184,13 +184,13 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
|||||||
|
|
||||||
}
|
}
|
||||||
xml = xml + " <ram:SellerTradeParty>\n";
|
xml = xml + " <ram:SellerTradeParty>\n";
|
||||||
xml += getTradePartyAsXML(trans.getSender(), true);
|
xml += getTradePartyAsXML(trans.getSender(), true, false);
|
||||||
xml += " </ram:SellerTradeParty>\n"
|
xml += " </ram:SellerTradeParty>\n"
|
||||||
+ " <ram:BuyerTradeParty>\n";
|
+ " <ram:BuyerTradeParty>\n";
|
||||||
// + " <ID>GE2020211</ID>\n"
|
// + " <ID>GE2020211</ID>\n"
|
||||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||||
|
|
||||||
xml += getTradePartyAsXML(trans.getRecipient(), false);
|
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
||||||
if ((trans.getOwnVATID() != null) && (trans.getOwnOrganisationName() != null)) {
|
if ((trans.getOwnVATID() != null) && (trans.getOwnOrganisationName() != null)) {
|
||||||
xml = xml + " <ram:SpecifiedTaxRegistration>\n" + " <ram:ID schemeID=\"VA\">"
|
xml = xml + " <ram:SpecifiedTaxRegistration>\n" + " <ram:ID schemeID=\"VA\">"
|
||||||
+ XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>\n"
|
+ XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>\n"
|
||||||
@@ -209,7 +209,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
|
|||||||
+ " <ram:ApplicableSupplyChainTradeDelivery>\n";
|
+ " <ram:ApplicableSupplyChainTradeDelivery>\n";
|
||||||
if (this.trans.getDeliveryAddress() != null) {
|
if (this.trans.getDeliveryAddress() != null) {
|
||||||
xml += "<ram:ShipToTradeParty>" +
|
xml += "<ram:ShipToTradeParty>" +
|
||||||
getTradePartyAsXML(this.trans.getDeliveryAddress(), false) +
|
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
||||||
"</ram:ShipToTradeParty>";
|
"</ram:ShipToTradeParty>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,14 +106,16 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @todo check if the two boolean args can be refactored
|
||||||
/***
|
/***
|
||||||
* returns the UN/CEFACT CII XML for companies(tradeparties), which is actually
|
* returns the UN/CEFACT CII XML for companies(tradeparties), which is actually
|
||||||
* the same for ZF1 (v 2013b) and ZF2 (v 2016b)
|
* the same for ZF1 (v 2013b) and ZF2 (v 2016b)
|
||||||
* @param party
|
* @param party
|
||||||
* @param isSender some attributes are allowed only for senders in certain profiles
|
* @param isSender some attributes are allowed only for senders in certain profiles
|
||||||
|
* @param isShipToTradeParty some attributes are allowed only for senders or recipients
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty party, boolean isSender) {
|
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty party, boolean isSender, boolean isShipToTradeParty) {
|
||||||
String xml = "";
|
String xml = "";
|
||||||
// According EN16931 either GlobalID or seller assigned ID might be present for BuyerTradeParty
|
// According EN16931 either GlobalID or seller assigned ID might be present for BuyerTradeParty
|
||||||
// and ShipToTradeParty, but not both. Prefer seller assigned ID for now.
|
// and ShipToTradeParty, but not both. Prefer seller assigned ID for now.
|
||||||
@@ -165,13 +167,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ " <ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
+ " <ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
||||||
+ "</ram:CountryID>\n"
|
+ "</ram:CountryID>\n"
|
||||||
+ " </ram:PostalTradeAddress>\n";
|
+ " </ram:PostalTradeAddress>\n";
|
||||||
if (party.getVATID() != null) {
|
if ((party.getVATID() != null)&&(!isShipToTradeParty)) {
|
||||||
xml += " <ram:SpecifiedTaxRegistration>\n"
|
xml += " <ram:SpecifiedTaxRegistration>\n"
|
||||||
+ " <ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
+ " <ram:ID schemeID=\"VA\">" + XMLTools.encodeXML(party.getVATID())
|
||||||
+ "</ram:ID>\n"
|
+ "</ram:ID>\n"
|
||||||
+ " </ram:SpecifiedTaxRegistration>\n";
|
+ " </ram:SpecifiedTaxRegistration>\n";
|
||||||
}
|
}
|
||||||
if (party.getTaxID() != null) {
|
if ((party.getTaxID() != null)&&(!isShipToTradeParty)) {
|
||||||
xml += " <ram:SpecifiedTaxRegistration>\n"
|
xml += " <ram:SpecifiedTaxRegistration>\n"
|
||||||
+ " <ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
+ " <ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
|
||||||
+ "</ram:ID>\n"
|
+ "</ram:ID>\n"
|
||||||
@@ -397,13 +399,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
|
|
||||||
}
|
}
|
||||||
xml = xml + " <ram:SellerTradeParty>\n"
|
xml = xml + " <ram:SellerTradeParty>\n"
|
||||||
+ getTradePartyAsXML(trans.getSender(), true)
|
+ getTradePartyAsXML(trans.getSender(), true, false)
|
||||||
+ " </ram:SellerTradeParty>\n"
|
+ " </ram:SellerTradeParty>\n"
|
||||||
+ " <ram:BuyerTradeParty>\n";
|
+ " <ram:BuyerTradeParty>\n";
|
||||||
// + " <ID>GE2020211</ID>\n"
|
// + " <ID>GE2020211</ID>\n"
|
||||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||||
|
|
||||||
xml += getTradePartyAsXML(trans.getRecipient(), false);
|
xml += getTradePartyAsXML(trans.getRecipient(), false, false);
|
||||||
xml += " </ram:BuyerTradeParty>\n";
|
xml += " </ram:BuyerTradeParty>\n";
|
||||||
|
|
||||||
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
if (trans.getBuyerOrderReferencedDocumentID() != null) {
|
||||||
@@ -437,7 +439,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ " <ram:ApplicableHeaderTradeDelivery>\n";
|
+ " <ram:ApplicableHeaderTradeDelivery>\n";
|
||||||
if (this.trans.getDeliveryAddress() != null) {
|
if (this.trans.getDeliveryAddress() != null) {
|
||||||
xml += "<ram:ShipToTradeParty>" +
|
xml += "<ram:ShipToTradeParty>" +
|
||||||
getTradePartyAsXML(this.trans.getDeliveryAddress(), false) +
|
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
|
||||||
"</ram:ShipToTradeParty>";
|
"</ram:ShipToTradeParty>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -260,7 +260,8 @@ public class ZF2PushTest extends TestCase {
|
|||||||
try {
|
try {
|
||||||
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date())
|
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date())
|
||||||
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID).setID("0009845"))
|
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID).setID("0009845"))
|
||||||
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setID("0008734").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE")))
|
.setDeliveryAddress(new TradeParty("just the other side of the street", "teststr.12a", "55232", "Entenhausen", "DE").addVATID("DE47110"))
|
||||||
|
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setID("0008734").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE").setFax("++49555123456")))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(16)), price, new BigDecimal(1.0)).addNote("item level 1/1").addAllowance(new Allowance(new BigDecimal(0.02)).setReason("item discount").setTaxPercent(new BigDecimal(16))))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(16)), price, new BigDecimal(1.0)).addNote("item level 1/1").addAllowance(new Allowance(new BigDecimal(0.02)).setReason("item discount").setTaxPercent(new BigDecimal(16))))
|
||||||
.addCharge(new Charge(new BigDecimal(0.5)).setReason("quick delivery charge").setTaxPercent(new BigDecimal(16)))
|
.addCharge(new Charge(new BigDecimal(0.5)).setReason("quick delivery charge").setTaxPercent(new BigDecimal(16)))
|
||||||
.addAllowance(new Allowance(new BigDecimal(0.2)).setReason("discount").setTaxPercent(new BigDecimal(16)))
|
.addAllowance(new Allowance(new BigDecimal(0.2)).setReason("discount").setTaxPercent(new BigDecimal(16)))
|
||||||
@@ -284,7 +285,10 @@ public class ZF2PushTest extends TestCase {
|
|||||||
assertTrue(zi.getUTF8().contains("0009845"));
|
assertTrue(zi.getUTF8().contains("0009845"));
|
||||||
assertTrue(zi.getUTF8().contains("0008734"));
|
assertTrue(zi.getUTF8().contains("0008734"));
|
||||||
assertTrue(zi.getUTF8().contains("item level 1/1"));
|
assertTrue(zi.getUTF8().contains("item level 1/1"));
|
||||||
|
assertTrue(zi.getUTF8().contains("DE4711")); // the VAT ID should be there...
|
||||||
|
assertFalse(zi.getUTF8().contains("DE47110")); // but not the VAT ID of the shiptotradeparty
|
||||||
assertTrue(zi.getUTF8().contains("document level 2/2"));
|
assertTrue(zi.getUTF8().contains("document level 2/2"));
|
||||||
|
assertFalse(zi.getUTF8().contains("++49555123456")); // in profile EN16931 contact fax number is not allowed
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user