Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from artemsnisarenko/sparkasse-pisp
Add sparkasse PISP
- Loading branch information
Showing
14 changed files
with
144 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...src/main/java/de/adorsys/xs2a/gateway/service/impl/SparkassePaymentInitiationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package de.adorsys.xs2a.gateway.service.impl; | ||
|
||
import de.adorsys.xs2a.gateway.adapter.BasePaymentInitiationService; | ||
|
||
import static de.adorsys.xs2a.gateway.service.provider.Sparkasse.BASE_URI; | ||
|
||
public class SparkassePaymentInitiationService extends BasePaymentInitiationService { | ||
|
||
@Override | ||
protected String getBaseUri() { | ||
return BASE_URI; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...s/sparkasse-adapter/src/main/java/de/adorsys/xs2a/gateway/service/provider/Sparkasse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package de.adorsys.xs2a.gateway.service.provider; | ||
|
||
import java.util.Collections; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public interface Sparkasse { | ||
Set<String> BANK_CODES = Collections.unmodifiableSet(new HashSet<>(Collections.singletonList("99999999"))); | ||
|
||
String BASE_URI = "https://xs2a-sandbox.f-i-apim.de:8444/fixs2a-env/xs2a-api/12345678/v1"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...a/de/adorsys/xs2a/gateway/service/provider/SparkassePaymentInitiationServiceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package de.adorsys.xs2a.gateway.service.provider; | ||
|
||
import de.adorsys.xs2a.gateway.service.PaymentInitiationService; | ||
import de.adorsys.xs2a.gateway.service.impl.SparkassePaymentInitiationService; | ||
|
||
import java.util.Set; | ||
|
||
import static de.adorsys.xs2a.gateway.service.provider.Sparkasse.BANK_CODES; | ||
|
||
public class SparkassePaymentInitiationServiceProvider implements PaymentInitiationServiceProvider { | ||
|
||
private PaymentInitiationService paymentInitiationService; | ||
|
||
@Override | ||
public Set<String> getBankCodes() { | ||
return BANK_CODES; | ||
} | ||
|
||
@Override | ||
public PaymentInitiationService getPaymentInitiationService() { | ||
if (paymentInitiationService == null) { | ||
paymentInitiationService = new SparkassePaymentInitiationService(); | ||
} | ||
return paymentInitiationService; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...TA-INF/services/de.adorsys.xs2a.gateway.service.provider.PaymentInitiationServiceProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
de.adorsys.xs2a.gateway.service.provider.SparkassePaymentInitiationServiceProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
xs2a-gateway-service-api-adapter/src/main/java/de/adorsys/xs2a/gateway/http/StringUri.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package de.adorsys.xs2a.gateway.http; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public class StringUri { | ||
|
||
public static String fromElements(String... elements) { | ||
return Arrays.stream(elements) | ||
.map(StringUri::trimUri) | ||
.collect(Collectors.joining("/")); | ||
} | ||
|
||
private static String trimUri(String str) { | ||
if (str == null || str.isEmpty()) { | ||
return ""; | ||
} | ||
str = str.startsWith("/") ? str.substring(1) : str; | ||
return str.endsWith("/") ? str.substring(0, str.length() - 1) : str; | ||
} | ||
|
||
public static String withQuery(String uri, Map<String, String> requestParams) { | ||
if (requestParams.isEmpty()) { | ||
return uri; | ||
} | ||
|
||
String requestParamsString = requestParams.entrySet().stream() | ||
.map(entry -> entry.getKey() + "=" + entry.getValue()) | ||
.collect(Collectors.joining("&", "?", "")); | ||
|
||
return uri + requestParamsString; | ||
} | ||
} |
Oops, something went wrong.