From e7cba816b75e776224df339ab06fdb7752a96f47 Mon Sep 17 00:00:00 2001 From: Christopher Derek Curry Date: Mon, 20 Nov 2017 14:34:56 +0100 Subject: [PATCH] Added more documentation to client classes (#3) --- .gitignore | 4 +-- README.md | 9 ++++-- .../OIOBeskedAfvisningSamlingHentClient.java | 8 ++++- .../sample/OIOLedsageDocumentOpretClient.java | 7 +++++ .../OIOLedsageDokumentSamlingHentClient.java | 8 ++++- .../dk/skat/emcs/b2b/sample/BaseClient.java | 31 +++++++++++++++++++ ...OBeskedAfvisningSamlingHentClientTest.java | 6 ++-- .../OIOLedsageDocumentOpretClientTest.java | 6 ++-- ...OLedsageDokumentSamlingHentClientTest.java | 6 ++-- 9 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 src/test/java/dk/skat/emcs/b2b/sample/BaseClient.java diff --git a/.gitignore b/.gitignore index a47e677..0cd1cef 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,4 @@ buildNumber.properties .idea *.iml # Do not add: -run-submit.sh -run-fetch.sh -run-fetch-ie704.sh \ No newline at end of file +run-*.sh \ No newline at end of file diff --git a/README.md b/README.md index b624640..8f2ca50 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,12 @@ the current versions of the mentioned frameworks in use. The sample clients currently implements calls to the services: -* **OIOLedsageDocumentOpret** -* **OIOLedsageDokumentSamlingHent** -* **OIOBeskedAfvisningSamlingHent** +* **OIOLedsageDocumentOpret** : Submit IE815 document +* **OIOLedsageDokumentSamlingHent** : Fetch IE801 document related to ARC number +* **OIOBeskedAfvisningSamlingHent** : Search for IE704 documents within the last month + +Service **OIOLedsageDocumentOpret** must invoked before invoking **OIOLedsageDokumentSamlingHent** (using the +returned ARC number) and **OIOBeskedAfvisningSamlingHent** (if submitted IE815 was not processed by **OIOLedsageDocumentOpret**). The main entry point into the source code of the implementation is these classes: diff --git a/src/main/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClient.java b/src/main/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClient.java index 15777c8..ad89e57 100644 --- a/src/main/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClient.java +++ b/src/main/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClient.java @@ -26,6 +26,12 @@ /** * OIOBeskedAfvisningSamlingHentClient * + * Input: + * Date time period (start, end) = the last month + * + * Output: + * IE704 documents (if any) + * * @author SKAT * @since 1.1 */ @@ -152,7 +158,7 @@ public void invoke(String virksomhedSENummerIdentifikator, } } } else { - sb.append("** IE 704 Messages: ").append(newLine); + sb.append("** IE704 Messages: ").append(newLine); List ie704Messages = out.getBeskedAfvisningSamling().getIE704BeskedTekst(); if (ie704Messages != null && ie704Messages.size() > 0) { for (String message : ie704Messages) { diff --git a/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java b/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java index 5b985c3..fd6fb36 100644 --- a/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java +++ b/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClient.java @@ -31,6 +31,13 @@ /** * OIOLedsageDocumentOpretClient * + * Input: + * IE815 document + * + * Output: + * ARC number = if IE815 was accepted + * Error Message stating IE704 = Instruction to call the service OIOBeskedAfvisningSamlingHentC + * * @author SKAT * @since 1.0 */ diff --git a/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClient.java b/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClient.java index 7b7c118..b4c4e0c 100644 --- a/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClient.java +++ b/src/main/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClient.java @@ -25,6 +25,12 @@ /** * OIOLedsageDokumentSamlingHentClient * + * Input: + * ARC number = from OIOLedsageDocumentOpret response + * + * Output: + * IE801 document + * * @author SKAT * @since 1.1 */ @@ -142,7 +148,7 @@ public void invoke(String virksomhedSENummerIdentifikator, } } } else { - sb.append("** IE 801 Messages: ").append(newLine); + sb.append("** IE801 Messages: ").append(newLine); List ie801Messages = out.getLedsageDokumentStamDataSamling().getIE801BeskedTekst(); for (String message : ie801Messages) { sb.append(message).append(newLine); diff --git a/src/test/java/dk/skat/emcs/b2b/sample/BaseClient.java b/src/test/java/dk/skat/emcs/b2b/sample/BaseClient.java new file mode 100644 index 0000000..b5e3c9e --- /dev/null +++ b/src/test/java/dk/skat/emcs/b2b/sample/BaseClient.java @@ -0,0 +1,31 @@ +package dk.skat.emcs.b2b.sample; + +/** + * BaseClient - Helper methods for test clients, e.g. we're using the same VAT number for all tests. + * + * @author SKAT + * @since 1.1 + */ +public class BaseClient { + + /** + * Get VAT number + * + * @return VAT number + */ + protected String getVirksomhedSENummerIdentifikator() { + String virksomhedSENummerIdentifikator = "30808460"; + return virksomhedSENummerIdentifikator; + } + + /** + * Get AfgiftOperatoerPunktAfgiftIdentifikator + * + * @return AfgiftOperatoerPunktAfgiftIdentifikator + */ + protected String getAfgiftOperatoerPunktAfgiftIdentifikator() { + String afgiftOperatoerPunktAfgiftIdentifikator = "DK82065873300"; + return afgiftOperatoerPunktAfgiftIdentifikator; + } + +} diff --git a/src/test/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClientTest.java b/src/test/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClientTest.java index 5b96641..dca69a6 100644 --- a/src/test/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClientTest.java +++ b/src/test/java/dk/skat/emcs/b2b/sample/OIOBeskedAfvisningSamlingHentClientTest.java @@ -8,7 +8,7 @@ * @author SKAT * @since 1.1 */ -public class OIOBeskedAfvisningSamlingHentClientTest { +public class OIOBeskedAfvisningSamlingHentClientTest extends BaseClient { @Test public void invoke() throws Exception { @@ -17,9 +17,9 @@ public void invoke() throws Exception { if (endpointURL != null) { // this CVR number present in the certificate. - String virksomhedSENummerIdentifikator = "30808460"; + String virksomhedSENummerIdentifikator = getVirksomhedSENummerIdentifikator(); // Excise number - String afgiftOperatoerPunktAfgiftIdentifikator = "DK82065873300"; + String afgiftOperatoerPunktAfgiftIdentifikator = getAfgiftOperatoerPunktAfgiftIdentifikator(); OIOBeskedAfvisningSamlingHentClient oioBeskedAfvisningSamlingHentClient = new OIOBeskedAfvisningSamlingHentClient(endpointURL); oioBeskedAfvisningSamlingHentClient.invoke(virksomhedSENummerIdentifikator, diff --git a/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClientTest.java b/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClientTest.java index 4a2b5bb..36fdcc6 100644 --- a/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClientTest.java +++ b/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDocumentOpretClientTest.java @@ -8,7 +8,7 @@ * @author SKAT * @since 1.0 */ -public class OIOLedsageDocumentOpretClientTest { +public class OIOLedsageDocumentOpretClientTest extends BaseClient { @Test public void invoke() throws Exception { @@ -21,9 +21,9 @@ public void invoke() throws Exception { String ie815 = "ie815.xml"; // VAT Number of the entity sending. Rule of thumb: this number matches // this CVR number present in the certificate. - String virksomhedSENummerIdentifikator = "30808460"; + String virksomhedSENummerIdentifikator = getVirksomhedSENummerIdentifikator(); // Excise number - String afgiftOperatoerPunktAfgiftIdentifikator = "DK82065873300"; + String afgiftOperatoerPunktAfgiftIdentifikator = getAfgiftOperatoerPunktAfgiftIdentifikator(); OIOLedsageDocumentOpretClient oioLedsageDocumentClient = new OIOLedsageDocumentOpretClient(endpointURL); oioLedsageDocumentClient.invoke(virksomhedSENummerIdentifikator, diff --git a/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClientTest.java b/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClientTest.java index 53ce08a..747a517 100644 --- a/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClientTest.java +++ b/src/test/java/dk/skat/emcs/b2b/sample/OIOLedsageDokumentSamlingHentClientTest.java @@ -8,7 +8,7 @@ * @author SKAT * @since 1.1 */ -public class OIOLedsageDokumentSamlingHentClientTest { +public class OIOLedsageDokumentSamlingHentClientTest extends BaseClient { @Test public void invoke() throws Exception { @@ -21,9 +21,9 @@ public void invoke() throws Exception { String ARCnumber = System.getProperty("dk.skat.emcs.b2b.sample.ARC"); // VAT Number of the entity sending. Rule of thumb: this number matches // this CVR number present in the certificate. - String virksomhedSENummerIdentifikator = "30808460"; + String virksomhedSENummerIdentifikator = getVirksomhedSENummerIdentifikator(); // Excise number - String afgiftOperatoerPunktAfgiftIdentifikator = "DK82065873300"; + String afgiftOperatoerPunktAfgiftIdentifikator = getAfgiftOperatoerPunktAfgiftIdentifikator(); OIOLedsageDokumentSamlingHentClient ledsageDokumentSamlingHentClient = new OIOLedsageDokumentSamlingHentClient(endpointURL); ledsageDokumentSamlingHentClient.invoke(virksomhedSENummerIdentifikator,