file_name
stringlengths
6
86
file_path
stringlengths
45
249
content
stringlengths
47
6.26M
file_size
int64
47
6.26M
language
stringclasses
1 value
extension
stringclasses
1 value
repo_name
stringclasses
767 values
repo_stars
int64
8
14.4k
repo_forks
int64
0
1.17k
repo_open_issues
int64
0
788
repo_created_at
stringclasses
767 values
repo_pushed_at
stringclasses
767 values
SpardaServiceProviderTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/test/java/de/adorsys/xs2a/adapter/sparda/SpardaServiceProviderTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.AccountInformationService; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.PaymentInitiationService; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.model.Aspsp; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; class SpardaServiceProviderTest { private SpardaServiceProvider serviceProvider; private final HttpClientConfig httpClientConfig = mock(HttpClientConfig.class); private final HttpClientFactory httpClientFactory = mock(HttpClientFactory.class); private final Aspsp aspsp = getAspsp(); @BeforeEach void setUp() { serviceProvider = new SpardaServiceProvider(); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); } @Test void getAccountInformationService() { AccountInformationService actualService = serviceProvider.getAccountInformationService(aspsp, httpClientFactory, null); assertThat(actualService) .isExactlyInstanceOf(SpardaAccountInformationService.class); } @Test void getPaymentInitiationService() { PaymentInitiationService actualService = serviceProvider.getPaymentInitiationService(aspsp, httpClientFactory, null); assertThat(actualService) .isExactlyInstanceOf(SpardaPaymentInitiationService.class); } @Test void getOauth2Service() { Oauth2Service actualService = serviceProvider.getOauth2Service(aspsp, httpClientFactory); assertThat(actualService) .isExactlyInstanceOf(SpardaOauth2Service.class); } private Aspsp getAspsp() { Aspsp aspsp = new Aspsp(); aspsp.setIdpUrl("https:idp1.url https://idp2.url"); return aspsp; } }
2,927
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaPkceOauth2ServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/test/java/de/adorsys/xs2a/adapter/sparda/SpardaPkceOauth2ServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; class SpardaPkceOauth2ServiceTest { @Test void codeVerifierBounds() { String codeVerifier = new SpardaPkceOauth2Service(null).codeVerifier(); assertThat(codeVerifier).hasSizeBetween(44, 127); } }
1,191
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaPaymentInitiationServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/test/java/de/adorsys/xs2a/adapter/sparda/SpardaPaymentInitiationServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import com.google.common.collect.Maps; import de.adorsys.xs2a.adapter.api.*; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.http.Request; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.api.model.PaymentInitationRequestResponse201; import de.adorsys.xs2a.adapter.api.model.PaymentInitiationJson; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.HashMap; import java.util.Map; import static de.adorsys.xs2a.adapter.api.model.PaymentProduct.SEPA_CREDIT_TRANSFERS; import static de.adorsys.xs2a.adapter.api.model.PaymentService.PAYMENTS; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class SpardaPaymentInitiationServiceTest { private static final String PSU_ID = "psuId"; private PaymentInitiationService paymentInitiationService; @Mock private HttpClientFactory httpClientFactory; @Mock private HttpClientConfig httpClientConfig; @Mock private HttpClient httpClient; @Mock private LinksRewriter linksRewriter; @Mock private SpardaJwtService spardaJwtService; @Captor private ArgumentCaptor<Map<String, String>> headersCaptor; private final Aspsp aspsp = getAspsp(); @BeforeEach void setUp() { when(httpClientFactory.getHttpClient(any())).thenReturn(httpClient); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); paymentInitiationService = new SpardaPaymentInitiationService(aspsp, httpClientFactory, linksRewriter, spardaJwtService); } @Test void initiatePayment() { Request.Builder requestBuilder = mock(Request.Builder.class); when(httpClient.post(any())).thenReturn(requestBuilder); when(requestBuilder.headers(anyMap())).thenReturn(requestBuilder); when(requestBuilder.send(any(), anyList())) .thenReturn(new Response<>(-1, new PaymentInitationRequestResponse201(), ResponseHeaders.emptyResponseHeaders())); when(spardaJwtService.getPsuId(any())).thenReturn(PSU_ID); paymentInitiationService.initiatePayment(PAYMENTS, SEPA_CREDIT_TRANSFERS, getAuthRequestHeaders(), RequestParams.empty(), new PaymentInitiationJson()); verify(requestBuilder, times(1)).headers(headersCaptor.capture()); Map<String, String> actualHeaders = headersCaptor.getValue(); assertThat(actualHeaders) .hasSize(2) .contains(Maps.immutableEntry(RequestHeaders.PSU_ID, PSU_ID)); } private RequestHeaders getAuthRequestHeaders() { Map<String, String> headers = new HashMap<>(); headers.put(RequestHeaders.AUTHORIZATION, "Bearer token"); return RequestHeaders.fromMap(headers); } private Aspsp getAspsp() { Aspsp aspsp = new Aspsp(); aspsp.setIdpUrl("https://foo.boo"); return aspsp; } }
4,310
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaOauth2ServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/test/java/de/adorsys/xs2a/adapter/sparda/SpardaOauth2ServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.Oauth2Service.Parameters; import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.api.model.Scope; import de.adorsys.xs2a.adapter.api.validation.ValidationError; import de.adorsys.xs2a.adapter.impl.http.ApacheHttpClient; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import java.io.IOException; import java.net.URI; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; import java.util.List; import static de.adorsys.xs2a.adapter.api.Oauth2Service.GrantType.AUTHORIZATION_CODE; import static de.adorsys.xs2a.adapter.api.Oauth2Service.GrantType.REFRESH_TOKEN; import static de.adorsys.xs2a.adapter.sparda.SpardaOauth2Service.UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; class SpardaOauth2ServiceTest { public static final String BIC = "GENODEF1S08"; public static final String AUTH_HOST = "https://idp.sparda-n.de"; public static final String TOKEN_HOST = "https://idp.sparda.de"; public static final String TOKEN_ENDPOINT = TOKEN_HOST + "/oauth2/token"; public static final String CLIENT_ID = "client-id"; public static final String REDIRECT_URI = "https://tpp.com/cb"; public static final String SCOPE = Scope.AIS.getValue(); public static final String UNSUPPORTED_SCOPE = "unsupportedScope"; private SpardaOauth2Service oauth2Service; private HttpClient httpClient; private Aspsp aspsp; private final HttpClientFactory httpClientFactory = mock(HttpClientFactory.class); private final HttpClientConfig httpClientConfig = mock(HttpClientConfig.class); @BeforeEach void setUp() { aspsp = new Aspsp(); aspsp.setBic(BIC); aspsp.setIdpUrl(AUTH_HOST + " " + TOKEN_HOST); httpClient = spy(new ApacheHttpClient(null, null)); Mockito.lenient() .doReturn(new Response<>(200, null, ResponseHeaders.emptyResponseHeaders())) .when(httpClient).send(any(), any()); when(httpClientFactory.getHttpClient(any())).thenReturn(httpClient); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); oauth2Service = SpardaOauth2Service.create(aspsp, httpClientFactory, CLIENT_ID); } @Test void getAuthorizationRequestUri() throws IOException { Parameters parameters = new Parameters(); parameters.setRedirectUri(REDIRECT_URI); parameters.setScope(SCOPE); URI uri = oauth2Service.getAuthorizationRequestUri(Collections.emptyMap(), parameters); assertEquals(AUTH_HOST + "/oauth2/authorize" + "?response_type=code" + "&redirect_uri=" + URLEncoder.encode(REDIRECT_URI, StandardCharsets.UTF_8.name()) + "&scope=" + SCOPE + "&client_id=" + CLIENT_ID + "&code_challenge_method=S256" + "&code_challenge=" + oauth2Service.codeChallenge() + "&bic=" + BIC, uri.toString()); Mockito.verifyNoInteractions(httpClient); } @Test void getAuthorizationRequestUriWithAisScopeMapping() throws IOException { Parameters parameters = new Parameters(); parameters.setRedirectUri(REDIRECT_URI); parameters.setScope(Scope.AIS_TRANSACTIONS.getValue()); URI uri = oauth2Service.getAuthorizationRequestUri(Collections.emptyMap(), parameters); assertEquals(AUTH_HOST + "/oauth2/authorize" + "?response_type=code" + "&redirect_uri=" + URLEncoder.encode(REDIRECT_URI, StandardCharsets.UTF_8.name()) + "&scope=" + SCOPE + "&client_id=" + CLIENT_ID + "&code_challenge_method=S256" + "&code_challenge=" + oauth2Service.codeChallenge() + "&bic=" + BIC, uri.toString()); Mockito.verifyNoInteractions(httpClient); } @Test void validateGetAuthorizationRequestUri() { List<ValidationError> validationErrors = oauth2Service.validateGetAuthorizationRequestUri(null, new Parameters()); assertThat(validationErrors) .extracting(ValidationError::getPath) .contains(Parameters.REDIRECT_URI, Parameters.SCOPE); } @Test void validateGetAuthorizationRequestUriWithUnsupportedScope() { Parameters parameters = new Parameters(); parameters.setRedirectUri(REDIRECT_URI); parameters.setScope(UNSUPPORTED_SCOPE); List<ValidationError> validationErrors = oauth2Service.validateGetAuthorizationRequestUri(null, parameters); assertThat(validationErrors).hasSize(1); ValidationError validationError = validationErrors.get(0); assertThat(validationError).isNotNull(); assertThat(validationError.getCode()).isEqualTo(ValidationError.Code.NOT_SUPPORTED); assertThat(validationError.getPath()).isEqualTo(Parameters.SCOPE); assertThat(validationError.getMessage()) .isEqualTo(String.format(UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE, UNSUPPORTED_SCOPE)); } @Test void getToken_authorizationCode() throws IOException { String code = "test-code"; Parameters parameters = new Parameters(); parameters.setRedirectUri(REDIRECT_URI); parameters.setGrantType(AUTHORIZATION_CODE.toString()); parameters.setAuthorizationCode(code); oauth2Service.getToken(Collections.emptyMap(), parameters); HashMap<String, String> expectedBody = new HashMap<>(); expectedBody.put(Parameters.GRANT_TYPE, AUTHORIZATION_CODE.toString()); expectedBody.put(Parameters.CLIENT_ID, CLIENT_ID); expectedBody.put(Parameters.REDIRECT_URI, REDIRECT_URI); expectedBody.put(Parameters.CODE, code); expectedBody.put(Parameters.CODE_VERIFIER, oauth2Service.codeVerifier()); Mockito.verify(httpClient, Mockito.times(1)) .send(ArgumentMatchers.argThat(req -> { boolean tokenExchange = req.method().equalsIgnoreCase("POST") && req.uri().equals(TOKEN_ENDPOINT); if (tokenExchange) { assertEquals(expectedBody, req.urlEncodedBody()); } return tokenExchange; }), any()); } @Test void getToken_refreshToken() throws IOException { String refreshToken = "refresh-token"; Parameters parameters = new Parameters(); parameters.setGrantType(REFRESH_TOKEN.toString()); parameters.setRefreshToken(refreshToken); oauth2Service.getToken(Collections.emptyMap(), parameters); HashMap<String, String> expectedBody = new HashMap<>(); expectedBody.put(Parameters.GRANT_TYPE, REFRESH_TOKEN.toString()); expectedBody.put(Parameters.CLIENT_ID, CLIENT_ID); expectedBody.put(Parameters.REFRESH_TOKEN, refreshToken); Mockito.verify(httpClient, Mockito.times(1)) .send(ArgumentMatchers.argThat(req -> { boolean tokenExchange = req.method().equalsIgnoreCase("POST") && req.uri().equals(TOKEN_ENDPOINT); if (tokenExchange) { assertEquals(expectedBody, req.urlEncodedBody()); } return tokenExchange; }), any()); } @Test void validateGetToken() { List<ValidationError> validationErrors = oauth2Service.validateGetToken(null, new Parameters()); assertThat(validationErrors).isEmpty(); } @Test void redirectUriIsRequiredForAuthorizationCodeExchange() { Parameters parameters = new Parameters(); parameters.setAuthorizationCode("asdf"); List<ValidationError> validationErrors = oauth2Service.validateGetToken(null, parameters); assertThat(validationErrors) .extracting(ValidationError::getPath) .containsExactly(Parameters.REDIRECT_URI); } @Test void clientIdFromCertificateIsUsedWhenNullIsPassedIn() throws Exception { Pkcs12KeyStore keyStore = Mockito.mock(Pkcs12KeyStore.class); when(httpClientConfig.getKeyStore()).thenReturn(keyStore); oauth2Service = SpardaOauth2Service.create(aspsp, httpClientFactory, null); Parameters parameters = new Parameters(); parameters.setRedirectUri(REDIRECT_URI); parameters.setScope(SCOPE); oauth2Service.getAuthorizationRequestUri(null, parameters); Mockito.verify(keyStore, Mockito.times(1)).getOrganizationIdentifier(); } }
10,056
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaServiceProvider.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/SpardaServiceProvider.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.*; import de.adorsys.xs2a.adapter.api.config.AdapterConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.impl.AbstractAdapterServiceProvider; public class SpardaServiceProvider extends AbstractAdapterServiceProvider implements Oauth2ServiceProvider { private static final SpardaJwtService JWT_SERVICE = new SpardaJwtService(); @Override public AccountInformationService getAccountInformationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { return new SpardaAccountInformationService(aspsp, httpClientFactory, linksRewriter, JWT_SERVICE); } @Override public PaymentInitiationService getPaymentInitiationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { return new SpardaPaymentInitiationService(aspsp, httpClientFactory, linksRewriter, JWT_SERVICE); } @Override public Oauth2Service getOauth2Service(Aspsp aspsp, HttpClientFactory httpClientFactory) { return SpardaOauth2Service.create(aspsp, httpClientFactory, AdapterConfig.readProperty("sparda.client_id")); } @Override public String getAdapterId() { return "sparda-bank-adapter"; } }
2,657
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaPaymentInitiationService.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/SpardaPaymentInitiationService.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.api.model.PaymentInitationRequestResponse201; import de.adorsys.xs2a.adapter.api.model.PaymentProduct; import de.adorsys.xs2a.adapter.api.model.PaymentService; import de.adorsys.xs2a.adapter.impl.BasePaymentInitiationService; import de.adorsys.xs2a.adapter.impl.http.ResponseHandlers; import de.adorsys.xs2a.adapter.impl.http.StringUri; import java.util.Map; import static java.util.function.Function.identity; public class SpardaPaymentInitiationService extends BasePaymentInitiationService { private static final String PIS_SCOPE = "pis"; private static final String BEARER_TOKEN_TYPE_PREFIX = "Bearer "; private final SpardaJwtService spardaJwtService; private final ResponseHandlers responseHandlers; public SpardaPaymentInitiationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter, SpardaJwtService spardaJwtService) { super(aspsp, httpClientFactory.getHttpClient(aspsp.getAdapterId()), linksRewriter, httpClientFactory.getHttpClientConfig().getLogSanitizer()); this.spardaJwtService = spardaJwtService; this.responseHandlers = new ResponseHandlers(httpClientFactory.getHttpClientConfig().getLogSanitizer()); } @Override public Response<PaymentInitationRequestResponse201> initiatePayment(PaymentService paymentService, PaymentProduct paymentProduct, RequestHeaders requestHeaders, RequestParams requestParams, Object body) { if (isOauthPreStep(requestHeaders)) { requestHeaders = modifyPsuId(requestHeaders); } String idpUri = StringUri.appendQueryParam(getIdpUri(), Oauth2Service.Parameters.SCOPE, PIS_SCOPE); return initiatePayment(paymentService, paymentProduct, body, requestHeaders, requestParams, identity(), responseHandlers.paymentInitiationResponseHandler(idpUri, PaymentInitationRequestResponse201.class)); } private boolean isOauthPreStep(RequestHeaders requestHeaders) { return requestHeaders.get(RequestHeaders.AUTHORIZATION) .map(authHeader -> authHeader.startsWith(BEARER_TOKEN_TYPE_PREFIX)) .orElse(false); } private RequestHeaders modifyPsuId(RequestHeaders requestHeaders) { // .orElse(null) should never be the case, as this method is invoked for OAuth pre-step only String token = requestHeaders.getAuthorization() .map(this::getBearerToken) .orElse(null); Map<String, String> headersMap = requestHeaders.toMap(); headersMap.put(RequestHeaders.PSU_ID.toLowerCase(), spardaJwtService.getPsuId(token)); return RequestHeaders.fromMap(headersMap); } private String getBearerToken(String authorizationHeader) { return authorizationHeader.substring(BEARER_TOKEN_TYPE_PREFIX.length()); } }
4,612
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaMapper.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/SpardaMapper.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.model.OK200TransactionDetails; import de.adorsys.xs2a.adapter.api.model.RemittanceInformationStructured; import de.adorsys.xs2a.adapter.api.model.Transactions; import de.adorsys.xs2a.adapter.api.model.TransactionsResponse200Json; import de.adorsys.xs2a.adapter.sparda.model.SpardaOK200TransactionDetails; import de.adorsys.xs2a.adapter.sparda.model.SpardaTransactionDetails; import de.adorsys.xs2a.adapter.sparda.model.SpardaTransactionResponse200Json; import org.mapstruct.Mapper; @Mapper public interface SpardaMapper { TransactionsResponse200Json toTransactionsResponse200Json(SpardaTransactionResponse200Json value); OK200TransactionDetails toOK200TransactionDetails(SpardaOK200TransactionDetails value); Transactions toTransactions(SpardaTransactionDetails value); default String map(RemittanceInformationStructured value) { return value == null ? null : value.getReference(); } }
1,822
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaPkceOauth2Service.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/SpardaPkceOauth2Service.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.PkceOauth2Extension; import de.adorsys.xs2a.adapter.impl.PkceOauth2Service; class SpardaPkceOauth2Service extends PkceOauth2Service { static final byte[] OCTET_SEQUENCE = PkceOauth2Extension.random(33); SpardaPkceOauth2Service(Oauth2Service oauth2Service) { super(oauth2Service); } @Override public byte[] octetSequence() { return OCTET_SEQUENCE; } }
1,351
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaOauth2Service.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/SpardaOauth2Service.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.PkceOauth2Extension; import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.http.HttpLogSanitizer; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.api.model.Scope; import de.adorsys.xs2a.adapter.api.model.TokenResponse; import de.adorsys.xs2a.adapter.api.validation.ValidationError; import de.adorsys.xs2a.adapter.impl.BaseOauth2Service; import de.adorsys.xs2a.adapter.impl.CertificateSubjectClientIdOauth2Service; import de.adorsys.xs2a.adapter.impl.PkceOauth2Service; import de.adorsys.xs2a.adapter.impl.http.StringUri; import de.adorsys.xs2a.adapter.impl.http.UriBuilder; import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.net.URI; import java.util.*; import static de.adorsys.xs2a.adapter.api.validation.Validation.requireValid; public class SpardaOauth2Service implements Oauth2Service, PkceOauth2Extension { private static final EnumMap<Scope, Scope> SCOPE_MAPPING = initiateScopeMapping(); protected static final String UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE = "Scope value [%s] is not supported"; private final Aspsp aspsp; private final Oauth2Service oauth2Service; private final String clientId; private final String authorizationEndpoint; private final String tokenEndpoint; private SpardaOauth2Service(Aspsp aspsp, Oauth2Service oauth2Service, String clientId) { this.aspsp = aspsp; this.oauth2Service = oauth2Service; this.clientId = clientId; String[] idpHosts = Objects.requireNonNull(aspsp.getIdpUrl()).trim().split("\\s+"); if (idpHosts.length != 2) { throw new IllegalArgumentException("IDP must consist of two hosts separated by a whitespace"); } authorizationEndpoint = StringUri.fromElements(idpHosts[0], "/oauth2/authorize"); tokenEndpoint = StringUri.fromElements(idpHosts[1], "/oauth2/token"); } public static SpardaOauth2Service create(Aspsp aspsp, HttpClientFactory httpClientFactory, String clientId) { HttpClient httpClient = httpClientFactory.getHttpClient(aspsp.getAdapterId()); HttpLogSanitizer logSanitizer = httpClientFactory.getHttpClientConfig().getLogSanitizer(); Pkcs12KeyStore keyStore = httpClientFactory.getHttpClientConfig().getKeyStore(); BaseOauth2Service baseOauth2Service = new BaseOauth2Service(aspsp, httpClient, logSanitizer); CertificateSubjectClientIdOauth2Service clientIdOauth2Service = new CertificateSubjectClientIdOauth2Service(baseOauth2Service, keyStore); PkceOauth2Service pkceOauth2Service = new SpardaPkceOauth2Service(clientIdOauth2Service); return new SpardaOauth2Service(aspsp, pkceOauth2Service, clientId); } private static EnumMap<Scope, Scope> initiateScopeMapping() { EnumMap<Scope, Scope> scopeMapping = new EnumMap<>(Scope.class); scopeMapping.put(Scope.AIS, Scope.AIS); scopeMapping.put(Scope.AIS_BALANCES, Scope.AIS); scopeMapping.put(Scope.AIS_TRANSACTIONS, Scope.AIS); scopeMapping.put(Scope.PIS, Scope.PIS); return scopeMapping; } @Override public URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) throws IOException { requireValid(validateGetAuthorizationRequestUri(headers, parameters)); parameters.setAuthorizationEndpoint(authorizationEndpoint); parameters.setClientId(clientId); parameters.setScope(mapScope(parameters.getScope())); return UriBuilder.fromUri(oauth2Service.getAuthorizationRequestUri(headers, parameters)) .queryParam(Parameters.BIC, aspsp.getBic()) .build(); } private String mapScope(String scope) { return SCOPE_MAPPING.get(Scope.fromValue(scope)).getValue(); } @Override public List<ValidationError> validateGetAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) { List<ValidationError> validationErrors = new ArrayList<>(); if (StringUtils.isBlank(parameters.getRedirectUri())) { validationErrors.add(ValidationError.required(Parameters.REDIRECT_URI)); } String scope = parameters.getScope(); if (StringUtils.isBlank(scope)) { validationErrors.add(ValidationError.required(Parameters.SCOPE)); } else if (!Scope.contains(scope)) { validationErrors.add(new ValidationError(ValidationError.Code.NOT_SUPPORTED, Parameters.SCOPE, String.format(UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE, scope))); } return validationErrors; } @Override public TokenResponse getToken(Map<String, String> headers, Parameters parameters) throws IOException { requireValid(validateGetToken(headers, parameters)); parameters.setClientId(clientId); parameters.setTokenEndpoint(tokenEndpoint); return oauth2Service.getToken(headers, parameters); } @Override public List<ValidationError> validateGetToken(Map<String, String> headers, Parameters parameters) { if (parameters.getAuthorizationCode() != null && StringUtils.isBlank(parameters.getRedirectUri())) { return Collections.singletonList(ValidationError.required(Parameters.REDIRECT_URI)); } return Collections.emptyList(); } @Override public byte[] octetSequence() { return SpardaPkceOauth2Service.OCTET_SEQUENCE; } }
6,724
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaJwtService.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/SpardaJwtService.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; import de.adorsys.xs2a.adapter.api.exception.Xs2aAdapterException; import java.text.ParseException; public class SpardaJwtService { public String getPsuId(String jwtToken) { try { SignedJWT signedJWT = SignedJWT.parse(jwtToken); JWTClaimsSet claimsSet = signedJWT.getJWTClaimsSet(); return claimsSet.getSubject(); } catch (ParseException e) { throw new Xs2aAdapterException("Sparda JWT parsing exception", e); } } }
1,443
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaAccountInformationService.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/SpardaAccountInformationService.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.impl.BaseAccountInformationService; import de.adorsys.xs2a.adapter.impl.http.ResponseHandlers; import de.adorsys.xs2a.adapter.impl.http.StringUri; import de.adorsys.xs2a.adapter.sparda.model.SpardaOK200TransactionDetails; import de.adorsys.xs2a.adapter.sparda.model.SpardaTransactionResponse200Json; import org.mapstruct.factory.Mappers; import java.util.Map; import static java.util.function.Function.identity; public class SpardaAccountInformationService extends BaseAccountInformationService { private static final String AIS_SCOPE = "ais"; private static final String BEARER_TOKEN_TYPE_PREFIX = "Bearer "; private final SpardaJwtService spardaJwtService; private final SpardaMapper spardaMapper = Mappers.getMapper(SpardaMapper.class); private final ResponseHandlers responseHandlers; public SpardaAccountInformationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter, SpardaJwtService spardaJwtService) { super(aspsp, httpClientFactory.getHttpClient(aspsp.getAdapterId()), linksRewriter, httpClientFactory.getHttpClientConfig().getLogSanitizer()); this.spardaJwtService = spardaJwtService; this.responseHandlers = new ResponseHandlers(httpClientFactory.getHttpClientConfig().getLogSanitizer()); } @Override public Response<ConsentsResponse201> createConsent(RequestHeaders requestHeaders, RequestParams requestParams, Consents body) { if (isOauthPreStep(requestHeaders)) { requestHeaders = modifyPsuId(requestHeaders); } String idpUri = StringUri.appendQueryParam(getIdpUri(), Oauth2Service.Parameters.SCOPE, AIS_SCOPE); return createConsent(requestHeaders, requestParams, body, identity(), responseHandlers.consentCreationResponseHandler(idpUri, ConsentsResponse201.class)); } @Override public Response<TransactionsResponse200Json> getTransactionList(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { return super.getTransactionList(accountId, requestHeaders, requestParams, SpardaTransactionResponse200Json.class, spardaMapper::toTransactionsResponse200Json); } @Override public Response<OK200TransactionDetails> getTransactionDetails(String accountId, String transactionId, RequestHeaders requestHeaders, RequestParams requestParams) { return super.getTransactionDetails(accountId, transactionId, requestHeaders, requestParams, SpardaOK200TransactionDetails.class, spardaMapper::toOK200TransactionDetails); } private boolean isOauthPreStep(RequestHeaders requestHeaders) { return requestHeaders.get(RequestHeaders.AUTHORIZATION) .map(authHeader -> authHeader.startsWith(BEARER_TOKEN_TYPE_PREFIX)) .orElse(false); } private RequestHeaders modifyPsuId(RequestHeaders requestHeaders) { // .orElse(null) should never be the case, as this method is invoked for OAuth pre-step only String token = requestHeaders.getAuthorization() .map(this::getBearerToken) .orElse(null); Map<String, String> headersMap = requestHeaders.toMap(); headersMap.put(RequestHeaders.PSU_ID.toLowerCase(), spardaJwtService.getPsuId(token)); return RequestHeaders.fromMap(headersMap); } private String getBearerToken(String authorizationHeader) { return authorizationHeader.substring(BEARER_TOKEN_TYPE_PREFIX.length()); } }
5,790
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaOK200TransactionDetails.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/model/SpardaOK200TransactionDetails.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda.model; import java.util.Objects; public class SpardaOK200TransactionDetails { private SpardaTransactionDetails transactionsDetails; public SpardaTransactionDetails getTransactionsDetails() { return transactionsDetails; } public void setTransactionsDetails(SpardaTransactionDetails transactionsDetails) { this.transactionsDetails = transactionsDetails; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SpardaOK200TransactionDetails that = (SpardaOK200TransactionDetails) o; return Objects.equals(transactionsDetails, that.transactionsDetails); } @Override public int hashCode() { return Objects.hash(transactionsDetails); } }
1,684
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaTransactionDetails.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/model/SpardaTransactionDetails.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.*; import java.time.LocalDate; import java.util.List; import java.util.Map; import java.util.Objects; public class SpardaTransactionDetails { private String transactionId; private String entryReference; private String endToEndId; private String mandateId; private String checkId; private String creditorId; private LocalDate bookingDate; private LocalDate valueDate; private Amount transactionAmount; private List<ReportExchangeRate> currencyExchange; private String creditorName; private AccountReference creditorAccount; private String creditorAgent; private String ultimateCreditor; private String debtorName; private AccountReference debtorAccount; private String debtorAgent; private String ultimateDebtor; private String remittanceInformationUnstructured; private List<String> remittanceInformationUnstructuredArray; private RemittanceInformationStructured remittanceInformationStructured; private List<RemittanceInformationStructured> remittanceInformationStructuredArray; private String additionalInformation; private AdditionalInformationStructured additionalInformationStructured; private PurposeCode purposeCode; private String bankTransactionCode; private String proprietaryBankTransactionCode; private Balance balanceAfterTransaction; @JsonProperty("_links") private Map<String, HrefType> links; public String getTransactionId() { return transactionId; } public void setTransactionId(String transactionId) { this.transactionId = transactionId; } public String getEntryReference() { return entryReference; } public void setEntryReference(String entryReference) { this.entryReference = entryReference; } public String getEndToEndId() { return endToEndId; } public void setEndToEndId(String endToEndId) { this.endToEndId = endToEndId; } public String getMandateId() { return mandateId; } public void setMandateId(String mandateId) { this.mandateId = mandateId; } public String getCheckId() { return checkId; } public void setCheckId(String checkId) { this.checkId = checkId; } public String getCreditorId() { return creditorId; } public void setCreditorId(String creditorId) { this.creditorId = creditorId; } public LocalDate getBookingDate() { return bookingDate; } public void setBookingDate(LocalDate bookingDate) { this.bookingDate = bookingDate; } public LocalDate getValueDate() { return valueDate; } public void setValueDate(LocalDate valueDate) { this.valueDate = valueDate; } public Amount getTransactionAmount() { return transactionAmount; } public void setTransactionAmount(Amount transactionAmount) { this.transactionAmount = transactionAmount; } public List<ReportExchangeRate> getCurrencyExchange() { return currencyExchange; } public void setCurrencyExchange(List<ReportExchangeRate> currencyExchange) { this.currencyExchange = currencyExchange; } public String getCreditorName() { return creditorName; } public void setCreditorName(String creditorName) { this.creditorName = creditorName; } public AccountReference getCreditorAccount() { return creditorAccount; } public void setCreditorAccount(AccountReference creditorAccount) { this.creditorAccount = creditorAccount; } public String getCreditorAgent() { return creditorAgent; } public void setCreditorAgent(String creditorAgent) { this.creditorAgent = creditorAgent; } public String getUltimateCreditor() { return ultimateCreditor; } public void setUltimateCreditor(String ultimateCreditor) { this.ultimateCreditor = ultimateCreditor; } public String getDebtorName() { return debtorName; } public void setDebtorName(String debtorName) { this.debtorName = debtorName; } public AccountReference getDebtorAccount() { return debtorAccount; } public void setDebtorAccount(AccountReference debtorAccount) { this.debtorAccount = debtorAccount; } public String getDebtorAgent() { return debtorAgent; } public void setDebtorAgent(String debtorAgent) { this.debtorAgent = debtorAgent; } public String getUltimateDebtor() { return ultimateDebtor; } public void setUltimateDebtor(String ultimateDebtor) { this.ultimateDebtor = ultimateDebtor; } public String getRemittanceInformationUnstructured() { return remittanceInformationUnstructured; } public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) { this.remittanceInformationUnstructured = remittanceInformationUnstructured; } public List<String> getRemittanceInformationUnstructuredArray() { return remittanceInformationUnstructuredArray; } public void setRemittanceInformationUnstructuredArray( List<String> remittanceInformationUnstructuredArray) { this.remittanceInformationUnstructuredArray = remittanceInformationUnstructuredArray; } public RemittanceInformationStructured getRemittanceInformationStructured() { return remittanceInformationStructured; } public void setRemittanceInformationStructured(RemittanceInformationStructured remittanceInformationStructured) { this.remittanceInformationStructured = remittanceInformationStructured; } public List<RemittanceInformationStructured> getRemittanceInformationStructuredArray() { return remittanceInformationStructuredArray; } public void setRemittanceInformationStructuredArray( List<RemittanceInformationStructured> remittanceInformationStructuredArray) { this.remittanceInformationStructuredArray = remittanceInformationStructuredArray; } public String getAdditionalInformation() { return additionalInformation; } public void setAdditionalInformation(String additionalInformation) { this.additionalInformation = additionalInformation; } public AdditionalInformationStructured getAdditionalInformationStructured() { return additionalInformationStructured; } public void setAdditionalInformationStructured( AdditionalInformationStructured additionalInformationStructured) { this.additionalInformationStructured = additionalInformationStructured; } public PurposeCode getPurposeCode() { return purposeCode; } public void setPurposeCode(PurposeCode purposeCode) { this.purposeCode = purposeCode; } public String getBankTransactionCode() { return bankTransactionCode; } public void setBankTransactionCode(String bankTransactionCode) { this.bankTransactionCode = bankTransactionCode; } public String getProprietaryBankTransactionCode() { return proprietaryBankTransactionCode; } public void setProprietaryBankTransactionCode(String proprietaryBankTransactionCode) { this.proprietaryBankTransactionCode = proprietaryBankTransactionCode; } public Balance getBalanceAfterTransaction() { return balanceAfterTransaction; } public void setBalanceAfterTransaction(Balance balanceAfterTransaction) { this.balanceAfterTransaction = balanceAfterTransaction; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SpardaTransactionDetails that = (SpardaTransactionDetails) o; return Objects.equals(transactionId, that.transactionId) && Objects.equals(entryReference, that.entryReference) && Objects.equals(endToEndId, that.endToEndId) && Objects.equals(mandateId, that.mandateId) && Objects.equals(checkId, that.checkId) && Objects.equals(creditorId, that.creditorId) && Objects.equals(bookingDate, that.bookingDate) && Objects.equals(valueDate, that.valueDate) && Objects.equals(transactionAmount, that.transactionAmount) && Objects.equals(currencyExchange, that.currencyExchange) && Objects.equals(creditorName, that.creditorName) && Objects.equals(creditorAccount, that.creditorAccount) && Objects.equals(creditorAgent, that.creditorAgent) && Objects.equals(ultimateCreditor, that.ultimateCreditor) && Objects.equals(debtorName, that.debtorName) && Objects.equals(debtorAccount, that.debtorAccount) && Objects.equals(debtorAgent, that.debtorAgent) && Objects.equals(ultimateDebtor, that.ultimateDebtor) && Objects.equals(remittanceInformationUnstructured, that.remittanceInformationUnstructured) && Objects.equals(remittanceInformationUnstructuredArray, that.remittanceInformationUnstructuredArray) && Objects.equals(remittanceInformationStructured, that.remittanceInformationStructured) && Objects.equals(remittanceInformationStructuredArray, that.remittanceInformationStructuredArray) && Objects.equals(additionalInformation, that.additionalInformation) && Objects.equals(additionalInformationStructured, that.additionalInformationStructured) && Objects.equals(purposeCode, that.purposeCode) && Objects.equals(bankTransactionCode, that.bankTransactionCode) && Objects.equals(proprietaryBankTransactionCode, that.proprietaryBankTransactionCode) && Objects.equals(balanceAfterTransaction, that.balanceAfterTransaction) && Objects.equals(links, that.links); } @Override public int hashCode() { return Objects.hash(transactionId, entryReference, endToEndId, mandateId, checkId, creditorId, bookingDate, valueDate, transactionAmount, currencyExchange, creditorName, creditorAccount, creditorAgent, ultimateCreditor, debtorName, debtorAccount, debtorAgent, ultimateDebtor, remittanceInformationUnstructured, remittanceInformationUnstructuredArray, remittanceInformationStructured, remittanceInformationStructuredArray, additionalInformation, additionalInformationStructured, purposeCode, bankTransactionCode, proprietaryBankTransactionCode, balanceAfterTransaction, links); } }
12,128
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaAccountReport.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/model/SpardaAccountReport.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.HrefType; import java.util.List; import java.util.Map; import java.util.Objects; public class SpardaAccountReport { private List<SpardaTransactionDetails> booked; private List<SpardaTransactionDetails> pending; @JsonProperty("_links") private Map<String, HrefType> links; public List<SpardaTransactionDetails> getBooked() { return booked; } public void setBooked(List<SpardaTransactionDetails> booked) { this.booked = booked; } public List<SpardaTransactionDetails> getPending() { return pending; } public void setPending(List<SpardaTransactionDetails> pending) { this.pending = pending; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SpardaAccountReport that = (SpardaAccountReport) o; return Objects.equals(booked, that.booked) && Objects.equals(pending, that.pending) && Objects.equals(links, that.links); } @Override public int hashCode() { return Objects.hash(booked, pending, links); } }
2,318
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SpardaTransactionResponse200Json.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparda-bank-adapter/src/main/java/de/adorsys/xs2a/adapter/sparda/model/SpardaTransactionResponse200Json.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparda.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.AccountReference; import de.adorsys.xs2a.adapter.api.model.Balance; import de.adorsys.xs2a.adapter.api.model.HrefType; import java.util.List; import java.util.Map; import java.util.Objects; public class SpardaTransactionResponse200Json { private AccountReference account; private SpardaAccountReport transactions; private List<Balance> balances; @JsonProperty("_links") private Map<String, HrefType> links; public AccountReference getAccount() { return account; } public void setAccount(AccountReference account) { this.account = account; } public SpardaAccountReport getTransactions() { return transactions; } public void setTransactions(SpardaAccountReport transactions) { this.transactions = transactions; } public List<Balance> getBalances() { return balances; } public void setBalances(List<Balance> balances) { this.balances = balances; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SpardaTransactionResponse200Json that = (SpardaTransactionResponse200Json) o; return Objects.equals(account, that.account) && Objects.equals(transactions, that.transactions) && Objects.equals(balances, that.balances) && Objects.equals(links, that.links); } @Override public int hashCode() { return Objects.hash(account, transactions, balances, links); } }
2,733
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkassePaymentInitiationServiceWireMockTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/test/java/de/adorsys/xs2a/adapter/sparkasse/SparkassePaymentInitiationServiceWireMockTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.PaymentInitiationService; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.test.ServiceWireMockTest; import de.adorsys.xs2a.adapter.test.TestRequestResponse; import org.apache.commons.lang3.tuple.Pair; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.HashMap; import java.util.Map; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.params.provider.Arguments.arguments; @ServiceWireMockTest(SparkasseServiceProvider.class) class SparkassePaymentInitiationServiceWireMockTest { protected static final String SCT_PAYMENT_ID = "5f6e3778-2b5c-460c-90f9-c86b0f5c5d57"; protected static final String SCT_AUTHORISATION_ID = "c9ef5300-0091-47c6-9df9-2190313e8f03"; protected static final String PAIN_SCT_PAYMENT_ID = "850987d5-eb54-4053-84c1-945485147e3b"; protected static final String PAIN_SCT_AUTHORISATION_ID = "cafd117d-2969-48be-b003-acd835bb02e6"; private final PaymentInitiationService service; private final Map<PaymentProduct, Pair<String, String>> ids; SparkassePaymentInitiationServiceWireMockTest(PaymentInitiationService service) { this.service = service; this.ids = initiateMap(); } private Map<PaymentProduct, Pair<String, String>> initiateMap() { Map<PaymentProduct, Pair<String, String>> map = new HashMap<>(); map.put(PaymentProduct.SEPA_CREDIT_TRANSFERS, Pair.of(SCT_PAYMENT_ID, SCT_AUTHORISATION_ID)); map.put(PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS, Pair.of(PAIN_SCT_PAYMENT_ID, PAIN_SCT_AUTHORISATION_ID)); return map; } @ParameterizedTest @MethodSource("paymentTypes") void initiatePayment(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/initiate-payment.json"); Response<PaymentInitationRequestResponse201> response = service.initiatePayment(paymentService, paymentProduct, requestResponse.requestHeaders(), RequestParams.empty(), isJson(paymentProduct) ? requestResponse.requestBody(PaymentInitiationJson.class) : requestResponse.requestBody()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(PaymentInitationRequestResponse201.class)); } private boolean isJson(PaymentProduct paymentProduct) { return paymentProduct == PaymentProduct.SEPA_CREDIT_TRANSFERS; } @ParameterizedTest @MethodSource("paymentTypes") void authenticatePsu(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/authenticate-psu.json"); Response<StartScaprocessResponse> response = service.startPaymentAuthorisation(paymentService, paymentProduct, ids.get(paymentProduct).getLeft(), requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(UpdatePsuAuthentication.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(StartScaprocessResponse.class)); } @ParameterizedTest @MethodSource("paymentTypes") void selectScaMethod(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/select-sca-method.json"); SelectPsuAuthenticationMethodResponse expected = requestResponse.responseBody(SelectPsuAuthenticationMethodResponse.class); Response<SelectPsuAuthenticationMethodResponse> response = service.updatePaymentPsuData(paymentService, paymentProduct, ids.get(paymentProduct).getLeft(), ids.get(paymentProduct).getRight(), requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(SelectPsuAuthenticationMethod.class)); SelectPsuAuthenticationMethodResponse actual = response.getBody(); assertThat(actual).isEqualToIgnoringGivenFields(expected, "chosenScaMethod"); assertThat(actual.getChosenScaMethod()).isEqualToComparingFieldByField(expected.getChosenScaMethod()); } @ParameterizedTest @MethodSource("paymentTypes") void authoriseTransaction(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/authorise-transaction.json"); Response<ScaStatusResponse> response = service.updatePaymentPsuData(paymentService, paymentProduct, ids.get(paymentProduct).getLeft(), ids.get(paymentProduct).getRight(), requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(TransactionAuthorisation.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(ScaStatusResponse.class)); } @ParameterizedTest @MethodSource("paymentTypes") void getScaStatus(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/get-sca-status.json"); Response<ScaStatusResponse> response = service.getPaymentInitiationScaStatus(paymentService, paymentProduct, ids.get(paymentProduct).getLeft(), ids.get(paymentProduct).getRight(), requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(ScaStatusResponse.class)); } @ParameterizedTest @MethodSource("paymentTypes") void getPaymentStatus(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/get-payment-status.json"); Response<PaymentInitiationStatusResponse200Json> response = service.getPaymentInitiationStatus(paymentService, paymentProduct, ids.get(paymentProduct).getLeft(), requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(PaymentInitiationStatusResponse200Json.class)); } private static Stream<Arguments> paymentTypes() { return Stream.of(arguments(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS), arguments(PaymentService.PAYMENTS, PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS)); } }
8,141
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseAccountInformationServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/test/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseAccountInformationServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.http.Request; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.junit.jupiter.MockitoExtension; import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class SparkasseAccountInformationServiceTest { private static final String ACCOUNT_ID = "accountId"; private static final String REMITTANCE_INFORMATION_STRUCTURED = "remittanceInformationStructuredStringValue"; private static final String CONSENT_ID = "consentId"; private static final String AUTHORISATION_ID = "authorisationId"; private static final String AUTHORISATION_TYPE = "PUSH_OTP"; private SparkasseAccountInformationService accountInformationService; @Mock private HttpClient httpClient; @Mock private HttpClientFactory httpClientFactory; @Mock private HttpClientConfig httpClientConfig; @Mock private Aspsp aspsp; @Mock private LinksRewriter linksRewriter; private final ClassLoader classLoader = getClass().getClassLoader(); private Request.Builder requestBuilder; @BeforeEach void setUp() { when(httpClientFactory.getHttpClient(any())).thenReturn(httpClient); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); accountInformationService = new SparkasseAccountInformationService(aspsp, httpClientFactory, linksRewriter); requestBuilder = new RequestBuilderImpl(httpClient, "", ""); } @Test void createConsent() throws IOException, URISyntaxException { byte[] response = readFile("responses/consentsPaymentInitiationResponse.json"); when(httpClient.post(anyString())).thenReturn(requestBuilder); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = accountInformationService.createConsent(RequestHeaders.empty(), RequestParams.empty(), new Consents()); verify(httpClient, times(1)).post(anyString()); verify(httpClient, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(ConsentsResponse201.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }); } @Test void startConsentAuthorisation() throws IOException, URISyntaxException { byte[] response = readFile("responses/startScaprocessResponse.json"); when(httpClient.post(anyString())).thenReturn(requestBuilder); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = accountInformationService.startConsentAuthorisation(CONSENT_ID, RequestHeaders.empty(), RequestParams.empty()); verify(httpClient, times(1)).post(anyString()); verify(httpClient, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(StartScaprocessResponse.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }) .matches(body -> body.getScaMethods() .get(0) // assuming only one Sca Method .getAuthenticationType() .equals(AUTHORISATION_TYPE)); } @Test void updateConsentsPsuData_updatePsuAuthentication() throws IOException, URISyntaxException { byte[] response = readFile("responses/updatePsuAuthenticationResponse.json"); when(httpClient.put(anyString())).thenReturn(requestBuilder); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = accountInformationService.updateConsentsPsuData(CONSENT_ID, AUTHORISATION_ID, RequestHeaders.empty(), RequestParams.empty(), new UpdatePsuAuthentication()); verify(httpClient, times(1)).put(anyString()); verify(httpClient, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(UpdatePsuAuthenticationResponse.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }) .matches(body -> body.getScaMethods() .get(0) // assuming only one Sca Method .getAuthenticationType() .equals(AUTHORISATION_TYPE)); } @Test void updateConsentsPsuData_selectScaMethod() throws IOException, URISyntaxException { byte[] response = readFile("responses/selectPsuAuthenticationMethodResponse.json"); when(httpClient.put(anyString())).thenReturn(requestBuilder); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = accountInformationService.updateConsentsPsuData(CONSENT_ID, AUTHORISATION_ID, RequestHeaders.empty(), RequestParams.empty(), new SelectPsuAuthenticationMethod()); verify(httpClient, times(1)).put(anyString()); verify(httpClient, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(SelectPsuAuthenticationMethodResponse.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }); } @Test void getTransactionList() throws IOException, URISyntaxException { byte[] response = readFile("./responses/getTransactionList.json"); when(httpClient.get(anyString())).thenReturn(requestBuilder); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = accountInformationService.getTransactionList(ACCOUNT_ID, RequestHeaders.empty(), RequestParams.empty()); verify(httpClient, times(1)).get(anyString()); verify(httpClient, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(TransactionsResponse200Json.class)) .matches(body -> body.getTransactions() .getBooked() .get(0) .getRemittanceInformationStructured() .equals(REMITTANCE_INFORMATION_STRUCTURED)); } @Test void getTransactionDetails() throws IOException, URISyntaxException { byte[] response = readFile("./responses/getTransactionDetails.json"); when(httpClient.get(anyString())).thenReturn(requestBuilder); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = accountInformationService.getTransactionDetails(ACCOUNT_ID, "transactionId", RequestHeaders.empty(), RequestParams.empty()); verify(httpClient, times(1)).get(anyString()); verify(httpClient, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(OK200TransactionDetails.class)) .matches(body -> body.getTransactionsDetails() .getRemittanceInformationStructured() .equals(REMITTANCE_INFORMATION_STRUCTURED)); } @SuppressWarnings("rawtypes") private Object getResponse(byte[] response, InvocationOnMock invocationOnMock) { HttpClient.ResponseHandler responseHandler = invocationOnMock.getArgument(1, HttpClient.ResponseHandler.class); return new Response<>(-1, responseHandler.apply(200, new ByteArrayInputStream(response), ResponseHeaders.emptyResponseHeaders()), null); } @SuppressWarnings("ConstantConditions") private byte[] readFile(String path) throws URISyntaxException, IOException { URI fileUri = classLoader.getResource(path).toURI(); Path pathToFile = Paths.get(fileUri); return Files.readAllBytes(pathToFile); } }
11,272
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseAccountInformationServiceWireMockTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/test/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseAccountInformationServiceWireMockTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.AccountInformationService; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.test.ServiceWireMockTest; import de.adorsys.xs2a.adapter.test.TestRequestResponse; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @ServiceWireMockTest(SparkasseServiceProvider.class) class SparkasseAccountInformationServiceWireMockTest { private static final String CONSENT_ID = "e3d6fd32-8e41-498b-a20a-c643215e420c"; private static final String AUTHORISATION_ID = "a7129418-87e2-43c3-ba57-38aa2e23093b"; private static final String ACCOUNT_ID = "3217d050-f5b5-4318-a799-413bce784ef6"; private final AccountInformationService service; SparkasseAccountInformationServiceWireMockTest(AccountInformationService service) { this.service = service; } @Test void createConsent() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/create-consent.json"); Response<ConsentsResponse201> response = service.createConsent(requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(Consents.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(ConsentsResponse201.class)); } @Test void authenticatePsu() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/authenticate-psu.json"); Response<StartScaprocessResponse> response = service.startConsentAuthorisation(CONSENT_ID, requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(UpdatePsuAuthentication.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(StartScaprocessResponse.class)); } @Test void selectScaMethod() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/select-sca-method.json"); SelectPsuAuthenticationMethodResponse expected = requestResponse.responseBody(SelectPsuAuthenticationMethodResponse.class); Response<SelectPsuAuthenticationMethodResponse> response = service.updateConsentsPsuData(CONSENT_ID, AUTHORISATION_ID, requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(SelectPsuAuthenticationMethod.class)); SelectPsuAuthenticationMethodResponse actual = response.getBody(); assertThat(actual).isEqualToIgnoringGivenFields(expected, "chosenScaMethod"); assertThat(actual.getChosenScaMethod()).isEqualToComparingFieldByField(expected.getChosenScaMethod()); } @Test void authoriseTransaction() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/authorise-transaction.json"); Response<ScaStatusResponse> response = service.updateConsentsPsuData(CONSENT_ID, AUTHORISATION_ID, requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(TransactionAuthorisation.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(ScaStatusResponse.class)); } @Test void getAccounts() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/get-accounts.json"); Response<AccountList> response = service.getAccountList(requestResponse.requestHeaders(), requestResponse.requestParams()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(AccountList.class)); } @Test void getTransactions() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/get-transactions.json"); Response<String> response = service.getTransactionListAsString(ACCOUNT_ID, requestResponse.requestHeaders(), requestResponse.requestParams()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody()); } @Test void getScaStatus() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/get-sca-status.json"); Response<ScaStatusResponse> response = service.getConsentScaStatus(CONSENT_ID, AUTHORISATION_ID, requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(ScaStatusResponse.class)); } @Test void getConsentStatus() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/get-consent-status.json"); Response<ConsentStatusResponse200> response = service.getConsentStatus(CONSENT_ID, requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(ConsentStatusResponse200.class)); } @Test void deleteConsent() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/delete-consent.json"); Response<Void> response = service.deleteConsent(CONSENT_ID, requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getStatusCode()).isEqualTo(202); } }
6,365
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseServiceProviderTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/test/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseServiceProviderTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.AccountInformationService; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.PaymentInitiationService; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.impl.http.BaseHttpClientConfig; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; class SparkasseServiceProviderTest { private final HttpClientFactory clientFactory = mock(HttpClientFactory.class); private final HttpClientConfig clientConfig = new BaseHttpClientConfig(null, null, null); private final SparkasseServiceProvider provider = new SparkasseServiceProvider(); private final Aspsp aspsp = new Aspsp(); @BeforeEach void setUp() { when(clientFactory.getHttpClientConfig()).thenReturn(clientConfig); } @Test void getAccountInformationService() { AccountInformationService actualService = provider.getAccountInformationService(aspsp, clientFactory, null); assertThat(actualService) .isExactlyInstanceOf(SparkasseAccountInformationService.class); } @Test void getPaymentInitiationService() { PaymentInitiationService actualService = provider.getPaymentInitiationService(aspsp, clientFactory, null); assertThat(actualService) .isExactlyInstanceOf(SparkassePaymentInitiationService.class); } @Test void getOauth2Service() { Oauth2Service actualService = provider.getOauth2Service(aspsp, clientFactory); assertThat(actualService) .isExactlyInstanceOf(SparkasseOauth2Service.class); } }
2,804
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkassePaymentInitiationServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/test/java/de/adorsys/xs2a/adapter/sparkasse/SparkassePaymentInitiationServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.*; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.http.Request; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl; import de.adorsys.xs2a.adapter.impl.link.identity.IdentityLinksRewriter; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; class SparkassePaymentInitiationServiceTest { private static final String PAYMENT_ID = "paymentId"; private static final String AUTHORISATION_ID = "authorisationId"; private static final String AUTHORISATION_TYPE = "PUSH_OTP"; private final HttpClient client = mock(HttpClient.class); private final HttpClientConfig httpClientConfig = mock(HttpClientConfig.class); private final ArgumentCaptor<Request.Builder> builderCaptor = ArgumentCaptor.forClass(Request.Builder.class); private final PaymentInitiationService service = new SparkasseServiceProvider() .getPaymentInitiationService(new Aspsp(), getHttpClientFactory(), new IdentityLinksRewriter()); private final ClassLoader classLoader = getClass().getClassLoader(); private Request.Builder requestBuilder; private HttpClientFactory getHttpClientFactory() { return new HttpClientFactory() { @Override public HttpClient getHttpClient(String adapterId, String qwacAlias, String[] supportedCipherSuites) { return client; } @Override public HttpClientConfig getHttpClientConfig() { return httpClientConfig; } }; } @BeforeEach void setUp() { requestBuilder = new RequestBuilderImpl(client, "", ""); } @Test void initiatePayment() throws IOException, URISyntaxException { byte[] response = readFile("responses/consentsPaymentInitiationResponse.json"); when(client.post(anyString())).thenReturn(requestBuilder); when(client.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); String requestBody = "<Document>\n" + " <CstmrCdtTrfInitn>\n" + " <PmtInf>\n" + " <ReqdExctnDt>2020-07-10</ReqdExctnDt>\n" + " </PmtInf>\n" + " <PmtInf>\n" + " <ReqdExctnDt>2020-07-10</ReqdExctnDt>\n" + " </PmtInf>\n" + " </CstmrCdtTrfInitn>\n" + "</Document>"; Response<?> actualResponse = service.initiatePayment(PaymentService.PAYMENTS, PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS, RequestHeaders.empty(), RequestParams.empty(), requestBody); verify(client, times(1)).send(builderCaptor.capture(), any()); Request.Builder actualBuilder = builderCaptor.getValue(); assertThat(actualBuilder) .isNotNull() .extracting(Request.Builder::body) .asString() .isXmlEqualTo("<Document>\n" + " <CstmrCdtTrfInitn>\n" + " <PmtInf>\n" + " <ReqdExctnDt>1999-01-01</ReqdExctnDt>\n" + " </PmtInf>\n" + " <PmtInf>\n" + " <ReqdExctnDt>1999-01-01</ReqdExctnDt>\n" + " </PmtInf>\n" + " </CstmrCdtTrfInitn>\n" + "</Document>"); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(PaymentInitationRequestResponse201.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }); } @Test void startPaymentAuthorisation() throws IOException, URISyntaxException { byte[] response = readFile("responses/startScaprocessResponse.json"); when(client.post(anyString())).thenReturn(requestBuilder); when(client.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = service.startPaymentAuthorisation(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, PAYMENT_ID, RequestHeaders.empty(), RequestParams.empty()); verify(client, times(1)).post(anyString()); verify(client, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(StartScaprocessResponse.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }) .matches(body -> body.getScaMethods() .get(0) // assuming only one Sca Method .getAuthenticationType() .equals(AUTHORISATION_TYPE)); } @Test void updatePaymentPsuData_updatePsuAuthentication() throws IOException, URISyntaxException { byte[] response = readFile("responses/updatePsuAuthenticationResponse.json"); when(client.put(anyString())).thenReturn(requestBuilder); when(client.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = service.updatePaymentPsuData(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, PAYMENT_ID, AUTHORISATION_ID, RequestHeaders.empty(), RequestParams.empty(), new UpdatePsuAuthentication()); verify(client, times(1)).put(anyString()); verify(client, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(UpdatePsuAuthenticationResponse.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }) .matches(body -> body.getScaMethods() .get(0) // assuming only one Sca Method .getAuthenticationType() .equals(AUTHORISATION_TYPE)); } @Test void updatePaymentPsuData_selectScaMethod() throws IOException, URISyntaxException { byte[] response = readFile("responses/selectPsuAuthenticationMethodResponse.json"); when(client.put(anyString())).thenReturn(requestBuilder); when(client.send(any(), any())) .thenAnswer(invocationOnMock -> getResponse(response, invocationOnMock)); Response<?> actualResponse = service.updatePaymentPsuData(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, PAYMENT_ID, AUTHORISATION_ID, RequestHeaders.empty(), RequestParams.empty(), new SelectPsuAuthenticationMethod()); verify(client, times(1)).put(anyString()); verify(client, times(1)).send(any(), any()); assertThat(actualResponse) .isNotNull() .extracting(Response::getBody) .asInstanceOf(InstanceOfAssertFactories.type(SelectPsuAuthenticationMethodResponse.class)) .matches(body -> { var authObject = (AuthenticationObject) body.getChosenScaMethod(); return authObject.getAuthenticationType().equals(AUTHORISATION_TYPE); }); } @SuppressWarnings("rawtypes") private Object getResponse(byte[] response, InvocationOnMock invocationOnMock) { HttpClient.ResponseHandler responseHandler = invocationOnMock.getArgument(1, HttpClient.ResponseHandler.class); return new Response<>(-1, responseHandler.apply(200, new ByteArrayInputStream(response), ResponseHeaders.emptyResponseHeaders()), null); } @SuppressWarnings("ConstantConditions") private byte[] readFile(String path) throws URISyntaxException, IOException { URI fileUri = classLoader.getResource(path).toURI(); Path pathToFile = Paths.get(fileUri); return Files.readAllBytes(pathToFile); } }
10,198
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseOauth2ServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/test/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseOauth2ServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.Oauth2Service.GrantType; import de.adorsys.xs2a.adapter.api.Oauth2Service.Parameters; import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.api.model.TokenResponse; import de.adorsys.xs2a.adapter.impl.http.ApacheHttpClient; import de.adorsys.xs2a.adapter.impl.oauth2.api.model.AuthorisationServerMetaData; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.*; class SparkasseOauth2ServiceTest { private static final String ORG_ID = "PSDDE-BAFIN-999999"; private static final String STATE = "xyz"; private static final String AUTHORIZATION_ENDPOINT = "https://www.sparkasse.de/oauth/authorize"; private static final String TOKEN_ENDPOINT = "https://www.sparkasse.de/oauth/token"; private static final String SCA_OAUTH_LINK = "https://sparkasse.de/oauth/.well-known"; private static final String CONSENT_ID = "consent-id"; private static final String AUTHORIZATION_CODE = "authorization-code"; private static final String REFRESH_TOKEN = "refresh-token"; private final Pkcs12KeyStore keyStore = mock(Pkcs12KeyStore.class); private final HttpClientFactory httpClientFactory = mock(HttpClientFactory.class); private final HttpClientConfig httpClientConfig = mock(HttpClientConfig.class); private final HttpClient httpClient = spy(new ApacheHttpClient(null, null)); private final Aspsp aspsp = new Aspsp(); private SparkasseOauth2Service oauth2Service; @BeforeEach void setUp() throws Exception { when(keyStore.getOrganizationIdentifier()) .thenReturn(ORG_ID); doReturn(authorizationServerMetadata()) .when(httpClient).send(argThat(req -> req.uri().equals(SCA_OAUTH_LINK)), any()); doReturn(tokenResponse()) .when(httpClient).send(argThat(req -> req.uri().equals(TOKEN_ENDPOINT)), any()); when(httpClientFactory.getHttpClient(any())).thenReturn(httpClient); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); when(httpClientConfig.getKeyStore()).thenReturn(keyStore); oauth2Service = SparkasseOauth2Service.create(aspsp, httpClientFactory); } private Response<AuthorisationServerMetaData> authorizationServerMetadata() { AuthorisationServerMetaData metadata = new AuthorisationServerMetaData(); metadata.setAuthorisationEndpoint(AUTHORIZATION_ENDPOINT); metadata.setTokenEndpoint(TOKEN_ENDPOINT); return new Response<>(200, metadata, ResponseHeaders.emptyResponseHeaders()); } private Response<TokenResponse> tokenResponse() { return new Response<>(200, new TokenResponse(), ResponseHeaders.emptyResponseHeaders()); } @Test void getAuthorizationRequestUri() throws IOException { Parameters parameters = new Parameters(); parameters.setScaOAuthLink(SCA_OAUTH_LINK); parameters.setState(STATE); parameters.setConsentId(CONSENT_ID); URI uri = oauth2Service.getAuthorizationRequestUri(null, parameters); assertEquals(AUTHORIZATION_ENDPOINT + "?" + "responseType=code&" + "state=xyz&" + "clientId=" + ORG_ID + "&" + "code_challenge_method=S256&" + "code_challenge=" + oauth2Service.codeChallenge() + "&" + "scope=AIS%3A+" + CONSENT_ID, uri.toString()); } @Test void getAuthorizationRequestUriForPayment() throws IOException { Parameters parameters = new Parameters(); parameters.setScaOAuthLink(SCA_OAUTH_LINK); parameters.setState(STATE); parameters.setPaymentId("payment-id"); URI uri = oauth2Service.getAuthorizationRequestUri(null, parameters); assertEquals(AUTHORIZATION_ENDPOINT + "?" + "responseType=code&" + "state=xyz&" + "clientId=" + ORG_ID + "&" + "code_challenge_method=S256&" + "code_challenge=" + oauth2Service.codeChallenge() + "&" + "scope=PIS%3A+payment-id", uri.toString()); } @Test void getToken_authorizationCodeExchange() throws IOException { Parameters parameters = new Parameters(); parameters.setScaOAuthLink(SCA_OAUTH_LINK); parameters.setGrantType(GrantType.AUTHORIZATION_CODE.toString()); parameters.setAuthorizationCode(AUTHORIZATION_CODE); oauth2Service.getToken(null, parameters); Map<String, String> expectedBody = new HashMap<>(); expectedBody.put(Parameters.GRANT_TYPE, GrantType.AUTHORIZATION_CODE.toString()); expectedBody.put(Parameters.CODE, AUTHORIZATION_CODE); expectedBody.put(Parameters.CLIENT_ID, ORG_ID); expectedBody.put(Parameters.CODE_VERIFIER, oauth2Service.codeVerifier()); Mockito.verify(httpClient, Mockito.times(1)).send(argThat(req -> { boolean tokenExchange = req.uri().equals(TOKEN_ENDPOINT); if (tokenExchange) { assertEquals(expectedBody, req.urlEncodedBody()); } return tokenExchange; }), any()); } @Test void getToken_refresh() throws IOException { Parameters parameters = new Parameters(); parameters.setScaOAuthLink(SCA_OAUTH_LINK); parameters.setGrantType(GrantType.REFRESH_TOKEN.toString()); parameters.setRefreshToken(REFRESH_TOKEN); oauth2Service.getToken(null, parameters); Map<String, String> expectedBody = new HashMap<>(); expectedBody.put(Parameters.GRANT_TYPE, GrantType.REFRESH_TOKEN.toString()); expectedBody.put(Parameters.REFRESH_TOKEN, REFRESH_TOKEN); expectedBody.put(Parameters.CLIENT_ID, ORG_ID); Mockito.verify(httpClient, Mockito.times(1)).send(argThat(req -> { boolean tokenExchange = req.uri().equals(TOKEN_ENDPOINT); if (tokenExchange) { assertEquals(expectedBody, req.urlEncodedBody()); } return tokenExchange; }), any()); } }
7,565
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkassePaymentInitiationService.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/SparkassePaymentInitiationService.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.impl.BasePaymentInitiationService; import de.adorsys.xs2a.adapter.sparkasse.model.SparkassePaymentInitationRequestResponse201; import de.adorsys.xs2a.adapter.sparkasse.model.SparkasseSelectPsuAuthenticationMethodResponse; import de.adorsys.xs2a.adapter.sparkasse.model.SparkasseStartScaprocessResponse; import de.adorsys.xs2a.adapter.sparkasse.model.SparkasseUpdatePsuAuthenticationResponse; import org.mapstruct.factory.Mappers; public class SparkassePaymentInitiationService extends BasePaymentInitiationService { private final SparkasseMapper sparkasseMapper = Mappers.getMapper(SparkasseMapper.class); public SparkassePaymentInitiationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { super(aspsp, httpClientFactory.getHttpClient(aspsp.getAdapterId()), linksRewriter, httpClientFactory.getHttpClientConfig().getLogSanitizer()); } @Override public Response<PaymentInitationRequestResponse201> initiatePayment(PaymentService paymentService, PaymentProduct paymentProduct, RequestHeaders requestHeaders, RequestParams requestParams, Object body) { if (paymentService == PaymentService.PAYMENTS && isXml(paymentProduct) && body instanceof String) { String xml = (String) body; body = resolveReqdExctnDt(xml); } return super.initiatePayment(paymentService, paymentProduct, requestHeaders, requestParams, body, SparkassePaymentInitationRequestResponse201.class, sparkasseMapper::toPaymentInitationRequestResponse201); } @Override public Response<StartScaprocessResponse> startPaymentAuthorisation(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { return super.startPaymentAuthorisation(paymentService, paymentProduct, paymentId, requestHeaders, requestParams, SparkasseStartScaprocessResponse.class, sparkasseMapper::toStartScaprocessResponse); } @Override public Response<UpdatePsuAuthenticationResponse> updatePaymentPsuData(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, UpdatePsuAuthentication updatePsuAuthentication) { return super.updatePaymentPsuData(paymentService, paymentProduct, paymentId, authorisationId, requestHeaders, requestParams, updatePsuAuthentication, SparkasseUpdatePsuAuthenticationResponse.class, sparkasseMapper::toUpdatePsuAuthenticationResponse); } @Override public Response<SelectPsuAuthenticationMethodResponse> updatePaymentPsuData(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, SelectPsuAuthenticationMethod selectPsuAuthenticationMethod) { return super.updatePaymentPsuData(paymentService, paymentProduct, paymentId, authorisationId, requestHeaders, requestParams, selectPsuAuthenticationMethod, SparkasseSelectPsuAuthenticationMethodResponse.class, sparkasseMapper::toSelectPsuAuthenticationMethodResponse); } private String resolveReqdExctnDt(String body) { return body.replaceAll("<ReqdExctnDt>.+</ReqdExctnDt>", "<ReqdExctnDt>1999-01-01</ReqdExctnDt>"); } }
6,491
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseAccountInformationService.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseAccountInformationService.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.impl.BaseAccountInformationService; import de.adorsys.xs2a.adapter.sparkasse.model.*; import org.mapstruct.factory.Mappers; public class SparkasseAccountInformationService extends BaseAccountInformationService { private final SparkasseMapper sparkasseMapper = Mappers.getMapper(SparkasseMapper.class); public SparkasseAccountInformationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { super(aspsp, httpClientFactory.getHttpClient(aspsp.getAdapterId()), linksRewriter, httpClientFactory.getHttpClientConfig().getLogSanitizer()); } @Override public Response<ConsentsResponse201> createConsent(RequestHeaders requestHeaders, RequestParams requestParams, Consents body) { return super.createConsent(requestHeaders, requestParams, body, SparkasseConsentsResponse201.class, sparkasseMapper::toConsentsResponse201); } @Override public Response<StartScaprocessResponse> startConsentAuthorisation(String consentId, RequestHeaders requestHeaders, RequestParams requestParams) { return super.startConsentAuthorisation(consentId, requestHeaders, requestParams, SparkasseStartScaprocessResponse.class, sparkasseMapper::toStartScaprocessResponse); } @Override public Response<UpdatePsuAuthenticationResponse> updateConsentsPsuData(String consentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, UpdatePsuAuthentication updatePsuAuthentication) { return super.updateConsentsPsuData(consentId, authorisationId, requestHeaders, requestParams, updatePsuAuthentication, SparkasseUpdatePsuAuthenticationResponse.class, sparkasseMapper::toUpdatePsuAuthenticationResponse); } @Override public Response<SelectPsuAuthenticationMethodResponse> updateConsentsPsuData(String consentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, SelectPsuAuthenticationMethod selectPsuAuthenticationMethod) { return super.updateConsentsPsuData(consentId, authorisationId, requestHeaders, requestParams, selectPsuAuthenticationMethod, SparkasseSelectPsuAuthenticationMethodResponse.class, sparkasseMapper::toSelectPsuAuthenticationMethodResponse); } @Override public Response<TransactionsResponse200Json> getTransactionList(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { return super.getTransactionList(accountId, requestHeaders, requestParams, SparkasseTransactionResponse200Json.class, sparkasseMapper::toTransactionsResponse200Json); } @Override public Response<OK200TransactionDetails> getTransactionDetails(String accountId, String transactionId, RequestHeaders requestHeaders, RequestParams requestParams) { return super.getTransactionDetails(accountId, transactionId, requestHeaders, requestParams, SparkasseOK200TransactionDetails.class, sparkasseMapper::toOK200TransactionDetails); } }
6,118
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseOauth2Service.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseOauth2Service.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.PkceOauth2Extension; import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.http.HttpLogSanitizer; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.api.model.TokenResponse; import de.adorsys.xs2a.adapter.impl.*; import de.adorsys.xs2a.adapter.impl.http.UriBuilder; import java.io.IOException; import java.net.URI; import java.util.Map; import static de.adorsys.xs2a.adapter.api.validation.Validation.requireValid; public class SparkasseOauth2Service extends Oauth2ServiceDecorator implements PkceOauth2Extension { private static final String AIS_SCOPE_PREFIX = "AIS: "; private static final String PIS_SCOPE_PREFIX = "PIS: "; private SparkasseOauth2Service(Oauth2Service oauth2Service) { super(oauth2Service); } public static SparkasseOauth2Service create(Aspsp aspsp, HttpClientFactory httpClientFactory) { HttpClient httpClient = httpClientFactory.getHttpClient(aspsp.getAdapterId()); HttpLogSanitizer logSanitizer = httpClientFactory.getHttpClientConfig().getLogSanitizer(); Pkcs12KeyStore keyStore = httpClientFactory.getHttpClientConfig().getKeyStore(); BaseOauth2Service baseOauth2Service = new BaseOauth2Service(aspsp, httpClient, logSanitizer); CertificateSubjectClientIdOauth2Service clientIdOauth2Service = new CertificateSubjectClientIdOauth2Service(baseOauth2Service, keyStore); PkceOauth2Service pkceOauth2Service = new PkceOauth2Service(clientIdOauth2Service); ScopeWithResourceIdOauth2Service scopeOauth2Service = new ScopeWithResourceIdOauth2Service(pkceOauth2Service, AIS_SCOPE_PREFIX, PIS_SCOPE_PREFIX); return new SparkasseOauth2Service(scopeOauth2Service); } @Override public URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) throws IOException { requireValid(validateGetAuthorizationRequestUri(headers, parameters)); return UriBuilder.fromUri(oauth2Service.getAuthorizationRequestUri(headers, parameters)) .renameQueryParam(Parameters.RESPONSE_TYPE, "responseType") .renameQueryParam(Parameters.CLIENT_ID, "clientId") .build(); } @Override public TokenResponse getToken(Map<String, String> headers, Parameters parameters) throws IOException { return oauth2Service.getToken(headers, parameters); } }
3,497
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseServiceProvider.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseServiceProvider.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.*; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.impl.AbstractAdapterServiceProvider; public class SparkasseServiceProvider extends AbstractAdapterServiceProvider implements Oauth2ServiceProvider { @Override public AccountInformationService getAccountInformationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { return new SparkasseAccountInformationService(aspsp, httpClientFactory, linksRewriter); } @Override public PaymentInitiationService getPaymentInitiationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { return new SparkassePaymentInitiationService(aspsp, httpClientFactory, linksRewriter); } @Override public Oauth2Service getOauth2Service(Aspsp aspsp, HttpClientFactory httpClientFactory) { return SparkasseOauth2Service.create(aspsp, httpClientFactory); } @Override public String getAdapterId() { return "sparkasse-adapter"; } }
2,411
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseMapper.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/SparkasseMapper.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.sparkasse.model.*; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.ValueMapping; @Mapper public interface SparkasseMapper { TransactionsResponse200Json toTransactionsResponse200Json(SparkasseTransactionResponse200Json value); OK200TransactionDetails toOK200TransactionDetails(SparkasseOK200TransactionDetails value); Transactions toTransactions(SparkasseTransactionDetails value); default String map(RemittanceInformationStructured value) { return value == null ? null : value.getReference(); } AuthenticationObject toAuthenticationObject(SparkasseAuthenticationObject value); @ValueMapping(target = "PUSH_OTP", source = "PUSH_DEC") String toAuthenticationType(SparkasseAuthenticationType value); @Mapping(target = "chosenScaMethod", expression = "java(toAuthenticationObject(value.getChosenScaMethod()))") ConsentsResponse201 toConsentsResponse201(SparkasseConsentsResponse201 value); PaymentInitationRequestResponse201 toPaymentInitationRequestResponse201(SparkassePaymentInitationRequestResponse201 value); @Mapping(target = "chosenScaMethod", expression = "java(toAuthenticationObject(value.getChosenScaMethod()))") SelectPsuAuthenticationMethodResponse toSelectPsuAuthenticationMethodResponse(SparkasseSelectPsuAuthenticationMethodResponse value); StartScaprocessResponse toStartScaprocessResponse(SparkasseStartScaprocessResponse value); UpdatePsuAuthenticationResponse toUpdatePsuAuthenticationResponse(SparkasseUpdatePsuAuthenticationResponse value); }
2,519
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseSelectPsuAuthenticationMethodResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseSelectPsuAuthenticationMethodResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.*; import java.util.Map; import java.util.Objects; public class SparkasseSelectPsuAuthenticationMethodResponse { private Amount transactionFees; private Amount currencyConversionFees; private Amount estimatedTotalAmount; private Amount estimatedInterbankSettlementAmount; private SparkasseAuthenticationObject chosenScaMethod; private ChallengeData challengeData; @JsonProperty("_links") private Map<String, HrefType> links; private ScaStatus scaStatus; private String psuMessage; public Amount getTransactionFees() { return transactionFees; } public void setTransactionFees(Amount transactionFees) { this.transactionFees = transactionFees; } public Amount getCurrencyConversionFees() { return currencyConversionFees; } public void setCurrencyConversionFees(Amount currencyConversionFees) { this.currencyConversionFees = currencyConversionFees; } public Amount getEstimatedTotalAmount() { return estimatedTotalAmount; } public void setEstimatedTotalAmount(Amount estimatedTotalAmount) { this.estimatedTotalAmount = estimatedTotalAmount; } public Amount getEstimatedInterbankSettlementAmount() { return estimatedInterbankSettlementAmount; } public void setEstimatedInterbankSettlementAmount(Amount estimatedInterbankSettlementAmount) { this.estimatedInterbankSettlementAmount = estimatedInterbankSettlementAmount; } public SparkasseAuthenticationObject getChosenScaMethod() { return chosenScaMethod; } public void setChosenScaMethod(SparkasseAuthenticationObject chosenScaMethod) { this.chosenScaMethod = chosenScaMethod; } public ChallengeData getChallengeData() { return challengeData; } public void setChallengeData(ChallengeData challengeData) { this.challengeData = challengeData; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } public ScaStatus getScaStatus() { return scaStatus; } public void setScaStatus(ScaStatus scaStatus) { this.scaStatus = scaStatus; } public String getPsuMessage() { return psuMessage; } public void setPsuMessage(String psuMessage) { this.psuMessage = psuMessage; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseSelectPsuAuthenticationMethodResponse that = (SparkasseSelectPsuAuthenticationMethodResponse) o; return Objects.equals(transactionFees, that.transactionFees) && Objects.equals(currencyConversionFees, that.currencyConversionFees) && Objects.equals(estimatedTotalAmount, that.estimatedTotalAmount) && Objects.equals(estimatedInterbankSettlementAmount, that.estimatedInterbankSettlementAmount) && Objects.equals(chosenScaMethod, that.chosenScaMethod) && Objects.equals(challengeData, that.challengeData) && Objects.equals(links, that.links) && Objects.equals(scaStatus, that.scaStatus) && Objects.equals(psuMessage, that.psuMessage); } @Override public int hashCode() { return Objects.hash(transactionFees, currencyConversionFees, estimatedTotalAmount, estimatedInterbankSettlementAmount, chosenScaMethod, challengeData, links, scaStatus, psuMessage); } }
4,665
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseConsentsResponse201.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseConsentsResponse201.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.*; import java.util.List; import java.util.Map; import java.util.Objects; public class SparkasseConsentsResponse201 { private ConsentStatus consentStatus; private String consentId; private List<SparkasseAuthenticationObject> scaMethods; private SparkasseAuthenticationObject chosenScaMethod; private ChallengeData challengeData; @JsonProperty("_links") private Map<String, HrefType> links; private String psuMessage; public ConsentStatus getConsentStatus() { return consentStatus; } public void setConsentStatus(ConsentStatus consentStatus) { this.consentStatus = consentStatus; } public String getConsentId() { return consentId; } public void setConsentId(String consentId) { this.consentId = consentId; } public List<SparkasseAuthenticationObject> getScaMethods() { return scaMethods; } public void setScaMethods(List<SparkasseAuthenticationObject> scaMethods) { this.scaMethods = scaMethods; } public SparkasseAuthenticationObject getChosenScaMethod() { return chosenScaMethod; } public void setChosenScaMethod(SparkasseAuthenticationObject chosenScaMethod) { this.chosenScaMethod = chosenScaMethod; } public ChallengeData getChallengeData() { return challengeData; } public void setChallengeData(ChallengeData challengeData) { this.challengeData = challengeData; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } public String getPsuMessage() { return psuMessage; } public void setPsuMessage(String psuMessage) { this.psuMessage = psuMessage; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseConsentsResponse201 that = (SparkasseConsentsResponse201) o; return Objects.equals(consentStatus, that.consentStatus) && Objects.equals(consentId, that.consentId) && Objects.equals(scaMethods, that.scaMethods) && Objects.equals(chosenScaMethod, that.chosenScaMethod) && Objects.equals(challengeData, that.challengeData) && Objects.equals(links, that.links) && Objects.equals(psuMessage, that.psuMessage); } @Override public int hashCode() { return Objects.hash(consentStatus, consentId, scaMethods, chosenScaMethod, challengeData, links, psuMessage); } }
3,691
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseTransactionDetails.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseTransactionDetails.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.*; import java.time.LocalDate; import java.util.List; import java.util.Map; import java.util.Objects; public class SparkasseTransactionDetails { private String transactionId; private String entryReference; private String endToEndId; private String mandateId; private String checkId; private String creditorId; private LocalDate bookingDate; private LocalDate valueDate; private Amount transactionAmount; private List<ReportExchangeRate> currencyExchange; private String creditorName; private AccountReference creditorAccount; private String creditorAgent; private String ultimateCreditor; private String debtorName; private AccountReference debtorAccount; private String debtorAgent; private String ultimateDebtor; private String remittanceInformationUnstructured; private List<String> remittanceInformationUnstructuredArray; private RemittanceInformationStructured remittanceInformationStructured; private List<RemittanceInformationStructured> remittanceInformationStructuredArray; private String additionalInformation; private AdditionalInformationStructured additionalInformationStructured; private PurposeCode purposeCode; private String bankTransactionCode; private String proprietaryBankTransactionCode; private Balance balanceAfterTransaction; @JsonProperty("_links") private Map<String, HrefType> links; public String getTransactionId() { return transactionId; } public void setTransactionId(String transactionId) { this.transactionId = transactionId; } public String getEntryReference() { return entryReference; } public void setEntryReference(String entryReference) { this.entryReference = entryReference; } public String getEndToEndId() { return endToEndId; } public void setEndToEndId(String endToEndId) { this.endToEndId = endToEndId; } public String getMandateId() { return mandateId; } public void setMandateId(String mandateId) { this.mandateId = mandateId; } public String getCheckId() { return checkId; } public void setCheckId(String checkId) { this.checkId = checkId; } public String getCreditorId() { return creditorId; } public void setCreditorId(String creditorId) { this.creditorId = creditorId; } public LocalDate getBookingDate() { return bookingDate; } public void setBookingDate(LocalDate bookingDate) { this.bookingDate = bookingDate; } public LocalDate getValueDate() { return valueDate; } public void setValueDate(LocalDate valueDate) { this.valueDate = valueDate; } public Amount getTransactionAmount() { return transactionAmount; } public void setTransactionAmount(Amount transactionAmount) { this.transactionAmount = transactionAmount; } public List<ReportExchangeRate> getCurrencyExchange() { return currencyExchange; } public void setCurrencyExchange(List<ReportExchangeRate> currencyExchange) { this.currencyExchange = currencyExchange; } public String getCreditorName() { return creditorName; } public void setCreditorName(String creditorName) { this.creditorName = creditorName; } public AccountReference getCreditorAccount() { return creditorAccount; } public void setCreditorAccount(AccountReference creditorAccount) { this.creditorAccount = creditorAccount; } public String getCreditorAgent() { return creditorAgent; } public void setCreditorAgent(String creditorAgent) { this.creditorAgent = creditorAgent; } public String getUltimateCreditor() { return ultimateCreditor; } public void setUltimateCreditor(String ultimateCreditor) { this.ultimateCreditor = ultimateCreditor; } public String getDebtorName() { return debtorName; } public void setDebtorName(String debtorName) { this.debtorName = debtorName; } public AccountReference getDebtorAccount() { return debtorAccount; } public void setDebtorAccount(AccountReference debtorAccount) { this.debtorAccount = debtorAccount; } public String getDebtorAgent() { return debtorAgent; } public void setDebtorAgent(String debtorAgent) { this.debtorAgent = debtorAgent; } public String getUltimateDebtor() { return ultimateDebtor; } public void setUltimateDebtor(String ultimateDebtor) { this.ultimateDebtor = ultimateDebtor; } public String getRemittanceInformationUnstructured() { return remittanceInformationUnstructured; } public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) { this.remittanceInformationUnstructured = remittanceInformationUnstructured; } public List<String> getRemittanceInformationUnstructuredArray() { return remittanceInformationUnstructuredArray; } public void setRemittanceInformationUnstructuredArray( List<String> remittanceInformationUnstructuredArray) { this.remittanceInformationUnstructuredArray = remittanceInformationUnstructuredArray; } public RemittanceInformationStructured getRemittanceInformationStructured() { return remittanceInformationStructured; } public void setRemittanceInformationStructured(RemittanceInformationStructured remittanceInformationStructured) { this.remittanceInformationStructured = remittanceInformationStructured; } public List<RemittanceInformationStructured> getRemittanceInformationStructuredArray() { return remittanceInformationStructuredArray; } public void setRemittanceInformationStructuredArray( List<RemittanceInformationStructured> remittanceInformationStructuredArray) { this.remittanceInformationStructuredArray = remittanceInformationStructuredArray; } public String getAdditionalInformation() { return additionalInformation; } public void setAdditionalInformation(String additionalInformation) { this.additionalInformation = additionalInformation; } public AdditionalInformationStructured getAdditionalInformationStructured() { return additionalInformationStructured; } public void setAdditionalInformationStructured( AdditionalInformationStructured additionalInformationStructured) { this.additionalInformationStructured = additionalInformationStructured; } public PurposeCode getPurposeCode() { return purposeCode; } public void setPurposeCode(PurposeCode purposeCode) { this.purposeCode = purposeCode; } public String getBankTransactionCode() { return bankTransactionCode; } public void setBankTransactionCode(String bankTransactionCode) { this.bankTransactionCode = bankTransactionCode; } public String getProprietaryBankTransactionCode() { return proprietaryBankTransactionCode; } public void setProprietaryBankTransactionCode(String proprietaryBankTransactionCode) { this.proprietaryBankTransactionCode = proprietaryBankTransactionCode; } public Balance getBalanceAfterTransaction() { return balanceAfterTransaction; } public void setBalanceAfterTransaction(Balance balanceAfterTransaction) { this.balanceAfterTransaction = balanceAfterTransaction; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseTransactionDetails that = (SparkasseTransactionDetails) o; return Objects.equals(transactionId, that.transactionId) && Objects.equals(entryReference, that.entryReference) && Objects.equals(endToEndId, that.endToEndId) && Objects.equals(mandateId, that.mandateId) && Objects.equals(checkId, that.checkId) && Objects.equals(creditorId, that.creditorId) && Objects.equals(bookingDate, that.bookingDate) && Objects.equals(valueDate, that.valueDate) && Objects.equals(transactionAmount, that.transactionAmount) && Objects.equals(currencyExchange, that.currencyExchange) && Objects.equals(creditorName, that.creditorName) && Objects.equals(creditorAccount, that.creditorAccount) && Objects.equals(creditorAgent, that.creditorAgent) && Objects.equals(ultimateCreditor, that.ultimateCreditor) && Objects.equals(debtorName, that.debtorName) && Objects.equals(debtorAccount, that.debtorAccount) && Objects.equals(debtorAgent, that.debtorAgent) && Objects.equals(ultimateDebtor, that.ultimateDebtor) && Objects.equals(remittanceInformationUnstructured, that.remittanceInformationUnstructured) && Objects.equals(remittanceInformationUnstructuredArray, that.remittanceInformationUnstructuredArray) && Objects.equals(remittanceInformationStructured, that.remittanceInformationStructured) && Objects.equals(remittanceInformationStructuredArray, that.remittanceInformationStructuredArray) && Objects.equals(additionalInformation, that.additionalInformation) && Objects.equals(additionalInformationStructured, that.additionalInformationStructured) && Objects.equals(purposeCode, that.purposeCode) && Objects.equals(bankTransactionCode, that.bankTransactionCode) && Objects.equals(proprietaryBankTransactionCode, that.proprietaryBankTransactionCode) && Objects.equals(balanceAfterTransaction, that.balanceAfterTransaction) && Objects.equals(links, that.links); } @Override public int hashCode() { return Objects.hash(transactionId, entryReference, endToEndId, mandateId, checkId, creditorId, bookingDate, valueDate, transactionAmount, currencyExchange, creditorName, creditorAccount, creditorAgent, ultimateCreditor, debtorName, debtorAccount, debtorAgent, ultimateDebtor, remittanceInformationUnstructured, remittanceInformationUnstructuredArray, remittanceInformationStructured, remittanceInformationStructuredArray, additionalInformation, additionalInformationStructured, purposeCode, bankTransactionCode, proprietaryBankTransactionCode, balanceAfterTransaction, links); } }
12,140
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseAuthenticationType.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseAuthenticationType.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum SparkasseAuthenticationType { SMS_OTP("SMS_OTP"), CHIP_OTP("CHIP_OTP"), PHOTO_OTP("PHOTO_OTP"), PUSH_OTP("PUSH_OTP"), PUSH_DEC("PUSH_DEC"), SMTP_OTP("SMTP_OTP"), EMAIL("EMAIL"); private final String value; SparkasseAuthenticationType(String value) { this.value = value; } @JsonCreator public static SparkasseAuthenticationType fromValue(String value) { for (SparkasseAuthenticationType e : SparkasseAuthenticationType.values()) { if (e.value.equals(value)) { return e; } } return null; } @Override @JsonValue public String toString() { return value; } }
1,709
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkassePaymentInitationRequestResponse201.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkassePaymentInitationRequestResponse201.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.*; import java.util.List; import java.util.Map; import java.util.Objects; public class SparkassePaymentInitationRequestResponse201 { private TransactionStatus transactionStatus; private String paymentId; private Amount transactionFees; private Amount currencyConversionFee; private Amount estimatedTotalAmount; private Amount estimatedInterbankSettlementAmount; private Boolean transactionFeeIndicator; private List<SparkasseAuthenticationObject> scaMethods; private SparkasseAuthenticationObject chosenScaMethod; private ChallengeData challengeData; @JsonProperty("_links") private Map<String, HrefType> links; private String psuMessage; private List<TppMessage2XX> tppMessages; public TransactionStatus getTransactionStatus() { return transactionStatus; } public void setTransactionStatus(TransactionStatus transactionStatus) { this.transactionStatus = transactionStatus; } public String getPaymentId() { return paymentId; } public void setPaymentId(String paymentId) { this.paymentId = paymentId; } public Amount getTransactionFees() { return transactionFees; } public void setTransactionFees(Amount transactionFees) { this.transactionFees = transactionFees; } public Amount getCurrencyConversionFee() { return currencyConversionFee; } public void setCurrencyConversionFee(Amount currencyConversionFee) { this.currencyConversionFee = currencyConversionFee; } public Amount getEstimatedTotalAmount() { return estimatedTotalAmount; } public void setEstimatedTotalAmount(Amount estimatedTotalAmount) { this.estimatedTotalAmount = estimatedTotalAmount; } public Amount getEstimatedInterbankSettlementAmount() { return estimatedInterbankSettlementAmount; } public void setEstimatedInterbankSettlementAmount(Amount estimatedInterbankSettlementAmount) { this.estimatedInterbankSettlementAmount = estimatedInterbankSettlementAmount; } public Boolean getTransactionFeeIndicator() { return transactionFeeIndicator; } public void setTransactionFeeIndicator(Boolean transactionFeeIndicator) { this.transactionFeeIndicator = transactionFeeIndicator; } public List<SparkasseAuthenticationObject> getScaMethods() { return scaMethods; } public void setScaMethods(List<SparkasseAuthenticationObject> scaMethods) { this.scaMethods = scaMethods; } public SparkasseAuthenticationObject getChosenScaMethod() { return chosenScaMethod; } public void setChosenScaMethod(SparkasseAuthenticationObject chosenScaMethod) { this.chosenScaMethod = chosenScaMethod; } public ChallengeData getChallengeData() { return challengeData; } public void setChallengeData(ChallengeData challengeData) { this.challengeData = challengeData; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } public String getPsuMessage() { return psuMessage; } public void setPsuMessage(String psuMessage) { this.psuMessage = psuMessage; } public List<TppMessage2XX> getTppMessages() { return tppMessages; } public void setTppMessages(List<TppMessage2XX> tppMessages) { this.tppMessages = tppMessages; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkassePaymentInitationRequestResponse201 that = (SparkassePaymentInitationRequestResponse201) o; return Objects.equals(transactionStatus, that.transactionStatus) && Objects.equals(paymentId, that.paymentId) && Objects.equals(transactionFees, that.transactionFees) && Objects.equals(currencyConversionFee, that.currencyConversionFee) && Objects.equals(estimatedTotalAmount, that.estimatedTotalAmount) && Objects.equals(estimatedInterbankSettlementAmount, that.estimatedInterbankSettlementAmount) && Objects.equals(transactionFeeIndicator, that.transactionFeeIndicator) && Objects.equals(scaMethods, that.scaMethods) && Objects.equals(chosenScaMethod, that.chosenScaMethod) && Objects.equals(challengeData, that.challengeData) && Objects.equals(links, that.links) && Objects.equals(psuMessage, that.psuMessage) && Objects.equals(tppMessages, that.tppMessages); } @Override public int hashCode() { return Objects.hash(transactionStatus, paymentId, transactionFees, currencyConversionFee, estimatedTotalAmount, estimatedInterbankSettlementAmount, transactionFeeIndicator, scaMethods, chosenScaMethod, challengeData, links, psuMessage, tppMessages); } }
6,156
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseAccountReport.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseAccountReport.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.HrefType; import java.util.List; import java.util.Map; import java.util.Objects; public class SparkasseAccountReport { private List<SparkasseTransactionDetails> booked; private List<SparkasseTransactionDetails> pending; @JsonProperty("_links") private Map<String, HrefType> links; public List<SparkasseTransactionDetails> getBooked() { return booked; } public void setBooked(List<SparkasseTransactionDetails> booked) { this.booked = booked; } public List<SparkasseTransactionDetails> getPending() { return pending; } public void setPending(List<SparkasseTransactionDetails> pending) { this.pending = pending; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseAccountReport that = (SparkasseAccountReport) o; return Objects.equals(booked, that.booked) && Objects.equals(pending, that.pending) && Objects.equals(links, that.links); } @Override public int hashCode() { return Objects.hash(booked, pending, links); } }
2,348
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseOK200TransactionDetails.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseOK200TransactionDetails.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import java.util.Objects; public class SparkasseOK200TransactionDetails { private SparkasseTransactionDetails transactionsDetails; public SparkasseTransactionDetails getTransactionsDetails() { return transactionsDetails; } public void setTransactionsDetails(SparkasseTransactionDetails transactionsDetails) { this.transactionsDetails = transactionsDetails; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseOK200TransactionDetails that = (SparkasseOK200TransactionDetails) o; return Objects.equals(transactionsDetails, that.transactionsDetails); } @Override public int hashCode() { return Objects.hash(transactionsDetails); } }
1,705
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseTransactionResponse200Json.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseTransactionResponse200Json.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.AccountReference; import de.adorsys.xs2a.adapter.api.model.Balance; import de.adorsys.xs2a.adapter.api.model.HrefType; import java.util.List; import java.util.Map; import java.util.Objects; public class SparkasseTransactionResponse200Json { private AccountReference account; private SparkasseAccountReport transactions; private List<Balance> balances; @JsonProperty("_links") private Map<String, HrefType> links; public AccountReference getAccount() { return account; } public void setAccount(AccountReference account) { this.account = account; } public SparkasseAccountReport getTransactions() { return transactions; } public void setTransactions(SparkasseAccountReport transactions) { this.transactions = transactions; } public List<Balance> getBalances() { return balances; } public void setBalances(List<Balance> balances) { this.balances = balances; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseTransactionResponse200Json that = (SparkasseTransactionResponse200Json) o; return Objects.equals(account, that.account) && Objects.equals(transactions, that.transactions) && Objects.equals(balances, that.balances) && Objects.equals(links, that.links); } @Override public int hashCode() { return Objects.hash(account, transactions, balances, links); } }
2,754
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseUpdatePsuAuthenticationResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseUpdatePsuAuthenticationResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.*; import java.util.List; import java.util.Map; import java.util.Objects; public class SparkasseUpdatePsuAuthenticationResponse { private Amount transactionFees; private Amount currencyConversionFees; private Amount estimatedTotalAmount; private Amount estimatedInterbankSettlementAmount; private SparkasseAuthenticationObject chosenScaMethod; private ChallengeData challengeData; private List<SparkasseAuthenticationObject> scaMethods; @JsonProperty("_links") private Map<String, HrefType> links; private ScaStatus scaStatus; private String psuMessage; private String authorisationId; public Amount getTransactionFees() { return transactionFees; } public void setTransactionFees(Amount transactionFees) { this.transactionFees = transactionFees; } public Amount getCurrencyConversionFees() { return currencyConversionFees; } public void setCurrencyConversionFees(Amount currencyConversionFees) { this.currencyConversionFees = currencyConversionFees; } public Amount getEstimatedTotalAmount() { return estimatedTotalAmount; } public void setEstimatedTotalAmount(Amount estimatedTotalAmount) { this.estimatedTotalAmount = estimatedTotalAmount; } public Amount getEstimatedInterbankSettlementAmount() { return estimatedInterbankSettlementAmount; } public void setEstimatedInterbankSettlementAmount(Amount estimatedInterbankSettlementAmount) { this.estimatedInterbankSettlementAmount = estimatedInterbankSettlementAmount; } public SparkasseAuthenticationObject getChosenScaMethod() { return chosenScaMethod; } public void setChosenScaMethod(SparkasseAuthenticationObject chosenScaMethod) { this.chosenScaMethod = chosenScaMethod; } public ChallengeData getChallengeData() { return challengeData; } public void setChallengeData(ChallengeData challengeData) { this.challengeData = challengeData; } public List<SparkasseAuthenticationObject> getScaMethods() { return scaMethods; } public void setScaMethods(List<SparkasseAuthenticationObject> scaMethods) { this.scaMethods = scaMethods; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } public ScaStatus getScaStatus() { return scaStatus; } public void setScaStatus(ScaStatus scaStatus) { this.scaStatus = scaStatus; } public String getPsuMessage() { return psuMessage; } public void setPsuMessage(String psuMessage) { this.psuMessage = psuMessage; } public String getAuthorisationId() { return authorisationId; } public void setAuthorisationId(String authorisationId) { this.authorisationId = authorisationId; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseUpdatePsuAuthenticationResponse that = (SparkasseUpdatePsuAuthenticationResponse) o; return Objects.equals(transactionFees, that.transactionFees) && Objects.equals(currencyConversionFees, that.currencyConversionFees) && Objects.equals(estimatedTotalAmount, that.estimatedTotalAmount) && Objects.equals(estimatedInterbankSettlementAmount, that.estimatedInterbankSettlementAmount) && Objects.equals(chosenScaMethod, that.chosenScaMethod) && Objects.equals(challengeData, that.challengeData) && Objects.equals(scaMethods, that.scaMethods) && Objects.equals(links, that.links) && Objects.equals(scaStatus, that.scaStatus) && Objects.equals(psuMessage, that.psuMessage) && Objects.equals(authorisationId, that.authorisationId); } @Override public int hashCode() { return Objects.hash(transactionFees, currencyConversionFees, estimatedTotalAmount, estimatedInterbankSettlementAmount, chosenScaMethod, challengeData, scaMethods, links, scaStatus, psuMessage, authorisationId); } }
5,369
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseStartScaprocessResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseStartScaprocessResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import com.fasterxml.jackson.annotation.JsonProperty; import de.adorsys.xs2a.adapter.api.model.*; import java.util.List; import java.util.Map; import java.util.Objects; public class SparkasseStartScaprocessResponse { private ScaStatus scaStatus; private String authorisationId; private List<SparkasseAuthenticationObject> scaMethods; private SparkasseAuthenticationObject chosenScaMethod; private ChallengeData challengeData; @JsonProperty("_links") private Map<String, HrefType> links; private String psuMessage; public ScaStatus getScaStatus() { return scaStatus; } public void setScaStatus(ScaStatus scaStatus) { this.scaStatus = scaStatus; } public String getAuthorisationId() { return authorisationId; } public void setAuthorisationId(String authorisationId) { this.authorisationId = authorisationId; } public List<SparkasseAuthenticationObject> getScaMethods() { return scaMethods; } public void setScaMethods(List<SparkasseAuthenticationObject> scaMethods) { this.scaMethods = scaMethods; } public SparkasseAuthenticationObject getChosenScaMethod() { return chosenScaMethod; } public void setChosenScaMethod(SparkasseAuthenticationObject chosenScaMethod) { this.chosenScaMethod = chosenScaMethod; } public ChallengeData getChallengeData() { return challengeData; } public void setChallengeData(ChallengeData challengeData) { this.challengeData = challengeData; } public Map<String, HrefType> getLinks() { return links; } public void setLinks(Map<String, HrefType> links) { this.links = links; } public String getPsuMessage() { return psuMessage; } public void setPsuMessage(String psuMessage) { this.psuMessage = psuMessage; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseStartScaprocessResponse that = (SparkasseStartScaprocessResponse) o; return Objects.equals(scaStatus, that.scaStatus) && Objects.equals(authorisationId, that.authorisationId) && Objects.equals(scaMethods, that.scaMethods) && Objects.equals(chosenScaMethod, that.chosenScaMethod) && Objects.equals(challengeData, that.challengeData) && Objects.equals(links, that.links) && Objects.equals(psuMessage, that.psuMessage); } @Override public int hashCode() { return Objects.hash(scaStatus, authorisationId, scaMethods, chosenScaMethod, challengeData, links, psuMessage); } }
3,711
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
SparkasseAuthenticationObject.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/sparkasse-adapter/src/main/java/de/adorsys/xs2a/adapter/sparkasse/model/SparkasseAuthenticationObject.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.sparkasse.model; import java.util.Objects; public class SparkasseAuthenticationObject { private SparkasseAuthenticationType authenticationType; private String authenticationVersion; private String authenticationMethodId; private String name; private String explanation; public SparkasseAuthenticationType getAuthenticationType() { return authenticationType; } public void setAuthenticationType(SparkasseAuthenticationType authenticationType) { this.authenticationType = authenticationType; } public String getAuthenticationVersion() { return authenticationVersion; } public void setAuthenticationVersion(String authenticationVersion) { this.authenticationVersion = authenticationVersion; } public String getAuthenticationMethodId() { return authenticationMethodId; } public void setAuthenticationMethodId(String authenticationMethodId) { this.authenticationMethodId = authenticationMethodId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getExplanation() { return explanation; } public void setExplanation(String explanation) { this.explanation = explanation; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SparkasseAuthenticationObject that = (SparkasseAuthenticationObject) o; return Objects.equals(authenticationType, that.authenticationType) && Objects.equals(authenticationVersion, that.authenticationVersion) && Objects.equals(authenticationMethodId, that.authenticationMethodId) && Objects.equals(name, that.name) && Objects.equals(explanation, that.explanation); } @Override public int hashCode() { return Objects.hash(authenticationType, authenticationVersion, authenticationMethodId, name, explanation); } }
2,990
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngApiFactoryTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngApiFactoryTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.model.Aspsp; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class IngApiFactoryTest { @Mock private HttpClientFactory httpClientFactory; @Mock private HttpClient httpClient; @Mock private HttpClientConfig httpClientConfig; private final Aspsp aspsp = new Aspsp(); @BeforeEach void setUp() { when(httpClientFactory.getHttpClient(any(), any())).thenReturn(httpClient); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); } @Test void getAccountInformationApi() { IngAccountInformationApi actual = IngApiFactory.getAccountInformationApi(aspsp, httpClientFactory); assertThat(actual) .isNotNull(); } @Test void getPaymentInitiationApi() { IngPaymentInitiationApi actual = IngApiFactory.getPaymentInitiationApi(aspsp, httpClientFactory); assertThat(actual) .isNotNull(); } @Test void getOAuth2Api() { IngOauth2Api actual = IngApiFactory.getOAuth2Api(aspsp, httpClientFactory); assertThat(actual) .isNotNull(); } }
2,530
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngOauth2ServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngOauth2ServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.Oauth2Service.Parameters; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.model.Scope; import de.adorsys.xs2a.adapter.api.validation.RequestValidationException; import de.adorsys.xs2a.adapter.api.validation.ValidationError; import de.adorsys.xs2a.adapter.ing.model.IngApplicationTokenResponse; import de.adorsys.xs2a.adapter.ing.model.IngAuthorizationURLResponse; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.net.URI; import java.util.Collections; import java.util.List; import static de.adorsys.xs2a.adapter.ing.IngOauth2Service.UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class IngOauth2ServiceTest { private static final String CLIENT_ID = "client-id"; private static final String LOCATION = "https://example.com/location"; private static final String REDIRECT_URI = "https://example.com/redirect"; private static final String SCOPE = Scope.AIS.getValue(); private static final String UNSUPPORTED_SCOPE = "unsupportedScope"; private static final String MAPPED_SCOPE = "payment-accounts:transactions:view payment-accounts:balances:view"; private static final IngApplicationTokenResponse APPLICATION_TOKEN_RESPONSE = buildApplicationTokenResponse(); @Mock private IngOauth2Api oauth2Api; @Mock private IngClientAuthenticationFactory clientAuthenticationFactory; @Mock IngClientAuthentication clientAuthentication; @InjectMocks private IngOauth2Service oauth2Service; @Test void getAuthorizationRequestUri_Failure_ScopeIsNotProvided() { Parameters parameters = new Parameters(); try { oauth2Service.getAuthorizationRequestUri(parameters); fail("Should not be reached as RequestValidationException is expected to be thrown before"); } catch (RequestValidationException e) { List<ValidationError> validationErrors = e.getValidationErrors(); assertNotNull(validationErrors); assertEquals(1, validationErrors.size()); ValidationError validationError = validationErrors.get(0); assertEquals(validationErrors.get(0), ValidationError.required(Oauth2Service.Parameters.SCOPE)); } } @Test void getAuthorizationRequestUri_Failure_ScopeIsUnsupported() { Parameters parameters = new Parameters(); parameters.setScope(UNSUPPORTED_SCOPE); try { oauth2Service.getAuthorizationRequestUri(parameters); fail("Should not be reached as RequestValidationException is expected to be thrown before"); } catch (RequestValidationException e) { List<ValidationError> validationErrors = e.getValidationErrors(); assertNotNull(validationErrors); assertEquals(1, validationErrors.size()); ValidationError validationError = validationErrors.get(0); assertEquals(ValidationError.Code.NOT_SUPPORTED, validationError.getCode()); assertEquals(Oauth2Service.Parameters.SCOPE, validationError.getPath()); assertEquals(String.format(UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE, UNSUPPORTED_SCOPE), validationError.getMessage()); } } @Test void getAuthorizationRequestUri_Success() { Parameters parameters = new Parameters(); parameters.setScope(SCOPE); parameters.setRedirectUri(REDIRECT_URI); when(clientAuthenticationFactory.newClientAuthenticationForApplicationToken()) .thenReturn(clientAuthentication); when(oauth2Api.getApplicationToken(Collections.singletonList(clientAuthentication))) .thenReturn(new Response<>(200, APPLICATION_TOKEN_RESPONSE, ResponseHeaders.emptyResponseHeaders())); when(clientAuthenticationFactory.newClientAuthentication(APPLICATION_TOKEN_RESPONSE)) .thenReturn(clientAuthentication); when(oauth2Api.getAuthorizationUrl(Collections.singletonList(clientAuthentication), MAPPED_SCOPE, REDIRECT_URI)) .thenReturn(new Response<>(200, buildAuthorizationURLResponse(), ResponseHeaders.emptyResponseHeaders())); URI uri = oauth2Service.getAuthorizationRequestUri(parameters); assertNotNull(uri); } private IngAuthorizationURLResponse buildAuthorizationURLResponse() { IngAuthorizationURLResponse authorizationURLResponse = new IngAuthorizationURLResponse(); authorizationURLResponse.setLocation(LOCATION); return authorizationURLResponse; } private static IngApplicationTokenResponse buildApplicationTokenResponse() { IngApplicationTokenResponse tokenResponse = new IngApplicationTokenResponse(); tokenResponse.setClientId(CLIENT_ID); return tokenResponse; } }
6,041
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountInformationServiceWireMockTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngAccountInformationServiceWireMockTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.AccountInformationService; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.model.AccountList; import de.adorsys.xs2a.adapter.api.model.TransactionsResponse200Json; import de.adorsys.xs2a.adapter.test.ServiceWireMockTest; import de.adorsys.xs2a.adapter.test.TestRequestResponse; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @ServiceWireMockTest(IngServiceProvider.class) class IngAccountInformationServiceWireMockTest { protected static final String ACCOUNT_ID = "a217d676-7559-4f2a-83dc-5da0c2279223"; private final AccountInformationService service; IngAccountInformationServiceWireMockTest(AccountInformationService service) { this.service = service; } @Test void getAccounts() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/get-accounts.json"); Response<AccountList> response = service.getAccountList(requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(AccountList.class)); } @Test void getTransactions() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("ais/get-transactions.json"); Response<TransactionsResponse200Json> response = service.getTransactionList(ACCOUNT_ID, requestResponse.requestHeaders(), requestResponse.requestParams()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(TransactionsResponse200Json.class)); } }
2,551
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngOauth2ServiceWireMockTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngOauth2ServiceWireMockTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.model.TokenResponse; import de.adorsys.xs2a.adapter.test.ServiceWireMockTest; import de.adorsys.xs2a.adapter.test.TestRequestResponse; import org.junit.jupiter.api.Test; import java.net.URI; import java.util.HashMap; import java.util.LinkedHashMap; import static org.assertj.core.api.Assertions.assertThat; @ServiceWireMockTest(IngServiceProvider.class) class IngOauth2ServiceWireMockTest { private final Oauth2Service service; IngOauth2ServiceWireMockTest(Oauth2Service service) { this.service = service; } @Test void getAuthorizationUriJson() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("oauth2/get-authorization-uri.json"); URI authorizationRequestUri = service.getAuthorizationRequestUri(requestResponse.requestHeaders().toMap(), new Oauth2Service.Parameters(new HashMap<>(requestResponse.requestParams().toMap()))); URI expectedUri = requestResponse.responseBody(URI.class); // not comparing two URIs directly because of the dynamic wiremock port assertThat(authorizationRequestUri.getPath()).isEqualTo(expectedUri.getPath()); assertThat(authorizationRequestUri.getQuery()).isEqualTo(expectedUri.getQuery()); } @Test void getToken() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("oauth2/get-token.json"); TokenResponse tokenResponse = service.getToken(requestResponse.requestHeaders().toMap(), new Oauth2Service.Parameters(new LinkedHashMap<>(requestResponse.requestParams().toMap()))); assertThat(tokenResponse).isEqualTo(requestResponse.responseBody(TokenResponse.class)); } }
2,660
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentInitiationServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngPaymentInitiationServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.api.validation.RequestValidationException; import de.adorsys.xs2a.adapter.api.validation.ValidationError; import de.adorsys.xs2a.adapter.impl.http.AbstractHttpClient; import de.adorsys.xs2a.adapter.ing.model.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import java.io.ByteArrayInputStream; import java.time.LocalDate; import static de.adorsys.xs2a.adapter.api.model.PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS; import static de.adorsys.xs2a.adapter.api.model.PaymentProduct.SEPA_CREDIT_TRANSFERS; import static de.adorsys.xs2a.adapter.api.model.PaymentService.*; import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; class IngPaymentInitiationServiceTest { private static final RequestHeaders emptyRequestHeaders = RequestHeaders.empty(); private static final ResponseHeaders emptyResponseHeaders = ResponseHeaders.emptyResponseHeaders(); private static final String PAYMENT_ID = "payment-id"; private final HttpClient httpClient = spy(AbstractHttpClient.class); private final IngPaymentInitiationApi pia = spy(new IngPaymentInitiationApi(null, httpClient, null)); private final IngOauth2Service oas = mock(IngOauth2Service.class); private final LinksRewriter linksRewriter = mock(LinksRewriter.class); private IngPaymentInitiationService pis; @BeforeEach void setUp() { pis = new IngPaymentInitiationService(pia, oas, linksRewriter, null); } @Test void periodicPaymentInitiationWithUnsupportedFrequencyCausesValidationException() { PeriodicPaymentInitiationJson body = new PeriodicPaymentInitiationJson(); body.setFrequency(FrequencyCode.MONTHLYVARIABLE); RequestParams requestParams = RequestParams.empty(); RequestValidationException e = assertThrows(RequestValidationException.class, () -> pis.initiatePayment(PERIODIC_PAYMENTS, SEPA_CREDIT_TRANSFERS, emptyRequestHeaders, requestParams, body)); assertThat(e.getValidationErrors()) .anyMatch(validationError -> validationError.getCode() == ValidationError.Code.NOT_SUPPORTED && "frequency".equals(validationError.getPath())); } @Test void getPeriodicPain001PaymentInformationDeserialization() { Mockito.doAnswer(invocationOnMock -> { HttpClient.ResponseHandler responseHandler = invocationOnMock.getArgument(1, HttpClient.ResponseHandler.class); String rawResponse = "---\r\n" + "Content-Disposition: form-data; name=\"xml_sct\"\r\n" + "Content-Type: application/xml\r\n\r\n" + "<xml>\r\n" + "---\r\n" + "Content-Disposition: form-data; name=\"startDate\"\r\n" + "Content-Type: text/plain\r\n\r\n" + "2020-02-20\r\n" + "---\r\n" + "Content-Disposition: form-data; name=\"endDate\"\r\n" + "Content-Type: text/plain\r\n\r\n" + "2020-02-22\r\n" + "---\r\n" + "Content-Disposition: form-data; name=\"frequency\"\r\n" + "Content-Type: text/plain\r\n\r\n" + "DAIL\r\n" + "---\r\n" + "Content-Disposition: form-data; name=\"dayOfExecution\"\r\n" + "Content-Type: text/plain\r\n\r\n" + "01\r\n" + "-----\r\n"; return new Response<>(200, responseHandler.apply(200, new ByteArrayInputStream(rawResponse.getBytes()), ResponseHeaders.fromMap(singletonMap("Content-Type", "multipart/form-data; boundary=-"))), null); }).when(httpClient).send(any(), any()); PeriodicPaymentInitiationMultipartBody expectedBody = new PeriodicPaymentInitiationMultipartBody(); expectedBody.setXml_sct("<xml>"); PeriodicPaymentInitiationXmlPart2StandingorderTypeJson json = new PeriodicPaymentInitiationXmlPart2StandingorderTypeJson(); json.setStartDate(LocalDate.of(2020, 2, 20)); json.setEndDate(LocalDate.of(2020, 2, 22)); json.setFrequency(FrequencyCode.DAILY); json.setDayOfExecution(DayOfExecution._1); expectedBody.setJson_standingorderType(json); Response<PeriodicPaymentInitiationMultipartBody> response = pis.getPeriodicPain001PaymentInformation(PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null); assertThat(response.getBody()).isEqualTo(expectedBody); } @Test void initiatePayment_xml() { doReturn(getResponse(new IngPaymentInitiationResponse())) .when(pia).initiatePaymentXml(any(), any(), any(), any(), anyList(), anyString()); pis.initiatePayment(PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, emptyRequestHeaders, null, "<test></test>"); verify(pia, times(1)) .initiatePaymentXml(any(), any(), any(), any(), anyList(), anyString()); verify(pia, never()).initiatePayment(any(), any(), any(), any(), anyList(), any()); } @Test void initiatePayment_periodicXml() { doReturn(getResponse(new IngPeriodicPaymentInitiationResponse())) .when(pia).initiatePeriodicPaymentXml(any(), any(), any(), any(), anyList(), any(IngPeriodicPaymentInitiationXml.class)); pis.initiatePayment(PERIODIC_PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, emptyRequestHeaders, null, new PeriodicPaymentInitiationMultipartBody()); verify(pia, times(1)) .initiatePeriodicPaymentXml(any(), any(), any(), any(), anyList(), any(IngPeriodicPaymentInitiationXml.class)); verify(pia, never()).initiatePeriodicPayment(any(), any(), any(), any(), anyList(), any()); } @Test void initiatePayment_unsupportedOperation() { assertThatThrownBy(() -> pis.initiatePayment(BULK_PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, emptyRequestHeaders, null, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void getSinglePaymentInformation() { doReturn(getResponse(new IngPaymentInstruction())) .when(pia).getPaymentDetails(any(), anyString(), any(), any(), anyList()); pis.getSinglePaymentInformation(SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null); verify(pia, times(1)) .getPaymentDetails(any(), anyString(), any(), any(), anyList()); } @Test void getPeriodicPaymentInformation() { doReturn(getResponse(new IngPeriodicPaymentInitiationJson())) .when(pia).getPeriodicPaymentDetails(any(), anyString(), any(), any(), anyList()); pis.getPeriodicPaymentInformation(SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null); verify(pia, times(1)) .getPeriodicPaymentDetails(any(), anyString(), any(), any(), anyList()); } @Test void getPaymentInformationAsString_paymentsXml() { doReturn(getResponse("<response></response>")) .when(pia).getPaymentDetailsXml(any(), anyString(), any(), any(), anyList()); pis.getPaymentInformationAsString(PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null); verify(pia, times(1)) .getPaymentDetailsXml(any(), anyString(), any(), any(), anyList()); verify(pia, never()) .getPaymentDetails(any(), anyString(), any(), any(), anyList()); } @Test void getPaymentInformationAsString_periodicPaymentsXml() { doReturn(getResponse(new IngPeriodicPaymentInitiationXml())) .when(pia).getPeriodicPaymentDetailsXml(any(), anyString(), any(), any(), anyList()); pis.getPaymentInformationAsString(PERIODIC_PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null); verify(pia, times(1)) .getPeriodicPaymentDetailsXml(any(), anyString(), any(), any(), anyList()); verify(pia, never()) .getPeriodicPaymentDetails(any(), anyString(), any(), any(), anyList()); } @Test void getPaymentInformationAsString_unsupportedOperation() { assertThatThrownBy(() -> pis.getPaymentInformationAsString(BULK_PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void getPaymentInitiationScaStatus() { assertThatThrownBy(() -> pis.getPaymentInitiationScaStatus(PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, "authorisation-id", emptyRequestHeaders, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void getPaymentInitiationStatus_unsupportedOperation() { assertThatThrownBy(() -> pis.getPaymentInitiationStatus(BULK_PAYMENTS, SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void getPaymentInitiationStatusAsString_paymentsXml() { doReturn(getResponse("<response></response>")) .when(pia).getPaymentStatusXml(any(), anyString(), any(), any(), anyList()); pis.getPaymentInitiationStatusAsString(PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null); verify(pia, times(1)) .getPaymentStatusXml(any(), anyString(), any(), any(), anyList()); verify(pia, never()) .getPaymentStatus(any(), anyString(), any(), any(), anyList()); } @Test void getPaymentInitiationStatusAsString_periodicPaymentsXml() { doReturn(getResponse("<response></response>")) .when(pia).getPeriodicPaymentStatusXml(any(), anyString(), any(), any(), anyList()); pis.getPaymentInitiationStatusAsString(PERIODIC_PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null); verify(pia, times(1)) .getPeriodicPaymentStatusXml(any(), anyString(), any(), any(), anyList()); verify(pia, never()) .getPeriodicPaymentStatus(any(), anyString(), any(), any(), anyList()); } @Test void getPaymentInitiationStatusAsString_unsupportedOperation() { assertThatThrownBy(() -> pis.getPaymentInitiationStatusAsString(BULK_PAYMENTS, SEPA_CREDIT_TRANSFERS, PAYMENT_ID, emptyRequestHeaders, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void getPaymentInitiationAuthorisation() { assertThatThrownBy(() -> pis.getPaymentInitiationAuthorisation(null, null, null, null, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void startPaymentAuthorisation() { assertThatThrownBy(() -> pis.startPaymentAuthorisation(null, null, null, null, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void startPaymentAuthorisation_withPsuAuthentication() { assertThatThrownBy(() -> pis.startPaymentAuthorisation(null, null, null, null, null, null)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void updatePaymentPsuData_selectScaMethod() { SelectPsuAuthenticationMethod body = new SelectPsuAuthenticationMethod(); assertThatThrownBy(() -> pis.updatePaymentPsuData(null, null, null, null, null, null, body)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void updatePaymentPsuData_authoriseTransaction() { TransactionAuthorisation body = new TransactionAuthorisation(); assertThatThrownBy(() -> pis.updatePaymentPsuData(null, null, null, null, null, null, body)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } @Test void updatePaymentPsuData_updatePsuAuthentication() { UpdatePsuAuthentication body = new UpdatePsuAuthentication(); assertThatThrownBy(() -> pis.updatePaymentPsuData(null, null, null, null, null, null, body)) .isInstanceOf(UnsupportedOperationException.class); verifyNoInteractions(pia); } private <T> Response<T> getResponse(T body) { return new Response<>(200, body, emptyResponseHeaders); } }
14,814
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountInformationApiTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngAccountInformationApiTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.Request; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import static java.util.Collections.emptyList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; class IngAccountInformationApiTest { private static final String RESOURCE_ID = "resourceId"; private static final String BALANCES = "%s/v3/accounts/%s/balances"; private static final String CARD_ACCOUNTS = "%s/v1/card-accounts/%s/transactions"; private static final String BASE_URI = "https://base.uri"; private static final String REQUEST_ID = "requestId"; private IngAccountInformationApi accountInformationApi; private final HttpClient httpClient = mock(HttpClient.class); private final Request.Builder builder = mock(Request.Builder.class); private final ArgumentCaptor<String> uriCaptor = ArgumentCaptor.forClass(String.class); @BeforeEach void setUp() { accountInformationApi = new IngAccountInformationApi(BASE_URI, httpClient, null); when(httpClient.get(anyString())).thenReturn(builder); when(builder.header(any(), any())).thenReturn(builder); } @Test void getBalances() { String expectedUri = String.format(BALANCES, BASE_URI, RESOURCE_ID); accountInformationApi.getBalances(RESOURCE_ID, emptyList(), null, REQUEST_ID, emptyList()); verifyInvocations(); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); } @Test void getCardAccountTransactions() { String expectedUri = String.format(CARD_ACCOUNTS, BASE_URI, RESOURCE_ID); accountInformationApi.getCardAccountTransactions(RESOURCE_ID, null, null, null, REQUEST_ID, emptyList()); verifyInvocations(); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); } private void verifyInvocations() { verify(httpClient, times(1)).get(uriCaptor.capture()); verify(builder, times(1)).header(anyString(), anyString()); verify(builder, times(1)).send(any(), anyList()); } }
3,131
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngMapperTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngMapperTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.ing.model.*; import org.junit.jupiter.api.Test; import org.mapstruct.factory.Mappers; import java.time.LocalDate; import java.time.LocalTime; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; class IngMapperTest { private static final String END_TO_END_IDENTIFICATION = "end-to-end id"; private static final String DEBTOR_IBAN = "debtor iban"; private static final String CURRENCY = "currency"; private static final String AMOUNT = "amount"; private static final String CREDITOR_IBAN = "creditor iban"; private static final String CREDITOR_AGENT = "creditor agent"; private static final String CREDITOR_NAME = "creditor name"; private static final String STREET = "street"; private static final String BUILDING_NUMBER = "building number"; private static final String CITY = "city"; private static final String POSTAL_CODE = "post code"; private static final String COUNTRY = "country"; private static final String REMITTANCE_INFORMATION_UNSTRUCTURED = "remit info unstr"; private static final LocalDate START_DATE = LocalDate.of(2020, 2, 20); private static final LocalDate END_DATE = LocalDate.of(2020, 2, 22); private static final OffsetDateTime LAST_CHANGE_DATE_TIME = OffsetDateTime.of(END_DATE, LocalTime.of(20, 20), ZoneOffset.UTC); private static final String PAYMENT_ID = "payment id"; private static final String XML = "xml"; private static final String TRANSACTION_ID = "transaction id"; private static final String END_TO_END_ID = "end-to-end id"; private static final String DEBTOR_NAME = "debtor name"; private static final String REFERENCE = "reference"; private static final String REFERENCE_TYPE = "reference type"; private static final String REFERENCE_ISSUER = "reference issuer"; private static final UUID RESOURCE_ID = UUID.randomUUID(); private static final String PRODUCT = "product"; private final IngMapper mapper = Mappers.getMapper(IngMapper.class); @Test void mapPeriodicPaymentInitiationJson() { PeriodicPaymentInitiationJson value = new PeriodicPaymentInitiationJson(); value.setEndToEndIdentification(END_TO_END_IDENTIFICATION); value.setDebtorAccount(debtorAccount()); value.setInstructedAmount(amount()); value.setCreditorAccount(creditorAccount()); value.setCreditorAgent(CREDITOR_AGENT); value.setCreditorName(CREDITOR_NAME); value.setCreditorAddress(creditorAddress()); value.setRemittanceInformationUnstructured(REMITTANCE_INFORMATION_UNSTRUCTURED); value.setStartDate(START_DATE); value.setEndDate(END_DATE); value.setExecutionRule(ExecutionRule.FOLLOWING); value.setFrequency(FrequencyCode.DAILY); value.setDayOfExecution(DayOfExecution._1); IngPeriodicPaymentInitiationJson mapped = mapper.map(value); assertThat(mapped.getEndToEndIdentification()).isEqualTo(END_TO_END_IDENTIFICATION); assertThat(mapped.getDebtorAccount().getIban()).isEqualTo(DEBTOR_IBAN); assertThat(mapped.getDebtorAccount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getInstructedAmount().getAmount()).isEqualTo(AMOUNT); assertThat(mapped.getInstructedAmount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getCreditorAccount().getIban()).isEqualTo(CREDITOR_IBAN); assertThat(mapped.getCreditorAccount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getCreditorAgent()).isEqualTo(CREDITOR_AGENT); assertThat(mapped.getCreditorName()).isEqualTo(CREDITOR_NAME); assertThat(mapped.getCreditorAddress().getStreet()).isEqualTo(STREET); assertThat(mapped.getCreditorAddress().getBuildingNumber()).isEqualTo(BUILDING_NUMBER); assertThat(mapped.getCreditorAddress().getCity()).isEqualTo(CITY); assertThat(mapped.getCreditorAddress().getPostalCode()).isEqualTo(POSTAL_CODE); assertThat(mapped.getCreditorAddress().getCountry()).isEqualTo(COUNTRY); assertThat(mapped.getRemittanceInformationUnstructured()).isEqualTo(REMITTANCE_INFORMATION_UNSTRUCTURED); assertThat(mapped.getStartDate()).isEqualTo(START_DATE); assertThat(mapped.getEndDate()).isEqualTo(END_DATE); assertThat(mapped.getFrequency()).isEqualTo(IngFrequencyCode.DAIL); assertThat(mapped.getDayOfExecution()).isEqualTo(IngDayOfExecution._1); } private AccountReference debtorAccount() { AccountReference debtorAccount = new AccountReference(); debtorAccount.setIban(DEBTOR_IBAN); debtorAccount.setCurrency(CURRENCY); return debtorAccount; } private Amount amount() { Amount instructedAmount = new Amount(); instructedAmount.setAmount(AMOUNT); instructedAmount.setCurrency(CURRENCY); return instructedAmount; } private AccountReference creditorAccount() { AccountReference creditorAccount = new AccountReference(); creditorAccount.setIban(CREDITOR_IBAN); creditorAccount.setCurrency(CURRENCY); return creditorAccount; } private Address creditorAddress() { Address creditorAddress = new Address(); creditorAddress.setStreetName(STREET); creditorAddress.setBuildingNumber(BUILDING_NUMBER); creditorAddress.setTownName(CITY); creditorAddress.setPostCode(POSTAL_CODE); creditorAddress.setCountry(COUNTRY); return creditorAddress; } @Test void mapIngPeriodicPaymentInitiationJson() { IngPeriodicPaymentInitiationJson value = new IngPeriodicPaymentInitiationJson(); value.setEndToEndIdentification(END_TO_END_IDENTIFICATION); value.setDebtorAccount(ingDebtorAccount()); value.setInstructedAmount(ingAmount()); value.setCreditorAccount(ingCreditorAccount()); value.setCreditorAgent(CREDITOR_AGENT); value.setCreditorName(CREDITOR_NAME); value.setCreditorAddress(ingCreditorAddress()); value.setRemittanceInformationUnstructured(REMITTANCE_INFORMATION_UNSTRUCTURED); value.setStartDate(START_DATE); value.setEndDate(END_DATE); value.setFrequency(IngFrequencyCode.MNTH); value.setDayOfExecution(IngDayOfExecution._2); PeriodicPaymentInitiationWithStatusResponse mapped = mapper.map(value); assertThat(mapped.getEndToEndIdentification()).isEqualTo(END_TO_END_IDENTIFICATION); assertThat(mapped.getDebtorAccount().getIban()).isEqualTo(DEBTOR_IBAN); assertThat(mapped.getDebtorAccount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getInstructedAmount().getAmount()).isEqualTo(AMOUNT); assertThat(mapped.getInstructedAmount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getCreditorAccount().getIban()).isEqualTo(CREDITOR_IBAN); assertThat(mapped.getCreditorAccount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getCreditorAgent()).isEqualTo(CREDITOR_AGENT); assertThat(mapped.getCreditorName()).isEqualTo(CREDITOR_NAME); assertThat(mapped.getCreditorAddress()).isEqualTo(creditorAddress()); assertThat(mapped.getRemittanceInformationUnstructured()).isEqualTo(REMITTANCE_INFORMATION_UNSTRUCTURED); assertThat(mapped.getStartDate()).isEqualTo(START_DATE); assertThat(mapped.getEndDate()).isEqualTo(END_DATE); assertThat(mapped.getFrequency()).isEqualTo(FrequencyCode.MONTHLY); assertThat(mapped.getDayOfExecution()).isEqualTo(DayOfExecution._2); } private IngDebtorAccount ingDebtorAccount() { IngDebtorAccount ingDebtorAccount = new IngDebtorAccount(); ingDebtorAccount.setCurrency(CURRENCY); ingDebtorAccount.setIban(DEBTOR_IBAN); return ingDebtorAccount; } private IngAmount ingAmount() { IngAmount ingInstructedAmount = new IngAmount(); ingInstructedAmount.setAmount(AMOUNT); ingInstructedAmount.setCurrency(CURRENCY); return ingInstructedAmount; } private IngCreditorAccount ingCreditorAccount() { IngCreditorAccount ingCreditorAccount = new IngCreditorAccount(); ingCreditorAccount.setIban(CREDITOR_IBAN); ingCreditorAccount.setCurrency(CURRENCY); return ingCreditorAccount; } private IngAddress ingCreditorAddress() { IngAddress ingCreditorAddress = new IngAddress(); ingCreditorAddress.setBuildingNumber(BUILDING_NUMBER); ingCreditorAddress.setCity(CITY); ingCreditorAddress.setStreet(STREET); ingCreditorAddress.setCountry(COUNTRY); ingCreditorAddress.setPostalCode(POSTAL_CODE); return ingCreditorAddress; } @Test void mapIngPeriodicPaymentInitiationResponse() { IngPeriodicPaymentInitiationResponse value = new IngPeriodicPaymentInitiationResponse(); value.setTransactionStatus("RCVD"); value.setPaymentId(PAYMENT_ID); value.setLinks(ingPeriodicLinks()); PaymentInitationRequestResponse201 mapped = mapper.map(value); assertThat(mapped.getPaymentId()).isEqualTo(PAYMENT_ID); assertThat(mapped.getTransactionStatus()).isEqualTo(TransactionStatus.RCVD); assertThat(mapped.getLinks().get("self").getHref()).isEqualTo("self href"); assertThat(mapped.getLinks().get("status").getHref()).isEqualTo("status href"); assertThat(mapped.getLinks().get("scaRedirect").getHref()).isEqualTo("sca redirect href"); assertThat(mapped.getLinks().get("delete").getHref()).isEqualTo("delete href"); } private IngPeriodicLinks ingPeriodicLinks() { IngPeriodicLinks ingPeriodicLinks = new IngPeriodicLinks(); ingPeriodicLinks.setSelf("self href"); ingPeriodicLinks.setStatus("status href"); ingPeriodicLinks.setScaRedirect("sca redirect href"); ingPeriodicLinks.setDelete("delete href"); return ingPeriodicLinks; } @Test void mapPeriodicPaymentInitiationMultipartBody() { PeriodicPaymentInitiationMultipartBody value = new PeriodicPaymentInitiationMultipartBody(); value.setXml_sct(XML); value.setJson_standingorderType(jsonStandingOrderType()); IngPeriodicPaymentInitiationXml mapped = mapper.map(value); assertThat(mapped.getXml_sct()).isEqualTo(XML); assertThat(mapped.getStartDate()).isEqualTo(START_DATE); assertThat(mapped.getEndDate()).isEqualTo(END_DATE); assertThat(mapped.getFrequency()).isEqualTo(IngFrequencyCode.WEEK); assertThat(mapped.getDayOfExecution()).isEqualTo(IngDayOfExecution._3); } private PeriodicPaymentInitiationXmlPart2StandingorderTypeJson jsonStandingOrderType() { PeriodicPaymentInitiationXmlPart2StandingorderTypeJson jsonStandingOrderType = new PeriodicPaymentInitiationXmlPart2StandingorderTypeJson(); jsonStandingOrderType.setStartDate(START_DATE); jsonStandingOrderType.setEndDate(END_DATE); jsonStandingOrderType.setFrequency(FrequencyCode.WEEKLY); jsonStandingOrderType.setDayOfExecution(DayOfExecution._3); return jsonStandingOrderType; } @Test void mapIngPeriodicPaymentInitiationXml() { IngPeriodicPaymentInitiationXml value = new IngPeriodicPaymentInitiationXml(); value.setXml_sct(XML); value.setStartDate(START_DATE); value.setEndDate(END_DATE); value.setFrequency(IngFrequencyCode.WEEK); value.setDayOfExecution(IngDayOfExecution._3); PeriodicPaymentInitiationMultipartBody mapped = mapper.map(value); assertThat(mapped.getXml_sct()).isEqualTo(XML); assertThat(mapped.getJson_standingorderType()).isEqualTo(jsonStandingOrderType()); } @Test void mapIngPaymentAgreementStatusResponse() { IngPaymentAgreementStatusResponse value = new IngPaymentAgreementStatusResponse(); value.setTransactionStatus(IngPaymentAgreementStatusResponse.TransactionStatus.RCVD); PaymentInitiationStatusResponse200Json mapped = mapper.map(value); assertThat(mapped.getTransactionStatus()).isEqualTo(TransactionStatus.RCVD); } @Test void mapIngPaymentStatusResponse() { IngPaymentStatusResponse value = new IngPaymentStatusResponse(); value.setTransactionStatus("RCVD"); PaymentInitiationStatusResponse200Json mapped = mapper.map(value); assertThat(mapped.getTransactionStatus()).isEqualTo(TransactionStatus.RCVD); } @Test void mapIngPaymentInstruction() { IngPaymentInstruction value = new IngPaymentInstruction(); value.setEndToEndIdentification(END_TO_END_IDENTIFICATION); value.setDebtorAccount(ingDebtorAccount()); value.setInstructedAmount(ingAmount()); value.setCreditorAccount(ingCreditorAccount()); value.setCreditorName(CREDITOR_NAME); value.setCreditorAddress(ingCreditorAddress()); value.setRemittanceInformationUnstructured(REMITTANCE_INFORMATION_UNSTRUCTURED); PaymentInitiationWithStatusResponse mapped = mapper.map(value); assertThat(mapped.getEndToEndIdentification()).isEqualTo(END_TO_END_IDENTIFICATION); assertThat(mapped.getDebtorAccount()).isEqualTo(debtorAccount()); assertThat(mapped.getInstructedAmount()).isEqualTo(amount()); assertThat(mapped.getCreditorAccount()).isEqualTo(creditorAccount()); assertThat(mapped.getCreditorName()).isEqualTo(CREDITOR_NAME); assertThat(mapped.getCreditorAddress()).isEqualTo(creditorAddress()); assertThat(mapped.getRemittanceInformationUnstructured()).isEqualTo(REMITTANCE_INFORMATION_UNSTRUCTURED); } @Test void mapIngPaymentInitiationResponse() { IngPaymentInitiationResponse value = new IngPaymentInitiationResponse(); value.setTransactionStatus("RCVD"); value.setPaymentId(PAYMENT_ID); value.setLinks(ingLinks()); value.setTppMessages(Collections.singletonList(ingTppMessage())); PaymentInitationRequestResponse201 mapped = mapper.map(value); assertThat(mapped.getTransactionStatus()).isEqualTo(TransactionStatus.RCVD); assertThat(mapped.getPaymentId()).isEqualTo(PAYMENT_ID); assertThat(mapped.getLinks().get("delete").getHref()).isEqualTo("delete href"); assertThat(mapped.getLinks().get("scaRedirect").getHref()).isEqualTo("sca redirect href"); assertThat(mapped.getLinks().get("self").getHref()).isEqualTo("self href"); assertThat(mapped.getLinks().get("status").getHref()).isEqualTo("status href"); assertThat(mapped.getTppMessages().get(0)).isEqualTo(tppMessage()); } private IngLinks ingLinks() { IngLinks ingLinks = new IngLinks(); ingLinks.setDelete("delete href"); ingLinks.setScaRedirect("sca redirect href"); ingLinks.setSelf("self href"); ingLinks.setStatus("status href"); return ingLinks; } private IngTppMessage ingTppMessage() { IngTppMessage ingTppMessage = new IngTppMessage(); ingTppMessage.setCategory("WARNING"); ingTppMessage.setCode("WARNING"); ingTppMessage.setPath("path"); ingTppMessage.setText("text"); return ingTppMessage; } private TppMessage201PaymentInitiation tppMessage() { TppMessage201PaymentInitiation tppMessage = new TppMessage201PaymentInitiation(); tppMessage.setCategory(TppMessageCategory.WARNING); tppMessage.setCode(MessageCode201PaymentInitiation.WARNING); tppMessage.setPath("path"); tppMessage.setText("text"); return tppMessage; } @Test void mapPaymentInitiationJson() { PaymentInitiationJson value = new PaymentInitiationJson(); value.setEndToEndIdentification(END_TO_END_IDENTIFICATION); value.setDebtorAccount(debtorAccount()); value.setInstructedAmount(amount()); value.setCreditorAccount(creditorAccount()); value.setCreditorName(CREDITOR_NAME); value.setCreditorAddress(creditorAddress()); value.setRemittanceInformationUnstructured(REMITTANCE_INFORMATION_UNSTRUCTURED); IngPaymentInstruction mapped = mapper.map(value); assertThat(mapped.getEndToEndIdentification()).isEqualTo(END_TO_END_IDENTIFICATION); assertThat(mapped.getDebtorAccount().getIban()).isEqualTo(DEBTOR_IBAN); assertThat(mapped.getDebtorAccount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getInstructedAmount().getAmount()).isEqualTo(AMOUNT); assertThat(mapped.getInstructedAmount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getCreditorAccount().getIban()).isEqualTo(CREDITOR_IBAN); assertThat(mapped.getCreditorAccount().getCurrency()).isEqualTo(CURRENCY); assertThat(mapped.getCreditorName()).isEqualTo(CREDITOR_NAME); assertThat(mapped.getCreditorAddress().getCountry()).isEqualTo(COUNTRY); assertThat(mapped.getCreditorAddress().getCity()).isEqualTo(CITY); assertThat(mapped.getCreditorAddress().getPostalCode()).isEqualTo(POSTAL_CODE); assertThat(mapped.getCreditorAddress().getStreet()).isEqualTo(STREET); assertThat(mapped.getCreditorAddress().getBuildingNumber()).isEqualTo(BUILDING_NUMBER); assertThat(mapped.getRemittanceInformationUnstructured()).isEqualTo(REMITTANCE_INFORMATION_UNSTRUCTURED); } @Test void mapIngTransactionsResponse() { IngTransactionsResponse value = new IngTransactionsResponse(); value.setAccount(ingAccountReference()); value.setTransactions(ingTransactions()); TransactionsResponse200Json mapped = mapper.map(value); assertThat(mapped.getAccount()).isEqualTo(creditorAccount()); assertThat(mapped.getTransactions()).isEqualTo(transactions()); } private IngAccountReferenceIban ingAccountReference() { IngAccountReferenceIban ingAccount = new IngAccountReferenceIban(); ingAccount.setIban(CREDITOR_IBAN); ingAccount.setCurrency(CURRENCY); return ingAccount; } private IngTransactions ingTransactions() { IngTransactions ingTransactions = new IngTransactions(); ingTransactions.setBooked(Collections.singletonList(ingTransaction())); ingTransactions.setPending(Collections.singletonList(ingTransaction())); ingTransactions.setLinks(ingLinksNext()); return ingTransactions; } private IngTransaction ingTransaction() { IngTransaction ingTransaction = new IngTransaction(); ingTransaction.setTransactionId(TRANSACTION_ID); ingTransaction.setEndToEndId(END_TO_END_ID); ingTransaction.setBookingDate(START_DATE); ingTransaction.setValueDate(END_DATE); ingTransaction.setTransactionAmount(ingAmount()); ingTransaction.setCreditorName(CREDITOR_NAME); ingTransaction.setCreditorAccount(ingCreditorCounterpartyAccount()); ingTransaction.setDebtorName(DEBTOR_NAME); ingTransaction.setDebtorAccount(ingDebtorCounterpartyAccount()); ingTransaction.setRemittanceInformationUnstructured(REMITTANCE_INFORMATION_UNSTRUCTURED); ingTransaction.setRemittanceInformationStructured(ingRemittanceInformationStructured()); return ingTransaction; } private IngCounterpartyAccount ingCreditorCounterpartyAccount() { IngCounterpartyAccount ingCreditorCounterpartyAccount = new IngCounterpartyAccount(); ingCreditorCounterpartyAccount.setIban(CREDITOR_IBAN); return ingCreditorCounterpartyAccount; } private IngCounterpartyAccount ingDebtorCounterpartyAccount() { IngCounterpartyAccount ingDebtorCounterpartyAccount = new IngCounterpartyAccount(); ingDebtorCounterpartyAccount.setIban(DEBTOR_IBAN); return ingDebtorCounterpartyAccount; } private IngTransactionRemittanceInformationStructured ingRemittanceInformationStructured() { IngTransactionRemittanceInformationStructured ingRemittanceInformationStructured = new IngTransactionRemittanceInformationStructured(); ingRemittanceInformationStructured.setReference(REFERENCE); ingRemittanceInformationStructured.setReferenceIssuer(REFERENCE_ISSUER); ingRemittanceInformationStructured.setReferenceType(REFERENCE_TYPE); return ingRemittanceInformationStructured; } private IngLinksNext ingLinksNext() { IngLinksNext ingLinksNext = new IngLinksNext(); ingLinksNext.setNext(ingHrefType("next href")); return ingLinksNext; } private IngHrefType ingHrefType(String href) { IngHrefType ingHrefType = new IngHrefType(); ingHrefType.setHref(href); return ingHrefType; } private AccountReport transactions() { AccountReport transaction = new AccountReport(); transaction.setBooked(Collections.singletonList(transaction())); transaction.setPending(Collections.singletonList(transaction())); transaction.setLinks(Collections.singletonMap("next", hrefType("next href"))); return transaction; } private HrefType hrefType(String href) { HrefType hrefType = new HrefType(); hrefType.setHref(href); return hrefType; } private Transactions transaction() { Transactions transaction = new Transactions(); transaction.setTransactionId(TRANSACTION_ID); transaction.setEndToEndId(END_TO_END_ID); transaction.setBookingDate(START_DATE); transaction.setValueDate(END_DATE); transaction.setTransactionAmount(amount()); transaction.setCreditorName(CREDITOR_NAME); transaction.setCreditorAccount(transactionCreditorAccount()); transaction.setDebtorName(DEBTOR_NAME); transaction.setDebtorAccount(transactionDebtorAccount()); transaction.setRemittanceInformationUnstructured(REMITTANCE_INFORMATION_UNSTRUCTURED); transaction.setRemittanceInformationStructured(REFERENCE); return transaction; } private AccountReference transactionCreditorAccount() { AccountReference transactionCreditorAccount = new AccountReference(); transactionCreditorAccount.setIban(CREDITOR_IBAN); return transactionCreditorAccount; } private AccountReference transactionDebtorAccount() { AccountReference transactionDebtorAccount = new AccountReference(); transactionDebtorAccount.setIban(DEBTOR_IBAN); return transactionDebtorAccount; } private RemittanceInformationStructured remittanceInformationStructured() { RemittanceInformationStructured remittanceInformationStructured = new RemittanceInformationStructured(); remittanceInformationStructured.setReference(REFERENCE); remittanceInformationStructured.setReferenceType(REFERENCE_TYPE); remittanceInformationStructured.setReferenceIssuer(REFERENCE_ISSUER); return remittanceInformationStructured; } @Test void mapIngBalancesResponse() { IngBalancesResponse value = new IngBalancesResponse(); value.setAccount(ingAccountReference()); value.setBalances(Collections.singletonList(ingBalance())); ReadAccountBalanceResponse200 mapped = mapper.map(value); assertThat(mapped.getAccount()).isEqualTo(creditorAccount()); assertThat(mapped.getBalances()).containsExactly(balance()); } private IngBalance ingBalance() { IngBalance ingBalance = new IngBalance(); ingBalance.setBalanceType("closingBooked"); ingBalance.setBalanceAmount(ingAmount()); ingBalance.setLastChangeDateTime(LAST_CHANGE_DATE_TIME); ingBalance.setReferenceDate(END_DATE); return ingBalance; } private Balance balance() { Balance balance = new Balance(); balance.setBalanceType(BalanceType.CLOSINGBOOKED); balance.setBalanceAmount(amount()); balance.setLastChangeDateTime(LAST_CHANGE_DATE_TIME); balance.setReferenceDate(END_DATE); return balance; } @Test void mapIngAccountsResponse() { IngAccountsResponse value = new IngAccountsResponse(); value.setAccounts(Collections.singletonList(ingAccount())); AccountList mapped = mapper.map(value); assertThat(mapped.getAccounts()).containsExactly(account()); } private IngAccount ingAccount() { IngAccount ingAccount = new IngAccount(); ingAccount.setResourceId(RESOURCE_ID); ingAccount.setIban(CREDITOR_IBAN); ingAccount.setName(CREDITOR_NAME); ingAccount.setCurrency(CURRENCY); ingAccount.setProduct(PRODUCT); ingAccount.setLinks(ingAccountLinks()); return ingAccount; } private IngAccountLinks ingAccountLinks() { IngAccountLinks ingAccountLinks = new IngAccountLinks(); ingAccountLinks.setBalances(ingHrefType("balances href")); ingAccountLinks.setTransactions(ingHrefType("transactions href")); return ingAccountLinks; } private AccountDetails account() { AccountDetails account = new AccountDetails(); account.setResourceId(RESOURCE_ID.toString()); account.setIban(CREDITOR_IBAN); account.setName(CREDITOR_NAME); account.setCurrency(CURRENCY); account.setProduct(PRODUCT); Map<String, HrefType> links = new HashMap<>(); links.put("balances", hrefType("balances href")); links.put("transactions", hrefType("transactions href")); account.setLinks(links); return account; } @Test void toTransactionStatus() { assertAll( () -> assertThat(mapper.toTransactionStatus("ACTV")).isEqualTo(TransactionStatus.ACSP), () -> assertThat(mapper.toTransactionStatus("EXPI")).isEqualTo(TransactionStatus.ACSC) ); } }
27,175
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngClientAuthenticationFactoryTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngClientAuthenticationFactoryTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore; import de.adorsys.xs2a.adapter.api.exception.Xs2aAdapterException; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import static org.assertj.core.api.Assertions.assertThatThrownBy; class IngClientAuthenticationFactoryTest { @Test void getClientAuthenticationFactory() throws UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException { Pkcs12KeyStore keyStore = Mockito.mock(Pkcs12KeyStore.class); Mockito.when(keyStore.getQsealPrivateKey(Mockito.any())).thenThrow(new KeyStoreException()); assertThatThrownBy(() -> IngClientAuthenticationFactory.getClientAuthenticationFactory(keyStore)) .isInstanceOf(Xs2aAdapterException.class); } }
1,770
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentInitiationApiTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngPaymentInitiationApiTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.api.http.Request; import de.adorsys.xs2a.adapter.impl.http.StringUri; import de.adorsys.xs2a.adapter.ing.model.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Collections; import java.util.List; import static de.adorsys.xs2a.adapter.ing.IngPaymentInitiationApi.*; import static de.adorsys.xs2a.adapter.ing.model.IngPaymentProduct.SEPA_CREDIT_TRANSFERS; import static de.adorsys.xs2a.adapter.ing.model.IngXmlPaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class IngPaymentInitiationApiTest { private static final ResponseHeaders emptyResponseHeaders = ResponseHeaders.emptyResponseHeaders(); private static final String PAYMENT_ID = "paymentId"; private static final String REQUEST_ID = "requestId"; private static final String PSU_IP_ADDRESS = "0.0.0.0"; private static final List<Interceptor> INTERCEPTORS = Collections.emptyList(); private static final String TPP_REDIRECT_URI = "https://redirect.uri"; private IngPaymentInitiationApi paymentInitiationApi; @Mock private HttpClient httpClient; @Mock private Request.Builder builder; @Captor private ArgumentCaptor<String> uriCaptor; private final String baseUrl = "https://url.base"; @BeforeEach void setUp() { paymentInitiationApi = new IngPaymentInitiationApi(baseUrl, httpClient, null); } @Test void getPaymentDetails() { String expectedUri = StringUri.fromElements(baseUrl, PAYMENTS, SEPA_CREDIT_TRANSFERS, PAYMENT_ID); when(httpClient.get(expectedUri)).thenReturn(builder); when(builder.header(anyString(), anyString())).thenReturn(builder); when(builder.send(any(), anyList())).thenReturn(getResponse(new IngPaymentInstruction())); Response<IngPaymentInstruction> actualResponse = paymentInitiationApi.getPaymentDetails(SEPA_CREDIT_TRANSFERS, PAYMENT_ID, REQUEST_ID, PSU_IP_ADDRESS, INTERCEPTORS); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(builder, times(2)).header(anyString(), anyString()); verify(builder, times(1)).send(any(), anyList()); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); assertThat(actualResponse) .isNotNull() .matches(r -> r.getStatusCode() == 200); } @Test void initiatePaymentXml() { String expectedUri = StringUri.fromElements(baseUrl, PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS); final String body = "<test></test>"; when(httpClient.post(expectedUri)).thenReturn(builder); when(builder.header(anyString(), anyString())).thenReturn(builder); when(builder.xmlBody(anyString())).thenReturn(builder); when(builder.send(any(), anyList())).thenReturn(getResponse(new IngPaymentInitiationResponse())); Response<IngPaymentInitiationResponse> actualResponse = paymentInitiationApi.initiatePaymentXml(PAIN_001_SEPA_CREDIT_TRANSFERS, REQUEST_ID, TPP_REDIRECT_URI, PSU_IP_ADDRESS, INTERCEPTORS, body); verify(httpClient, times(1)).post(uriCaptor.capture()); verify(builder, times(3)).header(anyString(), anyString()); verify(builder, times(1)).xmlBody(anyString()); verify(builder, times(1)).send(any(), anyList()); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); assertThat(actualResponse) .isNotNull() .matches(r -> r.getStatusCode() == 200); } @Test void getPaymentDetailsXml() { String expectedUri = StringUri.fromElements(baseUrl, PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID); when(httpClient.get(expectedUri)).thenReturn(builder); when(builder.header(anyString(), anyString())).thenReturn(builder); when(builder.send(any(), anyList())).thenReturn(getResponse("<response></response>")); Response<String> actualResponse = paymentInitiationApi.getPaymentDetailsXml(PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, REQUEST_ID, PSU_IP_ADDRESS, INTERCEPTORS); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(builder, times(2)).header(anyString(), anyString()); verify(builder, times(1)).send(any(), anyList()); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); assertThat(actualResponse) .isNotNull() .matches(r -> r.getStatusCode() == 200); } @Test void getPaymentStatusXml() { String expectedUri = StringUri.fromElements(baseUrl, PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, STATUS); when(httpClient.get(expectedUri)).thenReturn(builder); when(builder.header(anyString(), anyString())).thenReturn(builder); when(builder.send(any(), anyList())).thenReturn(getResponse("<response></response>")); Response<String> actualResponse = paymentInitiationApi.getPaymentStatusXml(PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, REQUEST_ID, PSU_IP_ADDRESS, INTERCEPTORS); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(builder, times(2)).header(anyString(), anyString()); verify(builder, times(1)).send(any(), anyList()); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); assertThat(actualResponse) .isNotNull() .matches(r -> r.getStatusCode() == 200); } @Test void getPeriodicPaymentDetails() { String expectedUri = StringUri.fromElements(baseUrl, PERIODIC_PAYMENTS, SEPA_CREDIT_TRANSFERS, PAYMENT_ID); when(httpClient.get(expectedUri)).thenReturn(builder); when(builder.header(anyString(), anyString())).thenReturn(builder); when(builder.send(any(), anyList())).thenReturn(getResponse(new IngPeriodicPaymentInitiationJson())); Response<IngPeriodicPaymentInitiationJson> actualResponse = paymentInitiationApi.getPeriodicPaymentDetails(SEPA_CREDIT_TRANSFERS, PAYMENT_ID, REQUEST_ID, PSU_IP_ADDRESS, INTERCEPTORS); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(builder, times(2)).header(anyString(), anyString()); verify(builder, times(1)).send(any(), anyList()); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); assertThat(actualResponse) .isNotNull() .matches(r -> r.getStatusCode() == 200); } @Test void initiatePeriodicPaymentXml() { String expectedUri = StringUri.fromElements(baseUrl, PERIODIC_PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS); final IngPeriodicPaymentInitiationXml body = new IngPeriodicPaymentInitiationXml(); when(httpClient.post(expectedUri)).thenReturn(builder); when(builder.header(anyString(), anyString())).thenReturn(builder); when(builder.addXmlPart(anyString(), any())).thenReturn(builder); when(builder.addPlainTextPart(anyString(), any())).thenReturn(builder); when(builder.send(any(), anyList())).thenReturn(getResponse(new IngPeriodicPaymentInitiationResponse())); Response<IngPeriodicPaymentInitiationResponse> actualResponse = paymentInitiationApi.initiatePeriodicPaymentXml(PAIN_001_SEPA_CREDIT_TRANSFERS, REQUEST_ID, TPP_REDIRECT_URI, PSU_IP_ADDRESS, INTERCEPTORS, body); verify(httpClient, times(1)).post(uriCaptor.capture()); verify(builder, times(3)).header(anyString(), anyString()); verify(builder, times(1)).addXmlPart(anyString(), any()); verify(builder, times(4)).addPlainTextPart(anyString(), any()); verify(builder, times(1)).send(any(), anyList()); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); assertThat(actualResponse) .isNotNull() .matches(r -> r.getStatusCode() == 200); } @Test void getPeriodicPaymentStatusXml() { String expectedUri = StringUri.fromElements(baseUrl, PERIODIC_PAYMENTS, PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, STATUS); when(httpClient.get(expectedUri)).thenReturn(builder); when(builder.header(anyString(), anyString())).thenReturn(builder); when(builder.send(any(), anyList())).thenReturn(getResponse("<response></response>")); Response<String> actualResponse = paymentInitiationApi.getPeriodicPaymentStatusXml(PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENT_ID, REQUEST_ID, PSU_IP_ADDRESS, INTERCEPTORS); verify(httpClient, times(1)).get(uriCaptor.capture()); verify(builder, times(2)).header(anyString(), anyString()); verify(builder, times(1)).send(any(), anyList()); assertThat(uriCaptor.getValue()) .isEqualTo(expectedUri); assertThat(actualResponse) .isNotNull() .matches(r -> r.getStatusCode() == 200); } private <T> Response<T> getResponse(T body) { return new Response<>(200, body, emptyResponseHeaders); } }
10,473
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngServiceProviderTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngServiceProviderTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.AccountInformationService; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.PaymentInitiationService; import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.model.Aspsp; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.security.*; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; class IngServiceProviderTest { private static final String B_64_CERTIFICATE = "-----BEGIN CERTIFICATE-----\n" + "MIIBLTCB2KADAgECAgEDMA0GCSqGSIb3DQEBBAUAMA0xCzAJBgNVBAMTAkNBMB4X\n" + "DTAyMTEwNzExNTcwM1oXDTIyMTEwNzExNTcwM1owFTETMBEGA1UEAxMKRW5kIEVu\n" + "dGl0eTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDVBDfF+uBr5s5jzzDs1njKlZNt\n" + "h8hHzEt3ASh67Peos+QrDzgpUyFXT6fdW2h7iPf0ifjM8eW2xa+3EnPjjU5jAgMB\n" + "AAGjGzAZMBcGA1UdIAQQMA4wBgYEVR0gADAEBgIqADANBgkqhkiG9w0BAQQFAANB\n" + "AFo//WOboCNOCcA1fvcWW9oc4MvV8ZPvFIAbyEbgyFd4id5lGDTRbRPvvNZRvdsN\n" + "NM2gXYr+f87NHIXc9EF3pzw=\n" + "-----END CERTIFICATE-----"; private IngServiceProvider serviceProvider; private final HttpClientConfig httpClientConfig = mock(HttpClientConfig.class); private final HttpClientFactory httpClientFactory = mock(HttpClientFactory.class); private final Pkcs12KeyStore keyStore = mock(Pkcs12KeyStore.class); private final X509Certificate certificate = generateCertificate(); private final PrivateKey privateKey = generatePrivateKey(); private final Aspsp aspsp = new Aspsp(); @BeforeEach void setUp() throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException { serviceProvider = new IngServiceProvider(); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); when(httpClientConfig.getKeyStore()).thenReturn(keyStore); when(keyStore.getQsealCertificate(any())).thenReturn(certificate); when(keyStore.getQsealPrivateKey(any())).thenReturn(privateKey); } @Test void getAccountInformationService() { AccountInformationService actualService = serviceProvider.getAccountInformationService(aspsp, httpClientFactory, null); assertThat(actualService) .isExactlyInstanceOf(IngAccountInformationService.class); } @Test void getOauth2Service() { Oauth2Service actualService = serviceProvider.getOauth2Service(aspsp, httpClientFactory); assertThat(actualService) .isExactlyInstanceOf(IngAccountInformationService.class); } @Test void getPaymentInitiationService() { PaymentInitiationService actualService = serviceProvider.getPaymentInitiationService(aspsp, httpClientFactory, null); assertThat(actualService) .isExactlyInstanceOf(IngPaymentInitiationService.class); } private static X509Certificate generateCertificate() { X509Certificate certificate = null; CertificateFactory cf = null; InputStream is = new ByteArrayInputStream(B_64_CERTIFICATE.getBytes(StandardCharsets.UTF_8)); try { cf = CertificateFactory.getInstance("X.509"); certificate = (X509Certificate) cf.generateCertificate(is); } catch (CertificateException e) { throw new RuntimeException(e); } return certificate; } private PrivateKey generatePrivateKey() { KeyPairGenerator generator = null; try { generator = KeyPairGenerator.getInstance("RSA"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } KeyPair keyPair = generator.genKeyPair(); return keyPair.getPrivate(); } }
5,163
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountInformationServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngAccountInformationServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.impl.http.JacksonObjectMapper; import de.adorsys.xs2a.adapter.ing.model.IngBalancesResponse; import de.adorsys.xs2a.adapter.ing.model.IngTransactionsResponse; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class IngAccountInformationServiceTest { private static final String CONSENT_ID = "consentId"; private static final String AUTHORISATION_ID = "authorisationId"; private static final String ACCOUNT_ID = "accountId"; @InjectMocks private IngAccountInformationService accountInformationService; @Mock private IngAccountInformationApi accountInformationApi; @Mock private IngOauth2Service oauth2Service; @Mock private LinksRewriter linksRewriter; private static final RequestHeaders emptyRequestHeaders = RequestHeaders.empty(); private static final RequestParams emptyParams = RequestParams.empty(); private static final ResponseHeaders emptyResponseHeaders = ResponseHeaders.emptyResponseHeaders(); @Test void createConsent() { Response<ConsentsResponse201> actualResponse = accountInformationService.createConsent(emptyRequestHeaders, emptyParams, null); assertThat(actualResponse) .isNotNull() .matches(r -> r.getHeaders().getHeadersMap().isEmpty()) .matches(r -> r.getStatusCode() == 200) .matches(r -> r.getBody().equals(new ConsentsResponse201())); } @Test void getConsentInformation() { assertThatThrownBy(() -> accountInformationService.getConsentInformation(CONSENT_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void deleteConsent() { assertThatThrownBy(() -> accountInformationService.deleteConsent(CONSENT_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getConsentStatus() { assertThatThrownBy(() -> accountInformationService.getConsentStatus(CONSENT_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getConsentAuthorisation() { assertThatThrownBy(() -> accountInformationService.getConsentAuthorisation(CONSENT_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void startConsentAuthorisation() { assertThatThrownBy(() -> accountInformationService.startConsentAuthorisation(CONSENT_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void startConsentAuthorisation_withPsuAuthentication() { assertThatThrownBy(() -> accountInformationService.startConsentAuthorisation(CONSENT_ID, emptyRequestHeaders, emptyParams, null)) .isInstanceOf(UnsupportedOperationException.class); } @Test void updateConsentsPsuData_selectScaMethod() { SelectPsuAuthenticationMethod body = new SelectPsuAuthenticationMethod(); assertThatThrownBy(() -> accountInformationService .updateConsentsPsuData(CONSENT_ID, AUTHORISATION_ID, emptyRequestHeaders, emptyParams, body)) .isInstanceOf(UnsupportedOperationException.class); } @Test void updateConsentsPsuData_authoriseTransaction() { TransactionAuthorisation body = new TransactionAuthorisation(); assertThatThrownBy(() -> accountInformationService .updateConsentsPsuData(CONSENT_ID, AUTHORISATION_ID, emptyRequestHeaders, emptyParams, body)) .isInstanceOf(UnsupportedOperationException.class); } @Test void updateConsentsPsuData_updatePsuAuthentication() { UpdatePsuAuthentication body = new UpdatePsuAuthentication(); assertThatThrownBy(() -> accountInformationService .updateConsentsPsuData(CONSENT_ID, AUTHORISATION_ID, emptyRequestHeaders, emptyParams, body)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getConsentScaStatus() { assertThatThrownBy(() -> accountInformationService .getConsentScaStatus(CONSENT_ID, AUTHORISATION_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getCardAccountList() { assertThatThrownBy(() -> accountInformationService.getCardAccountList(emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getCardAccountDetails() { assertThatThrownBy(() -> accountInformationService.getCardAccountDetails(ACCOUNT_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getCardAccountBalances() { assertThatThrownBy(() -> accountInformationService.getCardAccountBalances(ACCOUNT_ID, emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getCardAccountTransactionList() { CardAccountsTransactionsResponse200 expectedBody = new CardAccountsTransactionsResponse200(); expectedBody.setLinks(Collections.emptyMap()); when(accountInformationApi.getCardAccountTransactions(anyString(), any(), any(), any(), any(), anyList())) .thenReturn(getResponse(expectedBody)); Response<CardAccountsTransactionsResponse200> actualResponse = accountInformationService.getCardAccountTransactionList(ACCOUNT_ID, emptyRequestHeaders, emptyParams); assertThat(actualResponse) .isNotNull() .matches(r -> r.getBody().equals(expectedBody)) .matches(r -> r.getStatusCode() == 200) .matches(r -> r.getHeaders().getHeadersMap().isEmpty()); } @Test void getBalances() { when(accountInformationApi.getBalances(anyString(), any(), any(), any(), anyList())) .thenReturn(getResponse(new IngBalancesResponse())); Response<ReadAccountBalanceResponse200> actualResponse = accountInformationService.getBalances(ACCOUNT_ID, emptyRequestHeaders, emptyParams); assertThat(actualResponse) .isNotNull() .matches(r -> r.getBody().equals(new ReadAccountBalanceResponse200())) .matches(r -> r.getStatusCode() == 200) .matches(r -> r.getHeaders().getHeadersMap().isEmpty()); } @Test void getTransactionDetails() { assertThatThrownBy(() -> accountInformationService .getTransactionDetails(ACCOUNT_ID, "transactionId", emptyRequestHeaders, emptyParams)) .isInstanceOf(UnsupportedOperationException.class); } @Test void getTransactionListAsString() { when(accountInformationApi.getTransactions(anyString(), any(), any(), any(), any(), any(), anyList())) .thenReturn(getResponse(new IngTransactionsResponse())); Response<String> actualResponse = accountInformationService.getTransactionListAsString(ACCOUNT_ID, emptyRequestHeaders, emptyParams); assertThat(actualResponse) .isNotNull() .matches(r -> r.getBody().equals(getTransactionsBodyAsString())) .matches(r -> r.getStatusCode() == 200) .matches(r -> r.getHeaders().getHeadersMap().isEmpty()); } private <T> Response<T> getResponse(T body) { return new Response<>(200, body, emptyResponseHeaders); } private String getTransactionsBodyAsString() { TransactionsResponse200Json body = new TransactionsResponse200Json(); body.setLinks(Collections.emptyMap()); return new JacksonObjectMapper().writeValueAsString(body); } }
9,362
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentInitiationServiceWireMockTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/test/java/de/adorsys/xs2a/adapter/ing/IngPaymentInitiationServiceWireMockTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.PaymentInitiationService; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.test.ServiceWireMockTest; import de.adorsys.xs2a.adapter.test.TestRequestResponse; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @ServiceWireMockTest(IngServiceProvider.class) class IngPaymentInitiationServiceWireMockTest { public static final String PAYMENT_ID = "111be84f-a62b-469b-b964-792da2840afb"; public static final String PERIODIC_PAYMENT_ID = "111be84f-a62b-469b-b964-792ea2847abd"; private final PaymentInitiationService service; IngPaymentInitiationServiceWireMockTest(PaymentInitiationService service) { this.service = service; } @Test void initiatePayment() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/payments/sepa-credit-transfers/initiate-payment.json"); Response<PaymentInitationRequestResponse201> response = service.initiatePayment(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(PaymentInitiationJson.class)); PaymentInitationRequestResponse201 expectedBody = requestResponse.responseBody(PaymentInitationRequestResponse201.class); // sca redirect link is stubbed via wiremock (has dynamic port) expectedBody.getLinks().put("scaRedirect", response.getBody().getLinks().get("scaRedirect")); assertThat(response.getBody()).isEqualTo(expectedBody); } @Test void getPaymentStatus() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/payments/sepa-credit-transfers/get-payment-status.json"); Response<PaymentInitiationStatusResponse200Json> response = service.getPaymentInitiationStatus(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, PAYMENT_ID, requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()) .isEqualTo(requestResponse.responseBody(PaymentInitiationStatusResponse200Json.class)); } @Test void initiatePeriodicPayment() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/periodic-payments/sepa-credit-transfers/initiate-payment.json"); Response<PaymentInitationRequestResponse201> response = service.initiatePayment(PaymentService.PERIODIC_PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(PeriodicPaymentInitiationJson.class)); PaymentInitationRequestResponse201 expectedBody = requestResponse.responseBody(PaymentInitationRequestResponse201.class); // sca redirect link is stubbed via wiremock (has dynamic port) expectedBody.getLinks().put("scaRedirect", response.getBody().getLinks().get("scaRedirect")); assertThat(response.getBody()).isEqualTo(expectedBody); } @Test void getPeriodicPaymentStatus() throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/periodic-payments/sepa-credit-transfers/get-payment-status.json"); Response<PaymentInitiationStatusResponse200Json> response = service.getPaymentInitiationStatus(PaymentService.PERIODIC_PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, PERIODIC_PAYMENT_ID, requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()) .isEqualTo(requestResponse.responseBody(PaymentInitiationStatusResponse200Json.class)); } }
4,978
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngClientAuthenticationFactory.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngClientAuthenticationFactory.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore; import de.adorsys.xs2a.adapter.api.config.AdapterConfig; import de.adorsys.xs2a.adapter.api.exception.Xs2aAdapterException; import de.adorsys.xs2a.adapter.ing.model.IngApplicationTokenResponse; import javax.security.auth.x500.X500Principal; import java.security.*; import java.security.cert.CertificateEncodingException; import java.security.cert.X509Certificate; import java.util.Base64; public class IngClientAuthenticationFactory { private final Signature signature; private final MessageDigest digest; private final String tppSignatureCertificate; private final String keyId; @SuppressWarnings("java:S4790") public IngClientAuthenticationFactory(X509Certificate certificate, PrivateKey privateKey) throws NoSuchAlgorithmException, InvalidKeyException, CertificateEncodingException { signature = Signature.getInstance("SHA256withRSA"); signature.initSign(privateKey); digest = MessageDigest.getInstance("SHA-256"); tppSignatureCertificate = base64(certificate.getEncoded()); keyId = keyId(certificate); } public static IngClientAuthenticationFactory getClientAuthenticationFactory(Pkcs12KeyStore keyStore) { String qsealAlias = AdapterConfig.readProperty("ing.qseal.alias"); try { X509Certificate qsealCertificate = keyStore.getQsealCertificate(qsealAlias); PrivateKey qsealPrivateKey = keyStore.getQsealPrivateKey(qsealAlias); return new IngClientAuthenticationFactory(qsealCertificate, qsealPrivateKey); } catch (GeneralSecurityException e) { throw new Xs2aAdapterException(e); } } private String keyId(X509Certificate certificate) { return "SN=" + certificate.getSerialNumber().toString(16) + ",CA=" + issuerNameRfc2253(certificate); } private String issuerNameRfc2253(X509Certificate qSealCertificate) { X500Principal issuerX500Principal = qSealCertificate.getIssuerX500Principal(); return issuerX500Principal.getName(X500Principal.RFC2253); } private String base64(byte[] data) { return Base64.getEncoder().encodeToString(data); } public IngClientAuthentication newClientAuthenticationForApplicationToken() { return new IngClientAuthentication(signature, digest, tppSignatureCertificate, keyId, null); } public IngClientAuthentication newClientAuthentication(IngApplicationTokenResponse applicationToken) { return new IngClientAuthentication(signature, digest, tppSignatureCertificate, applicationToken.getClientId(), applicationToken.getAccessToken()); } public IngClientAuthentication newClientAuthentication(IngApplicationTokenResponse applicationToken, String accessToken) { return new IngClientAuthentication(signature, digest, tppSignatureCertificate, applicationToken.getClientId(), accessToken); } }
3,817
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngMapper.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngMapper.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.ing.model.*; import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; @Mapper public interface IngMapper { AccountList map(IngAccountsResponse value); ReadAccountBalanceResponse200 map(IngBalancesResponse value); @Mapping(target = "balances", ignore = true) @Mapping(target = "links", ignore = true) TransactionsResponse200Json map(IngTransactionsResponse value); default String map(UUID value) { return value.toString(); } default Map<String, HrefType> map(IngAccountLinks value) { if (value == null) { return null; } HashMap<String, HrefType> links = new HashMap<>(); if (value.getBalances() != null) { HrefType balances = new HrefType(); balances.setHref(value.getBalances().getHref()); links.put("balances", balances); } if (value.getTransactions() != null) { HrefType transactions = new HrefType(); transactions.setHref(value.getTransactions().getHref()); links.put("transactions", transactions); } return links; } default Map<String, HrefType> map(IngLinksNext value) { if (value == null) { return null; } if (value.getNext() != null) { HrefType next = new HrefType(); next.setHref(value.getNext().getHref()); return Collections.singletonMap("next", next); } return Collections.emptyMap(); } @Mapping(target = "bban", ignore = true) @Mapping(target = "pan", ignore = true) @Mapping(target = "maskedPan", ignore = true) @Mapping(target = "msisdn", ignore = true) AccountReference map(IngAccountReferenceIban value); @Mapping(target = "bban", ignore = true) @Mapping(target = "msisdn", ignore = true) @Mapping(target = "cashAccountType", ignore = true) @Mapping(target = "status", ignore = true) @Mapping(target = "bic", ignore = true) @Mapping(target = "linkedAccounts", ignore = true) @Mapping(target = "details", ignore = true) @Mapping(target = "balances", ignore = true) @Mapping(target = "displayName", ignore = true) @Mapping(target = "ownerName", ignore = true) @Mapping(target = "usage", ignore = true) AccountDetails map(IngAccount value); @Mapping(target = "creditLimitIncluded", ignore = true) @Mapping(target = "lastCommittedTransaction", ignore = true) Balance map(IngBalance value); default BalanceType toBalanceType(String value) { return BalanceType.fromValue(value); } default TransactionStatus toTransactionStatus(String value) { if ("ACTV".equals(value)) { return TransactionStatus.ACSP; } if ("EXPI".equals(value)) { return TransactionStatus.ACSC; } return TransactionStatus.fromValue(value); } default TppMessageCategory toTppMessageCategory(String value) { return TppMessageCategory.fromValue(value); } default MessageCode2XX toMessageCode2XX(String value) { return MessageCode2XX.fromValue(value); } @Mapping(target = "pan", ignore = true) @Mapping(target = "maskedPan", ignore = true) @Mapping(target = "msisdn", ignore = true) @Mapping(target = "currency", ignore = true) AccountReference map(IngCounterpartyAccount value); @Mapping(target = "entryReference", ignore = true) @Mapping(target = "mandateId", ignore = true) @Mapping(target = "checkId", ignore = true) @Mapping(target = "creditorId", ignore = true) @Mapping(target = "ultimateCreditor", ignore = true) @Mapping(target = "ultimateDebtor", ignore = true) @Mapping(target = "purposeCode", ignore = true) @Mapping(target = "bankTransactionCode", ignore = true) @Mapping(target = "proprietaryBankTransactionCode", ignore = true) @Mapping(target = "links", ignore = true) @Mapping(target = "creditorAgent", ignore = true) @Mapping(target = "debtorAgent", ignore = true) @Mapping(target = "remittanceInformationUnstructuredArray", ignore = true) @Mapping(target = "remittanceInformationStructuredArray", ignore = true) @Mapping(target = "additionalInformationStructured", ignore = true) @Mapping(target = "balanceAfterTransaction", ignore = true) @Mapping(target = "currencyExchange", ignore = true) @Mapping(target = "additionalInformation", ignore = true) Transactions map(IngTransaction value); default String map(IngTransactionRemittanceInformationStructured value) { return value == null ? null : value.getReference(); } TokenResponse map(IngTokenResponse value); @Mapping(target = "chargeBearer", ignore = true) @Mapping(target = "clearingSystemMemberIdentification", ignore = true) @Mapping(target = "debtorName", ignore = true) @Mapping(target = "debtorAgent", ignore = true) @Mapping(target = "instructionPriority", ignore = true) @Mapping(target = "serviceLevelCode", ignore = true) @Mapping(target = "localInstrumentCode", ignore = true) @Mapping(target = "categoryPurposeCode", ignore = true) @Mapping(target = "requestedExecutionDate", ignore = true) IngPaymentInstruction map(PaymentInitiationJson value); @Mapping(target = "streetName", source = "street") @Mapping(target = "townName", source = "city") @Mapping(target = "postCode", source = "postalCode") Address map(IngAddress value); @InheritInverseConfiguration IngAddress map(Address value); @Mapping(target = "transactionFees", ignore = true) @Mapping(target = "transactionFeeIndicator", ignore = true) @Mapping(target = "scaMethods", ignore = true) @Mapping(target = "challengeData", ignore = true) @Mapping(target = "psuMessage", ignore = true) @Mapping(target = "chosenScaMethod", ignore = true) PaymentInitationRequestResponse201 map(IngPaymentInitiationResponse value); default Map<String, HrefType> map(IngLinks value) { if (value == null) { return null; } HashMap<String, HrefType> links = new HashMap<>(); if (value.getScaRedirect() != null) { HrefType scaRedirect = new HrefType(); scaRedirect.setHref(value.getScaRedirect()); links.put("scaRedirect", scaRedirect); } if (value.getSelf() != null) { HrefType self = new HrefType(); self.setHref(value.getSelf()); links.put("self", self); } if (value.getStatus() != null) { HrefType status = new HrefType(); status.setHref(value.getStatus()); links.put("status", status); } if (value.getDelete() != null) { HrefType delete = new HrefType(); delete.setHref(value.getDelete()); links.put("delete", delete); } return links; } @Mapping(target = "transactionStatus", ignore = true) PaymentInitiationWithStatusResponse map(IngPaymentInstruction value); @Mapping(target = "bban", ignore = true) @Mapping(target = "pan", ignore = true) @Mapping(target = "maskedPan", ignore = true) @Mapping(target = "msisdn", ignore = true) AccountReference map(IngDebtorAccount value); @Mapping(target = "pan", ignore = true) @Mapping(target = "maskedPan", ignore = true) @Mapping(target = "msisdn", ignore = true) AccountReference map(IngCreditorAccount value); @Mapping(target = "fundsAvailable", ignore = true) @Mapping(target = "psuMessage", ignore = true) PaymentInitiationStatusResponse200Json map(IngPaymentStatusResponse value); @Mapping(target = "chargeBearer", ignore = true) @Mapping(target = "clearingSystemMemberIdentification", ignore = true) @Mapping(target = "debtorName", ignore = true) @Mapping(target = "debtorAgent", ignore = true) @Mapping(target = "instructionPriority", ignore = true) @Mapping(target = "serviceLevelCode", ignore = true) @Mapping(target = "localInstrumentCode", ignore = true) @Mapping(target = "categoryPurposeCode", ignore = true) @Mapping(target = "requestedExecutionDate", ignore = true) IngPeriodicPaymentInitiationJson map(PeriodicPaymentInitiationJson value); default IngFrequencyCode map(FrequencyCode value) { if (value == null) { return null; } switch (value) { case DAILY: return IngFrequencyCode.DAIL; case WEEKLY: return IngFrequencyCode.WEEK; case EVERYTWOWEEKS: return IngFrequencyCode.TOWK; case MONTHLY: return IngFrequencyCode.MNTH; case EVERYTWOMONTHS: return IngFrequencyCode.TOMN; case QUARTERLY: return IngFrequencyCode.QUTR; case SEMIANNUAL: return IngFrequencyCode.SEMI; case ANNUAL: return IngFrequencyCode.YEAR; default: throw new IllegalArgumentException(); } } @Mapping(target = "transactionFees", ignore = true) @Mapping(target = "transactionFeeIndicator", ignore = true) @Mapping(target = "scaMethods", ignore = true) @Mapping(target = "chosenScaMethod", ignore = true) @Mapping(target = "challengeData", ignore = true) @Mapping(target = "psuMessage", ignore = true) PaymentInitationRequestResponse201 map(IngPeriodicPaymentInitiationResponse value); default Map<String, HrefType> map(IngPeriodicLinks value) { if (value == null) { return null; } HashMap<String, HrefType> links = new HashMap<>(); if (value.getScaRedirect() != null) { HrefType scaRedirect = new HrefType(); scaRedirect.setHref(value.getScaRedirect()); links.put("scaRedirect", scaRedirect); } if (value.getSelf() != null) { HrefType self = new HrefType(); self.setHref(value.getSelf()); links.put("self", self); } if (value.getStatus() != null) { HrefType status = new HrefType(); status.setHref(value.getStatus()); links.put("status", status); } if (value.getDelete() != null) { HrefType delete = new HrefType(); delete.setHref(value.getDelete()); links.put("delete", delete); } return links; } @Mapping(target = "executionRule", ignore = true) @Mapping(target = "transactionStatus", ignore = true) PeriodicPaymentInitiationWithStatusResponse map(IngPeriodicPaymentInitiationJson value); default FrequencyCode map(IngFrequencyCode value) { if (value == null) { return null; } switch (value) { case DAIL: return FrequencyCode.DAILY; case WEEK: return FrequencyCode.WEEKLY; case TOWK: return FrequencyCode.EVERYTWOWEEKS; case MNTH: return FrequencyCode.MONTHLY; case TOMN: return FrequencyCode.EVERYTWOMONTHS; case QUTR: return FrequencyCode.QUARTERLY; case SEMI: return FrequencyCode.SEMIANNUAL; case YEAR: return FrequencyCode.ANNUAL; default: throw new IllegalArgumentException(); } } @Mapping(target = "fundsAvailable", ignore = true) @Mapping(target = "psuMessage", ignore = true) PaymentInitiationStatusResponse200Json map(IngPaymentAgreementStatusResponse value); default IngPeriodicPaymentInitiationXml map(PeriodicPaymentInitiationMultipartBody value) { if (value == null) { return null; } IngPeriodicPaymentInitiationXml target = new IngPeriodicPaymentInitiationXml(); target.setXml_sct(value.getXml_sct() == null ? null : value.getXml_sct().toString()); if (value.getJson_standingorderType() != null) { target.setStartDate(value.getJson_standingorderType().getStartDate()); target.setEndDate(value.getJson_standingorderType().getEndDate()); target.setFrequency(map(value.getJson_standingorderType().getFrequency())); target.setDayOfExecution(map(value.getJson_standingorderType().getDayOfExecution())); } return target; } IngDayOfExecution map(DayOfExecution value); DayOfExecution map(IngDayOfExecution value); default PeriodicPaymentInitiationMultipartBody map(IngPeriodicPaymentInitiationXml value) { if (value == null) { return null; } PeriodicPaymentInitiationMultipartBody target = new PeriodicPaymentInitiationMultipartBody(); target.setXml_sct(value.getXml_sct()); PeriodicPaymentInitiationXmlPart2StandingorderTypeJson json = new PeriodicPaymentInitiationXmlPart2StandingorderTypeJson(); target.setJson_standingorderType(json); json.setStartDate(value.getStartDate()); json.setEndDate(value.getEndDate()); json.setFrequency(map(value.getFrequency())); json.setDayOfExecution(map(value.getDayOfExecution())); return target; } }
14,434
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngApiFactory.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngApiFactory.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.config.AdapterConfig; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.model.Aspsp; public class IngApiFactory { private IngApiFactory() { } public static IngAccountInformationApi getAccountInformationApi(Aspsp aspsp, HttpClientFactory httpClientFactory) { HttpClient httpClient = httpClient(aspsp, httpClientFactory); HttpClientConfig httpClientConfig = httpClientFactory.getHttpClientConfig(); return new IngAccountInformationApi(aspsp.getUrl(), httpClient, httpClientConfig.getLogSanitizer()); } public static IngPaymentInitiationApi getPaymentInitiationApi(Aspsp aspsp, HttpClientFactory httpClientFactory) { HttpClient httpClient = httpClient(aspsp, httpClientFactory); HttpClientConfig httpClientConfig = httpClientFactory.getHttpClientConfig(); return new IngPaymentInitiationApi(aspsp.getUrl(), httpClient, httpClientConfig.getLogSanitizer()); } public static IngOauth2Api getOAuth2Api(Aspsp aspsp, HttpClientFactory httpClientFactory) { String baseUrl = aspsp.getIdpUrl() != null ? aspsp.getIdpUrl() : aspsp.getUrl(); HttpClient httpClient = httpClient(aspsp, httpClientFactory); HttpClientConfig httpClientConfig = httpClientFactory.getHttpClientConfig(); return new IngOauth2Api(baseUrl, httpClient, httpClientConfig.getLogSanitizer()); } private static HttpClient httpClient(Aspsp aspsp, HttpClientFactory httpClientFactory) { return httpClientFactory.getHttpClient(aspsp.getAdapterId(), AdapterConfig.readProperty("ing.qwac.alias")); } }
2,640
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngOauth2Service.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngOauth2Service.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.api.model.Scope; import de.adorsys.xs2a.adapter.api.validation.ValidationError; import de.adorsys.xs2a.adapter.impl.http.StringUri; import de.adorsys.xs2a.adapter.ing.model.IngApplicationTokenResponse; import de.adorsys.xs2a.adapter.ing.model.IngAuthorizationURLResponse; import de.adorsys.xs2a.adapter.ing.model.IngTokenResponse; import org.apache.commons.lang3.StringUtils; import java.net.URI; import java.util.*; import static de.adorsys.xs2a.adapter.api.Oauth2Service.ResponseType.CODE; import static de.adorsys.xs2a.adapter.api.validation.Validation.requireValid; public class IngOauth2Service { private static final String AIS_TRANSACTIONS_SCOPE = "payment-accounts:transactions:view"; private static final String AIS_BALANCES_SCOPE = "payment-accounts:balances:view"; private static final String PIS_SCOPE = "payment-accounts:balances:view"; private static final EnumMap<Scope, String> SCOPE_MAPPING = initiateScopeMapping(); protected static final String UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE = "Scope value [%s] is not supported"; private final IngOauth2Api oauth2Api; private final IngClientAuthenticationFactory clientAuthenticationFactory; private final List<Interceptor> interceptors; private IngApplicationTokenResponse applicationToken; public IngOauth2Service(IngOauth2Api oauth2Api, IngClientAuthenticationFactory clientAuthenticationFactory, List<Interceptor> interceptors) { this.oauth2Api = oauth2Api; this.clientAuthenticationFactory = clientAuthenticationFactory; this.interceptors = interceptors; } private static EnumMap<Scope, String> initiateScopeMapping() { EnumMap<Scope, String> scopeMapping = new EnumMap<>(Scope.class); scopeMapping.put(Scope.AIS_TRANSACTIONS, AIS_TRANSACTIONS_SCOPE); scopeMapping.put(Scope.AIS_BALANCES, AIS_BALANCES_SCOPE); scopeMapping.put(Scope.AIS, AIS_TRANSACTIONS_SCOPE + " " + AIS_BALANCES_SCOPE); scopeMapping.put(Scope.PIS, PIS_SCOPE); return scopeMapping; } public URI getAuthorizationRequestUri(Oauth2Service.Parameters parameters) { requireValid(validateScope(parameters.getScope())); parameters.setScope(mapScope(parameters.getScope())); IngClientAuthentication clientAuthentication = getClientAuthentication(); IngAuthorizationURLResponse authorizationUrlResponse = oauth2Api.getAuthorizationUrl(addInterceptor(clientAuthentication), parameters.getScope(), parameters.getRedirectUri()) .getBody(); parameters.setClientId(getClientId()); parameters.setResponseType(CODE.toString()); return URI.create(StringUri.withQuery(authorizationUrlResponse.getLocation(), parameters.asMap())); } private List<ValidationError> validateScope(String scope) { List<ValidationError> validationErrors = new ArrayList<>(); if (StringUtils.isBlank(scope)) { validationErrors.add(ValidationError.required(Oauth2Service.Parameters.SCOPE)); } else if (!Scope.contains(scope)) { validationErrors.add(new ValidationError(ValidationError.Code.NOT_SUPPORTED, Oauth2Service.Parameters.SCOPE, String.format(UNSUPPORTED_SCOPE_VALUE_ERROR_MESSAGE, scope))); } return validationErrors; } private String mapScope(String scope) { return SCOPE_MAPPING.get(Scope.fromValue(scope)); } public IngClientAuthentication getClientAuthentication() { return clientAuthenticationFactory.newClientAuthentication(getApplicationToken()); } private IngApplicationTokenResponse getApplicationToken() { if (applicationToken != null) { return applicationToken; } IngClientAuthentication clientAuthentication = clientAuthenticationFactory.newClientAuthenticationForApplicationToken(); applicationToken = oauth2Api.getApplicationToken(addInterceptor(clientAuthentication)) .getBody(); return applicationToken; } private String getClientId() { return getApplicationToken().getClientId(); } public IngTokenResponse getToken(Oauth2Service.Parameters parameters) { IngClientAuthentication clientAuthentication = getClientAuthentication(); return oauth2Api.getCustomerToken(parameters, addInterceptor(clientAuthentication)) .getBody(); } public IngClientAuthentication getClientAuthentication(String accessToken) { return clientAuthenticationFactory.newClientAuthentication(getApplicationToken(), accessToken); } private List<Interceptor> addInterceptor(Interceptor interceptor) { List<Interceptor> tempList = new ArrayList<>(Optional.ofNullable(interceptors) .orElseGet(Collections::emptyList)); tempList.add(interceptor); return Collections.unmodifiableList(tempList); } }
6,083
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngServiceProvider.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngServiceProvider.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.*; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.impl.AbstractAdapterServiceProvider; import de.adorsys.xs2a.adapter.impl.link.identity.IdentityLinksRewriter; public class IngServiceProvider extends AbstractAdapterServiceProvider implements Oauth2ServiceProvider { private static final LinksRewriter DEFAULT_LINKS_REWRITER = new IdentityLinksRewriter(); @Override public AccountInformationService getAccountInformationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { return getIngAccountInformationService(aspsp, httpClientFactory, linksRewriter); } private IngAccountInformationService getIngAccountInformationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { return new IngAccountInformationService(IngApiFactory.getAccountInformationApi(aspsp, httpClientFactory), ingOauth2Service(aspsp, httpClientFactory), linksRewriter, getInterceptors(aspsp)); } private IngOauth2Service ingOauth2Service(Aspsp aspsp, HttpClientFactory httpClientFactory) { return new IngOauth2Service(IngApiFactory.getOAuth2Api(aspsp, httpClientFactory), IngClientAuthenticationFactory.getClientAuthenticationFactory(httpClientFactory.getHttpClientConfig().getKeyStore()), getInterceptors(aspsp)); } @Override public Oauth2Service getOauth2Service(Aspsp aspsp, HttpClientFactory httpClientFactory) { return getIngAccountInformationService(aspsp, httpClientFactory, DEFAULT_LINKS_REWRITER); } @Override public String getAdapterId() { return "ing-adapter"; } @Override public PaymentInitiationService getPaymentInitiationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) { return new IngPaymentInitiationService(IngApiFactory.getPaymentInitiationApi(aspsp, httpClientFactory), ingOauth2Service(aspsp, httpClientFactory), linksRewriter, getInterceptors(aspsp)); } }
3,596
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentInitiationApi.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngPaymentInitiationApi.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpLogSanitizer; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.impl.http.JacksonObjectMapper; import de.adorsys.xs2a.adapter.impl.http.JsonMapper; import de.adorsys.xs2a.adapter.impl.http.ResponseHandlers; import de.adorsys.xs2a.adapter.impl.http.StringUri; import de.adorsys.xs2a.adapter.ing.model.*; import java.util.List; import static java.util.Objects.requireNonNull; // version: 1.1.12 public class IngPaymentInitiationApi { static final String PAYMENTS = "/v1/payments"; static final String PERIODIC_PAYMENTS = "/v1/periodic-payments/"; static final String STATUS = "status"; private final String baseUri; private final HttpClient httpClient; private final ResponseHandlers responseHandlers; private final JsonMapper jsonMapper = new JacksonObjectMapper(); public IngPaymentInitiationApi(String baseUri, HttpClient httpClient, HttpLogSanitizer logSanitizer) { this.baseUri = baseUri; this.httpClient = httpClient; this.responseHandlers = new ResponseHandlers(logSanitizer); } public Response<IngPaymentInitiationResponse> initiatePayment(IngPaymentProduct paymentProduct, String requestId, String tppRedirectUri, String psuIpAddress, List<Interceptor> interceptors, IngPaymentInstruction body) { String uri = StringUri.fromElements(baseUri, PAYMENTS, requireNonNull(paymentProduct).toString()); return httpClient.post(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.TPP_REDIRECT_URI, tppRedirectUri) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .jsonBody(jsonMapper.writeValueAsString(body)) .send(responseHandlers.jsonResponseHandler(IngPaymentInitiationResponse.class), interceptors); } public Response<IngPaymentInstruction> getPaymentDetails(IngPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId)); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.jsonResponseHandler(IngPaymentInstruction.class), interceptors); } public Response<IngPaymentStatusResponse> getPaymentStatus(IngPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId), STATUS); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.jsonResponseHandler(IngPaymentStatusResponse.class), interceptors); } public Response<IngPaymentInitiationResponse> initiatePaymentXml(IngXmlPaymentProduct paymentProduct, String requestId, String tppRedirectUri, String psuIpAddress, List<Interceptor> interceptors, String body) { String uri = StringUri.fromElements(baseUri, PAYMENTS, requireNonNull(paymentProduct).toString()); return httpClient.post(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.TPP_REDIRECT_URI, tppRedirectUri) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .xmlBody(body) .send(responseHandlers.jsonResponseHandler(IngPaymentInitiationResponse.class), interceptors); } public Response<String> getPaymentDetailsXml(IngXmlPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId)); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.stringResponseHandler(), interceptors); } public Response<String> getPaymentStatusXml(IngXmlPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId), STATUS); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.stringResponseHandler(), interceptors); } public Response<IngPeriodicPaymentInitiationResponse> initiatePeriodicPayment(IngPaymentProduct paymentProduct, String requestId, String tppRedirectUri, String psuIpAddress, List<Interceptor> interceptors, IngPeriodicPaymentInitiationJson body) { String uri = StringUri.fromElements(baseUri, PERIODIC_PAYMENTS, requireNonNull(paymentProduct).toString()); return httpClient.post(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.TPP_REDIRECT_URI, tppRedirectUri) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .jsonBody(jsonMapper.writeValueAsString(body)) .send(responseHandlers.jsonResponseHandler(IngPeriodicPaymentInitiationResponse.class), interceptors); } public Response<IngPeriodicPaymentInitiationJson> getPeriodicPaymentDetails(IngPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PERIODIC_PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId)); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.jsonResponseHandler(IngPeriodicPaymentInitiationJson.class), interceptors); } public Response<IngPaymentAgreementStatusResponse> getPeriodicPaymentStatus(IngPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PERIODIC_PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId), STATUS); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.jsonResponseHandler(IngPaymentAgreementStatusResponse.class), interceptors); } public Response<IngPeriodicPaymentInitiationResponse> initiatePeriodicPaymentXml(IngXmlPaymentProduct paymentProduct, String requestId, String tppRedirectUri, String psuIpAddress, List<Interceptor> interceptors, IngPeriodicPaymentInitiationXml body) { String uri = StringUri.fromElements(baseUri, PERIODIC_PAYMENTS, requireNonNull(paymentProduct).toString()); return httpClient.post(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.TPP_REDIRECT_URI, tppRedirectUri) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .addXmlPart("xml_sct", body.getXml_sct()) .addPlainTextPart("startDate", body.getStartDate()) .addPlainTextPart("endDate", body.getEndDate()) .addPlainTextPart("frequency", body.getFrequency()) .addPlainTextPart("dayOfExecution", body.getDayOfExecution()) .send(responseHandlers.jsonResponseHandler(IngPeriodicPaymentInitiationResponse.class), interceptors); } public Response<IngPeriodicPaymentInitiationXml> getPeriodicPaymentDetailsXml(IngXmlPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PERIODIC_PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId)); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.multipartFormDataResponseHandler(IngPeriodicPaymentInitiationXml.class), interceptors); } public Response<String> getPeriodicPaymentStatusXml(IngXmlPaymentProduct paymentProduct, String paymentId, String requestId, String psuIpAddress, List<Interceptor> interceptors) { String uri = StringUri.fromElements(baseUri, PERIODIC_PAYMENTS, requireNonNull(paymentProduct).toString(), requireNonNull(paymentId), STATUS); return httpClient.get(uri) .header(RequestHeaders.X_REQUEST_ID, requestId) .header(RequestHeaders.PSU_IP_ADDRESS, psuIpAddress) .send(responseHandlers.stringResponseHandler(), interceptors); } }
14,446
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngOauth2Api.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngOauth2Api.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.Oauth2Service; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpLogSanitizer; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.impl.http.ResponseHandlers; import de.adorsys.xs2a.adapter.impl.http.StringUri; import de.adorsys.xs2a.adapter.ing.model.IngApplicationTokenResponse; import de.adorsys.xs2a.adapter.ing.model.IngAuthorizationURLResponse; import de.adorsys.xs2a.adapter.ing.model.IngTokenResponse; import java.util.List; import static java.util.Collections.singletonMap; public class IngOauth2Api { private static final String TOKEN_ENDPOINT = "/oauth2/token"; private static final String AUTHORIZATION_ENDPOINT = "/oauth2/authorization-server-url"; private final String baseUri; private final HttpClient httpClient; private final ResponseHandlers handlers; public IngOauth2Api(String baseUri, HttpClient httpClient, HttpLogSanitizer logSanitizer) { this.baseUri = baseUri; this.httpClient = httpClient; this.handlers = new ResponseHandlers(logSanitizer); } public Response<IngApplicationTokenResponse> getApplicationToken(List<Interceptor> interceptors) { // When using eIDAS certificates supporting PSD2 the scope parameter is not required. // The scopes will be derived automatically from the PSD2 roles in the certificate. // When using eIDAS certificates supporting PSD2, the response will contain the client ID of your application, // this client ID has to be used in the rest of the session when the client ID or key ID is required. return httpClient.post(baseUri + TOKEN_ENDPOINT) .urlEncodedBody(singletonMap("grant_type", "client_credentials")) .send(handlers.jsonResponseHandler(IngApplicationTokenResponse.class), interceptors); } public Response<IngTokenResponse> getCustomerToken(Oauth2Service.Parameters parameters, List<Interceptor> interceptors) { return httpClient.post(baseUri + TOKEN_ENDPOINT) .urlEncodedBody(parameters.asMap()) .send(handlers.jsonResponseHandler(IngTokenResponse.class), interceptors); } public Response<IngAuthorizationURLResponse> getAuthorizationUrl(List<Interceptor> interceptors, String scope, String redirectUri) { Oauth2Service.Parameters queryParameters = new Oauth2Service.Parameters(); queryParameters.setScope(scope); queryParameters.setRedirectUri(redirectUri); String uri = StringUri.withQuery(baseUri + AUTHORIZATION_ENDPOINT, queryParameters.asMap()); return httpClient.get(uri) .send(handlers.jsonResponseHandler(IngAuthorizationURLResponse.class), interceptors); } }
3,922
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountInformationService.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngAccountInformationService.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.*; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.impl.http.JacksonObjectMapper; import de.adorsys.xs2a.adapter.impl.http.JsonMapper; import org.mapstruct.factory.Mappers; import java.net.URI; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; import static java.util.Collections.emptyMap; public class IngAccountInformationService implements AccountInformationService, Oauth2Service { private final IngOauth2Service oauth2Service; private final IngAccountInformationApi accountInformationApi; private final LinksRewriter linksRewriter; private final IngMapper mapper = Mappers.getMapper(IngMapper.class); private final JsonMapper jsonMapper = new JacksonObjectMapper(); private final List<Interceptor> interceptors; public IngAccountInformationService(IngAccountInformationApi accountInformationApi, IngOauth2Service oauth2Service, LinksRewriter linksRewriter, List<Interceptor> interceptors) { this.accountInformationApi = accountInformationApi; this.oauth2Service = oauth2Service; this.linksRewriter = linksRewriter; this.interceptors = interceptors; } @Override public Response<ConsentsResponse201> createConsent(RequestHeaders requestHeaders, RequestParams requestParams, Consents body) { return toResponse(new ConsentsResponse201()); } private <T> Response<T> toResponse(T body) { return new Response<>(200, body, ResponseHeaders.fromMap(emptyMap())); } @Override public Response<ConsentInformationResponse200Json> getConsentInformation(String consentId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<Void> deleteConsent(String consentId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<ConsentStatusResponse200> getConsentStatus(String consentId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<Authorisations> getConsentAuthorisation(String consentId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<StartScaprocessResponse> startConsentAuthorisation(String consentId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<StartScaprocessResponse> startConsentAuthorisation(String consentId, RequestHeaders requestHeaders, RequestParams requestParams, UpdatePsuAuthentication updatePsuAuthentication) { throw new UnsupportedOperationException(); } @Override public Response<SelectPsuAuthenticationMethodResponse> updateConsentsPsuData(String consentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, SelectPsuAuthenticationMethod selectPsuAuthenticationMethod) { throw new UnsupportedOperationException(); } @Override public Response<ScaStatusResponse> updateConsentsPsuData(String consentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, TransactionAuthorisation transactionAuthorisation) { throw new UnsupportedOperationException(); } @Override public Response<UpdatePsuAuthenticationResponse> updateConsentsPsuData(String consentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, UpdatePsuAuthentication updatePsuAuthentication) { throw new UnsupportedOperationException(); } @Override public Response<ScaStatusResponse> getConsentScaStatus(String consentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<CardAccountList> getCardAccountList(RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<OK200CardAccountDetails> getCardAccountDetails(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<ReadCardAccountBalanceResponse200> getCardAccountBalances(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<CardAccountsTransactionsResponse200> getCardAccountTransactionList(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { String accessToken = requestHeaders.getAccessToken().orElse(null); IngClientAuthentication clientAuthentication = oauth2Service.getClientAuthentication(accessToken); LocalDate dateFrom = requestParams.dateFrom(); LocalDate dateTo = requestParams.dateTo(); Integer limit = requestParams.get("limit", Integer::valueOf); Response<CardAccountsTransactionsResponse200> response = accountInformationApi.getCardAccountTransactions( accountId, dateFrom, dateTo, limit, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), addInterceptor(clientAuthentication)); // rewrite links CardAccountsTransactionsResponse200 body = response.getBody(); if (body != null) { body.setLinks(rewriteLinks(body.getLinks())); CardAccountReport cardTransactions = body.getCardTransactions(); if (cardTransactions != null) { cardTransactions.setLinks(rewriteLinks(cardTransactions.getLinks())); } } return response; } @Override public URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) { return oauth2Service.getAuthorizationRequestUri(parameters); } @Override public TokenResponse getToken(Map<String, String> headers, Parameters parameters) { return mapper.map(oauth2Service.getToken(parameters)); } @Override public Response<AccountList> getAccountList(RequestHeaders requestHeaders, RequestParams requestParams) { String accessToken = requestHeaders.getAccessToken().orElse(null); IngClientAuthentication clientAuthentication = oauth2Service.getClientAuthentication(accessToken); String requestId = requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null); Response<AccountList> response = accountInformationApi.getAccounts(requestId, addInterceptor(clientAuthentication)) .map(mapper::map); rewriteLinks(response.getBody()); return response; } @Override public Response<OK200AccountDetails> readAccountDetails(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } private void rewriteLinks(AccountList accountList) { Optional.ofNullable(accountList) .map(AccountList::getAccounts) .ifPresent(accounts -> accounts.forEach(acc -> acc.setLinks(rewriteLinks(acc.getLinks())) )); } private Map<String, HrefType> rewriteLinks(Map<String, HrefType> links) { return linksRewriter.rewrite(links); } @Override public Response<ReadAccountBalanceResponse200> getBalances(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { String accessToken = requestHeaders.getAccessToken().orElse(null); IngClientAuthentication clientAuthentication = oauth2Service.getClientAuthentication(accessToken); Currency currency = requestParams.get("currency", Currency::getInstance); String requestId = requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null); List<String> balanceTypes = requestParams.get("balanceTypes", this::parseBalanceTypes); return accountInformationApi.getBalances(accountId, balanceTypes, currency, requestId, addInterceptor(clientAuthentication)) .map(mapper::map); } private List<String> parseBalanceTypes(String value) { if (value == null) { return Collections.emptyList(); } return Arrays.stream(value.split(",")) .collect(Collectors.toList()); } @Override public Response<TransactionsResponse200Json> getTransactionList(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { String accessToken = requestHeaders.getAccessToken().orElse(null); IngClientAuthentication clientAuthentication = oauth2Service.getClientAuthentication(accessToken); LocalDate dateFrom = requestParams.dateFrom(); LocalDate dateTo = requestParams.dateTo(); Currency currency = requestParams.get("currency", Currency::getInstance); Integer limit = requestParams.get("limit", Integer::valueOf); String requestId = requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null); Response<TransactionsResponse200Json> response = accountInformationApi.getTransactions(accountId, dateFrom, dateTo, currency, limit, requestId, addInterceptor(clientAuthentication)) .map(mapper::map); rewriteLinks(response.getBody()); return response; } @Override public Response<OK200TransactionDetails> getTransactionDetails(String accountId, String transactionId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<String> getTransactionListAsString(String accountId, RequestHeaders requestHeaders, RequestParams requestParams) { return getTransactionList(accountId, requestHeaders, requestParams) .map(jsonMapper::writeValueAsString); } private void rewriteLinks(TransactionsResponse200Json transactionsResponse) { Optional.ofNullable(transactionsResponse) .ifPresent(body -> { body.setLinks(rewriteLinks(body.getLinks())); Optional.ofNullable(body.getTransactions()) .ifPresent(ts -> { ts.setLinks(rewriteLinks(ts.getLinks())); rewriteLinks(ts.getBooked()); rewriteLinks(ts.getPending()); }); }); } private void rewriteLinks(List<Transactions> transactionDetails) { Optional.ofNullable(transactionDetails) .ifPresent(td -> td.forEach(t -> t.setLinks(rewriteLinks(t.getLinks())))); } private List<Interceptor> addInterceptor(Interceptor interceptor) { List<Interceptor> tempList = new ArrayList<>(Optional.ofNullable(interceptors) .orElseGet(Collections::emptyList)); tempList.add(interceptor); return Collections.unmodifiableList(tempList); } }
15,651
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentInitiationService.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngPaymentInitiationService.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.PaymentInitiationService; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.api.validation.ValidationError; import de.adorsys.xs2a.adapter.impl.http.JacksonObjectMapper; import de.adorsys.xs2a.adapter.impl.http.JsonMapper; import de.adorsys.xs2a.adapter.ing.model.IngPaymentProduct; import de.adorsys.xs2a.adapter.ing.model.IngXmlPaymentProduct; import org.mapstruct.factory.Mappers; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.function.Function; import static de.adorsys.xs2a.adapter.api.validation.Validation.requireValid; import static de.adorsys.xs2a.adapter.api.validation.ValidationError.Code.NOT_SUPPORTED; public class IngPaymentInitiationService implements PaymentInitiationService { private final IngOauth2Service ingOauth2Service; private final LinksRewriter linksRewriter; private final IngPaymentInitiationApi paymentInitiationApi; private final IngMapper mapper = Mappers.getMapper(IngMapper.class); private final JsonMapper jsonMapper = new JacksonObjectMapper(); private final List<Interceptor> interceptors; public IngPaymentInitiationService(IngPaymentInitiationApi paymentInitiationApi, IngOauth2Service ingOauth2Service, LinksRewriter linksRewriter, List<Interceptor> interceptors) { this.paymentInitiationApi = paymentInitiationApi; this.ingOauth2Service = ingOauth2Service; this.linksRewriter = linksRewriter; this.interceptors = interceptors; } @Override public Response<PaymentInitationRequestResponse201> initiatePayment(PaymentService paymentService, PaymentProduct paymentProduct, RequestHeaders requestHeaders, RequestParams requestParams, Object body) { requireValid(validateInitiatePayment(paymentService, paymentProduct, requestHeaders, requestParams, body)); switch (paymentService) { case PAYMENTS: if (body instanceof String) { IngXmlPaymentProduct product = IngXmlPaymentProduct.of(paymentProduct); return paymentInitiationApi.initiatePaymentXml(product, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.TPP_REDIRECT_URI).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication()), (String) body) .map(mapper::map) .map(this::rewriteLinks); } IngPaymentProduct product = IngPaymentProduct.of(paymentProduct); PaymentInitiationJson jsonBody = jsonMapper.convertValue(body, PaymentInitiationJson.class); return paymentInitiationApi.initiatePayment(product, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.TPP_REDIRECT_URI).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication()), mapper.map(jsonBody)) .map(mapper::map) .map(this::rewriteLinks); case PERIODIC_PAYMENTS: if (body instanceof PeriodicPaymentInitiationMultipartBody) { return paymentInitiationApi.initiatePeriodicPaymentXml(IngXmlPaymentProduct.of(paymentProduct), requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.TPP_REDIRECT_URI).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication()), mapper.map((PeriodicPaymentInitiationMultipartBody) body)) .map(mapper::map) .map(this::rewriteLinks); } return paymentInitiationApi.initiatePeriodicPayment(IngPaymentProduct.of(paymentProduct), requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.TPP_REDIRECT_URI).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication()), mapper.map(jsonMapper.convertValue(body, PeriodicPaymentInitiationJson.class))) .map(mapper::map) .map(this::rewriteLinks); default: throw new UnsupportedOperationException(paymentService.toString()); } } @Override public List<ValidationError> validateInitiatePayment(PaymentService paymentService, PaymentProduct paymentProduct, RequestHeaders requestHeaders, RequestParams requestParams, Object body) { if (paymentService == PaymentService.PERIODIC_PAYMENTS && !(body instanceof PeriodicPaymentInitiationMultipartBody)) { FrequencyCode frequency = jsonMapper.convertValue(body, PeriodicPaymentInitiationJson.class).getFrequency(); try { mapper.map(frequency); } catch (IllegalArgumentException e) { return Collections.singletonList( new ValidationError(NOT_SUPPORTED, "frequency", "\"" + frequency + "\" value is not supported")); } } return Collections.emptyList(); } private PaymentInitationRequestResponse201 rewriteLinks(PaymentInitationRequestResponse201 body) { body.setLinks(linksRewriter.rewrite(body.getLinks())); return body; } @Override public Response<PaymentInitiationWithStatusResponse> getSinglePaymentInformation(PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { IngPaymentProduct product = IngPaymentProduct.of(paymentProduct); return paymentInitiationApi.getPaymentDetails(product, paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(mapper::map); } @Override public Response<PeriodicPaymentInitiationWithStatusResponse> getPeriodicPaymentInformation(PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { IngPaymentProduct product = IngPaymentProduct.of(paymentProduct); return paymentInitiationApi.getPeriodicPaymentDetails(product, paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(mapper::map); } @Override public Response<PeriodicPaymentInitiationMultipartBody> getPeriodicPain001PaymentInformation(PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { IngXmlPaymentProduct product = IngXmlPaymentProduct.of(paymentProduct); return paymentInitiationApi.getPeriodicPaymentDetailsXml(product, paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(mapper::map); } @Override public Response<String> getPaymentInformationAsString(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { switch (paymentService) { case PAYMENTS: if (isXml(paymentProduct)) { IngXmlPaymentProduct product = IngXmlPaymentProduct.of(paymentProduct); return paymentInitiationApi.getPaymentDetailsXml(product, paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(Function.identity()); } return getSinglePaymentInformation(paymentProduct, paymentId, requestHeaders, requestParams) .map(jsonMapper::writeValueAsString); case PERIODIC_PAYMENTS: if (isXml(paymentProduct)) { return getPeriodicPain001PaymentInformation(paymentProduct, paymentId, requestHeaders, requestParams) .map(jsonMapper::writeValueAsString); } return getPeriodicPaymentInformation(paymentProduct, paymentId, requestHeaders, requestParams) .map(jsonMapper::writeValueAsString); default: throw new UnsupportedOperationException(paymentService.toString()); } } protected boolean isXml(PaymentProduct paymentProduct) { return paymentProduct.toString().startsWith("pain"); } @Override public Response<ScaStatusResponse> getPaymentInitiationScaStatus(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<PaymentInitiationStatusResponse200Json> getPaymentInitiationStatus(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { IngPaymentProduct product = IngPaymentProduct.of(paymentProduct); switch (paymentService) { case PAYMENTS: return paymentInitiationApi.getPaymentStatus(product, paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(mapper::map); case PERIODIC_PAYMENTS: return paymentInitiationApi.getPeriodicPaymentStatus(product, paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(mapper::map); default: throw new UnsupportedOperationException(paymentService.toString()); } } @Override public Response<String> getPaymentInitiationStatusAsString(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { switch (paymentService) { case PAYMENTS: if (isXml(paymentProduct)) { IngXmlPaymentProduct product = IngXmlPaymentProduct.of(paymentProduct); return paymentInitiationApi.getPaymentStatusXml(product, paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(Function.identity()); } return getPaymentInitiationStatus(paymentService, paymentProduct, paymentId, requestHeaders, requestParams) .map(jsonMapper::writeValueAsString); case PERIODIC_PAYMENTS: if (isXml(paymentProduct)) { return paymentInitiationApi.getPeriodicPaymentStatusXml(IngXmlPaymentProduct.of(paymentProduct), paymentId, requestHeaders.get(RequestHeaders.X_REQUEST_ID).orElse(null), requestHeaders.get(RequestHeaders.PSU_IP_ADDRESS).orElse(null), addInterceptor(ingOauth2Service.getClientAuthentication())) .map(Function.identity()); } return getPaymentInitiationStatus(paymentService, paymentProduct, paymentId, requestHeaders, requestParams) .map(jsonMapper::writeValueAsString); default: throw new UnsupportedOperationException(paymentService.toString()); } } @Override public Response<Authorisations> getPaymentInitiationAuthorisation(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<StartScaprocessResponse> startPaymentAuthorisation(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams) { throw new UnsupportedOperationException(); } @Override public Response<StartScaprocessResponse> startPaymentAuthorisation(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, RequestHeaders requestHeaders, RequestParams requestParams, UpdatePsuAuthentication updatePsuAuthentication) { throw new UnsupportedOperationException(); } @Override public Response<SelectPsuAuthenticationMethodResponse> updatePaymentPsuData(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, SelectPsuAuthenticationMethod selectPsuAuthenticationMethod) { throw new UnsupportedOperationException(); } @Override public Response<ScaStatusResponse> updatePaymentPsuData(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, TransactionAuthorisation transactionAuthorisation) { throw new UnsupportedOperationException(); } @Override public Response<UpdatePsuAuthenticationResponse> updatePaymentPsuData(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, String authorisationId, RequestHeaders requestHeaders, RequestParams requestParams, UpdatePsuAuthentication updatePsuAuthentication) { throw new UnsupportedOperationException(); } private List<Interceptor> addInterceptor(Interceptor interceptor) { List<Interceptor> tempList = new ArrayList<>(Optional.ofNullable(interceptors) .orElseGet(Collections::emptyList)); tempList.add(interceptor); return Collections.unmodifiableList(tempList); } }
21,400
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountInformationApi.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngAccountInformationApi.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpLogSanitizer; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.api.model.CardAccountsTransactionsResponse200; import de.adorsys.xs2a.adapter.impl.http.ResponseHandlers; import de.adorsys.xs2a.adapter.impl.http.StringUri; import de.adorsys.xs2a.adapter.ing.model.IngAccountsResponse; import de.adorsys.xs2a.adapter.ing.model.IngBalancesResponse; import de.adorsys.xs2a.adapter.ing.model.IngTransactionsResponse; import java.time.LocalDate; import java.util.*; public class IngAccountInformationApi { private static final String ACCOUNTS_ENDPOINT = "/v3/accounts"; private static final String TRANSACTIONS_ENDPOINT = "/v2/accounts/{{accountId}}/transactions"; private static final String BALANCES_ENDPOINT = "/v3/accounts/{{accountId}}/balances"; private static final String CARD_ACCOUNT_TRANSACTIONS_ENDPOINT = "/v1/card-accounts/{{accountId}}/transactions"; private static final String ACCOUNT_ID_PLACEHOLDER = "{{accountId}}"; private final String baseUri; private final HttpClient httpClient; private final ResponseHandlers handlers; public IngAccountInformationApi(String baseUri, HttpClient httpClient, HttpLogSanitizer logSanitizer) { this.baseUri = baseUri; this.httpClient = httpClient; this.handlers = new ResponseHandlers(logSanitizer); } public Response<IngAccountsResponse> getAccounts(String requestId, List<Interceptor> interceptors) { return getResponse(baseUri + ACCOUNTS_ENDPOINT, requestId, interceptors, IngAccountsResponse.class); } public Response<IngTransactionsResponse> getTransactions(String resourceId, LocalDate dateFrom, LocalDate dateTo, Currency currency, Integer limit, String requestId, List<Interceptor> interceptors) { Map<String, Object> queryParams = new LinkedHashMap<>(); queryParams.put("dateFrom", dateFrom); queryParams.put("dateTo", dateTo); queryParams.put("currency", currency); queryParams.put("limit", limit); String uri = StringUri.withQuery( baseUri + TRANSACTIONS_ENDPOINT.replace(ACCOUNT_ID_PLACEHOLDER, Objects.requireNonNull(resourceId)), queryParams ); return getResponse(uri, requestId, interceptors, IngTransactionsResponse.class); } /** * @param balanceTypes (optional) A comma separated list of ISO20022 balance type(s) * @param currency (optional/conditional) 3 Letter ISO Currency Code (ISO 4217) * for which transactions are requested. Required in case * transactions are requested for a multi-currency account. */ public Response<IngBalancesResponse> getBalances(String resourceId, List<String> balanceTypes, Currency currency, String requestId, List<Interceptor> interceptors) { Map<String, Object> queryParams = new LinkedHashMap<>(); queryParams.put("balanceTypes", balanceTypes.isEmpty() ? null : String.join(",", balanceTypes)); queryParams.put("currency", currency); String uri = StringUri.withQuery( baseUri + BALANCES_ENDPOINT.replace(ACCOUNT_ID_PLACEHOLDER, Objects.requireNonNull(resourceId)), queryParams ); return getResponse(uri, requestId, interceptors, IngBalancesResponse.class); } public Response<CardAccountsTransactionsResponse200> getCardAccountTransactions(String accountId, LocalDate dateFrom, LocalDate dateTo, Integer limit, String requestId, List<Interceptor> interceptors) { Map<String, Object> queryParams = new LinkedHashMap<>(); queryParams.put("dateFrom", dateFrom); queryParams.put("dateTo", dateTo); queryParams.put("limit", limit); String uri = StringUri.withQuery( baseUri + CARD_ACCOUNT_TRANSACTIONS_ENDPOINT.replace(ACCOUNT_ID_PLACEHOLDER, Objects.requireNonNull(accountId)), queryParams ); return getResponse(uri, requestId, interceptors, CardAccountsTransactionsResponse200.class); } private <T> Response<T> getResponse(String url, String requestId, List<Interceptor> interceptors, Class<T> tClass) { return httpClient.get(url) .header(RequestHeaders.X_REQUEST_ID, requestId) .send(handlers.jsonResponseHandler(tClass), interceptors); } }
6,520
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngClientAuthentication.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/IngClientAuthentication.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.exception.Xs2aAdapterException; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.api.http.Request; import java.net.MalformedURLException; import java.net.URL; import java.security.MessageDigest; import java.security.Signature; import java.security.SignatureException; import java.time.Instant; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.Base64; import java.util.Locale; public class IngClientAuthentication implements Interceptor { // java.time.format.DateTimeFormatter.RFC_1123_DATE_TIME doesn't pad single digit day-of-month with a zero private static final DateTimeFormatter RFC_1123_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss O", Locale.US) .withZone(ZoneOffset.UTC); private final Signature signature; private final MessageDigest digest; private final String tppSignatureCertificate; private final String keyId; private final String accessToken; IngClientAuthentication(Signature signature, MessageDigest digest, String tppSignatureCertificate, String keyId, String accessToken) { this.signature = signature; this.digest = digest; this.tppSignatureCertificate = tppSignatureCertificate; this.keyId = keyId; this.accessToken = accessToken; } @Override public Request.Builder preHandle(Request.Builder requestBuilder) { String xRequestId = requestBuilder.headers().get(RequestHeaders.X_REQUEST_ID); String date = RFC_1123_DATE_TIME_FORMATTER.format(Instant.now()); String digestValue = "SHA-256=" + base64(digest(requestBuilder.content())); String signingString = "(request-target): " + requestTarget(requestBuilder) + "\n" + (xRequestId != null ? "x-request-id: " + xRequestId + "\n" : "") + "date: " + date + "\n" + "digest: " + digestValue; String signatureValue = "keyId=\"" + keyId + "\",algorithm=\"rsa-sha256\",headers=\"(request-target)" + (xRequestId != null ? " x-request-id" : "") + " date digest\"," + "signature=\"" + base64(sign(signingString)) + "\""; if (accessToken == null) { requestBuilder.header("Authorization", "Signature " + signatureValue); } else { requestBuilder .header("Signature", signatureValue) .header("Authorization", "Bearer " + accessToken); } requestBuilder .header("Date", date) .header("Digest", digestValue) .header("TPP-Signature-Certificate", tppSignatureCertificate); return requestBuilder; } private String base64(byte[] data) { return Base64.getEncoder().encodeToString(data); } private byte[] digest(String content) { digest.update(content.getBytes()); return digest.digest(); } private String requestTarget(Request.Builder requestBuilder) { try { return requestBuilder.method().toLowerCase() + " " + new URL(requestBuilder.uri()).getFile(); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } private byte[] sign(String signingString) { try { signature.update(signingString.getBytes()); return signature.sign(); } catch (SignatureException e) { throw new Xs2aAdapterException(e); } } }
4,629
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngTransaction.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngTransaction.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import java.time.LocalDate; import java.time.OffsetDateTime; public class IngTransaction { private String transactionId; private String endToEndId; private LocalDate bookingDate; private LocalDate valueDate; private OffsetDateTime executionDateTime; private IngAmount transactionAmount; private String creditorName; private IngCounterpartyAccount creditorAccount; private String debtorName; private IngCounterpartyAccount debtorAccount; private String transactionType; private String remittanceInformationUnstructured; private IngTransactionRemittanceInformationStructured remittanceInformationStructured; public String getTransactionId() { return transactionId; } public void setTransactionId(String transactionId) { this.transactionId = transactionId; } public String getEndToEndId() { return endToEndId; } public void setEndToEndId(String endToEndId) { this.endToEndId = endToEndId; } public LocalDate getBookingDate() { return bookingDate; } public void setBookingDate(LocalDate bookingDate) { this.bookingDate = bookingDate; } public LocalDate getValueDate() { return valueDate; } public void setValueDate(LocalDate valueDate) { this.valueDate = valueDate; } public OffsetDateTime getExecutionDateTime() { return executionDateTime; } public void setExecutionDateTime(OffsetDateTime executionDateTime) { this.executionDateTime = executionDateTime; } public IngAmount getTransactionAmount() { return transactionAmount; } public void setTransactionAmount(IngAmount transactionAmount) { this.transactionAmount = transactionAmount; } public String getCreditorName() { return creditorName; } public void setCreditorName(String creditorName) { this.creditorName = creditorName; } public IngCounterpartyAccount getCreditorAccount() { return creditorAccount; } public void setCreditorAccount(IngCounterpartyAccount creditorAccount) { this.creditorAccount = creditorAccount; } public String getDebtorName() { return debtorName; } public void setDebtorName(String debtorName) { this.debtorName = debtorName; } public IngCounterpartyAccount getDebtorAccount() { return debtorAccount; } public void setDebtorAccount(IngCounterpartyAccount debtorAccount) { this.debtorAccount = debtorAccount; } public String getTransactionType() { return transactionType; } public void setTransactionType(String transactionType) { this.transactionType = transactionType; } public String getRemittanceInformationUnstructured() { return remittanceInformationUnstructured; } public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) { this.remittanceInformationUnstructured = remittanceInformationUnstructured; } public IngTransactionRemittanceInformationStructured getRemittanceInformationStructured() { return remittanceInformationStructured; } public void setRemittanceInformationStructured(IngTransactionRemittanceInformationStructured remittanceInformationStructured) { this.remittanceInformationStructured = remittanceInformationStructured; } }
4,337
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPeriodicPaymentInitiationXml.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPeriodicPaymentInitiationXml.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import java.time.LocalDate; public class IngPeriodicPaymentInitiationXml { private String xml_sct; private LocalDate startDate; private LocalDate endDate; private IngFrequencyCode frequency; private IngDayOfExecution dayOfExecution; public String getXml_sct() { return xml_sct; } public void setXml_sct(String xml_sct) { this.xml_sct = xml_sct; } public LocalDate getStartDate() { return startDate; } public void setStartDate(LocalDate startDate) { this.startDate = startDate; } public LocalDate getEndDate() { return endDate; } public void setEndDate(LocalDate endDate) { this.endDate = endDate; } public IngFrequencyCode getFrequency() { return frequency; } public void setFrequency(IngFrequencyCode frequency) { this.frequency = frequency; } public IngDayOfExecution getDayOfExecution() { return dayOfExecution; } public void setDayOfExecution(IngDayOfExecution dayOfExecution) { this.dayOfExecution = dayOfExecution; } }
1,994
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngCounterpartyAccount.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngCounterpartyAccount.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngCounterpartyAccount { private String iban; private String bban; private String bic; public String getIban() { return iban; } public void setIban(String iban) { this.iban = iban; } public String getBban() { return bban; } public void setBban(String bban) { this.bban = bban; } public String getBic() { return bic; } public void setBic(String bic) { this.bic = bic; } }
1,374
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentStatusResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPaymentStatusResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngPaymentStatusResponse { private String transactionStatus; public String getTransactionStatus() { return transactionStatus; } public void setTransactionStatus(String transactionStatus) { this.transactionStatus = transactionStatus; } }
1,162
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccount.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngAccount.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.UUID; public class IngAccount { private UUID resourceId; private String iban; private String name; private String currency; private String product; @JsonProperty("_links") private IngAccountLinks links; public UUID getResourceId() { return resourceId; } public void setResourceId(UUID resourceId) { this.resourceId = resourceId; } public String getIban() { return iban; } public void setIban(String iban) { this.iban = iban; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } public String getProduct() { return product; } public void setProduct(String product) { this.product = product; } public IngAccountLinks getLinks() { return links; } public void setLinks(IngAccountLinks links) { this.links = links; } }
2,064
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPeriodicPaymentInitiationResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPeriodicPaymentInitiationResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; public class IngPeriodicPaymentInitiationResponse { private String transactionStatus; private String paymentId; @JsonProperty("_links") private IngPeriodicLinks links; private List<IngTppMessage> tppMessages; public String getTransactionStatus() { return transactionStatus; } public void setTransactionStatus(String transactionStatus) { this.transactionStatus = transactionStatus; } public String getPaymentId() { return paymentId; } public void setPaymentId(String paymentId) { this.paymentId = paymentId; } public IngPeriodicLinks getLinks() { return links; } public void setLinks(IngPeriodicLinks links) { this.links = links; } public List<IngTppMessage> getTppMessages() { return tppMessages; } public void setTppMessages(List<IngTppMessage> tppMessages) { this.tppMessages = tppMessages; } }
1,910
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAmount.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngAmount.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngAmount { private String currency; private String amount; public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } public String getAmount() { return amount; } public void setAmount(String amount) { this.amount = amount; } }
1,254
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngTransactionsResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngTransactionsResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngTransactionsResponse { private IngAccountReferenceIban account; private IngTransactions transactions; public IngAccountReferenceIban getAccount() { return account; } public void setAccount(IngAccountReferenceIban account) { this.account = account; } public IngTransactions getTransactions() { return transactions; } public void setTransactions(IngTransactions transactions) { this.transactions = transactions; } }
1,381
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngChargeBearer.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngChargeBearer.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum IngChargeBearer { DEBT("DEBT"), CRED("CRED"), SHAR("SHAR"), SLEV("SLEV"); private final String value; IngChargeBearer(String value) { this.value = value; } @JsonCreator public static IngChargeBearer of(String value) { for (IngChargeBearer e : IngChargeBearer.values()) { if (e.value.equals(value)) { return e; } } throw new IllegalArgumentException(value); } @JsonValue @Override public String toString() { return value; } }
1,561
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngTppMessage.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngTppMessage.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngTppMessage { private String category; private String code; private String text; private String path; public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } }
1,556
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAuthorizationURLResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngAuthorizationURLResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngAuthorizationURLResponse { private String location; public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } }
1,102
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngXmlPaymentProduct.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngXmlPaymentProduct.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import de.adorsys.xs2a.adapter.api.model.PaymentProduct; public enum IngXmlPaymentProduct { PAIN_001_SEPA_CREDIT_TRANSFERS("pain.001-sepa-credit-transfers"), PAIN_001_CROSS_BORDER_CREDIT_TRANSFERS("pain.001-cross-border-credit-transfers"), PAIN_001_DOMESTIC_CREDIT_TRANSFERS("pain.001-domestic-credit-transfers"); private final String value; IngXmlPaymentProduct(String value) { this.value = value; } @JsonCreator public static IngXmlPaymentProduct fromValue(String value) { for (IngXmlPaymentProduct e : IngXmlPaymentProduct.values()) { if (e.value.equals(value)) { return e; } } throw new IllegalArgumentException(value); } public static IngXmlPaymentProduct of(PaymentProduct paymentProduct) { return fromValue(paymentProduct.toString()); } @Override @JsonValue public String toString() { return value; } }
1,944
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngClearingSystemMemberIdentification.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngClearingSystemMemberIdentification.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngClearingSystemMemberIdentification { private String clearingSystemIdentificationCode; private String memberIdentification; public String getClearingSystemIdentificationCode() { return clearingSystemIdentificationCode; } public void setClearingSystemIdentificationCode(String clearingSystemIdentificationCode) { this.clearingSystemIdentificationCode = clearingSystemIdentificationCode; } public String getMemberIdentification() { return memberIdentification; } public void setMemberIdentification(String memberIdentification) { this.memberIdentification = memberIdentification; } }
1,548
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentInitiationResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPaymentInitiationResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; public class IngPaymentInitiationResponse { private String transactionStatus; private String paymentId; @JsonProperty("_links") private IngLinks links; private List<IngTppMessage> tppMessages; public String getTransactionStatus() { return transactionStatus; } public void setTransactionStatus(String transactionStatus) { this.transactionStatus = transactionStatus; } public String getPaymentId() { return paymentId; } public void setPaymentId(String paymentId) { this.paymentId = paymentId; } public IngLinks getLinks() { return links; } public void setLinks(IngLinks links) { this.links = links; } public List<IngTppMessage> getTppMessages() { return tppMessages; } public void setTppMessages(List<IngTppMessage> tppMessages) { this.tppMessages = tppMessages; } }
1,877
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngTokenResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngTokenResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonProperty; public class IngTokenResponse { @JsonProperty("access_token") private String accessToken; @JsonProperty("token_type") private String tokenType; @JsonProperty("expires_in") private Long expiresInSeconds; @JsonProperty("refresh_token") private String refreshToken; private String scope; public String getAccessToken() { return accessToken; } public String getTokenType() { return tokenType; } public Long getExpiresInSeconds() { return expiresInSeconds; } public String getRefreshToken() { return refreshToken; } public String getScope() { return scope; } }
1,610
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountLinks.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngAccountLinks.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngAccountLinks { private IngHrefType balances; private IngHrefType transactions; public IngHrefType getBalances() { return balances; } public void setBalances(IngHrefType balances) { this.balances = balances; } public IngHrefType getTransactions() { return transactions; } public void setTransactions(IngHrefType transactions) { this.transactions = transactions; } }
1,332
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngLinks.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngLinks.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngLinks { private String scaRedirect; private String self; private String status; private String delete; public String getScaRedirect() { return scaRedirect; } public void setScaRedirect(String scaRedirect) { this.scaRedirect = scaRedirect; } public String getSelf() { return self; } public void setSelf(String self) { this.self = self; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getDelete() { return delete; } public void setDelete(String delete) { this.delete = delete; } }
1,600
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngApplicationTokenResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngApplicationTokenResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonProperty; public class IngApplicationTokenResponse extends IngTokenResponse { @JsonProperty("client_id") private String clientId; public final String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } }
1,219
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentInstruction.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPaymentInstruction.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import java.time.LocalDate; public class IngPaymentInstruction { private String endToEndIdentification; private IngDebtorAccount debtorAccount; private IngAmount instructedAmount; private IngCreditorAccount creditorAccount; private String creditorAgent; private String creditorName; private IngAddress creditorAddress; private String chargeBearer; private String remittanceInformationUnstructured; private IngClearingSystemMemberIdentification clearingSystemMemberIdentification; private String debtorName; private String debtorAgent; private String instructionPriority; private String serviceLevelCode; private String localInstrumentCode; private String categoryPurposeCode; private LocalDate requestedExecutionDate; public String getEndToEndIdentification() { return endToEndIdentification; } public void setEndToEndIdentification(String endToEndIdentification) { this.endToEndIdentification = endToEndIdentification; } public IngDebtorAccount getDebtorAccount() { return debtorAccount; } public void setDebtorAccount(IngDebtorAccount debtorAccount) { this.debtorAccount = debtorAccount; } public IngAmount getInstructedAmount() { return instructedAmount; } public void setInstructedAmount(IngAmount instructedAmount) { this.instructedAmount = instructedAmount; } public IngCreditorAccount getCreditorAccount() { return creditorAccount; } public void setCreditorAccount(IngCreditorAccount creditorAccount) { this.creditorAccount = creditorAccount; } public String getCreditorAgent() { return creditorAgent; } public void setCreditorAgent(String creditorAgent) { this.creditorAgent = creditorAgent; } public String getCreditorName() { return creditorName; } public void setCreditorName(String creditorName) { this.creditorName = creditorName; } public IngAddress getCreditorAddress() { return creditorAddress; } public void setCreditorAddress(IngAddress creditorAddress) { this.creditorAddress = creditorAddress; } public String getChargeBearer() { return chargeBearer; } public void setChargeBearer(String chargeBearer) { this.chargeBearer = chargeBearer; } public String getRemittanceInformationUnstructured() { return remittanceInformationUnstructured; } public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) { this.remittanceInformationUnstructured = remittanceInformationUnstructured; } public IngClearingSystemMemberIdentification getClearingSystemMemberIdentification() { return clearingSystemMemberIdentification; } public void setClearingSystemMemberIdentification(IngClearingSystemMemberIdentification clearingSystemMemberIdentification) { this.clearingSystemMemberIdentification = clearingSystemMemberIdentification; } public String getDebtorName() { return debtorName; } public void setDebtorName(String debtorName) { this.debtorName = debtorName; } public String getDebtorAgent() { return debtorAgent; } public void setDebtorAgent(String debtorAgent) { this.debtorAgent = debtorAgent; } public String getInstructionPriority() { return instructionPriority; } public void setInstructionPriority(String instructionPriority) { this.instructionPriority = instructionPriority; } public String getServiceLevelCode() { return serviceLevelCode; } public void setServiceLevelCode(String serviceLevelCode) { this.serviceLevelCode = serviceLevelCode; } public String getLocalInstrumentCode() { return localInstrumentCode; } public void setLocalInstrumentCode(String localInstrumentCode) { this.localInstrumentCode = localInstrumentCode; } public String getCategoryPurposeCode() { return categoryPurposeCode; } public void setCategoryPurposeCode(String categoryPurposeCode) { this.categoryPurposeCode = categoryPurposeCode; } public LocalDate getRequestedExecutionDate() { return requestedExecutionDate; } public void setRequestedExecutionDate(LocalDate requestedExecutionDate) { this.requestedExecutionDate = requestedExecutionDate; } }
5,413
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngDayOfExecution.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngDayOfExecution.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum IngDayOfExecution { _1("01"), _2("02"), _3("03"), _4("04"), _5("05"), _6("06"), _7("07"), _8("08"), _9("09"), _10("10"), _11("11"), _12("12"), _13("13"), _14("14"), _15("15"), _16("16"), _17("17"), _18("18"), _19("19"), _20("20"), _21("21"), _22("22"), _23("23"), _24("24"), _25("25"), _26("26"), _27("27"), _28("28"), _29("29"), _30("30"), _31("31"); private final String value; IngDayOfExecution(String value) { this.value = value; } @JsonCreator public static IngDayOfExecution of(String value) { for (IngDayOfExecution e : IngDayOfExecution.values()) { if (e.value.equals(value)) { return e; } } throw new IllegalArgumentException(value); } @JsonValue @Override public String toString() { return value; } }
1,982
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngDebtorAccount.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngDebtorAccount.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngDebtorAccount { private String iban; private String currency; public String getIban() { return iban; } public void setIban(String iban) { this.iban = iban; } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } }
1,247
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngInstructionPriority.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngInstructionPriority.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum IngInstructionPriority { HIGH("HIGH"), NORM("NORM"); private final String value; IngInstructionPriority(String value) { this.value = value; } @JsonCreator public static IngInstructionPriority of(String value) { for (IngInstructionPriority e : IngInstructionPriority.values()) { if (e.value.equals(value)) { return e; } } throw new IllegalArgumentException(value); } @JsonValue @Override public String toString() { return value; } }
1,558
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountsResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngAccountsResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import java.util.List; public class IngAccountsResponse { private List<IngAccount> accounts; public List<IngAccount> getAccounts() { return accounts; } public void setAccounts(List<IngAccount> accounts) { this.accounts = accounts; } }
1,148
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngTransactionRemittanceInformationStructured.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngTransactionRemittanceInformationStructured.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngTransactionRemittanceInformationStructured { private String referenceType; private String referenceIssuer; private String reference; public String getReferenceType() { return referenceType; } public void setReferenceType(String referenceType) { this.referenceType = referenceType; } public String getReferenceIssuer() { return referenceIssuer; } public void setReferenceIssuer(String referenceIssuer) { this.referenceIssuer = referenceIssuer; } public String getReference() { return reference; } public void setReference(String reference) { this.reference = reference; } }
1,579
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAddress.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngAddress.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngAddress { private String street; private String buildingNumber; private String city; private String postalCode; private String country; public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getBuildingNumber() { return buildingNumber; } public void setBuildingNumber(String buildingNumber) { this.buildingNumber = buildingNumber; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } }
1,828
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngAccountReferenceIban.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngAccountReferenceIban.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngAccountReferenceIban { private String iban; private String currency; public String getIban() { return iban; } public void setIban(String iban) { this.iban = iban; } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } }
1,254
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngBalance.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngBalance.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import java.time.LocalDate; import java.time.OffsetDateTime; public class IngBalance { private String balanceType; private IngAmount balanceAmount; private OffsetDateTime lastChangeDateTime; private LocalDate referenceDate; public String getBalanceType() { return balanceType; } public void setBalanceType(String balanceType) { this.balanceType = balanceType; } public IngAmount getBalanceAmount() { return balanceAmount; } public void setBalanceAmount(IngAmount balanceAmount) { this.balanceAmount = balanceAmount; } public OffsetDateTime getLastChangeDateTime() { return lastChangeDateTime; } public void setLastChangeDateTime(OffsetDateTime lastChangeDateTime) { this.lastChangeDateTime = lastChangeDateTime; } public LocalDate getReferenceDate() { return referenceDate; } public void setReferenceDate(LocalDate referenceDate) { this.referenceDate = referenceDate; } }
1,902
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngHrefType.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngHrefType.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngHrefType { private String href; public String getHref() { return href; } public void setHref(String href) { this.href = href; } }
1,058
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentProduct.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPaymentProduct.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import de.adorsys.xs2a.adapter.api.model.PaymentProduct; public enum IngPaymentProduct { SEPA_CREDIT_TRANSFERS("sepa-credit-transfers"), CROSS_BORDER_CREDIT_TRANSFERS("cross-border-credit-transfers"), DOMESTIC_CREDIT_TRANSFERS("domestic-credit-transfers"); private final String value; IngPaymentProduct(String value) { this.value = value; } @JsonCreator public static IngPaymentProduct fromValue(String value) { for (IngPaymentProduct e : IngPaymentProduct.values()) { if (e.value.equals(value)) { return e; } } throw new IllegalArgumentException(value); } public static IngPaymentProduct of(PaymentProduct paymentProduct) { return fromValue(paymentProduct.toString()); } @Override @JsonValue public String toString() { return value; } }
1,872
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngLinksNext.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngLinksNext.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngLinksNext { private IngHrefType next; public IngHrefType getNext() { return next; } public void setNext(IngHrefType next) { this.next = next; } }
1,074
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngFrequencyCode.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngFrequencyCode.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public enum IngFrequencyCode { DAIL("DAIL"), WEEK("WEEK"), TOWK("TOWK"), MNTH("MNTH"), TOMN("TOMN"), FOMN("FOMN"), QUTR("QUTR"), SEMI("SEMI"), YEAR("YEAR"); private final String value; IngFrequencyCode(String value) { this.value = value; } @JsonCreator public static IngFrequencyCode of(String value) { for (IngFrequencyCode e : IngFrequencyCode.values()) { if (e.value.equals(value)) { return e; } } throw new IllegalArgumentException(value); } @JsonValue @Override public String toString() { return value; } }
1,661
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngTransactions.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngTransactions.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; public class IngTransactions { private List<IngTransaction> booked; private List<IngTransaction> pending; private List<IngTransaction> info; @JsonProperty("_links") private IngLinksNext links; public List<IngTransaction> getBooked() { return booked; } public void setBooked(List<IngTransaction> booked) { this.booked = booked; } public List<IngTransaction> getPending() { return pending; } public void setPending(List<IngTransaction> pending) { this.pending = pending; } public List<IngTransaction> getInfo() { return info; } public void setInfo(List<IngTransaction> info) { this.info = info; } public IngLinksNext getLinks() { return links; } public void setLinks(IngLinksNext links) { this.links = links; } }
1,823
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPeriodicLinks.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPeriodicLinks.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngPeriodicLinks { private String scaRedirect; private String self; private String status; private String delete; public String getScaRedirect() { return scaRedirect; } public void setScaRedirect(String scaRedirect) { this.scaRedirect = scaRedirect; } public String getSelf() { return self; } public void setSelf(String self) { this.self = self; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getDelete() { return delete; } public void setDelete(String delete) { this.delete = delete; } }
1,608
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPeriodicPaymentInitiationJson.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPeriodicPaymentInitiationJson.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import java.time.LocalDate; public class IngPeriodicPaymentInitiationJson { private String endToEndIdentification; private IngDebtorAccount debtorAccount; private IngAmount instructedAmount; private IngCreditorAccount creditorAccount; private String creditorAgent; private String creditorName; private IngAddress creditorAddress; private IngChargeBearer chargeBearer; private String remittanceInformationUnstructured; private IngClearingSystemMemberIdentification clearingSystemMemberIdentification; private String debtorName; private String debtorAgent; private IngInstructionPriority instructionPriority; private String serviceLevelCode; private String localInstrumentCode; private String categoryPurposeCode; private LocalDate requestedExecutionDate; private LocalDate startDate; private LocalDate endDate; private IngFrequencyCode frequency; private IngDayOfExecution dayOfExecution; public String getEndToEndIdentification() { return endToEndIdentification; } public void setEndToEndIdentification(String endToEndIdentification) { this.endToEndIdentification = endToEndIdentification; } public IngDebtorAccount getDebtorAccount() { return debtorAccount; } public void setDebtorAccount(IngDebtorAccount debtorAccount) { this.debtorAccount = debtorAccount; } public IngAmount getInstructedAmount() { return instructedAmount; } public void setInstructedAmount(IngAmount instructedAmount) { this.instructedAmount = instructedAmount; } public IngCreditorAccount getCreditorAccount() { return creditorAccount; } public void setCreditorAccount(IngCreditorAccount creditorAccount) { this.creditorAccount = creditorAccount; } public String getCreditorAgent() { return creditorAgent; } public void setCreditorAgent(String creditorAgent) { this.creditorAgent = creditorAgent; } public String getCreditorName() { return creditorName; } public void setCreditorName(String creditorName) { this.creditorName = creditorName; } public IngAddress getCreditorAddress() { return creditorAddress; } public void setCreditorAddress(IngAddress creditorAddress) { this.creditorAddress = creditorAddress; } public IngChargeBearer getChargeBearer() { return chargeBearer; } public void setChargeBearer(IngChargeBearer chargeBearer) { this.chargeBearer = chargeBearer; } public String getRemittanceInformationUnstructured() { return remittanceInformationUnstructured; } public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) { this.remittanceInformationUnstructured = remittanceInformationUnstructured; } public IngClearingSystemMemberIdentification getClearingSystemMemberIdentification() { return clearingSystemMemberIdentification; } public void setClearingSystemMemberIdentification(IngClearingSystemMemberIdentification clearingSystemMemberIdentification) { this.clearingSystemMemberIdentification = clearingSystemMemberIdentification; } public String getDebtorName() { return debtorName; } public void setDebtorName(String debtorName) { this.debtorName = debtorName; } public String getDebtorAgent() { return debtorAgent; } public void setDebtorAgent(String debtorAgent) { this.debtorAgent = debtorAgent; } public IngInstructionPriority getInstructionPriority() { return instructionPriority; } public void setInstructionPriority(IngInstructionPriority instructionPriority) { this.instructionPriority = instructionPriority; } public String getServiceLevelCode() { return serviceLevelCode; } public void setServiceLevelCode(String serviceLevelCode) { this.serviceLevelCode = serviceLevelCode; } public String getLocalInstrumentCode() { return localInstrumentCode; } public void setLocalInstrumentCode(String localInstrumentCode) { this.localInstrumentCode = localInstrumentCode; } public String getCategoryPurposeCode() { return categoryPurposeCode; } public void setCategoryPurposeCode(String categoryPurposeCode) { this.categoryPurposeCode = categoryPurposeCode; } public LocalDate getRequestedExecutionDate() { return requestedExecutionDate; } public void setRequestedExecutionDate(LocalDate requestedExecutionDate) { this.requestedExecutionDate = requestedExecutionDate; } public LocalDate getStartDate() { return startDate; } public void setStartDate(LocalDate startDate) { this.startDate = startDate; } public LocalDate getEndDate() { return endDate; } public void setEndDate(LocalDate endDate) { this.endDate = endDate; } public IngFrequencyCode getFrequency() { return frequency; } public void setFrequency(IngFrequencyCode frequency) { this.frequency = frequency; } public IngDayOfExecution getDayOfExecution() { return dayOfExecution; } public void setDayOfExecution(IngDayOfExecution dayOfExecution) { this.dayOfExecution = dayOfExecution; } }
6,366
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngPaymentAgreementStatusResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngPaymentAgreementStatusResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; public class IngPaymentAgreementStatusResponse { private TransactionStatus transactionStatus; public enum TransactionStatus { RCVD("RCVD"), ACTV("ACTV"), EXPI("EXPI"), CANC("CANC"), RJCT("RJCT"); private final String value; TransactionStatus(String value) { this.value = value; } @JsonCreator public static TransactionStatus of(String value) { for (TransactionStatus e : TransactionStatus.values()) { if (e.value.equals(value)) { return e; } } throw new IllegalArgumentException(value); } @JsonValue @Override public String toString() { return value; } } public TransactionStatus getTransactionStatus() { return transactionStatus; } public void setTransactionStatus(TransactionStatus transactionStatus) { this.transactionStatus = transactionStatus; } }
2,021
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngBalancesResponse.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngBalancesResponse.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; import java.util.List; public class IngBalancesResponse { private IngAccountReferenceIban account; private List<IngBalance> balances; public IngAccountReferenceIban getAccount() { return account; } public void setAccount(IngAccountReferenceIban account) { this.account = account; } public List<IngBalance> getBalances() { return balances; } public void setBalances(List<IngBalance> balances) { this.balances = balances; } }
1,376
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
IngCreditorAccount.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/ing-adapter/src/main/java/de/adorsys/xs2a/adapter/ing/model/IngCreditorAccount.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.ing.model; public class IngCreditorAccount { private String iban; private String bban; private String currency; public String getIban() { return iban; } public void setIban(String iban) { this.iban = iban; } public String getBban() { return bban; } public void setBban(String bban) { this.bban = bban; } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } }
1,405
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
PsuIdTypeHeaderInterceptorTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/verlag-adapter/src/test/java/de/adorsys/xs2a/adapter/verlag/PsuIdTypeHeaderInterceptorTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.verlag; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.Interceptor; import de.adorsys.xs2a.adapter.api.http.Request; import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; import java.util.UUID; import static de.adorsys.xs2a.adapter.api.RequestHeaders.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; class PsuIdTypeHeaderInterceptorTest { private static final String METHOD = "GET"; private static final String URI = "https://uri.com"; private static final String APPLICATION_JSON = "application/json"; private static final String PSUID = "psu_id"; private static final String ASPSP_ID = UUID.randomUUID().toString(); private static final String EMPTY_VALUE = " "; private static final String SOME_PSU_ID_TYPE = "SOME_PSU_ID_TYPE"; private final Interceptor interceptor = new PsuIdTypeHeaderInterceptor(); private final Request.Builder builder = new RequestBuilderImpl(mock(HttpClient.class), METHOD, URI); @BeforeEach public void setUp() { populateHeader(builder); } @Test void apply_noPsuIdType() { interceptor.preHandle(builder); assertFalse(builder.headers().containsKey(PSU_ID_TYPE)); checkAssertions(builder); } @Test void apply_psuIdTypeWithoutValue() { builder.header(PSU_ID_TYPE, ""); interceptor.preHandle(builder); assertFalse(builder.headers().containsKey(PSU_ID_TYPE)); checkAssertions(builder); } @Test void apply_psuIdTypeWithEmptyValue() { builder.header(PSU_ID_TYPE, EMPTY_VALUE); interceptor.preHandle(builder); assertFalse(builder.headers().containsKey(PSU_ID_TYPE)); checkAssertions(builder); } @Test void apply_psuIdTypeWithValue() { builder.header(PSU_ID_TYPE, SOME_PSU_ID_TYPE); interceptor.preHandle(builder); assertTrue(builder.headers().containsKey(PSU_ID_TYPE)); assertEquals(SOME_PSU_ID_TYPE, builder.headers().get(PSU_ID_TYPE)); checkAssertions(builder); } private void populateHeader(Request.Builder builder) { builder.headers(buildHeaders()); } private Map<String, String> buildHeaders() { Map<String, String> headers = new HashMap<>(); headers.put(X_GTW_ASPSP_ID, ASPSP_ID); headers.put(CONTENT_TYPE, APPLICATION_JSON); headers.put(PSU_ID, PSUID); return headers; } private void checkAssertions(Request.Builder builder) { assertTrue(builder.headers().containsKey(X_GTW_ASPSP_ID)); assertEquals(ASPSP_ID, builder.headers().get(X_GTW_ASPSP_ID)); assertTrue(builder.headers().containsKey(CONTENT_TYPE)); assertEquals(APPLICATION_JSON, builder.headers().get(CONTENT_TYPE)); assertTrue(builder.headers().containsKey(PSU_ID)); assertEquals(PSUID, builder.headers().get(PSU_ID)); assertEquals(URI, builder.uri()); assertEquals(METHOD, builder.method()); } }
4,059
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
VerlagPaymentInitiationServiceWireMockTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/verlag-adapter/src/test/java/de/adorsys/xs2a/adapter/verlag/VerlagPaymentInitiationServiceWireMockTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.verlag; import de.adorsys.xs2a.adapter.api.PaymentInitiationService; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.model.*; import de.adorsys.xs2a.adapter.test.ServiceWireMockTest; import de.adorsys.xs2a.adapter.test.TestRequestResponse; import org.apache.commons.lang3.tuple.Pair; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.HashMap; import java.util.Map; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.params.provider.Arguments.arguments; @ServiceWireMockTest(TestVerlagServiceProvider.class) class VerlagPaymentInitiationServiceWireMockTest { protected static final String PAYMENTS_SCT_PAYMENT_ID = "fwD0xfgmDk9sGQViY-hS-fzlme_eDCUx3yjmKFt1Qky8lLRAzZIEXwk1k_5JbtVSTXPei8-LpTJAvgJsTrnLs_SdMWF3876hAweK_n7HJlg=_=_psGLvQpt9Q"; protected static final String PAYMENTS_SCT_AUTHORISATION_ID = "56fb9bd4-1c56-448e-8d45-b65bb42373c8"; protected static final String PAYMENTS_PAIN_PAYMENT_ID = "tIsb8fiD9_bi1gDuN7EwhAlPkOdfHwgvoAIiksmOVVYOhIu0pokCEKbQldu1TJJb2JZg8bL_p92Ot1RZiwTlEPSdMWF3876hAweK_n7HJlg=_=_psGLvQpt9Q"; protected static final String PAYMENTS_PAIN_AUTHORISATION_ID = "b890406b-f872-4889-9242-6891f5d6967b"; protected static final String PERIODIC_SCT_PAYMENT_ID = "Q0RrZV0EJeCvkSBG-l43vgV3yDa4kmPXnXLyXsRdg-YuY6TWANrBE4d49FUDqNwzCiLVnsE-K0LFvitlevm4mPSdMWF3876hAweK_n7HJlg=_=_psGLvQpt9Q"; protected static final String PERIODIC_SCT_AUTHORISATION_ID = "ce9beeb9-2df6-4ce0-b73a-c6a3a6a597d3"; private static final Ids ids = initiateMap(); private final PaymentInitiationService service; VerlagPaymentInitiationServiceWireMockTest(PaymentInitiationService service) { this.service = service; } private static Ids initiateMap() { return new Ids() .add(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, PAYMENTS_SCT_PAYMENT_ID, PAYMENTS_SCT_AUTHORISATION_ID) .add(PaymentService.PAYMENTS, PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS, PAYMENTS_PAIN_PAYMENT_ID, PAYMENTS_PAIN_AUTHORISATION_ID) .add(PaymentService.PERIODIC_PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS, PERIODIC_SCT_PAYMENT_ID, PERIODIC_SCT_AUTHORISATION_ID); } @ParameterizedTest @MethodSource("paymentTypes") void initiatePayment(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/initiate-payment.json"); Response<PaymentInitationRequestResponse201> response = service.initiatePayment(paymentService, paymentProduct, requestResponse.requestHeaders(), RequestParams.empty(), getRequestBody(paymentService, paymentProduct, requestResponse)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(PaymentInitationRequestResponse201.class)); } private Object getRequestBody(PaymentService paymentService, PaymentProduct paymentProduct, TestRequestResponse requestResponse) { if (paymentService == PaymentService.PAYMENTS) { if (paymentProduct == PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS) { return requestResponse.requestBody(); // SEPA_CREDIT_TRANSFERS } else { return requestResponse.requestBody(PaymentInitiationJson.class); } } else if (paymentService == PaymentService.PERIODIC_PAYMENTS) { if (paymentProduct == PaymentProduct.SEPA_CREDIT_TRANSFERS) { return requestResponse.requestBody(PeriodicPaymentInitiationJson.class); } } return null; } @ParameterizedTest @MethodSource("paymentTypes") void authenticatePsu(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/authenticate-psu.json"); Response<StartScaprocessResponse> response = service.startPaymentAuthorisation(paymentService, paymentProduct, ids.getPaymentId(paymentService, paymentProduct), requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(UpdatePsuAuthentication.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(StartScaprocessResponse.class)); } @ParameterizedTest @MethodSource("paymentTypes") void selectScaMethod(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/select-sca-method.json"); Response<SelectPsuAuthenticationMethodResponse> response = service.updatePaymentPsuData(paymentService, paymentProduct, ids.getPaymentId(paymentService, paymentProduct), ids.getAuthorisationId(paymentService, paymentProduct), requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(SelectPsuAuthenticationMethod.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(SelectPsuAuthenticationMethodResponse.class)); } @ParameterizedTest @MethodSource("paymentTypes") void authoriseTransaction(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/authorise-transaction.json"); Response<ScaStatusResponse> response = service.updatePaymentPsuData(paymentService, paymentProduct, ids.getPaymentId(paymentService, paymentProduct), ids.getAuthorisationId(paymentService, paymentProduct), requestResponse.requestHeaders(), RequestParams.empty(), requestResponse.requestBody(TransactionAuthorisation.class)); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(ScaStatusResponse.class)); } @ParameterizedTest @MethodSource("paymentTypes") void getPaymentStatus(PaymentService paymentService, PaymentProduct paymentProduct) throws Exception { TestRequestResponse requestResponse = new TestRequestResponse("pis/" + paymentService + "/" + paymentProduct + "/get-payment-status.json"); Response<PaymentInitiationStatusResponse200Json> response = service.getPaymentInitiationStatus(paymentService, paymentProduct, ids.getPaymentId(paymentService, paymentProduct), requestResponse.requestHeaders(), RequestParams.empty()); assertThat(response.getBody()).isEqualTo(requestResponse.responseBody(PaymentInitiationStatusResponse200Json.class)); } private static Stream<Arguments> paymentTypes() { return Stream.of(arguments(PaymentService.PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS), arguments(PaymentService.PAYMENTS, PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS), arguments(PaymentService.PERIODIC_PAYMENTS, PaymentProduct.SEPA_CREDIT_TRANSFERS)); } private static class Ids { private final Map<Pair<PaymentService, PaymentProduct>, Pair<String, String>> ids = new HashMap<>(); Ids add(PaymentService paymentService, PaymentProduct paymentProduct, String paymentId, String authorisationId) { ids.put(Pair.of(paymentService, paymentProduct), Pair.of(paymentId, authorisationId)); return this; } String getPaymentId(PaymentService paymentService, PaymentProduct paymentProduct) { return ids.get(Pair.of(paymentService, paymentProduct)).getLeft(); } String getAuthorisationId(PaymentService paymentService, PaymentProduct paymentProduct) { return ids.get(Pair.of(paymentService, paymentProduct)).getRight(); } } }
9,217
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z
VerlagAccountInformationServiceTest.java
/FileExtraction/Java_unseen/adorsys_xs2a-adapter/adapters/verlag-adapter/src/test/java/de/adorsys/xs2a/adapter/verlag/VerlagAccountInformationServiceTest.java
/* * Copyright 2018-2022 adorsys GmbH & Co KG * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or (at * your option) any later version. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. * * This project is also available under a separate commercial license. You can * contact us at [email protected]. */ package de.adorsys.xs2a.adapter.verlag; import de.adorsys.xs2a.adapter.api.RequestHeaders; import de.adorsys.xs2a.adapter.api.RequestParams; import de.adorsys.xs2a.adapter.api.Response; import de.adorsys.xs2a.adapter.api.ResponseHeaders; import de.adorsys.xs2a.adapter.api.http.HttpClient; import de.adorsys.xs2a.adapter.api.http.HttpClientConfig; import de.adorsys.xs2a.adapter.api.http.HttpClientFactory; import de.adorsys.xs2a.adapter.api.http.Request; import de.adorsys.xs2a.adapter.api.link.LinksRewriter; import de.adorsys.xs2a.adapter.api.model.Aspsp; import de.adorsys.xs2a.adapter.api.model.OK200TransactionDetails; import de.adorsys.xs2a.adapter.api.model.TransactionsResponse200Json; import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.io.ByteArrayInputStream; import java.util.AbstractMap; import java.util.Map; import java.util.stream.Stream; import static de.adorsys.xs2a.adapter.api.http.ContentType.*; import static java.util.Collections.singletonMap; import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.params.provider.Arguments.arguments; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) class VerlagAccountInformationServiceTest { private static final String URI = "https://foo.boo"; private static final String ACCOUNT_ID = "accountId"; private static final String REMITTANCE_INFORMATION_STRUCTURED = "remittanceInformationStructuredStringValue"; private VerlagAccountInformationService accountInformationService; @Mock private HttpClient httpClient; @Mock private Aspsp aspsp; @Mock private LinksRewriter linksRewriter; @Mock private AbstractMap.SimpleImmutableEntry<String, String> apiKey; @Mock private HttpClientFactory httpClientFactory; @Mock private HttpClientConfig httpClientConfig; @BeforeEach void setUp() { when(httpClientFactory.getHttpClient(any(), any(), any())).thenReturn(httpClient); when(httpClientFactory.getHttpClientConfig()).thenReturn(httpClientConfig); accountInformationService = new VerlagAccountInformationService(aspsp, apiKey, httpClientFactory, null, linksRewriter); } @Test void getTransactionList() { String rawResponse = "{\n" + " \"transactions\": {\n" + " \"booked\": [\n" + " {\n" + " \"remittanceInformationStructured\": {" + " \"reference\": \"" + REMITTANCE_INFORMATION_STRUCTURED + "\"\n" + " }\n" + " }\n" + " ]\n" + " }\n" + "}"; when(httpClient.get(anyString())) .thenReturn(new RequestBuilderImpl(httpClient, "GET", URI)); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> { HttpClient.ResponseHandler responseHandler = invocationOnMock.getArgument(1, HttpClient.ResponseHandler.class); return new Response<>(-1, responseHandler.apply(200, new ByteArrayInputStream(rawResponse.getBytes()), ResponseHeaders.emptyResponseHeaders()), null); }); Response<?> actualResponse = accountInformationService.getTransactionList(ACCOUNT_ID, RequestHeaders.empty(), RequestParams.empty()); verify(httpClient, times(1)).get(anyString()); verify(httpClient, times(1)).send(any(), any()); assertNotNull(actualResponse); Object body = actualResponse.getBody(); assertTrue(body instanceof TransactionsResponse200Json); String remittanceInformationStructured = ((TransactionsResponse200Json) body).getTransactions() .getBooked() .get(0) .getRemittanceInformationStructured(); assertEquals(REMITTANCE_INFORMATION_STRUCTURED, remittanceInformationStructured); } @Test void getTransactionDetails() { String rawResponse = "{\n" + " \"transactionsDetails\": {\n" + " \"remittanceInformationStructured\": {" + " \"reference\": \"" + REMITTANCE_INFORMATION_STRUCTURED + "\"\n" + " }\n" + " }\n" + "}"; when(httpClient.get(anyString())) .thenReturn(new RequestBuilderImpl(httpClient, "GET", URI)); when(httpClient.send(any(), any())) .thenAnswer(invocationOnMock -> { HttpClient.ResponseHandler responseHandler = invocationOnMock.getArgument(1, HttpClient.ResponseHandler.class); return new Response<>(-1, responseHandler.apply(200, new ByteArrayInputStream(rawResponse.getBytes()), ResponseHeaders.emptyResponseHeaders()), null); }); Response<?> actualResponse = accountInformationService.getTransactionDetails(ACCOUNT_ID, "transactionId", RequestHeaders.empty(), RequestParams.empty()); verify(httpClient, times(1)).get(anyString()); verify(httpClient, times(1)).send(any(), any()); assertNotNull(actualResponse); Object body = actualResponse.getBody(); assertTrue(body instanceof OK200TransactionDetails); String remittanceInformationStructured = ((OK200TransactionDetails) body).getTransactionsDetails() .getRemittanceInformationStructured(); assertEquals(REMITTANCE_INFORMATION_STRUCTURED, remittanceInformationStructured); } @ParameterizedTest @MethodSource("requestHeaders") @SuppressWarnings("unchecked") void getTransactionListAsString(RequestHeaders requestHeaders, String expectedValue) { Request.Builder requestBuilder = spy(new RequestBuilderImpl(httpClient, "GET", URI)); ArgumentCaptor<Map<String, String>> headersCaptor = ArgumentCaptor.forClass(Map.class); when(httpClient.get(anyString())).thenReturn(requestBuilder); accountInformationService.getTransactionListAsString(ACCOUNT_ID, requestHeaders, RequestParams.empty()); verify(requestBuilder, times(1)).headers(headersCaptor.capture()); Map<String, String> actualHeaders = headersCaptor.getValue(); assertFalse(actualHeaders.isEmpty()); assertTrue(actualHeaders.containsValue(expectedValue)); } private static Stream<Arguments> requestHeaders() { return Stream.of(arguments(RequestHeaders.empty(), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, "")), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, null)), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, ALL)), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, APPLICATION_XML)), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, TEXT_PLAIN)), TEXT_PLAIN), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, APPLICATION_JSON)), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, APPLICATION_XML + "," + ALL)), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, APPLICATION_JSON + "," + TEXT_PLAIN)), APPLICATION_JSON), arguments(RequestHeaders.fromMap(singletonMap(RequestHeaders.ACCEPT, APPLICATION_XML + "," + TEXT_PLAIN)), APPLICATION_JSON) ); } }
8,998
Java
.java
adorsys/xs2a-adapter
37
25
5
2019-04-01T09:31:44Z
2024-03-09T08:27:14Z