Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:create-bank-account-access-rest-server-ledgers #44

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
*/

package de.adorsys.ledgers.baam.api.resource;
import de.adorsys.ledgers.baam.db.domain.BankAccountAccess;

import de.adorsys.ledgers.baam.db.domain.*;
import io.swagger.v3.oas.annotations.*;
import io.swagger.v3.oas.annotations.tags.*;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@Tag(name = "Bank Account Access", description = "Provide endpoint for managing bank account access.")
Expand All @@ -18,7 +20,7 @@ public interface BankAccountAccessAPI {

@PostMapping
@Operation(summary = "Create Bank Account Access", description = "Creates a new bank account access entry")
ResponseEntity<BankAccountAccess> createAccess(@RequestBody BankAccountAccess access);
ResponseEntity<BankAccountAccess> createAccountAccess(@RequestBody BankAccountAccess bankAccountAccess);

@GetMapping("/{Id}")
@Operation(summary = "Get Bank Account Access", description = "Retrieves a bank account access entry by ID")
Expand All @@ -30,7 +32,7 @@ public interface BankAccountAccessAPI {

@PutMapping("/{Id}")
@Operation(summary = "Update Bank Account Access", description = "Updates an existing bank account access entry")
ResponseEntity<BankAccountAccess> updateAccess(@PathVariable String Id, @RequestBody BankAccountAccess access);
ResponseEntity<BankAccountAccess> updateAccess(@PathVariable String Id, @RequestBody BankAccountAccess bankAccountAccess);

@DeleteMapping("/{Id}")
@Operation(summary = "Delete Bank Account Access", description = "Deletes a bank account access entry by ID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,19 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ruleset.basedir>../..</ruleset.basedir>
</properties>
<dependencies>
<dependency>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>ledgers-bank-account-access-rest-api</artifactId>
<version>6.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>ledgers-bank-account-access-service-api</artifactId>
<version>6.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/
package de.adorsys.ledgers.baam.server.resource;

import de.adorsys.ledgers.baam.api.resource.*;
import de.adorsys.ledgers.baam.api.service.*;
import de.adorsys.ledgers.baam.db.domain.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
public class BankAccountAccessResource implements BankAccountAccessAPI {

private final BankAccountAccessService<BankAccountAccess> bankAccountAccessService;

@Autowired
public BankAccountAccessResource(BankAccountAccessService<BankAccountAccess> bankAccountAccessService) {
this.bankAccountAccessService = bankAccountAccessService;
}


@Override
public ResponseEntity<BankAccountAccess> createAccountAccess(BankAccountAccess bankAccountAccess) {
return new ResponseEntity<>(bankAccountAccessService.createBankAccountAccess(bankAccountAccess), HttpStatus.OK);
}

@Override
public ResponseEntity<List<BankAccountAccess>> getAllAccesses() {
return ResponseEntity.ok(bankAccountAccessService.getAllBankAccountAccess());
}

@Override
public ResponseEntity<BankAccountAccess> getAccessById(String Id) {
return ResponseEntity.ok(bankAccountAccessService.getBankAccountAccessById(Id));
}

@Override
public ResponseEntity<BankAccountAccess> updateAccess(String Id, BankAccountAccess bankAccountAccess) {
bankAccountAccessService.modifyBankAccountAccess(bankAccountAccess);
return ResponseEntity.ok(bankAccountAccess);
}

@Override
public ResponseEntity<Void> deleteAccess(String Id) {
bankAccountAccessService.revokeBankAccountAccess(Id);
return ResponseEntity.ok().build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@

import de.adorsys.ledgers.baam.db.domain.*;

import java.util.List;
import java.util.Optional;
import java.util.*;

public interface BankAccountAccessService<T extends BankAccountAccess> {

T createBankAccountAccess(String accountId, String entityId, T accessDetails);

T createBankAccountAccess(T accessDetails);
void modifyBankAccountAccess(T bankAccountAccess);
void suspendBankAccountAccess(String id);
void reactivateBankAccountAccess(String id);
Optional<Boolean> revokeBankAccountAccess(String accessId);
void revokeBankAccountAccess(String accessId);
List<T> getAllBankAccountAccess();
T getBankAccountAccessById(String id);
}
Expand Down
Loading