Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Commit e792a9d

Browse files
isabellaiowandi34
authored andcommitted
Update to XS2A 2.0.3
- replace expired test cert - fix invalid IBAN in PIS test (XS2A now validates IBANs for PIS) - ignore log files from tests (bug) - fix tests which tried to access transactions/balances with wrong consent (worked only because of a bug in XS2A)
1 parent 9a823d3 commit e792a9d

File tree

8 files changed

+90
-19
lines changed

8 files changed

+90
-19
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ database-migration.sql
44

55
### Services ###
66
target
7-
service/logs
7+
# current bug: tests create log files here :(
8+
service/logs/
89
.service
910

1011
### UI ###

service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<properties>
2525
<java.version>1.8</java.version>
2626
<lombok.version>1.16.22</lombok.version>
27-
<xs2a.version>2.0</xs2a.version>
27+
<xs2a.version>2.0.3</xs2a.version>
2828
<cucumber.version>4.2.0</cucumber.version>
2929
<testcontainers.version>1.10.1</testcontainers.version>
3030
</properties>

service/src/test/java/de/adorsys/psd2/sandbox/xs2a/ais/AIS.feature

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,16 @@ Feature: AIS
126126
Examples:
127127
| accounts | balances | transactions | psu-id | password | sca-method | tan | withBalance |
128128
| DE11760365688833114935;DE13760365689669622432 | DE11760365688833114935 | DE11760365688833114935 | PSU-Successful | 12345 | SMS_OTP | 54321 | false |
129-
| DE11760365688833114935 | null | null | PSU-Successful | 12345 | SMS_OTP | 54321 | false |
129+
130+
Scenario Outline: Get Transactions without permissions in consent
131+
Given PSU created a consent on dedicated accounts for account information <accounts>, balances <balances> and transactions <transactions>
132+
And PSU authorised the consent with psu-id <psu-id>, password <password>, sca-method <sca-method> and tan <tan>
133+
And PSU accesses the account list withBalances false
134+
And PSU accesses the transaction list without a valid consent
135+
Then the transactions are not accessible
136+
Examples:
137+
| accounts | balances | transactions | psu-id | password | sca-method | tan |
138+
| DE11760365688833114935 | null | null | PSU-Successful | 12345 | SMS_OTP | 54321 |
130139

131140
################################################################################################
132141
# #
@@ -142,7 +151,16 @@ Feature: AIS
142151
Examples:
143152
| accounts | balances | transactions | psu-id | password | sca-method | tan | withBalances |
144153
| DE11760365688833114935;DE13760365689669622432 | DE11760365688833114935 | DE11760365688833114935 | PSU-Successful | 12345 | SMS_OTP | 54321 | false |
145-
| DE11760365688833114935 | null | null | PSU-Successful | 12345 | SMS_OTP | 54321 | false |
154+
155+
Scenario Outline: Get Balance List without permissions in consent
156+
Given PSU created a consent on dedicated accounts for account information <accounts>, balances <balances> and transactions <transactions>
157+
And PSU authorised the consent with psu-id <psu-id>, password <password>, sca-method <sca-method> and tan <tan>
158+
And PSU accesses the account list withBalances false
159+
When PSU accesses the balance list without a valid consent
160+
Then the balances are not accessible
161+
Examples:
162+
| accounts | balances | transactions | psu-id | password | sca-method | tan |
163+
| DE11760365688833114935 | null | null | PSU-Successful | 12345 | SMS_OTP | 54321 |
146164

147165
################################################################################################
148166
# #

service/src/test/java/de/adorsys/psd2/sandbox/xs2a/ais/AisSteps.java

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.adorsys.psd2.sandbox.xs2a.ais;
22

3+
import static de.adorsys.psd2.xs2a.domain.MessageErrorCode.CONSENT_INVALID;
34
import static org.hamcrest.CoreMatchers.containsString;
45
import static org.hamcrest.CoreMatchers.equalTo;
56
import static org.hamcrest.MatcherAssert.assertThat;
@@ -52,6 +53,7 @@
5253
import org.junit.Ignore;
5354
import org.springframework.beans.factory.annotation.Autowired;
5455
import org.springframework.http.HttpMethod;
56+
import org.springframework.http.HttpStatus;
5557
import org.springframework.http.ResponseEntity;
5658

5759
@Ignore("without this ignore intellij tries to run the step files")
@@ -314,12 +316,31 @@ public void getAccountListWithBalance(String withBalance) {
314316
}
315317

