Skip to content

Commit

Permalink
Merge branch 'release-13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hryhorii Hevorkian committed Sep 13, 2021
2 parents f223d3a + 1a59bd9 commit 2bb69e1
Show file tree
Hide file tree
Showing 14 changed files with 147 additions and 14 deletions.
16 changes: 16 additions & 0 deletions doc/release_notes/Release_notes_12.0.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
= Release notes v.12.0

== Table of Contents

* Migrated onto new XS2A version

* Added specific PSU Message to response in case of Decoupled SCA approach

== Migrated onto new XS2A version

From now on, Connector uses XS2A version 12.0.

== Added specific PSU Message to response in case of Decoupled SCA approach

From now on, specific PSU message "Please check your app to continue..." is sent after authorisation start
in case of `Decoupled` SCA approach
16 changes: 16 additions & 0 deletions doc/release_notes/Release_notes_13.0.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
= Release notes v.13.0

== Table of Contents

* Migrated onto new XS2A version

* Added specific PSU Message to response in case of Decoupled SCA approach

== Migrated onto new XS2A version

From now on, Connector uses XS2A version 13.0.

== Added specific PSU Message to response in case of Decoupled SCA approach

From now on, specific PSU message "Please check your app to continue..." is sent after authorisation start
in case of `Decoupled` SCA approach
2 changes: 1 addition & 1 deletion gateway-app-embedded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>xs2a-connector-examples</artifactId>
<groupId>de.adorsys.ledgers</groupId>
<version>11.11</version>
<version>13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion gateway-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>xs2a-connector-examples</artifactId>
<version>11.11</version>
<version>13.0</version>
<relativePath>..</relativePath>
</parent>
<artifactId>gateway-app</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ledgers-rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>xs2a-connector-examples</artifactId>
<version>11.11</version>
<version>13.0</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ledgers-rest-client</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>xs2a-connector-examples</artifactId>
<version>11.11</version>
<version>13.0</version>
<packaging>pom</packaging>

<name>XS2A Connector Examples</name>
Expand Down Expand Up @@ -86,7 +86,7 @@
<ruleset.basedir>${project.basedir}</ruleset.basedir>

<!-- xs2a version -->
<xs2a.version>11.11</xs2a.version>
<xs2a.version>13.0</xs2a.version>
<!-- ledgers version -->
<ledgers.version>4.14</ledgers.version>

