-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FINERACT-1926: Asset Externalization on Fineract
- Loading branch information
Showing
16 changed files
with
1,194 additions
and
34 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.../apache/fineract/infrastructure/core/exception/HttpMessageNotReadableErrorController.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,54 @@ | ||
/** | ||
* 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.infrastructure.core.exception; | ||
|
||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.Response; | ||
import jakarta.ws.rs.ext.ExceptionMapper; | ||
import jakarta.ws.rs.ext.Provider; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.fineract.infrastructure.core.data.ApiParameterError; | ||
import org.apache.fineract.infrastructure.core.exceptionmapper.FineractExceptionMapper; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.http.converter.HttpMessageNotReadableException; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Provider | ||
@Component | ||
@Scope("singleton") | ||
@Slf4j | ||
public class HttpMessageNotReadableErrorController implements ExceptionMapper<HttpMessageNotReadableException>, FineractExceptionMapper { | ||
|
||
@Override | ||
public Response toResponse(HttpMessageNotReadableException exception) { | ||
final String globalisationMessageCode = "error.msg.invalid.json.data"; | ||
final String defaultUserMessage = "The referenced JSON data is invalid, validate date format as yyyy-MM-dd or other cases like String instead of Number"; | ||
log.warn("Exception: {}, Message: {}", exception.getClass().getName(), defaultUserMessage); | ||
|
||
final ApiParameterError error = ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage); | ||
|
||
return Response.status(Response.Status.BAD_REQUEST).entity(error).type(MediaType.APPLICATION_JSON).build(); | ||
} | ||
|
||
@Override | ||
public int errorCode() { | ||
return 4001; | ||
} | ||
|
||
} |
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
30 changes: 30 additions & 0 deletions
30
...r/src/main/java/org/apache/fineract/investor/api/search/ExternalAssetOwnersSearchApi.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,30 @@ | ||
/** | ||
* 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.investor.api.search; | ||
|
||
import org.apache.fineract.infrastructure.core.service.PagedRequest; | ||
import org.apache.fineract.investor.data.ExternalTransferData; | ||
import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchRequest; | ||
import org.springframework.data.domain.Page; | ||
|
||
public interface ExternalAssetOwnersSearchApi { | ||
|
||
Page<ExternalTransferData> searchInvestorData(PagedRequest<ExternalAssetOwnerSearchRequest> request); | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...in/java/org/apache/fineract/investor/api/search/ExternalAssetOwnersSearchApiDelegate.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,40 @@ | ||
/** | ||
* 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.investor.api.search; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.apache.fineract.infrastructure.core.service.PagedRequest; | ||
import org.apache.fineract.investor.data.ExternalTransferData; | ||
import org.apache.fineract.investor.service.search.ExternalAssetOwnerSearchService; | ||
import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchRequest; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class ExternalAssetOwnersSearchApiDelegate implements ExternalAssetOwnersSearchApi { | ||
|
||
private final ExternalAssetOwnerSearchService externalAssetOwnerSearchService; | ||
|
||
@Override | ||
public Page<ExternalTransferData> searchInvestorData(PagedRequest<ExternalAssetOwnerSearchRequest> request) { | ||
return externalAssetOwnerSearchService.searchInvestorData(request); | ||
} | ||
|
||
} |
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
55 changes: 55 additions & 0 deletions
55
.../src/main/java/org/apache/fineract/investor/domain/search/SearchedExternalAssetOwner.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,55 @@ | ||
/** | ||
* 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.investor.domain.search; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.LocalDate; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.apache.fineract.infrastructure.core.domain.ExternalId; | ||
import org.apache.fineract.investor.data.ExternalTransferStatus; | ||
import org.apache.fineract.investor.data.ExternalTransferSubStatus; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class SearchedExternalAssetOwner { | ||
|
||
private final Long transferId; | ||
private final Long loanId; | ||
private final ExternalId externalLoanId; | ||
|
||
private final ExternalId owner; | ||
private final ExternalId transferExternalId; | ||
|
||
private final ExternalTransferStatus status; | ||
private final ExternalTransferSubStatus subStatus; | ||
|
||
private final String purchasePriceRatio; | ||
private final LocalDate settlementDate; | ||
private final LocalDate effectiveFrom; | ||
private final LocalDate effectiveTo; | ||
|
||
private final Long detailsId; | ||
private final BigDecimal totalOutstanding; | ||
private final BigDecimal principalOutstanding; | ||
private final BigDecimal interestOutstanding; | ||
private final BigDecimal feeOutstanding; | ||
private final BigDecimal penaltyOutstanding; | ||
private final BigDecimal totalOverpaid; | ||
} |
29 changes: 29 additions & 0 deletions
29
...ava/org/apache/fineract/investor/domain/search/SearchingExternalAssetOwnerRepository.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,29 @@ | ||
/** | ||
* 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.investor.domain.search; | ||
|
||
import org.apache.fineract.infrastructure.core.service.PagedRequest; | ||
import org.apache.fineract.investor.service.search.domain.ExternalAssetOwnerSearchRequest; | ||
import org.springframework.data.domain.Page; | ||
|
||
public interface SearchingExternalAssetOwnerRepository { | ||
|
||
Page<SearchedExternalAssetOwner> searchInvestorData(PagedRequest<ExternalAssetOwnerSearchRequest> searchRequest); | ||
|
||
} |
Oops, something went wrong.