316318
@When("PSU accesses the transaction list")
317-
public void getAccountList() {
319+
public void getTransactionList() {
318320
getTransactionList("true");
319321
}
320322

321323
@When("PSU accesses the transaction list withBalances (.*)")
322324
public void getTransactionList(String withBalance) {
325+
ResponseEntity<TransactionsResponse200Json> response = getTransactions(
326+
TransactionsResponse200Json.class, withBalance
327+
);
328+
329+
assertTrue(response.getStatusCode().is2xxSuccessful());
330+
331+
context.setActualResponse(response);
332+
}
333+
334+
@When("PSU accesses the transaction list without a valid consent")
335+
public void getTransactionListWithoutConsent() {
336+
ResponseEntity<JsonNode> response = getTransactions(JsonNode.class, "false");
337+
338+
assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
339+
340+
context.setActualResponse(response);
341+
}
342+
343+
private <T> ResponseEntity<T> getTransactions(Class<T> clazz, String withBalance) {
323344
ResponseEntity<AccountList> actualResponse = context.getActualResponse();
324345
HashMap<String, String> headers = TestUtils.createSession();
325346
headers.put("Consent-ID", context.getConsentId());
@@ -329,37 +350,47 @@ public void getTransactionList(String withBalance) {
329350
"?bookingStatus=both&dateFrom=%s&dateTo=%s&withBalance=%s",
330351
LocalDate.now().minusYears(1), LocalDate.now(), withBalance
331352
);
332-
333353
context.setWithBalance(Boolean.parseBoolean(withBalance));
334354

335-
ResponseEntity<TransactionsResponse200Json> response = template.exchange(
355+
return template.exchange(
336356
"accounts/" + context.getAccountId() + "/transactions" + queryParams,
337357
HttpMethod.GET,
338358
request.toHttpEntity(),
339-
TransactionsResponse200Json.class);
359+
clazz);
360+
}
361+
362+
@When("PSU accesses the balance list")
363+
public void getBalanceList() {
364+
ResponseEntity<ReadAccountBalanceResponse200> response = getBalances(
365+
ReadAccountBalanceResponse200.class
366+
);
340367

341368
assertTrue(response.getStatusCode().is2xxSuccessful());
342369

343370
context.setActualResponse(response);
344371
}
345372

346-
@When("PSU accesses the balance list")
347-
public void getBalanceList() {
373+
@When("PSU accesses the balance list without a valid consent")
374+
public void psuAccessesTheBalanceListWithoutAValidConsent() {
375+
ResponseEntity<JsonNode> response = getBalances(JsonNode.class);
376+
377+
assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode());
378+
379+
context.setActualResponse(response);
380+
}
381+
382+
private <T> ResponseEntity<T> getBalances(Class<T> clazz) {
348383
ResponseEntity<AccountList> actualResponse = context.getActualResponse();
349384
HashMap<String, String> headers = TestUtils.createSession();
350385
headers.put("Consent-ID", context.getConsentId());
351386
Request<?> request = Request.emptyRequest(headers);
352387
context.setAccountId(actualResponse.getBody().getAccounts().get(0).getResourceId());
353388

354-
ResponseEntity<ReadAccountBalanceResponse200> response = template.exchange(
389+
return template.exchange(
355390
"accounts/" + context.getAccountId() + "/balances",
356391
HttpMethod.GET,
357392
request.toHttpEntity(),
358-
ReadAccountBalanceResponse200.class);
359-
360-
assertTrue(response.getStatusCode().is2xxSuccessful());
361-
362-
context.setActualResponse(response);
393+
clazz);
363394
}
364395

365396
@When("PSU accesses a single transaction")
@@ -467,6 +498,27 @@ public void receiveErrorMessageAndCode(String errorMessage) {
467498
assertThat(err.get("text").asText(), containsString("channel independent blocking"));
468499
}
469500

501+
@Then("the transactions are not accessible")
502+
public void transactionsAreNotAccessible() {
503+
assertUnauthorizedBecauseConsentMissingPermissions();
504+
}
505+
506+
@Then("the balances are not accessible")
507+
public void balancesAreNotAccessible() {
508+
assertUnauthorizedBecauseConsentMissingPermissions();
509+
}
510+
511+
private void assertUnauthorizedBecauseConsentMissingPermissions() {
512+
ResponseEntity<JsonNode> actualResponse = context.getActualResponse();
513+
JsonNode err = actualResponse.getBody().get("tppMessages").get(0);
514+
515+
assertEquals(HttpStatus.UNAUTHORIZED, context.getActualResponse().getStatusCode());
516+
assertThat(err.get("category").asText(), equalTo(TppMessageCategory.ERROR.toString()));
517+
assertThat(err.get("code").asText(), equalTo(CONSENT_INVALID.toString()));
518+
assertThat(err.get("text").asText(), containsString(
519+
"The consent was created by this TPP but is not valid for the addressed service/resource"));
520+
}
521+
470522
private <T> ResponseEntity<T> handleCredentialRequest(Class<T> clazz, String url, String psuId,
471523
String password) {
472524
HashMap<String, String> headers = TestUtils.createSession();

service/src/test/java/de/adorsys/psd2/sandbox/xs2a/pis/PIS.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Feature: PIS
117117
Examples:
118118
| payment-service | iban | payment-product | code | category | text |
119119
| payments | DE13760365681209386222 | sepa-credit-transfers | SERVICE_BLOCKED | ERROR | channel independent blocking |
120-
| payments | DE13760365681209386223 | sepa-credit-transfers | PAYMENT_FAILED | ERROR | payment initiation POST request failed during the initial process |
120+
| payments | DE89370400440532013000 | sepa-credit-transfers | PAYMENT_FAILED | ERROR | payment initiation POST request failed during the initial process |
121121

122122
Scenario Outline: Initiation of a Single Payment Exceeding the Available Balance
123123
Given PSU initiated a single payment with iban <iban> and the exceeding amount <amount>

service/src/test/java/de/adorsys/psd2/sandbox/xs2a/util/TestUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class TestUtils {
1818
public static String getTppQwacCertificate() {
1919
StringBuilder sb = new StringBuilder();
2020
try {
21-
// TODO: testCertificate will be invalid in a year. Validity = 365 days
2221
Files.lines(Paths.get("src/test/resources/testData/testCertificate.pem"))
2322
.forEach(sb::append);
2423
} catch (IOException e) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
-----BEGIN CERTIFICATE-----MIIEBjCCAu6gAwIBAgIEAmCHWTANBgkqhkiG9w0BAQsFADCBlDELMAkGA1UEBhMCREUxDzANBgNVBAgMBkhlc3NlbjESMBAGA1UEBwwJRnJhbmtmdXJ0MRUwEwYDVQQKDAxBdXRob3JpdHkgQ0ExCzAJBgNVBAsMAklUMSEwHwYDVQQDDBhBdXRob3JpdHkgQ0EgRG9tYWluIE5hbWUxGTAXBgkqhkiG9w0BCQEWCmNhQHRlc3QuZGUwHhcNMTgwODE3MDcxNzAyWhcNMTgwOTAzMDc1NzMxWjB6MRMwE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fosu/tM5ja7lVGrdcRz80evLVjA6rVd/YWyuUhJieNlAk+VcmG0xL3muSRjR0CgFx3IT+jCgfZY/l9LCMwRzrvmlGgbwFd5Qf/ySANuP+Wz0G0rCC4pAdASzngY279/a9vS30UG7C8D2Y72v91/qUu055pWHjGplOLSXNu0Hwq/XxEG0+fjqPKBRe6wdEaIbGHxXrWQjVBFhQJoUJwQcX4pAahKeseq8VMSf+HEYPVvYGmRhk8jvlm5r0W5TvxAn1AE6DCb7Y9ku2wLM0S9I81zipdEJ5J5u6hqgcdvOfL5NRc5cOV9MLmLrztPIeDYbJW28DZBDvzsnt7/679OzMqAWHY/UGDRqyF+CpTgBWhKguDLsMFMqoThaXWqBMuYMyxUw1J2VSDIkihgXEVWpS/1RQMDAuQI5oFiGNEVsWFGJqCVo06+PKY4JSv62cL4OVX8s0p7G8UhAd+An1fbGdnHkXnr/P8EyLJppnGtTXAAgzvtuAkM6ZTvjH+r2cKAeGVLVxGD3aNJaUU/WskZzmGokZQeDqRU0bV73fhPwcuc2dyq5Zi3uQ9VKBHzvKQ5f1hDF/b/R20uB/SbqGzpTwpvHmAAXWWlUnUU4GvSDuWNI=-----END CERTIFICATE-----

service/src/test/resources/xs2a-application-test.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ spring.datasource.password=cms
55

66
liquibase.enabled=true
77
logging.level.de.adorsys=DEBUG
8+
logging.level.root=INFO
89

910
sandbox.scaapproach=redirect
1011
server_key=test123

0 commit comments

Comments
 (0)