-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
FINERACT 2120: Add new command parameters withdrawToLinkedAccount and disburseToLinkedAccount and integrate with PHEE #4046
base: develop
Are you sure you want to change the base?
Changes from all commits
1aed130
1c410ab
308efb3
2aef648
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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.infrastructure.core.exception; | ||
|
||
public class ConfigurationNotEnabledException extends AbstractPlatformException { | ||
|
||
protected ConfigurationNotEnabledException(String globalisationMessageCode, String defaultUserMessage, | ||
final Object... defaultUserMessageArgs) { | ||
super(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* 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.exceptionmapper; | ||
|
||
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.ApiGlobalErrorResponse; | ||
import org.apache.fineract.infrastructure.core.exception.ConfigurationNotEnabledException; | ||
import org.apache.fineract.infrastructure.core.exception.ErrorHandler; | ||
import org.springframework.context.annotation.Scope; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Provider | ||
@Component | ||
@Scope("singleton") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed. |
||
@Slf4j | ||
public class ConfigurationNotEnabledExceptionMapper implements ExceptionMapper<ConfigurationNotEnabledException> { | ||
|
||
@Override | ||
public Response toResponse(final ConfigurationNotEnabledException exception) { | ||
log.warn("Exception occurred", ErrorHandler.findMostSpecificException(exception)); | ||
final ApiGlobalErrorResponse notEnabledErrorResponse = ApiGlobalErrorResponse.notEnabled(exception.getGlobalisationMessageCode(), | ||
exception.getDefaultUserMessage(), exception.getDefaultUserMessageArgs()); | ||
return Response.status(Response.Status.FORBIDDEN).entity(notEnabledErrorResponse).type(MediaType.APPLICATION_JSON).build(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import jakarta.persistence.Table; | ||
import java.util.Map; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.fineract.infrastructure.core.api.JsonCommand; | ||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom; | ||
|
@@ -35,6 +36,7 @@ | |
|
||
@Entity | ||
@Getter | ||
@Setter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did introduced setters here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this resolved? |
||
@Table(name = "m_payment_detail") | ||
public class PaymentDetail extends AbstractPersistableCustom<Long> { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* 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.loanaccount.handler; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.apache.fineract.commands.annotation.CommandType; | ||
import org.apache.fineract.commands.handler.NewCommandSourceHandler; | ||
import org.apache.fineract.infrastructure.core.api.JsonCommand; | ||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; | ||
import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@CommandType(entity = "LOAN", action = "DISBURSETOLINKEDACCOUNT") | ||
public class DisburseLoanToLinkedAccountCommandHandler implements NewCommandSourceHandler { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you consider moving payment hub ee related stuff to a separate module? |
||
|
||
private final LoanWritePlatformService writePlatformService; | ||
|
||
@Transactional | ||
@Override | ||
public CommandProcessingResult processCommand(final JsonCommand command) { | ||
|
||
return this.writePlatformService.disburseLoanToLinkedAccount(command.entityId(), command, true); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,13 @@ apply plugin: 'com.google.cloud.tools.jib' | |
apply plugin: 'org.springframework.boot' | ||
apply plugin: 'se.thinkcode.cucumber-runner' | ||
|
||
|
||
repositories { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this repository! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This repository is required for this dependency implementation 'org.pheesdk:PaymentHubSDK:1.0.0' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You cannot put your own repository into a community project. If the payment hub sdk is not available on a public repository that is not controlled by your organization, it has absolutely no place in opersource, community Fineract. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to load the Payment Hub SDK dependency at runtime if it's hosted in a private JFrog Artifactory? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is absolutely a no-go. If Payment Hub SDK is needed, let's fix it over there to be published to a publicly accessed repository, for example Maven central. |
||
maven { | ||
url = uri('https://jfrog.sandbox.fynarfin.io/artifactory/fyn-libs-snapshot') | ||
} | ||
} | ||
|
||
check.dependsOn('cucumber') | ||
|
||
compileJava.doLast { | ||
|
@@ -164,15 +171,15 @@ configurations.driver.each {File file -> | |
task createDB { | ||
description= "Creates the MariaDB Database. Needs database name to be passed (like: -PdbName=someDBname)" | ||
doLast { | ||
def sql = Sql.newInstance( 'jdbc:mariadb://localhost:3306/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver' ) | ||
def sql = Sql.newInstance( 'jdbc:mariadb://localhost:3307/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver' ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please reverse these changes! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment shouldn't be resolved since the changes weren't yet made. |
||
sql.execute( 'CREATE DATABASE '+"`$dbName` CHARACTER SET utf8mb4" ) | ||
} | ||
} | ||
|
||
task dropDB { | ||
description= "Drops the specified MariaDB database. The database name has to be passed (like: -PdbName=someDBname)" | ||
doLast { | ||
def sql = Sql.newInstance( 'jdbc:mariadb://localhost:3306/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver' ) | ||
def sql = Sql.newInstance( 'jdbc:mariadb://localhost:3307/', mysqlUser, mysqlPassword, 'org.mariadb.jdbc.Driver' ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please reverse these changes! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment shouldn't be resolved since the changes weren't yet made. |
||
sql.execute( 'DROP DATABASE '+"`$dbName`") | ||
} | ||
} | ||
|
@@ -225,6 +232,7 @@ bootRun { | |
dependencies { | ||
implementation 'org.mariadb.jdbc:mariadb-java-client' | ||
implementation 'org.postgresql:postgresql' | ||
implementation 'org.pheesdk:PaymentHubSDK:1.0.0' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think it is right to be here. Would you move to the dependencies.gradle? Also it might be better to have it in a separate module. Most of the ppl would not need payment hub support... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The version shouldn't be here that's for sure. In terms of packaging the PaymentHubSDK with Fineract, there are 2 options:
I'm not sure how much extra weight the Payment Hub SDK is, but if it's just DTOs and API classes, I'd say it's acceptable to be bundled with Fineract. |
||
} | ||
} | ||
|
||
|
@@ -280,6 +288,7 @@ jib { | |
dependencies { | ||
implementation 'org.mariadb.jdbc:mariadb-java-client' | ||
implementation 'org.postgresql:postgresql' | ||
implementation 'org.pheesdk:PaymentHubSDK:1.0.0' | ||
} | ||
|
||
pluginExtensions { | ||
|
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.infrastructure.configuration.exception; | ||
|
||
import org.apache.fineract.infrastructure.core.exception.ConfigurationNotEnabledException; | ||
|
||
public class GlobalConfigurationNotEnabledException extends ConfigurationNotEnabledException { | ||
|
||
public GlobalConfigurationNotEnabledException(final String configName) { | ||
super("error.msg.configuration.not.enabled", "Configuration `" + configName + "` is not enabled", configName); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,6 +263,21 @@ public InteropIdentifierAccountResponseData getAccountByIdentifier(@NotNull Inte | |
return InteropIdentifierAccountResponseData.build(identifier.getId(), identifier.getAccount().getExternalId().getValue()); | ||
} | ||
|
||
@NotNull | ||
@Transactional | ||
@Override | ||
public InteropIdentifier getIndentifierByAccount(@NotNull SavingsAccount account) { | ||
InteropIdentifier identifier = findIdentifier(account); | ||
return identifier; | ||
} | ||
|
||
@NotNull | ||
@Transactional | ||
@Override | ||
public InteropIdentifier getIdentifierByAccountId(@NotNull Long accountId) { | ||
return identifierRepository.findOneByAccountId(accountId); | ||
} | ||
|
||
@NotNull | ||
@Transactional | ||
@Override | ||
|
@@ -641,6 +656,10 @@ public InteropIdentifier findIdentifier(@NotNull InteropIdentifierType idType, @ | |
return identifierRepository.findOneByTypeAndValueAndSubType(idType, idValue, subIdOrType); | ||
} | ||
|
||
public InteropIdentifier findIdentifier(@NotNull SavingsAccount account) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why don't we have a Transactional annotation on this? |
||
return identifierRepository.findOneByAccountId(account.getId()); | ||
} | ||
|
||
/* | ||
* Guaranteed to throw an exception no matter what the data integrity issue is. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need Setter annotation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this resolved?