FINERACT-2169: Refactor currencies api resource;

This commit is contained in:
viktorpavlenko
2025-03-19 17:40:20 +01:00
committed by Adam Saghy
parent 1cb5d7c371
commit c2c157cfd7
6 changed files with 51 additions and 60 deletions
@@ -18,21 +18,25 @@
*/
package org.apache.fineract.organisation.monetary.data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Collection;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* Immutable data object for application currency.
*/
public class ApplicationCurrencyConfigurationData {
@Getter
@RequiredArgsConstructor
public class ApplicationCurrencyConfigurationData implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private final Collection<CurrencyData> selectedCurrencyOptions;
@SuppressWarnings("unused")
private final Collection<CurrencyData> currencyOptions;
public ApplicationCurrencyConfigurationData(final Collection<CurrencyData> currencyOptions,
final Collection<CurrencyData> selectedCurrencyOptions) {
this.currencyOptions = currencyOptions;
this.selectedCurrencyOptions = selectedCurrencyOptions;
}
}
@@ -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.organisation.monetary.data.request;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
public record CurrencyRequest(List<String> currencies) implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
}
@@ -37,6 +37,6 @@ public class OrganisationCurrencyReadPlatformServiceImpl implements Organisation
// remove selected currency options
currencyOptions.removeAll(selectedCurrencyOptions);
return new ApplicationCurrencyConfigurationData(currencyOptions, selectedCurrencyOptions);
return new ApplicationCurrencyConfigurationData(selectedCurrencyOptions, currencyOptions);
}
}