-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into 28-create-bank-acc…
…ount-access-service-api-ledgers-bank-account-access-service-api
- Loading branch information
Showing
30 changed files
with
740 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ public enum AccessScope { | |
WRITE, | ||
EXECUTE, | ||
DELETE; | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...ccount-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AgentAccess.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.ledgers.baam.db.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "agent_access") | ||
public class AgentAccess extends BankAccountAccess { | ||
|
||
public AgentAccess() { | ||
super(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...ount-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AuditorAccess.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,17 @@ | ||
package de.adorsys.ledgers.baam.db.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "auditor_access") | ||
public class AuditorAccess extends BankAccountAccess { | ||
|
||
public AuditorAccess() { | ||
super(); | ||
this.setStatus(AccessStatus.ACTIVE); // By default, AuditorAccess is active | ||
this.setWeight(1.0); // Weight is always 1 for Auditor Access | ||
} | ||
|
||
} | ||
|
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
35 changes: 35 additions & 0 deletions
35
...ccount-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/ConsentType.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,35 @@ | ||
package de.adorsys.ledgers.baam.db.domain; | ||
|
||
/** | ||
* Enum representing different types of consents in the context of open banking. | ||
* These consents define the scope of access granted to third-party service providers. | ||
*/ | ||
public enum ConsentType { | ||
|
||
/* | ||
* The need to implement Other Open Banking Services may call for the creation of more ConsentTypes | ||
*/ | ||
|
||
/** | ||
* Consent allowing the third party to access account information such as | ||
* balances, transaction histories, and account details without modifying them. | ||
* This is typically used by Account Information Service Providers (AISP). | ||
*/ | ||
ACCOUNT_INFORMATION_CONSENT, | ||
|
||
/** | ||
* Consent allowing the third party to initiate payments from the account | ||
* on behalf of the account holder. This is typically used by Payment | ||
* Initiation Service Providers (PISP). | ||
*/ | ||
PAYMENT_INITIATION_CONSENT, | ||
|
||
/** | ||
* Consent allowing the third party to verify whether the account has | ||
* sufficient funds for a particular transaction. No additional account | ||
* information is provided beyond the confirmation of funds. | ||
*/ | ||
CONFIRMATION_OF_FUNDS_CONSENT | ||
|
||
} | ||
|
20 changes: 20 additions & 0 deletions
20
...nt-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/DelegatedAccess.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,20 @@ | ||
package de.adorsys.ledgers.baam.db.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@Entity | ||
public class DelegatedAccess extends BankAccountAccess { | ||
|
||
private DelegatedAccessType delegatedType; | ||
|
||
public DelegatedAccess() { | ||
super(); | ||
} | ||
|
||
} | ||
|
||
|
12 changes: 12 additions & 0 deletions
12
...ccess-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/DelegatedAccessType.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,12 @@ | ||
package de.adorsys.ledgers.baam.db.domain; | ||
|
||
/** | ||
* Enum representing different types of Power of Attorney. | ||
*/ | ||
public enum DelegatedAccessType { | ||
GENERAL, | ||
LIMITED, | ||
DURABLE, | ||
SPRINGING | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
...count-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/HolderAccess.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,19 @@ | ||
package de.adorsys.ledgers.baam.db.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Table(name = "holder_access") | ||
@Data | ||
@NoArgsConstructor(force = true) | ||
public class HolderAccess extends BankAccountAccess { | ||
|
||
// Constructor for creating HolderAccess with full access | ||
public HolderAccess(String entityId, String accountId) { | ||
super(); | ||
this.setEntityId(entityId); | ||
this.setAccountId(accountId); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ount-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/ManagerAccess.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.ledgers.baam.db.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.AllArgsConstructor; | ||
|
||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
|
||
@Entity | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ManagerAccess extends BankAccountAccess { | ||
|
||
|
||
@ElementCollection | ||
private Set<TypeOfManagedAccess> managedAccessTypes = new HashSet<>(); | ||
|
||
@ElementCollection | ||
private Set<AccessScope> scopeOfAccess = new HashSet<>(); | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...t-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/ThirdPartyAccess.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.ledgers.baam.db.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@Entity | ||
@Table(name = "third_party_access") | ||
public class ThirdPartyAccess extends BankAccountAccess { | ||
|
||
@Column(name = "consent_type") | ||
@Enumerated(EnumType.STRING) | ||
private ConsentType consentType; | ||
|
||
@Column(name = "expiration_date") | ||
private LocalDateTime expirationDate; | ||
|
||
@Column(name = "max_transaction_amount") | ||
private Double maxTransactionAmount; | ||
|
||
} | ||
|
8 changes: 8 additions & 0 deletions
8
...ccess-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/TypeOfManagedAccess.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,8 @@ | ||
package de.adorsys.ledgers.baam.db.domain; | ||
|
||
public enum TypeOfManagedAccess { | ||
AGENT_ACCESS, | ||
AUDITOR_ACCESS, | ||
POA_ACCESS; | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...repository/src/main/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepository.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.ledgers.baam.db.repository; | ||
|
||
import de.adorsys.ledgers.baam.db.domain.AgentAccess; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface AgentAccessRepository extends JpaRepository<AgentAccess, String> { | ||
|
||
} | ||
|
10 changes: 10 additions & 0 deletions
10
...pository/src/main/java/de/adorsys/ledgers/baam/db/repository/AuditorAccessRepository.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,10 @@ | ||
package de.adorsys.ledgers.baam.db.repository; | ||
|
||
import de.adorsys.ledgers.baam.db.domain.AuditorAccess; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface AuditorAccessRepository extends JpaRepository<AuditorAccess, String> { | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...sitory/src/main/java/de/adorsys/ledgers/baam/db/repository/DelegatedAccessRepository.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.ledgers.baam.db.repository; | ||
|
||
import de.adorsys.ledgers.baam.db.domain.DelegatedAccess; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface DelegatedAccessRepository extends JpaRepository<DelegatedAccess, String> { | ||
|
||
List<DelegatedAccess> findByAccountId(String accountId); | ||
} |
14 changes: 14 additions & 0 deletions
14
...epository/src/main/java/de/adorsys/ledgers/baam/db/repository/HolderAccessRepository.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,14 @@ | ||
/* | ||
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG | ||
* All rights are reserved. | ||
*/ | ||
|
||
package de.adorsys.ledgers.baam.db.repository; | ||
|
||
import de.adorsys.ledgers.baam.db.domain.HolderAccess; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface HolderAccessRepository extends JpaRepository<HolderAccess, String> { | ||
} |
13 changes: 13 additions & 0 deletions
13
...pository/src/main/java/de/adorsys/ledgers/baam/db/repository/ManagerAccessRepository.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.ledgers.baam.db.repository; | ||
|
||
|
||
import de.adorsys.ledgers.baam.db.domain.ManagerAccess; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
|
||
|
||
@Repository | ||
public interface ManagerAccessRepository extends JpaRepository<ManagerAccess, String> { | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...itory/src/main/java/de/adorsys/ledgers/baam/db/repository/ThirdPartyAccessRepository.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.ledgers.baam.db.repository; | ||
|
||
import de.adorsys.ledgers.baam.db.domain.ThirdPartyAccess; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ThirdPartyAccessRepository extends JpaRepository<ThirdPartyAccess, String> { | ||
|
||
} | ||
|
51 changes: 51 additions & 0 deletions
51
...pository/src/test/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepositoryIT.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,51 @@ | ||
package de.adorsys.ledgers.baam.db.repository; | ||
|
||
import com.github.springtestdbunit.DbUnitTestExecutionListener; | ||
import de.adorsys.ledgers.baam.db.domain.*; | ||
import de.adorsys.ledgers.baam.db.test.BaamRepositoryApplication; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.TestExecutionListeners; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; | ||
import org.springframework.test.context.transaction.TransactionalTestExecutionListener; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
@SpringBootTest(classes = BaamRepositoryApplication.class) | ||
@ExtendWith(SpringExtension.class) | ||
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, | ||
TransactionalTestExecutionListener.class, | ||
DbUnitTestExecutionListener.class}) | ||
|
||
public class AgentAccessRepositoryIT { | ||
|
||
@Autowired | ||
private AgentAccessRepository agentAccessRepository; | ||
|
||
@Test | ||
void test_create_ok() { | ||
// Given | ||
agentAccessRepository.deleteAll(); // Clean up any existing records | ||
AgentAccess agentAccess = new AgentAccess(); | ||
agentAccess.setId("1"); | ||
agentAccess.setAccountId("1L"); | ||
agentAccess.setEntityId("2L"); | ||
agentAccess.setScope(AccessScope.EXECUTE); // Example action scope | ||
agentAccess.setWeight(0.5); // Partial authority | ||
agentAccess.setConditions(AccessCondition.AMOUNT_RESTRICTED); // Example condition | ||
agentAccess.setStatus(AccessStatus.ACTIVE); // Agent is active | ||
agentAccess.setPolicies("Payment-Only Policy"); // Example policy | ||
|
||
// When | ||
AgentAccess savedAccess = agentAccessRepository.save(agentAccess); | ||
|
||
// Retrieve the saved object | ||
AgentAccess result = agentAccessRepository.findById(savedAccess.getId()).orElse(null); | ||
|
||
// Then | ||
assertNotNull(result); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...sitory/src/test/java/de/adorsys/ledgers/baam/db/repository/AuditorAccessRepositoryIT.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,51 @@ | ||
package de.adorsys.ledgers.baam.db.repository; | ||
|
||
import com.github.springtestdbunit.DbUnitTestExecutionListener; | ||
import de.adorsys.ledgers.baam.db.domain.AccessStatus; | ||
import de.adorsys.ledgers.baam.db.domain.AuditorAccess; | ||
import de.adorsys.ledgers.baam.db.test.BaamRepositoryApplication; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.TestExecutionListeners; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; | ||
import org.springframework.test.context.transaction.TransactionalTestExecutionListener; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
@SpringBootTest(classes = BaamRepositoryApplication.class) | ||
@ExtendWith(SpringExtension.class) | ||
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, | ||
TransactionalTestExecutionListener.class, | ||
DbUnitTestExecutionListener.class}) | ||
public class AuditorAccessRepositoryIT { | ||
|
||
@Autowired | ||
private AuditorAccessRepository auditorAccessRepository; | ||
|
||
@Test | ||
void test_createAuditorAccess_ok() { | ||
// Given | ||
auditorAccessRepository.deleteAll(); // Clean up any existing records | ||
|
||
AuditorAccess auditorAccess = new AuditorAccess(); | ||
auditorAccess.setId("1"); | ||
auditorAccess.setAccountId("100L"); | ||
auditorAccess.setEntityId("200L"); | ||
auditorAccess.setStatus(AccessStatus.ACTIVE); // Setting status explicitly | ||
|
||
// When | ||
AuditorAccess savedAccess = auditorAccessRepository.save(auditorAccess); | ||
|
||
// Retrieve the saved object | ||
AuditorAccess result = auditorAccessRepository.findById(savedAccess.getId()).orElse(null); | ||
|
||
// Then | ||
assertNotNull(result); | ||
assertEquals("100L", result.getAccountId()); | ||
assertEquals(AccessStatus.ACTIVE, result.getStatus()); | ||
} | ||
} |
Oops, something went wrong.