Skip to content
Open
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 @@ -327,6 +327,15 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_WORKING_DAYS")
.requestMatchers(API_MATCHER.matcher(HttpMethod.PUT, "/api/*/workingdays"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "UPDATE_WORKING_DAYS")
// client address (template before wildcard for specificity)
.requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/client/addresses/template"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_ADDRESS")
.requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/client/*/addresses"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_ADDRESS")
.requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/client/*/addresses"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "CREATE_ADDRESS")
.requestMatchers(API_MATCHER.matcher(HttpMethod.PUT, "/api/*/client/*/addresses"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "UPDATE_ADDRESS")
// interest rate chart slabs (before charts for specificity)
.requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/interestratecharts/*/chartslabs"))
.hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_CHARTSLAB")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.address.command;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.fineract.command.core.Command;
import org.apache.fineract.portfolio.client.data.ClientAddressCreateRequest;

@Data
@EqualsAndHashCode(callSuper = true)
public class ClientAddressCreateCommand extends Command<ClientAddressCreateRequest> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.address.command;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.fineract.command.core.Command;
import org.apache.fineract.portfolio.client.data.ClientAddressUpdateRequest;

@Data
@EqualsAndHashCode(callSuper = true)
public class ClientAddressUpdateCommand extends Command<ClientAddressUpdateRequest> {}
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.client.api;
package org.apache.fineract.portfolio.address.data;

import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serial;
import java.io.Serializable;
import lombok.Builder;
import lombok.Data;

/**
* Created by Chirag Gupta on 01/12/18.
*/
@SuppressWarnings({ "MemberName" })
final class ClientAddressApiResourcesSwagger {

private ClientAddressApiResourcesSwagger() {}

@Schema(description = "PostClientClientIdAddressesResponse")
public static final class PostClientClientIdAddressesResponse {

private PostClientClientIdAddressesResponse() {}

@Schema(example = "15")
public Long resourceId;
}

@Schema(description = "PutClientClientIdAddressesResponse")
public static final class PutClientClientIdAddressesResponse {
@Data
@Builder
public class ClientAddressCreateResponse implements Serializable {

private PutClientClientIdAddressesResponse() {}
@Serial
private static final long serialVersionUID = 1L;

@Schema(example = "67")
public Long resourceId;
}
private Long resourceId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.address.data;

import java.io.Serial;
import java.io.Serializable;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class ClientAddressUpdateResponse implements Serializable {

@Serial
private static final long serialVersionUID = 1L;

private Long resourceId;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.address.handler;

import io.github.resilience4j.retry.annotation.Retry;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.command.core.Command;
import org.apache.fineract.command.core.CommandHandler;
import org.apache.fineract.portfolio.address.data.ClientAddressCreateResponse;
import org.apache.fineract.portfolio.address.service.ClientAddressWriteService;
import org.apache.fineract.portfolio.client.data.ClientAddressCreateRequest;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Component
@RequiredArgsConstructor
public class ClientAddressCreateCommandHandler implements CommandHandler<ClientAddressCreateRequest, ClientAddressCreateResponse> {

private final ClientAddressWriteService writePlatformService;

@Retry(name = "commandClientAddressCreate", fallbackMethod = "fallback")
@Override
@Transactional
public ClientAddressCreateResponse handle(Command<ClientAddressCreateRequest> command) {
return writePlatformService.createClientAddress(command.getPayload());
}

@Override
public ClientAddressCreateResponse fallback(Command<ClientAddressCreateRequest> command, Throwable t) {
return CommandHandler.super.fallback(command, t);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.portfolio.address.handler;

import io.github.resilience4j.retry.annotation.Retry;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.command.core.Command;
import org.apache.fineract.command.core.CommandHandler;
import org.apache.fineract.portfolio.address.data.ClientAddressUpdateResponse;
import org.apache.fineract.portfolio.address.service.ClientAddressWriteService;
import org.apache.fineract.portfolio.client.data.ClientAddressUpdateRequest;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Slf4j
@Component
@RequiredArgsConstructor
public class ClientAddressUpdateCommandHandler implements CommandHandler<ClientAddressUpdateRequest, ClientAddressUpdateResponse> {

private final ClientAddressWriteService writePlatformService;

@Retry(name = "commandClientAddressUpdate", fallbackMethod = "fallback")
@Override
@Transactional
public ClientAddressUpdateResponse handle(Command<ClientAddressUpdateRequest> command) {
return writePlatformService.updateClientAddress(command.getPayload());
}

@Override
public ClientAddressUpdateResponse fallback(Command<ClientAddressUpdateRequest> command, Throwable t) {
return CommandHandler.super.fallback(command, t);
}
}
Loading