From 30d04ce34e92c2ae6643a527215086841133de69 Mon Sep 17 00:00:00 2001 From: Cedric Khin Date: Mon, 14 Dec 2020 17:20:58 +0100 Subject: [PATCH] Add an interop release transfer command handler (FINERACT-1281) --- .../ReleaseInteropTransferHandler.java | 49 +++++++++++++++++++ .../interoperation/util/InteropUtil.java | 1 + 2 files changed, 50 insertions(+) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/interoperation/handler/ReleaseInteropTransferHandler.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/handler/ReleaseInteropTransferHandler.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/handler/ReleaseInteropTransferHandler.java new file mode 100644 index 000000000..4c1dad399 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/handler/ReleaseInteropTransferHandler.java @@ -0,0 +1,49 @@ +/** + * 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.interoperation.handler; + +import static org.apache.fineract.interoperation.util.InteropUtil.ACTION_TRANSFER_RELEASE; +import static org.apache.fineract.interoperation.util.InteropUtil.ENTITY_NAME_TRANSFER; + +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.interoperation.service.InteropService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = ENTITY_NAME_TRANSFER, action = ACTION_TRANSFER_RELEASE) +public class ReleaseInteropTransferHandler implements NewCommandSourceHandler { + + private final InteropService interopService; + + @Autowired + public ReleaseInteropTransferHandler(InteropService interopService) { + this.interopService = interopService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.interopService.releaseTransfer(command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/InteropUtil.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/InteropUtil.java index 9888f287d..d93c24ec2 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/InteropUtil.java +++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/util/InteropUtil.java @@ -41,6 +41,7 @@ public final class InteropUtil { public static final String ACTION_TRANSFER_PREPARE = "PREPARE"; public static final String ACTION_TRANSFER_COMMIT = "CREATE"; + public static final String ACTION_TRANSFER_RELEASE = "RELEASE"; public static final String PARAM_LOCALE = "locale"; public static final String PARAM_DATE_FORMAT = "dateFormat";