Skip to content

Commit 2c800fe

Browse files
Fix merge
1 parent ebe84cf commit 2c800fe

File tree

6 files changed

+68
-54
lines changed

6 files changed

+68
-54
lines changed

bzst-dip-java-client-demo/src/main/java/software/xdev/ApplicationWithCesop.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.slf4j.LoggerFactory;
1515

1616
import software.xdev.bzst.dip.client.BzstDipClient;
17-
import software.xdev.bzst.dip.client.exception.HttpStatusCodeNotExceptedException;
1817
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfiguration;
1918
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfigurationBuilder;
2019
import software.xdev.bzst.dip.client.model.configuration.BzstDipOecdDocType;
@@ -57,7 +56,7 @@ public final class ApplicationWithCesop
5756
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationWithCesop.class);
5857

5958
public static void main(final String[] args)
60-
throws InterruptedException, HttpStatusCodeNotExceptedException, IOException, DatatypeConfigurationException
59+
throws InterruptedException, IOException, DatatypeConfigurationException
6160
{
6261
final BzstDipConfiguration configuration = createConfiguration();
6362
final BzstDipClient bzstDipClient = new BzstDipClient(configuration);

bzst-dip-java-client-demo/src/main/java/software/xdev/ApplicationWithCsvInput.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111

12-
import com.opencsv.exceptions.CsvValidationException;
13-
1412
import software.xdev.bzst.dip.client.BzstDipClient;
1513
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfiguration;
1614
import software.xdev.bzst.dip.client.model.message.dac7.BzstDipCompleteResult;
@@ -22,7 +20,7 @@ public final class ApplicationWithCsvInput
2220
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationWithCsvInput.class);
2321

2422
public static void main(final String[] args)
25-
throws InterruptedException, HttpStatusCodeNotExceptedException, IOException, CsvValidationException
23+
throws InterruptedException, IOException
2624
{
2725
final BzstDipConfiguration configuration = ApplicationWithDac7.createConfiguration();
2826

bzst-dip-java-client/pom.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@
493493
<plugin>
494494
<groupId>software.xdev</groupId>
495495
<artifactId>find-and-replace-maven-plugin</artifactId>
496-
<version>1.0.0</version>
496+
<version>1.0.3</version>
497497
<executions>
498498
<execution>
499499
<!-- Remove so that we don't need additional dependency -->
@@ -542,10 +542,17 @@
542542
<replaceAll>false</replaceAll>
543543
<replaceLineBased>false</replaceLineBased>
544544
</configuration>
545-
</execution>
545+
</execution>
546+
</executions>
546547
</plugin>
548+
</plugins>
549+
</build>
550+
</profile>
551+
<profile>
552+
<id>pmd</id>
553+
<build>
554+
<plugins>
547555
<plugin>
548-
<id>pmd</id>
549556
<artifactId>maven-pmd-plugin</artifactId>
550557
<version>3.26.0</version>
551558
<configuration>

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/BzstDipClient.java

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import org.slf4j.Logger;
2424
import org.slf4j.LoggerFactory;
2525

26-
import com.opencsv.exceptions.CsvValidationException;
27-
2826
import software.xdev.bzst.dip.client.generated.api.MdEinreichenProviderApi;
2927
import software.xdev.bzst.dip.client.generated.client.ApiClient;
3028
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfiguration;
@@ -91,14 +89,14 @@ public BzstDipSendingResult sendDipOnly(final BzstDipMessage message)
9189
}
9290

9391
/**
94-
* Sends the message without querying for a response. We recommend using the
95-
* {@link #sendDipAndQueryResult(String)} counterpart and
96-
* suggest only using this method, if specifically needed.
92+
* Sends the message without querying for a response. We recommend using the {@link #sendDipAndQueryResult(String)}
93+
* counterpart and suggest only using this method, if specifically needed.
94+
*
9795
* @param csvData which will be parsed by the {@link ReportableSellerCsvFileParser}.
9896
* @return the result which only contains the dataTransferNumber
9997
*/
10098
public BzstDipSendingResult sendDipOnly(final String csvData)
101-
throws HttpStatusCodeNotExceptedException, CsvValidationException, IOException
99+
throws IOException
102100
{
103101
return this.sendDipOnly(new ReportableSellerCsvFileParser(this.configuration).parseCsvData(csvData));
104102
}
@@ -138,13 +136,14 @@ public BzstDipSendingResult sendDipOnly(
138136
/**
139137
* Sends the message and queries a result.
140138
* <p>
141-
* Querying the result might take a few seconds and is configured in
142-
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
139+
* Querying the result might take a few seconds and is configured in
140+
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
143141
* </p>
144142
* <p>
145-
* In special cases {@link #sendDipOnly(BzstDipMessage)} can be used, if the result is not needed,
146-
* or the results should be queried in some other way.
143+
* In special cases {@link #sendDipOnly(BzstDipMessage)} can be used, if the result is not needed, or the results
144+
* should be queried in some other way.
147145
* </p>
146+
*
148147
* @param message with the data for the BZST DIP API.
149148
* @return the result which contains the dataTransferNumber and all found responses in the API.
150149
*/
@@ -155,21 +154,22 @@ public BzstDipCompleteResult sendDipAndQueryResult(final BzstDipMessage message)
155154
}
156155