Expand Down
8 changes: 4 additions & 4 deletions scripts/.release-scripts-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ function get_remote_repo_name {
# Hook method to define the develop branch name
# Returns the develop branch name as text
function get_develop_branch_name {
if [[ "$1" =~ ^8\..* ]]
if [[ "$1" =~ ^12\..* ]]
then
echo "support-8.x"
echo "support-12.x"
else
echo "develop"
fi
Expand All @@ -43,9 +43,9 @@ function get_develop_branch_name {
# Hook method to define the master branch name
# Returns the master branch name as text
function get_master_branch_name {
if [[ "$1" =~ ^8\..* ]]
if [[ "$1" =~ ^12\..* ]]
then
echo "master-8.x"
echo "master-12.x"
else
echo "master"
fi
Expand Down
2 changes: 1 addition & 1 deletion xs2a-connector-embedded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>xs2a-connector-examples</artifactId>
<groupId>de.adorsys.ledgers</groupId>
<version>11.11</version>
<version>13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion xs2a-connector-oauth-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>xs2a-connector-examples</artifactId>
<groupId>de.adorsys.ledgers</groupId>
<version>11.11</version>
<version>13.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion xs2a-connector-remote/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>xs2a-connector-examples</artifactId>
<version>11.11</version>
<version>13.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion xs2a-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>xs2a-connector-examples</artifactId>
<version>11.11</version>
<version>13.0</version>
<relativePath>..</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class SpiMockData {
public static final List<SpiAuthenticationObject> SCA_METHODS = buildScaMethods();
public static final String PSU_MESSAGE = "mocked PSU message from the bank";
public static final String PSU_MESSAGE_START_AUTHORISATION = "Start authorisation mocked PSU message from the bank";
public static final String DECOUPLED_PSU_MESSAGE = "Please check your app to continue...";
public static final boolean FUNDS_AVAILABLE = true;

private static SpiLinks buildSpiLinks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ public SpiResponse<SpiStartAuthorisationResponse> startAuthorisation(@NotNull Sp
@NotNull String authorisationId,
T businessObject,
@NotNull SpiAspspConsentDataProvider aspspConsentDataProvider) {
String psuMessage = (scaApproach == ScaApproach.DECOUPLED)
? SpiMockData.DECOUPLED_PSU_MESSAGE
: SpiMockData.PSU_MESSAGE_START_AUTHORISATION;
return SpiResponse.<SpiStartAuthorisationResponse>builder()
.payload(new SpiStartAuthorisationResponse(scaApproach, scaStatus, SpiMockData.PSU_MESSAGE_START_AUTHORISATION, SpiMockData.TPP_MESSAGES_START_AUTHORISATION))
.payload(new SpiStartAuthorisationResponse(scaApproach, scaStatus, psuMessage, SpiMockData.TPP_MESSAGES_START_AUTHORISATION))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright 2018-2021 adorsys GmbH & Co KG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package de.adorsys.aspsp.xs2a.connector.spi.impl.authorisation;

import de.adorsys.aspsp.xs2a.connector.spi.impl.SpiMockData;
import de.adorsys.psd2.xs2a.core.profile.ScaApproach;
import de.adorsys.psd2.xs2a.core.sca.ScaStatus;
import de.adorsys.psd2.xs2a.core.tpp.TppInfo;
import de.adorsys.psd2.xs2a.spi.domain.SpiAspspConsentDataProvider;
import de.adorsys.psd2.xs2a.spi.domain.SpiContextData;
import de.adorsys.psd2.xs2a.spi.domain.authorisation.SpiStartAuthorisationResponse;
import de.adorsys.psd2.xs2a.spi.domain.psu.SpiPsuData;
import de.adorsys.psd2.xs2a.spi.domain.response.SpiResponse;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.UUID;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@ExtendWith(MockitoExtension.class)
class AbstractAuthorisationSpiTest {
private static final String PSU_ID = "anton.brueckner";
private static final String AUTHORISATION_ID = "authorisation Id";
private static final ScaApproach DECOUPLED_APPROACH = ScaApproach.DECOUPLED;
private static final ScaApproach NON_DECOUPLED_APPROACH = ScaApproach.EMBEDDED;
private static final ScaStatus SCA_STATUS = ScaStatus.PSUAUTHENTICATED;
private static final SpiPsuData PSU_ID_DATA_1 = SpiPsuData.builder()
.psuId(PSU_ID)
.psuIdType("2")
.psuCorporateId("3")
.psuCorporateIdType("4")
.psuIpAddress("5")
.psuIpPort("6")
.psuUserAgent("7")
.psuGeoLocation("8")
.psuAccept("9")
.psuAcceptCharset("10")
.psuAcceptEncoding("11")
.psuAcceptLanguage("12")
.psuHttpMethod("13")
.psuDeviceId(UUID.randomUUID())
.build();
private static final String ACCESS_TOKEN = "access_token";
private static final SpiContextData SPI_CONTEXT_DATA = new SpiContextData(PSU_ID_DATA_1, new TppInfo(), UUID.randomUUID(), UUID.randomUUID(), ACCESS_TOKEN, null, null, null, null);

private final AbstractAuthorisationSpi authorisationSpi = Mockito.mock(AbstractAuthorisationSpi.class, Mockito.CALLS_REAL_METHODS);

@Mock
private SpiAspspConsentDataProvider spiAspspConsentDataProvider;

@Test
void startAuthorisation_decoupledApproach() {
//Given
String expected = SpiMockData.DECOUPLED_PSU_MESSAGE;

//When
SpiResponse<SpiStartAuthorisationResponse> actual =
authorisationSpi.startAuthorisation(SPI_CONTEXT_DATA, DECOUPLED_APPROACH, SCA_STATUS, AUTHORISATION_ID, null, spiAspspConsentDataProvider);

//Then
assertNotNull(actual.getPayload());
assertEquals(expected, actual.getPayload().getPsuMessage());
}

@Test
void startAuthorisation_nonDecoupledApproach() {
//Given
String expected = SpiMockData.PSU_MESSAGE_START_AUTHORISATION;

//When
SpiResponse<SpiStartAuthorisationResponse> actual =
authorisationSpi.startAuthorisation(SPI_CONTEXT_DATA, NON_DECOUPLED_APPROACH, SCA_STATUS, AUTHORISATION_ID, null, spiAspspConsentDataProvider);

//Then
assertNotNull(actual.getPayload());
assertEquals(expected, actual.getPayload().getPsuMessage());
}
}

0 comments on commit 2bb69e1

Please sign in to comment.