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

Commit 53901d6

Browse files
authored
Update to finapi v1.107 (#331)
1 parent 4b2bb0d commit 53901d6

File tree

16 files changed

+240
-14
lines changed

16 files changed

+240
-14
lines changed

src/main/java/org/proshin/finapi/bank/Bank.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.time.OffsetDateTime;
1919
import java.util.Optional;
20+
import org.proshin.finapi.bank.out.BankGroup;
2021
import org.proshin.finapi.bank.out.BankInterface;
2122
import org.proshin.finapi.bank.out.LoginFields;
2223

@@ -82,6 +83,8 @@ public interface Bank {
8283

8384
Iterable<BankInterface> interfaces();
8485

86+
Optional<BankGroup> bankGroup();
87+
8588
/**
8689
* @deprecated since v0.1.92 due to PSD2-related changes
8790
*/

src/main/java/org/proshin/finapi/bank/FpBank.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
import java.time.OffsetDateTime;
1919
import java.util.Optional;
2020
import org.json.JSONObject;
21+
import org.proshin.finapi.bank.out.BankGroup;
2122
import org.proshin.finapi.bank.out.BankInterface;
23+
import org.proshin.finapi.bank.out.FpBankGroup;
2224
import org.proshin.finapi.bank.out.FpBankInterface;
2325
import org.proshin.finapi.bank.out.FpLoginFields;
2426
import org.proshin.finapi.bank.out.LoginFields;
@@ -124,6 +126,12 @@ public Iterable<BankInterface> interfaces() {
124126
);
125127
}
126128

129+
@Override
130+
public Optional<BankGroup> bankGroup() {
131+
return Optional.ofNullable(this.origin.getJSONObject("bankGroup"))
132+
.map(FpBankGroup::new);
133+
}
134+
127135
@Override
128136
public Optional<OffsetDateTime> lastCommunicationAttempt() {
129137
return new OptionalOffsetDateTimeOf(this.origin, "lastCommunicationAttempt").get();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2020 Roman Proshin
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.proshin.finapi.bank.out;
17+
18+
public interface BankGroup {
19+
20+
Long id();
21+
22+
String name();
23+
}

src/main/java/org/proshin/finapi/bank/out/BankInterface.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public interface BankInterface {
3838

3939
Optional<OffsetDateTime> lastSuccessfulCommunication();
4040

41+
boolean isMoneyTransferSupported();
42+
4143
enum BankInterfaceProperty {
4244
REDIRECT_APPROACH, DECOUPLED_APPROACH, DETAILED_CONSENT
4345
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2020 Roman Proshin
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.proshin.finapi.bank.out;
17+
18+
import org.json.JSONObject;
19+
20+
public class FpBankGroup implements BankGroup {
21+
22+
private final JSONObject origin;
23+
24+
public FpBankGroup(final JSONObject origin) {
25+
this.origin = origin;
26+
}
27+
28+
@Override
29+
public Long id() {
30+
return this.origin.getLong("id");
31+
}
32+
33+
@Override
34+
public String name() {
35+
return this.origin.getString("name");
36+
}
37+
}

src/main/java/org/proshin/finapi/bank/out/FpBankInterface.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,9 @@ public Optional<OffsetDateTime> lastCommunicationAttempt() {
7979
public Optional<OffsetDateTime> lastSuccessfulCommunication() {
8080
return new OptionalOffsetDateTimeOf(this.origin, "lastSuccessfulCommunication").get();
8181
}
82+
83+
@Override
84+
public boolean isMoneyTransferSupported() {
85+
return this.origin.getBoolean("isMoneyTransferSupported");
86+
}
8287
}

src/main/java/org/proshin/finapi/bankconnection/out/BankConnectionInterface.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ public interface BankConnectionInterface {
2626

2727
TwoStepProcedures twoStepProcedures();
2828

29-
BankConsent aisConsent();
29+
Optional<BankConsent> aisConsent();
3030

3131
Optional<UpdateResult> lastManualUpdate();
3232

3333
Optional<UpdateResult> lastAutoUpdate();
34+
35+
boolean userActionRequired();
3436
}

src/main/java/org/proshin/finapi/bankconnection/out/FpBankConnectionInterface.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ public TwoStepProcedures twoStepProcedures() {
4848
}
4949

5050
@Override
51-
public BankConsent aisConsent() {
52-
return new FpBankConsent(this.origin.getJSONObject("aisConsent"));
51+
public Optional<BankConsent> aisConsent() {
52+
return new OptionalObjectOf(this.origin, "aisConsent").get()
53+
.map(FpBankConsent::new);
5354
}
5455

5556
@Override
@@ -63,4 +64,9 @@ public Optional<UpdateResult> lastAutoUpdate() {
6364
return new OptionalObjectOf(this.origin, "lastAutoUpdate").get()
6465
.map(FpUpdateResult::new);
6566
}
67+
68+
@Override
69+
public boolean userActionRequired() {
70+
return this.origin.getBoolean("userActionRequired");
71+
}
6672
}

src/main/java/org/proshin/finapi/client/out/Configuration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public interface Configuration {
4444
@Deprecated
4545
boolean isXs2aEnabled();
4646

47+
boolean isStandalonePaymentsEnabled();
48+
4749
Iterable<String> availableBankGroups();
4850

4951
Optional<String> applicationName();

src/main/java/org/proshin/finapi/client/out/FpConfiguration.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ public boolean isXs2aEnabled() {
8585
return this.origin.getBoolean("isXs2aEnabled");
8686
}
8787

88+
@Override
89+
public boolean isStandalonePaymentsEnabled() {
90+
return this.origin.getBoolean("isStandalonePaymentsEnabled");
91+
}
92+
8893
@Override
8994
public Iterable<String> availableBankGroups() {
9095
return new IterableJsonArray<>(

0 commit comments

Comments
 (0)