157156
public BzstDipCompleteResult sendDipAndQueryResult(final BzstCesopPaymentDataBody message)
158-
throws HttpStatusCodeNotExceptedException, InterruptedException, IOException, DatatypeConfigurationException
157+
throws InterruptedException, IOException, DatatypeConfigurationException
159158
{
160159
return this.sendDipAndQueryResult(message.toXmlType());
161160
}
162161

163162
/**
164163
* Sends the message and queries a result.
165164
* <p>
166-
* Querying the result might take a few seconds and is configured in
167-
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
165+
* Querying the result might take a few seconds and is configured in
166+
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
168167
* </p>
169168
* <p>
170-
* In special cases {@link #sendDipOnly(String)} can be used, if the result is not needed,
171-
* or the results should be queried in some other way.
169+
* In special cases {@link #sendDipOnly(String)} can be used, if the result is not needed, or the results should be
170+
* queried in some other way.
172171
* </p>
172+
*
173173
* @param csvData which will be parsed by the {@link ReportableSellerCsvFileParser}.
174174
* @return the result which contains the dataTransferNumber and all found responses in the API.
175175
*/
@@ -182,13 +182,14 @@ public BzstDipCompleteResult sendDipAndQueryResult(final String csvData)
182182
/**
183183
* Sends the message and queries a result.
184184
* <p>
185-
* Querying the result might take a few seconds and is configured in
186-
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
185+
* Querying the result might take a few seconds and is configured in
186+
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
187187
* </p>
188188
* <p>
189-
* In special cases {@link #sendDipOnly(List)} can be used, if the result is not needed,
190-
* or the results should be queried in some other way.
189+
* In special cases {@link #sendDipOnly(List)} can be used, if the result is not needed, or the results should be
190+
* queried in some other way.
191191
* </p>
192+
*
192193
* @param correctableReportableSellerTypes with the data for the BZST DIP API.
193194
* @return the result which contains the dataTransferNumber and all found responses in the API.
194195
*/
@@ -206,16 +207,16 @@ public BzstDipCompleteResult sendDipAndQueryResult(
206207
/**
207208
* Sends the message and queries a result.
208209
* <p>
209-
* Querying the result might take a few seconds and is configured in
210-
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
210+
* Querying the result might take a few seconds and is configured in
211+
* {@link BzstDipConfiguration#getQueryResultConfiguration()}.
211212
* </p>
212213
* <p>
213-
* In special cases {@link #sendDipOnly(List, CorrectablePlatformOperatorType)} can be used, if the result is
214-
* not needed,
215-
* or the results should be queried in some other way.
214+
* In special cases {@link #sendDipOnly(List, CorrectablePlatformOperatorType)} can be used, if the result is not
215+
* needed, or the results should be queried in some other way.
216216
* </p>
217+
*
217218
* @param correctableReportableSellerTypes with the data for the BZST DIP API.
218-
* @param correctablePlatformOperatorType with the information about the platform operator.
219+
* @param correctablePlatformOperatorType with the information about the platform operator.
219220
* @return the result which contains the dataTransferNumber and all found responses in the API.
220221
*/
221222
public BzstDipCompleteResult sendDipAndQueryResult(
@@ -224,38 +225,35 @@ public BzstDipCompleteResult sendDipAndQueryResult(
224225
)
225226
throws InterruptedException, IOException
226227
{
227-
final BzstDipSendingResult sendingResult =
228-
this.sendDipOnlyInternal(correctableReportableSellerTypes, correctablePlatformOperatorType);
229-
230-
Thread.sleep(this.configuration.getQueryResultConfiguration().delayBeforeCheckingResults().toMillis());
228+
final BzstDipSendingResult sendingResult =
229+
this.sendDipOnlyInternal(correctableReportableSellerTypes, correctablePlatformOperatorType);
230+
231+
Thread.sleep(this.configuration.getQueryResultConfiguration().delayBeforeCheckingResults().toMillis());
231232

232233
final BzstDipRequestStatusResult requestStatusResult = this.queryDipResultWithRetry(sendingResult);
233-
234-
return BzstDipCompleteResult.fromResult(sendingResult, requestStatusResult);
234+
235+
return BzstDipCompleteResult.fromResult(sendingResult, requestStatusResult);
235236
}
236237

237238
public BzstDipCompleteResult sendDipAndQueryResult(
238239
final PaymentDataBodyType paymentDataBodyType
239240
)
240-
throws HttpStatusCodeNotExceptedException, InterruptedException, IOException
241+
throws InterruptedException, IOException
241242
{
242-
try(final WebClient client = new WebClient(this.configuration))
243-
{
244-
final BzstDipSendingResult sendingResult =
245-
this.sendDipOnlyInternal(paymentDataBodyType, client);
246-
247-
Thread.sleep(this.configuration.getQueryResultConfiguration().delayBeforeCheckingResults().toMillis());
248-
249-
final BzstDipRequestStatusResult requestStatusResult = this.queryDipResultWithRetry(client, sendingResult);
250-
251-
return BzstDipCompleteResult.fromResult(sendingResult, requestStatusResult);
252-
}
243+
final WebClient client = new WebClient(this.configuration);
244+
final BzstDipSendingResult sendingResult = this.sendDipOnlyInternal(paymentDataBodyType, client);
245+
246+
Thread.sleep(this.configuration.getQueryResultConfiguration().delayBeforeCheckingResults().toMillis());
247+
248+
final BzstDipRequestStatusResult requestStatusResult = this.queryDipResultWithRetry(sendingResult);
249+
250+
return BzstDipCompleteResult.fromResult(sendingResult, requestStatusResult);
253251
}
254252

255253
/**
256-
* Queries for a DIP result. We recommend using the
257-
* {@link #sendDipAndQueryResult(BzstDipMessage)} counterpart and
254+
* Queries for a DIP result. We recommend using the {@link #sendDipAndQueryResult(BzstDipMessage)} counterpart and
258255
* suggest only using this method, if specifically needed.
256+
*
259257
* @return all found {@link BzstDipSingleTransferResult}s
260258
*/
261259
public BzstDipRequestStatusResult queryDipResult() throws IOException
@@ -292,7 +290,7 @@ private BzstDipSendingResult sendDipOnlyInternal(
292290
private BzstDipSendingResult sendDipOnlyInternal(
293291
final PaymentDataBodyType paymentDataBodyType,
294292
final WebClient client
295-
) throws HttpStatusCodeNotExceptedException
293+
)
296294
{
297295
final XMLDocumentCreator xmlDocumentCreator = new XMLDocumentCreator(this.configuration);
298296
final String signedXML =

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/util/WebClientUtil.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@
1515
*/
1616
package software.xdev.bzst.dip.client.util;
1717

18+
import static software.xdev.bzst.dip.client.webclient.BearerTokenRequester.MDS_POSTFIX;
19+
1820
import java.io.IOException;
21+
import java.io.InputStream;
1922
import java.io.StringReader;
23+
import java.security.KeyStore;
24+
import java.security.PrivateKey;
25+
import java.time.Duration;
2026
import java.util.ArrayList;
27+
import java.util.Date;
2128
import java.util.List;
29+
import java.util.UUID;
2230

2331
import javax.xml.parsers.DocumentBuilder;
2432
import javax.xml.parsers.DocumentBuilderFactory;
@@ -33,7 +41,10 @@
3341
import org.xml.sax.InputSource;
3442
import org.xml.sax.SAXException;
3543

44+
import io.jsonwebtoken.Jwts;
45+
import software.xdev.bzst.dip.client.exception.EncryptionException;
3646
import software.xdev.bzst.dip.client.factory.DocumentBuilderFactoryNoExternalEntities;
47+
import software.xdev.bzst.dip.client.model.configuration.BzstDipConfiguration;
3748

3849

3950
/**

bzst-dip-java-client/src/main/java/software/xdev/bzst/dip/client/webclient/BearerTokenRequester.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ private String createRequestToken()
105105
{
106106
final KeyStore.PrivateKeyEntry privateKeyEntry = SigningUtil.getPrivateKeyEntry(
107107
keystoreInputStream,
108+
this.configuration.getKeyStorePrivateKeyAlias(),
108109
this.configuration.getCertificateKeystorePassword(),
109110
SigningUtil.KEYSTORE_TYPE
110111
);

0 commit comments

Comments
 (0)