Skip to content

Commit

Permalink
Added more documentation to client classes (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcurry authored Nov 20, 2017
1 parent 0a761f3 commit e7cba81
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 17 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ buildNumber.properties
.idea
*.iml
# Do not add:
run-submit.sh
run-fetch.sh
run-fetch-ie704.sh
run-*.sh
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
/**
* OIOBeskedAfvisningSamlingHentClient
*
* Input:
* Date time period (start, end) = the last month
*
* Output:
* IE704 documents (if any)
*
* @author SKAT
* @since 1.1
*/
Expand Down Expand Up @@ -152,7 +158,7 @@ public void invoke(String virksomhedSENummerIdentifikator,
}
}
} else {
sb.append("** IE 704 Messages: ").append(newLine);
sb.append("** IE704 Messages: ").append(newLine);
List<String> ie704Messages = out.getBeskedAfvisningSamling().getIE704BeskedTekst();
if (ie704Messages != null && ie704Messages.size() > 0) {
for (String message : ie704Messages) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
/**
* OIOLedsageDokumentSamlingHentClient
*
* Input:
* ARC number = from OIOLedsageDocumentOpret response
*
* Output:
* IE801 document
*
* @author SKAT
* @since 1.1
*/
Expand Down Expand Up @@ -142,7 +148,7 @@ public void invoke(String virksomhedSENummerIdentifikator,
}
}
} else {
sb.append("** IE 801 Messages: ").append(newLine);
sb.append("** IE801 Messages: ").append(newLine);
List<String> ie801Messages = out.getLedsageDokumentStamDataSamling().getIE801BeskedTekst();
for (String message : ie801Messages) {
sb.append(message).append(newLine);
Expand Down
31 changes: 31 additions & 0 deletions src/test/java/dk/skat/emcs/b2b/sample/BaseClient.java
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author SKAT
* @since 1.1
*/
public class OIOBeskedAfvisningSamlingHentClientTest {
public class OIOBeskedAfvisningSamlingHentClientTest extends BaseClient {

@Test
public void invoke() throws Exception {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author SKAT
* @since 1.0
*/
public class OIOLedsageDocumentOpretClientTest {
public class OIOLedsageDocumentOpretClientTest extends BaseClient {

@Test
public void invoke() throws Exception {
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @author SKAT
* @since 1.1
*/
public class OIOLedsageDokumentSamlingHentClientTest {
public class OIOLedsageDokumentSamlingHentClientTest extends BaseClient {

@Test
public void invoke() throws Exception {
Expand All @@ -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,
Expand Down

0 comments on commit e7cba81

Please sign in to comment.