Skip to content

Commit 88ef71d

Browse files
committed
Fix build
1 parent f48b714 commit 88ef71d

6 files changed

Lines changed: 28 additions & 26 deletions

File tree

.github/workflows/maven-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
java-version: [ 11 ]
10+
java-version: [ 17 ]
1111

1212
permissions:
1313
contents: read
@@ -22,7 +22,7 @@ jobs:
2222
java-version: ${{ matrix.java-version }}
2323

2424
- name: Cache Maven packages
25-
uses: actions/cache@v1
25+
uses: actions/cache@v4
2626
with:
2727
path: ~/.m2
2828
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@
6161
<plugin>
6262
<groupId>org.apache.maven.plugins</groupId>
6363
<artifactId>maven-surefire-plugin</artifactId>
64-
<version>3.0.0-M5</version>
64+
<version>3.5.3</version>
6565
<configuration>
6666
<runOrder>alphabetical</runOrder>
6767
<useSystemClassLoader>false</useSystemClassLoader>
6868
<redirectTestOutputToFile>true</redirectTestOutputToFile>
6969
<reportFormat>plain</reportFormat>
70-
<systemProperties>
70+
<systemPropertyVariables>
7171
<property>
7272
<name>java.io.tmpdir</name>
7373
<value>target</value>
@@ -80,7 +80,7 @@
8080
<name>user.region</name>
8181
<value>en</value>
8282
</property>
83-
</systemProperties>
83+
</systemPropertyVariables>
8484
</configuration>
8585
</plugin>
8686
<plugin>

