adamsaghy commented on code in PR #6241:
URL: https://github.com/apache/fineract/pull/6241#discussion_r3863148038
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignSavingsTransactionHelper.java:
##########
@@ -48,4 +62,93 @@ public PostSavingsAccountTransactionsResponse withdraw(Long
savingsId, PostSavin
public PostSavingsAccountTransactionsResponse withdraw(Long savingsId,
String amount, String transactionDate) {
return withdraw(savingsId, SavingsRequestBuilders.withdrawal(amount,
transactionDate));
}
+
+ /** The server only accepts this command while the force-withdrawal global
configuration is enabled. */
+ public PostSavingsAccountTransactionsResponse forceWithdraw(Long
savingsId, PostSavingsAccountTransactionsRequest request) {
+ return ok(
+ () ->
fineractClient.savingsAccountTransactions().createSavingsAccountTransaction(savingsId,
request, "force-withdrawal"));
+ }
+
+ public PostSavingsAccountTransactionsResponse forceWithdraw(Long
savingsId, String amount, String transactionDate) {
+ return forceWithdraw(savingsId,
SavingsRequestBuilders.withdrawal(amount, transactionDate));
+ }
+
+ public CallFailedRuntimeException withdrawExpectingError(Long savingsId,
String amount, String transactionDate) {
+ PostSavingsAccountTransactionsRequest request =
SavingsRequestBuilders.withdrawal(amount, transactionDate);
+ return fail(() ->
fineractClient.savingsAccountTransactions().createSavingsAccountTransaction(savingsId,
request, "withdrawal"));
+ }
+
+ public PostSavingsAccountTransactionsResponse postInterestAsOn(Long
savingsId, String transactionDate) {
+ PostSavingsAccountTransactionsRequest request =
SavingsRequestBuilders.postInterestAsOn(transactionDate);
+ return ok(
+ () ->
fineractClient.savingsAccountTransactions().createSavingsAccountTransaction(savingsId,
request, "postInterestAsOn"));
+ }
+
+ public PostSavingsAccountTransactionsResponse holdAmount(Long savingsId,
String amount, String transactionDate, String reasonForBlock) {
+ PostSavingsAccountTransactionsRequest request =
SavingsRequestBuilders.holdAmount(amount, transactionDate, reasonForBlock);
+ return ok(() ->
fineractClient.savingsAccountTransactions().createSavingsAccountTransaction(savingsId,
request, "holdAmount"));
+ }
+
+ public CommandProcessingResult reverseTransaction(Long savingsId, Long
transactionId) {
+ return adjustTransaction(savingsId, transactionId, "reverse");
+ }
+
+ public CommandProcessingResult undoTransaction(Long savingsId, Long
transactionId) {
+ return adjustTransaction(savingsId, transactionId, "undo");
+ }
+
+ public CommandProcessingResult releaseAmount(Long savingsId, Long
holdTransactionId) {
+ return adjustTransaction(savingsId, holdTransactionId,
"releaseAmount");
+ }
+
+ /** All three commands are driven by the query parameter alone and read no
payload, hence the empty body. */
+ private CommandProcessingResult adjustTransaction(Long savingsId, Long
transactionId, String command) {
+ PostSavingsAccountBulkReversalTransactionsRequest request = new
PostSavingsAccountBulkReversalTransactionsRequest();
+ return ok(() ->
fineractClient.savingsAccountTransactions().adjustSavingsAccountTransaction(savingsId,
transactionId, request,
+ command));
+ }
+
+ /** The generated client types this response as a bare {@code String}, so
the JSON is mapped here. */
+ public SavingsAccountTransactionData getTransaction(Long savingsId, Long
transactionId) {
+ String json = ok(() ->
fineractClient.savingsAccountTransactions().retrieveOneSavingsAccountTransaction(savingsId,
transactionId));
Review Comment:
Instead of keeping String, it would be better to update the swagger to
return the valid data type
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]