Skip to content

Commit 4c3e1df

Browse files
authored
Merge pull request #1 from datatrans/DT-22498
DT-22498 DT OpenAPI Java SDK generator throws exception
2 parents f924628 + c04d7a3 commit 4c3e1df

File tree

4 files changed

+11155
-5686
lines changed

4 files changed

+11155
-5686
lines changed

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ $ mvn clean compile
88
```
99

1010
### Deploy to your own artifacts sever
11+
1112
Currently, the Datatrans Java SDK is not yet available on Maven Central (or something similar).
12-
Thats why you manually need to deploy it to your own artifacts hosting solution.
13+
That's why you manually need to deploy it to your own artifacts hosting solution.
1314

1415
```
1516
# You might have to adjust your ~/.m2/settings.xml or add a <distributionManagement> section to the pom.xml
1617
$ mvn deploy
1718
```
1819

1920
## Using the Java SDK
21+
2022
Once deployed, add the following dependency:
2123

2224
### Maven users
@@ -41,6 +43,7 @@ compile "ch.datatrans:datatrans-java-sdk:2.0.15"
4143
```
4244

4345
### Invoking the SDK
46+
4447
```java
4548
ApiClient defaultClient = Configuration.getDefaultApiClient();
4649
defaultClient.setBasePath("https://api.sandbox.datatrans.com");
@@ -52,28 +55,26 @@ Basic.setPassword("password"); // your Datatrans server to server password
5255

5356
V1TransactionsApi transactionsApiInstance = new V1TransactionsApi(defaultClient);
5457

55-
AuthorizeRequest authorizeRequest = new AuthorizeRequest();
56-
authorizeRequest.currency("CHF")
58+
RedirectRequest redirectRequest = new RedirectRequest();
59+
redirectRequest.successUrl("https://pay.sandbox.datatrans.com/upp/merchant/successPage.jsp")
60+
.cancelUrl("https://pay.sandbox.datatrans.com/upp/merchant/cancelPage.jsp")
61+
.errorUrl("https://pay.sandbox.datatrans.com/upp/merchant/errorPage.jsp");
62+
63+
InitRequest initRequest = new InitRequest();
64+
initRequest.currency("CHF")
65+
.paymentMethods(List.of(InitRequest.PaymentMethodsEnum.VIS))
66+
.redirect(redirectRequest)
5767
.amount(100L)
5868
.refno(String.valueOf(System.currentTimeMillis()));
5969

60-
CardAuthorizeRequest cardAuthorizeRequest = new CardAuthorizeRequest();
61-
62-
cardAuthorizeRequest.alias("AAABcH0Bq92s3kgAESIAAbGj5NIsAHWC")
63-
.expiryMonth("12")
64-
.expiryYear("21");
65-
66-
authorizeRequest.setCard(cardAuthorizeRequest);
67-
6870
try {
69-
AuthorizeResponse result = transactionsApiInstance.authorize(authorizeRequest);
71+
InitResponse result = transactionsApiInstance.init(initRequest);
7072
System.out.println(result);
7173
} catch (ApiException e) {
72-
System.err.println("Exception when calling V1AliasesApi#aliasesConvert");
74+
System.err.println("Exception when calling V1TransactionsApi#init");
7375
System.err.println("Status code: " + e.getCode());
7476
System.err.println("Reason: " + e.getResponseBody());
7577
System.err.println("Response headers: " + e.getResponseHeaders());
7678
e.printStackTrace();
7779
}
7880
```
79-

pom.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
1515
<gson-fire-version>1.8.5</gson-fire-version>
1616
<swagger-core-version>1.6.2</swagger-core-version>
17-
<okhttp-version>4.9.1</okhttp-version>
18-
<gson-version>2.8.6</gson-version>
17+
<okhttp-version>4.12.0</okhttp-version>
18+
<gson-version>2.8.9</gson-version>
1919
<commons-lang3-version>3.11</commons-lang3-version>
2020
<javax-annotation-version>1.3.2</javax-annotation-version>
21-
<junit-version>4.13.1</junit-version>
21+
<junit-version>5.10.3</junit-version>
2222
<jsr305.version>3.0.2</jsr305.version>
23-
<datatrans-json-api.version>2.0.15</datatrans-json-api.version>
24-
<openapi-generator-maven-plugin>5.1.0</openapi-generator-maven-plugin>
23+
<datatrans-json-api.version>2.0.45</datatrans-json-api.version>
24+
<openapi-generator-maven-plugin>7.7.0</openapi-generator-maven-plugin>
2525
<default.package>ch.datatrans</default.package>
2626
</properties>
2727

@@ -70,8 +70,8 @@
7070
</dependency>
7171
<!-- test dependencies -->
7272
<dependency>
73-
<groupId>junit</groupId>
74-
<artifactId>junit</artifactId>
73+
<groupId>org.junit.jupiter</groupId>
74+
<artifactId>junit-jupiter-api</artifactId>
7575
<version>${junit-version}</version>
7676
<scope>test</scope>
7777
</dependency>
@@ -133,4 +133,4 @@
133133
</build>
134134

135135

136-
</project>
136+
</project>

0 commit comments

Comments
 (0)