src/main/java/com/twikey/modal/DocumentResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ public static Document fromJson(JSONObject json, String state) {
145145
resp.debtorEmail = ctct.optString("EmailAdr");
146146
resp.customerNumber = ctct.optString("Othr");
147147

148-
resp.iban = mndt.getString("DbtrAcct");
148+
resp.iban = mndt.optString("DbtrAcct");
149149

150150
JSONObject agent = mndt.getJSONObject("DbtrAgt").getJSONObject("FinInstnId");
151-
resp.bic = agent.getString("BICFI");
152-
resp.debtorBank = agent.getString("Nm");
151+
resp.bic = agent.optString("BICFI");
152+
resp.debtorBank = agent.optString("Nm");
153153

154154
resp.contractNumber = mndt.getString("RfrdDoc");
155155

src/test/java/com/twikey/DocumentGatewayTest.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class DocumentGatewayTest {
1717
private final String apiKey = System.getenv("TWIKEY_API_KEY"); // found in https://www.twikey.com/r/admin#/c/settings/api
1818

1919
private final String _ct = System.getenv("CT"); // found @ https://www.twikey.com/r/admin#/c/template
20+
private final String mndtNumber = System.getenv("MNDTNUMBER");
2021

2122
private Long ct;
2223

@@ -84,9 +85,9 @@ public void testSignMandate() throws Exception, TwikeyClient.UserException {
8485
}
8586

8687
@Test
87-
public void testAction() throws IOException, TwikeyClient.UserException, InterruptedException {
88+
public void testAction() throws IOException, TwikeyClient.UserException {
8889
Assume.assumeTrue("APIKey is set", apiKey != null);
89-
MandateActionRequest action = new MandateActionRequest(MandateActionRequest.MandateActionType.REMINDER, "CORERECURRENTNL18166")
90+
MandateActionRequest action = new MandateActionRequest(MandateActionRequest.MandateActionType.REMINDER, mndtNumber)
9091
.setReminder(1);
9192
api.document().action(action);
9293
}
@@ -116,28 +117,28 @@ public void testCancel() throws Exception, TwikeyClient.UserException {
116117
@Test
117118
public void testFetch() throws Exception, TwikeyClient.UserException {
118119
Assume.assumeTrue("APIKey is set", apiKey != null);
119-
MandateDetailRequest fetch = new MandateDetailRequest("CORERECURRENTNL18166")
120+
MandateDetailRequest fetch = new MandateDetailRequest(mndtNumber)
120121
.setForce(true);
121122
DocumentResponse.Document response = api.document().fetch(fetch);
122123
assertNotNull("Document Reference", response.getMandateNumber());
123124
}
124125

125126
@Test
126-
public void testUpdateMandate() throws IOException, TwikeyClient.UserException, InterruptedException {
127+
public void testUpdateMandate() throws IOException, TwikeyClient.UserException {
127128
Assume.assumeTrue("APIKey is set", apiKey != null);
128-
UpdateMandateRequest update = new UpdateMandateRequest("CORERECURRENTNL18166", customer, account);
129+
UpdateMandateRequest update = new UpdateMandateRequest(mndtNumber, customer, account);
129130
api.document().update(update);
130131
}
131132

132133
@Test
133-
public void testCustomerAccess() throws IOException, TwikeyClient.UserException, InterruptedException {
134+
public void testCustomerAccess() throws IOException, TwikeyClient.UserException {
134135
Assume.assumeTrue("APIKey is set", apiKey != null);
135-
DocumentResponse.CustomerAccessResponse response = api.document().customerAccess("CORERECURRENTNL18166");
136+
DocumentResponse.CustomerAccessResponse response = api.document().customerAccess(mndtNumber);
136137
assertNotNull("Document Customer Url", response.getUrl());
137138
}
138139

139140
@Test
140-
public void testRetrievePdf() throws IOException, TwikeyClient.UserException, InterruptedException {
141+
public void testRetrievePdf() throws IOException, TwikeyClient.UserException {
141142
Assume.assumeTrue("APIKey is set", apiKey != null);
142143
DocumentResponse.PdfResponse retrievedPdf = api.document().retrievePdf("CORERECURRENTNL18247");
143144
retrievedPdf.save("target/pdf.pdf");

src/test/java/com/twikey/RefundGatewayTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
public class RefundGatewayTest {
1515

1616
private final String apiKey = System.getenv("TWIKEY_API_KEY"); // found in https://www.twikey.com/r/admin#/c/settings/api
17+
private final String iban = System.getenv("REFUND_IBAN"); // found in https://www.twikey.com/r/admin#/c/settings/api
1718

1819
private final String ct = System.getenv("CT");
1920

@@ -37,8 +38,8 @@ public void createCustomer(){
3738
.setLang("nl")
3839
.setMobile("32498665995");
3940

40-
account = new DocumentRequests.Account("NL46ABNA8910219718", "ABNANL2A");
41-
41+
Assume.assumeTrue("IBAN is set", iban != null);
42+
account = new DocumentRequests.Account(iban, "ABNANL2A");
4243
api = new TwikeyClient(apiKey)
4344
.withTestEndpoint()
4445
.withUserAgent("twikey-api-java/junit");

src/test/java/com/twikey/TransactionGatewayTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void prepClient() {
2929
}
3030

3131
@Test
32-
public void testCreate() throws IOException, TwikeyClient.UserException, InterruptedException {
32+
public void testCreate() throws IOException, TwikeyClient.UserException {
3333
Assume.assumeNotNull(apiKey,mandateNumber);
3434
TransactionRequests.NewTransactionRequest request = new TransactionRequests.NewTransactionRequest(mandateNumber, "hey", 10.0);
3535
TransactionResponse.Transaction linkResponse = api.transaction().create(request);
@@ -51,7 +51,7 @@ public void testCreate() throws IOException, TwikeyClient.UserException, Interru
5151
}
5252

5353
@Test
54-
public void testStatus() throws IOException, TwikeyClient.UserException, InterruptedException {
54+
public void testStatus() throws IOException, TwikeyClient.UserException {
5555
Assume.assumeNotNull(apiKey, mandateNumber);
5656
TransactionRequests.StatusRequest statusRequest = new TransactionRequests.StatusRequest()
5757
.setMandateNumber(mandateNumber)
@@ -62,7 +62,7 @@ public void testStatus() throws IOException, TwikeyClient.UserException, Interru
6262
}
6363

6464
@Test
65-
public void testAction() throws IOException, TwikeyClient.UserException, InterruptedException {
65+
public void testAction() throws IOException, TwikeyClient.UserException {
6666
Assume.assumeNotNull(apiKey, mandateNumber);
6767
TransactionRequests.NewTransactionRequest request = new TransactionRequests.NewTransactionRequest(mandateNumber, "hey", 10.0);
6868
TransactionResponse.Transaction linkResponse = api.transaction().create(request);
@@ -72,7 +72,7 @@ public void testAction() throws IOException, TwikeyClient.UserException, Interru
7272
}
7373

7474
@Test
75-
public void testUpdate() throws IOException, TwikeyClient.UserException, InterruptedException {
75+
public void testUpdate() throws IOException, TwikeyClient.UserException {
7676
Assume.assumeNotNull(apiKey, mandateNumber);
7777
TransactionRequests.NewTransactionRequest request = new TransactionRequests.NewTransactionRequest(mandateNumber, "hey", 10.0);
7878
TransactionResponse.Transaction linkResponse = api.transaction().create(request);
@@ -82,15 +82,15 @@ public void testUpdate() throws IOException, TwikeyClient.UserException, Interru
8282
}
8383

8484
@Test
85-
public void testRefund() throws IOException, TwikeyClient.UserException, InterruptedException {
85+
public void testRefund() throws IOException, TwikeyClient.UserException {
8686
Assume.assumeNotNull(apiKey, mandateNumber, paidTxId);
8787
TransactionRequests.RefundRequest requestRefund = new TransactionRequests.RefundRequest("6445226", "hey", 10.0);
8888
TransactionResponse.Refund refundResponse = api.transaction().refund(requestRefund);
8989
assertNotNull("Transaction Id", refundResponse);
9090
}
9191

9292
@Test
93-
public void testRemove() throws IOException, TwikeyClient.UserException, InterruptedException {
93+
public void testRemove() throws IOException, TwikeyClient.UserException {
9494
Assume.assumeNotNull(apiKey, mandateNumber);
9595
TransactionRequests.NewTransactionRequest request = new TransactionRequests.NewTransactionRequest(mandateNumber, "hey", 10.0);
9696
TransactionResponse.Transaction linkResponse = api.transaction().create(request);
@@ -100,15 +100,15 @@ public void testRemove() throws IOException, TwikeyClient.UserException, Interru
100100
}
101101

102102
@Test
103-
public void testQuery() throws IOException, TwikeyClient.UserException, InterruptedException {
103+
public void testQuery() throws IOException, TwikeyClient.UserException {
104104
Assume.assumeNotNull(apiKey, mandateNumber);
105105
TransactionRequests.QueryRequest queryRequest = new TransactionRequests.QueryRequest(6445226);
106106
List<TransactionResponse.Transaction> response = api.transaction().query(queryRequest);
107107
assertNotNull("Transaction", response);
108108
}
109109

110110
@Test
111-
public void testFeed() throws IOException, TwikeyClient.UserException, InterruptedException {
111+
public void testFeed() throws IOException, TwikeyClient.UserException {
112112
Assume.assumeTrue("APIKey is set", apiKey != null);
113113
api.transaction().feed(updatedTransaction -> {
114114
String state_ = updatedTransaction.getState();

0 commit comments

Comments
 (0)