diff --git a/build.gradle b/build.gradle
index 8282b8676..0bc2b2a38 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,7 @@
plugins {
id 'org.jpos.jposapp' version '0.0.10'
id 'idea'
+ id 'org.gradlex.extra-java-module-info' version '1.9'
}
diff --git a/gradle/modules.properties b/gradle/modules.properties
new file mode 100644
index 000000000..0358a044d
--- /dev/null
+++ b/gradle/modules.properties
@@ -0,0 +1,2 @@
+quartz=org.quartz-scheduler:quartz
+
diff --git a/modules/cmf/build.gradle b/modules/cmf/build.gradle
index 78ce7ee97..c509a23fa 100644
--- a/modules/cmf/build.gradle
+++ b/modules/cmf/build.gradle
@@ -2,8 +2,6 @@ description = 'jPOS-EE :: CMF Utils'
dependencies {
api libs.jpos
- api libs.commonsLang3
-
testImplementation testlibs.junit
testRuntimeOnly testlibs.junitRuntime
}
diff --git a/modules/cmf/src/main/java/module-info.java b/modules/cmf/src/main/java/module-info.java
new file mode 100644
index 000000000..387b079c1
--- /dev/null
+++ b/modules/cmf/src/main/java/module-info.java
@@ -0,0 +1,6 @@
+module org.jpos.ee.cmf {
+ requires org.jpos.jpos;
+
+ exports org.jpos.cmf;
+ exports org.jpos.cmf.iso;
+}
diff --git a/modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmount.java b/modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmount.java
deleted file mode 100644
index 1cef36929..000000000
--- a/modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmount.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * jPOS Project [http://jpos.org]
- * Copyright (C) 2000-2024 jPOS Software SRL
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package org.jpos.cmf;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.math.BigDecimal;
-import java.util.Objects;
-
-/**
- * @deprecated Use {@link org.jpos.cmf.CMFAdditionalAmount}
- */
-@Deprecated
-@SuppressWarnings("WeakerAccess")
-public class AdditionalAmount {
-
- public final static int SERIALIZED_DATA_LENGTH = 21;
-
- private String accountType;
- private AmountType amountType;
- private BigDecimal amount;
- private String currencyCode;
- private int currencyMinorUnit;
-
- public AdditionalAmount(String accountType, BigDecimal amount, String currencyCode,
- AmountType amountType, int currencyMinorUnit) {
-
- setAccountType(accountType);
- setAmount(amount);
- setCurrencyCode(currencyCode);
- setAmountType(amountType);
- setCurrencyMinorUnit(currencyMinorUnit);
- }
-
- public String getAccountType() {
- return accountType;
- }
-
- public void setAccountType(String accountType) {
-
- Objects.requireNonNull(accountType);
-
- if (accountType.length() != 2)
- throw new IllegalArgumentException("Invalid account type length");
-
- this.accountType = accountType;
- }
-
- public AmountType getAmountType() {
- return amountType;
- }
-
- public void setAmountType(AmountType amountType) {
- Objects.requireNonNull(amountType);
- this.amountType = amountType;
- }
-
- public BigDecimal getAmount() {
- return amount;
- }
-
- public void setAmount(BigDecimal amount) {
- Objects.requireNonNull(amount);
- this.amount = amount;
- }
-
- public String getCurrencyCode() {
- return currencyCode;
- }
-
- public void setCurrencyCode(String currencyCode) {
-
- Objects.requireNonNull(currencyCode);
-
- if (currencyCode.length() != 3)
- throw new IllegalArgumentException("Invalid currency code");
-
- this.currencyCode = currencyCode;
- }
-
- public int getCurrencyMinorUnit() {
- return currencyMinorUnit;
- }
-
- public void setCurrencyMinorUnit(int currencyMinorUnit) {
-
- if (currencyMinorUnit < 0 || currencyMinorUnit > 9)
- throw new IllegalArgumentException("Invalid currency minor unit value");
-
- this.currencyMinorUnit = currencyMinorUnit;
- }
-
- public String serialize() {
- if (getAmountType() == null)
- throw new IllegalStateException("Amount type not set");
-
- if (getAmount() == null)
- throw new IllegalStateException("Amount not set");
-
- long absAmt= getAmount().movePointRight(getCurrencyMinorUnit()).abs().longValue();
-
- return getAccountType() +
- getAmountType().toString() +
- getCurrencyCode() +
- getCurrencyMinorUnit() +
- (getAmount().compareTo(BigDecimal.ZERO) >= 0 ? "C" : "D") +
- StringUtils.leftPad(Long.toString(absAmt), 12, '0');
- }
-
- @Override
- public String toString() {
- return amount + String.format ("{%s,%s,%s,%d}", accountType, amountType, currencyCode, currencyMinorUnit);
- }
-
- static AdditionalAmount parse(String data) {
- Objects.requireNonNull(data);
-
- if (data.length() != SERIALIZED_DATA_LENGTH)
- throw new IllegalArgumentException("Invalid data length");
-
- String accountType = StringUtils.mid(data, 0, 2);
- AmountType amountType = AmountType.fromCode(StringUtils.mid(data, 2, 2));
- String currencyCode = StringUtils.mid(data, 4, 3);
- int minorUnit = Integer.parseInt(StringUtils.mid(data, 7, 1));
- BigDecimal amount = new BigDecimal(StringUtils.right(data, 12)).movePointLeft(minorUnit);
- String amountSign = StringUtils.mid(data, 8, 1);
-
- if (!"C.D".contains(amountSign))
- throw new IllegalArgumentException("Invalid amount sign");
-
- if ("D".equalsIgnoreCase(amountSign))
- amount = amount.negate();
-
- return new AdditionalAmount(accountType, amount, currencyCode, amountType, minorUnit);
- }
-}
diff --git a/modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmountsWrapper.java b/modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmountsWrapper.java
deleted file mode 100644
index 470e509cf..000000000
--- a/modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmountsWrapper.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * jPOS Project [http://jpos.org]
- * Copyright (C) 2000-2024 jPOS Software SRL
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package org.jpos.cmf;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Handles additional amounts field content - DE-054
- *
- * @deprecated Use {@link org.jpos.iso.AdditionalAmountsWrapper}
- */
-@Deprecated
-public final class AdditionalAmountsWrapper extends LinkedHashSet {
-
- private static final long serialVersionUID = 2526355280704001241L;
-
- public static AdditionalAmountsWrapper parse(String data) {
- if (data.length() % AdditionalAmount.SERIALIZED_DATA_LENGTH != 0)
- throw new IllegalArgumentException("Invalid length");
-
- AdditionalAmountsWrapper amounts = new AdditionalAmountsWrapper();
- int i = 0;
-
- while (i < data.length()) {
- AdditionalAmount amount = AdditionalAmount.parse(
- StringUtils.mid(data, i, AdditionalAmount.SERIALIZED_DATA_LENGTH));
-
- amounts.add(amount);
-
- i += AdditionalAmount.SERIALIZED_DATA_LENGTH;
- }
-
- return amounts;
- }
-
- public String serialize() {
- StringBuilder sb = new StringBuilder();
- forEach(amount -> sb.append(amount.serialize()));
- return sb.toString();
- }
-
-
- /**
- * Returns a list of the additional amounts that match the filter criteria.
- *
- * If one of the filters is null, it's not considered in the criteria.
- *
- * @param accountType the account type to filter amounts by.
- * @param amountType the amount type to filter amounts by.
- * @return a list of the additional amounts that match the filter criteria.
- */
- public List listByTypes(String accountType, AmountType amountType) {
- ArrayList amounts = new ArrayList<>();
- for (AdditionalAmount amount : this) {
- if ((accountType == null || amount.getAccountType().equals(accountType)) &&
- (amountType == null || amount.getAmountType() == amountType)) {
- amounts.add(amount);
- }
- }
-
- return amounts;
- }
-
-
- /**
- * Returns true when the wrapper has the given {@code amountType}.
- *
- * @param amountType the amount type.
- * @return true when the wrapper has the given {@code amountType}.
- * @throws NullPointerException if {@code amountType} is {@code null}
- */
- public boolean containsAmountType(AmountType amountType) {
- Objects.requireNonNull(amountType);
- return getFirstByAmountType(amountType) != null;
- }
-
-
- /**
- * Returns the first occurrence of the additional amount that matches the filter criteria.
- *
- * @param amountType the amount type to filter amounts by
- * @return the first occurrence of the additional amount that matches the filter criteria, or null if none matches
- * @throws NullPointerException if {@code amountType} is {@code null}
- */
- public AdditionalAmount getFirstByAmountType(AmountType amountType) {
- Objects.requireNonNull(amountType);
- for (AdditionalAmount addAmnt : this) {
- if (addAmnt.getAmountType().equals(amountType))
- return addAmnt;
- }
- return null;
- }
-
-
- /**
- * Returns a list of the additional amounts that match the filter criteria.
- *
- * @param amountType the amount type to filter amounts by.
- * @return a list of the additional amounts that match the filter criteria.
- * @throws NullPointerException if {@code amountType} is {@code null}
- */
- public List listByAmountType(AmountType amountType) {
- Objects.requireNonNull(amountType);
- return listByTypes(null, amountType);
- }
-
-}
diff --git a/modules/cmf/src/main/java/org/jpos/cmf/AmountType.java b/modules/cmf/src/main/java/org/jpos/cmf/AmountType.java
index 33cf8ef38..acd8a0aea 100644
--- a/modules/cmf/src/main/java/org/jpos/cmf/AmountType.java
+++ b/modules/cmf/src/main/java/org/jpos/cmf/AmountType.java
@@ -18,8 +18,8 @@
package org.jpos.cmf;
-import org.jpos.iso.AdditionalAmountType;
-import org.jpos.iso.AdditionalAmountTypeConverter;
+import org.jpos.cmf.iso.AdditionalAmountType;
+import org.jpos.cmf.iso.AdditionalAmountTypeConverter;
import java.util.HashMap;
import java.util.Map;
diff --git a/modules/cmf/src/main/java/org/jpos/cmf/CMFAdditionalAmount.java b/modules/cmf/src/main/java/org/jpos/cmf/CMFAdditionalAmount.java
index c80456cc9..ed99795db 100644
--- a/modules/cmf/src/main/java/org/jpos/cmf/CMFAdditionalAmount.java
+++ b/modules/cmf/src/main/java/org/jpos/cmf/CMFAdditionalAmount.java
@@ -18,8 +18,9 @@
package org.jpos.cmf;
-import org.apache.commons.lang3.StringUtils;
-import org.jpos.iso.AdditionalAmount;
+// import org.apache.commons.lang3.StringUtils;
+import org.jpos.cmf.iso.AdditionalAmount;
+import org.jpos.iso.ISOUtil;
import java.math.BigDecimal;
import java.util.Objects;
@@ -54,7 +55,7 @@ public String serialize() {
getCurrencyCode() +
getCurrencyMinorUnit() +
(getAmount().compareTo(BigDecimal.ZERO) >= 0 ? "C" : "D") +
- StringUtils.leftPad(Long.toString(absAmt), 12, '0');
+ ISOUtil.zeropad(absAmt, 12);
}
public static AdditionalAmount parse(String data) {
@@ -63,13 +64,13 @@ public static AdditionalAmount parse(String data) {
if (data.length() != SERIALIZED_DATA_LENGTH)
throw new IllegalArgumentException("Invalid data length");
- String accountType = StringUtils.mid(data, 0, 2);
- String amountType = StringUtils.mid(data, 2, 2);
- String currencyCode = StringUtils.mid(data, 4, 3);
- int minorUnit = Integer.parseInt(StringUtils.mid(data, 7, 1));
+ String accountType = data.substring(0, 2);
+ String amountType = data.substring(2, 4);
+ String currencyCode = data.substring(4, 7);
+ int minorUnit = Integer.parseInt(data.substring(7, 8));
- String amountSign = StringUtils.mid(data, 8, 1);
- BigDecimal amount = new BigDecimal(StringUtils.right(data, 12)).movePointLeft(minorUnit);
+ String amountSign = data.substring(8,9);
+ BigDecimal amount = new BigDecimal(data.substring(data.length() - 12)).movePointLeft(minorUnit);
if (!"C.D".contains(amountSign))
throw new IllegalArgumentException("Invalid amount sign");
diff --git a/modules/cmf/src/main/java/org/jpos/cmf/OriginalDataElementsWrapper.java b/modules/cmf/src/main/java/org/jpos/cmf/OriginalDataElementsWrapper.java
index e6885b303..65361c452 100644
--- a/modules/cmf/src/main/java/org/jpos/cmf/OriginalDataElementsWrapper.java
+++ b/modules/cmf/src/main/java/org/jpos/cmf/OriginalDataElementsWrapper.java
@@ -18,10 +18,12 @@
package org.jpos.cmf;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.DateUtils;
import org.jpos.iso.ISODate;
+import org.jpos.iso.ISOUtil;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Objects;
@@ -29,8 +31,9 @@
* Handles original data elements field content - DE-056
*/
public final class OriginalDataElementsWrapper {
-
private static final int MAX_FIELD_LENGTH = 41;
+ private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+
private String originalMTI;
private long originalSTAN;
@@ -52,7 +55,9 @@ private void parse(String fieldValue) {
try {
setOriginalMTI(fieldValue.substring(0, 4));
setOriginalSTAN(Long.parseLong(fieldValue.substring(4, 16)));
- setOriginalLocalDate(DateUtils.parseDate(fieldValue.substring(16, 30), "yyyyMMddHHmmss"));
+
+ LocalDateTime localDateTime = LocalDateTime.parse(fieldValue.substring(16, 30), DATE_FORMATTER);
+ setOriginalLocalDate(Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()));
setOriginalAcquiringInstCode(fieldValue.substring(30));
}
catch (Exception e) {
@@ -64,19 +69,19 @@ private void parse(String fieldValue) {
public String serialize() {
StringBuilder r = new StringBuilder();
- if (StringUtils.isNotBlank(getOriginalMTI()))
- r.append(StringUtils.leftPad(getOriginalMTI(), 4, '0'));
+ if (originalMTI != null && !originalMTI.isBlank())
+ r.append(String.format("%04d", Integer.parseInt(originalMTI)));
else
r.append("0000");
- r.append(StringUtils.leftPad(Long.toString(getOriginalSTAN()), 12, '0'));
+ r.append(ISOUtil.zeropad(getOriginalSTAN(), 12));
if (getOriginalLocalDate() != null)
r.append(ISODate.formatDate(getOriginalLocalDate(), "yyyyMMddHHmmss"));
else
- r.append(StringUtils.repeat('0', 14));
+ r.append(ISOUtil.zeropad(0L,14));
- if (StringUtils.isNotBlank(getOriginalAcquiringInstCode()))
+ if (originalAcquiringInstCode != null && !originalAcquiringInstCode.isBlank())
r.append(getOriginalAcquiringInstCode());
return r.toString();
@@ -87,8 +92,7 @@ public String getOriginalMTI() {
}
public void setOriginalMTI(String originalMTI) {
-
- if (StringUtils.isBlank(originalMTI))
+ if (originalMTI == null || originalMTI.isBlank())
throw new NullPointerException("originalMTI cannot be null or empty");
if (originalMTI.length() != 4)
diff --git a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmount.java b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmount.java
similarity index 99%
rename from modules/cmf/src/main/java/org/jpos/iso/AdditionalAmount.java
rename to modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmount.java
index daa4727a8..b03a63301 100644
--- a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmount.java
+++ b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmount.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.iso;
+package org.jpos.cmf.iso;
import java.math.BigDecimal;
import java.util.Objects;
diff --git a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountType.java b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountType.java
similarity index 96%
rename from modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountType.java
rename to modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountType.java
index c32085eba..50ac64e81 100644
--- a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountType.java
+++ b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountType.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.iso;
+package org.jpos.cmf.iso;
public interface AdditionalAmountType {
String code();
diff --git a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountTypeConverter.java b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountTypeConverter.java
similarity index 98%
rename from modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountTypeConverter.java
rename to modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountTypeConverter.java
index 399d81f8b..5da7d0045 100644
--- a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountTypeConverter.java
+++ b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountTypeConverter.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.iso;
+package org.jpos.cmf.iso;
public interface AdditionalAmountTypeConverter {
/**
diff --git a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountsWrapper.java b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountsWrapper.java
similarity index 96%
rename from modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountsWrapper.java
rename to modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountsWrapper.java
index 14bc6d9d1..43d3aa3fd 100644
--- a/modules/cmf/src/main/java/org/jpos/iso/AdditionalAmountsWrapper.java
+++ b/modules/cmf/src/main/java/org/jpos/cmf/iso/AdditionalAmountsWrapper.java
@@ -16,9 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.iso;
-
-import org.apache.commons.lang3.StringUtils;
+package org.jpos.cmf.iso;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -53,10 +51,10 @@ public static AdditionalAmountsWrapper parse(
AdditionalAmountsWrapper amounts = new AdditionalAmountsWrapper();
for (int i = 0; i < data.length(); i += amtLength) {
- AdditionalAmount amount = parser.apply(StringUtils.mid(data, i, amtLength));
+ String amountData = data.substring(i, i + amtLength);
+ AdditionalAmount amount = parser.apply(amountData);
amounts.add(amount);
}
-
return amounts;
}
diff --git a/modules/cmf/src/test/java/org/jpos/cmf/AdditionalAmountsWrapperTest.java b/modules/cmf/src/test/java/org/jpos/cmf/AdditionalAmountsWrapperTest.java
deleted file mode 100644
index 42cd123bb..000000000
--- a/modules/cmf/src/test/java/org/jpos/cmf/AdditionalAmountsWrapperTest.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * jPOS Project [http://jpos.org]
- * Copyright (C) 2000-2024 jPOS Software SRL
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package org.jpos.cmf;
-
-import org.junit.jupiter.api.Test;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-@Deprecated
-public final class AdditionalAmountsWrapperTest {
-
- @Test
- public void test_contains_amountType() {
-
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- wrapper.add(new AdditionalAmount("30", new BigDecimal("10.00"), "858", AmountType.AMOUNT_CASH, 1));
- wrapper.add(new AdditionalAmount("30", new BigDecimal("12.00"), "858", AmountType.AMOUNT_TAXABLE, 1));
-
- assertTrue(wrapper.containsAmountType(AmountType.AMOUNT_TAXABLE));
- assertTrue(wrapper.containsAmountType(AmountType.AMOUNT_CASH));
- assertFalse(wrapper.containsAmountType(AmountType.AMOUNT_REMAINING_THIS_CYCLE));
- }
-
- @Test
- public void test_get_by_amountType() {
-
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- wrapper.add(new AdditionalAmount("30", new BigDecimal("10.00"), "858", AmountType.AMOUNT_CASH, 1));
- wrapper.add(new AdditionalAmount("30", new BigDecimal("12.00"), "858", AmountType.AMOUNT_TAXABLE, 1));
-
- assertNotNull(wrapper.getFirstByAmountType(AmountType.AMOUNT_TAXABLE));
- assertNotNull(wrapper.getFirstByAmountType(AmountType.AMOUNT_CASH));
- assertNull(wrapper.getFirstByAmountType(AmountType.AMOUNT_REMAINING_THIS_CYCLE));
- }
-
-
- @Test
- public void testParseInvalidLengthData() {
- String sample = "00028582C00000010000000018582C0000001000";
- assertThrows(IllegalArgumentException.class, () -> AdditionalAmountsWrapper.parse(sample));
- }
-
- @Test
- public void testSuccessfulParse() {
- String sample = "00" + "02" + "858"+"2" + "C"+"000000100000" +
- "00" + "01" + "858"+"2" + "C"+"000000100000";
-
- AdditionalAmountsWrapper wrapper = AdditionalAmountsWrapper.parse(sample);
- assertEquals(2, wrapper.size());
- }
-
- @Test
- public void testParseAndSerialize() {
- String sample = "00" + "02" + "840"+"2" + "C"+"000000100000" +
- "00" + "01" + "858"+"2" + "C"+"000000100000";
-
- AdditionalAmountsWrapper wrapper = AdditionalAmountsWrapper.parse(sample);
- assertEquals(sample, wrapper.serialize());
- }
-
- @Test
- public void testParseAndSerializeOneItem() {
-
- String sample = "00" + "01" + "858"+"2" + "C"+"000000100000";
-
- AdditionalAmountsWrapper wrapper = AdditionalAmountsWrapper.parse(sample);
-
- assertEquals(1, wrapper.size());
- assertEquals(sample, wrapper.serialize());
- }
-
- @Test
- public void test_listByAmountType() {
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- wrapper.add(new AdditionalAmount("00", new BigDecimal("200.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
- wrapper.add(new AdditionalAmount("00", new BigDecimal("300.00"), "840", AmountType.AMOUNT_CASH, 1));
- wrapper.add(new AdditionalAmount("30", new BigDecimal("400.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
-
- List amounts = wrapper.listByAmountType(AmountType.AMOUNT_SURCHARGE);
-
- assertNotNull(amounts);
- assertEquals(2, amounts.size());
- }
-
- @Test
- public void test_listByTypes_WithAccountAndAmountTypes() {
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- wrapper.add(new AdditionalAmount("00", new BigDecimal("200.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
- wrapper.add(new AdditionalAmount("00", new BigDecimal("300.00"), "840", AmountType.AMOUNT_CASH, 1));
- wrapper.add(new AdditionalAmount("30", new BigDecimal("400.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
-
- List amounts = wrapper.listByTypes("00", AmountType.AMOUNT_SURCHARGE);
- assertNotNull(amounts);
- assertEquals(1, amounts.size());
- }
-
- @Test
- public void test_listByTypes_WithNullAccountType() {
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- wrapper.add(new AdditionalAmount("00", new BigDecimal("200.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
- wrapper.add(new AdditionalAmount("00", new BigDecimal("300.00"), "840", AmountType.AMOUNT_CASH, 1));
- wrapper.add(new AdditionalAmount("30", new BigDecimal("400.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
-
- List amounts = wrapper.listByTypes(null, AmountType.AMOUNT_SURCHARGE);
- assertNotNull(amounts);
- assertEquals(2, amounts.size());
- }
-
-
-
- @Test
- public void test_getFirstByAmountType() {
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- wrapper.add(new AdditionalAmount("00", new BigDecimal("200.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
- wrapper.add(new AdditionalAmount("00", new BigDecimal("300.00"), "840", AmountType.AMOUNT_CASH, 1));
- wrapper.add(new AdditionalAmount("30", new BigDecimal("400.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
-
- AdditionalAmount amount = wrapper.getFirstByAmountType(AmountType.AMOUNT_SURCHARGE);
-
- assertNotNull(amount);
- assertEquals(new BigDecimal("200.00"), amount.getAmount());
- assertEquals("00", amount.getAccountType());
- }
-
- @Test
- public void test_containsAmountType() {
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- wrapper.add(new AdditionalAmount("00", new BigDecimal("200.00"), "840", AmountType.AMOUNT_SURCHARGE, 1));
- wrapper.add(new AdditionalAmount("00", new BigDecimal("300.00"), "840", AmountType.AMOUNT_CASH, 1));
-
- assertTrue(wrapper.containsAmountType(AmountType.AMOUNT_SURCHARGE));
- assertTrue(wrapper.containsAmountType(AmountType.AMOUNT_CASH));
- assertFalse(wrapper.containsAmountType(AmountType.AMOUNT_REMAINING_THIS_CYCLE));
- }
-
- @Test
- public void toStringTest() {
- AdditionalAmountsWrapper wrapper = new AdditionalAmountsWrapper();
-
- AdditionalAmount as = new AdditionalAmount("00", new BigDecimal("200.00"), "840", AmountType.AMOUNT_SURCHARGE, 2);
- AdditionalAmount ac = new AdditionalAmount("00", new BigDecimal("300.00"), "840", AmountType.AMOUNT_CASH, 2);
- wrapper.add(as);
- wrapper.add(ac);
-
- assertEquals("200.00{00,42,840,2}", as.toString());
- assertEquals("300.00{00,40,840,2}", ac.toString());
- assertEquals("[200.00{00,42,840,2}, 300.00{00,40,840,2}]", wrapper.toString());
- }
-}
-
-
-
diff --git a/modules/cmf/src/test/java/org/jpos/iso/AdditionalAmountsWrapperTest.java b/modules/cmf/src/test/java/org/jpos/cmf/iso/AdditionalAmountsWrapperTest.java
similarity index 99%
rename from modules/cmf/src/test/java/org/jpos/iso/AdditionalAmountsWrapperTest.java
rename to modules/cmf/src/test/java/org/jpos/cmf/iso/AdditionalAmountsWrapperTest.java
index de8bc39fc..a7202f2ba 100644
--- a/modules/cmf/src/test/java/org/jpos/iso/AdditionalAmountsWrapperTest.java
+++ b/modules/cmf/src/test/java/org/jpos/cmf/iso/AdditionalAmountsWrapperTest.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.iso;
+package org.jpos.cmf.iso;
import org.junit.jupiter.api.Test;
diff --git a/modules/core/src/main/java/module-info.java b/modules/core/src/main/java/module-info.java
new file mode 100644
index 000000000..d6a1ae215
--- /dev/null
+++ b/modules/core/src/main/java/module-info.java
@@ -0,0 +1,7 @@
+module org.jpos.ee.core {
+ requires java.desktop;
+ requires org.jpos.jpos;
+
+ exports org.jpos.ee;
+ exports org.jpos.ee.support;
+}
diff --git a/modules/core/src/main/java/org/jpos/util/BeanDiff.java b/modules/core/src/main/java/org/jpos/ee/support/BeanDiff.java
similarity index 99%
rename from modules/core/src/main/java/org/jpos/util/BeanDiff.java
rename to modules/core/src/main/java/org/jpos/ee/support/BeanDiff.java
index 3dda682e1..9515010cb 100644
--- a/modules/core/src/main/java/org/jpos/util/BeanDiff.java
+++ b/modules/core/src/main/java/org/jpos/ee/support/BeanDiff.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.util;
+package org.jpos.ee.support;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
diff --git a/modules/core/src/main/java/org/jpos/util/DiffEntry.java b/modules/core/src/main/java/org/jpos/ee/support/DiffEntry.java
similarity index 98%
rename from modules/core/src/main/java/org/jpos/util/DiffEntry.java
rename to modules/core/src/main/java/org/jpos/ee/support/DiffEntry.java
index f36b973f3..1ebbdb549 100644
--- a/modules/core/src/main/java/org/jpos/util/DiffEntry.java
+++ b/modules/core/src/main/java/org/jpos/ee/support/DiffEntry.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.util;
+package org.jpos.ee.support;
/**
*
diff --git a/modules/quartz/build.gradle b/modules/quartz/build.gradle
index 0db90b136..0f3b1d54f 100644
--- a/modules/quartz/build.gradle
+++ b/modules/quartz/build.gradle
@@ -1,12 +1,18 @@
+plugins {
+ id 'org.gradlex.extra-java-module-info' version '1.9'
+}
+
description = 'jPOS-EE :: Quartz integration'
+extraJavaModuleInfo {
+ failOnMissingModuleInfo.set(false)
+ automaticModule('org.quartz-scheduler:quartz', 'org.quartz')
+}
+
+
dependencies {
- api libs.jpos
- api (libs.quartz) {
- exclude group: 'org.slf4j', module: 'slf4j-api'
- exclude group: 'jakarta.xml.bind', module: 'jakarta.xml.bind-api'
- }
- api libs.slf4j
- // api libs.jakartaBind
+ implementation libs.jpos
+ implementation libs.quartz
+ implementation libs.slf4j
}
diff --git a/modules/quartz/src/main/java/module-info.java b/modules/quartz/src/main/java/module-info.java
new file mode 100644
index 000000000..c3c05570b
--- /dev/null
+++ b/modules/quartz/src/main/java/module-info.java
@@ -0,0 +1,7 @@
+module org.jpos.quartz {
+ requires org.jpos.jpos;
+ requires org.jdom2;
+ requires org.quartz;
+
+ exports org.jpos.quartz;
+}
diff --git a/modules/quartz/src/main/java/org/jpos/q2/QuartzAdaptor.java b/modules/quartz/src/main/java/org/jpos/quartz/QuartzAdaptor.java
similarity index 99%
rename from modules/quartz/src/main/java/org/jpos/q2/QuartzAdaptor.java
rename to modules/quartz/src/main/java/org/jpos/quartz/QuartzAdaptor.java
index 0042d5bf9..8cbe62498 100644
--- a/modules/quartz/src/main/java/org/jpos/q2/QuartzAdaptor.java
+++ b/modules/quartz/src/main/java/org/jpos/quartz/QuartzAdaptor.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.q2;
+package org.jpos.quartz;
import org.jdom2.Element;
import org.jpos.core.Configurable;
@@ -29,6 +29,7 @@
import org.jpos.util.Logger;
import org.jpos.util.NameRegistrar;
import org.quartz.*;
+import org.jpos.q2.*;
import org.quartz.impl.StdSchedulerFactory;
import java.util.Date;
diff --git a/modules/quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java b/modules/quartz/src/main/java/org/jpos/quartz/QuartzJobSupport.java
similarity index 97%
rename from modules/quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java
rename to modules/quartz/src/main/java/org/jpos/quartz/QuartzJobSupport.java
index c60c921fc..a85287230 100644
--- a/modules/quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java
+++ b/modules/quartz/src/main/java/org/jpos/quartz/QuartzJobSupport.java
@@ -16,11 +16,12 @@
* along with this program. If not, see .
*/
-package org.jpos.q2;
+package org.jpos.quartz;
import org.jpos.core.Configurable;
import org.jpos.core.Configuration;
import org.jpos.core.ConfigurationException;
+import org.jpos.q2.QFactory;
import org.jpos.util.Log;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
diff --git a/modules/quartz/src/main/java/org/jpos/q2/TestJob.java b/modules/quartz/src/main/java/org/jpos/quartz/TestJob.java
similarity index 97%
rename from modules/quartz/src/main/java/org/jpos/q2/TestJob.java
rename to modules/quartz/src/main/java/org/jpos/quartz/TestJob.java
index 8636d3e84..f229250f0 100644
--- a/modules/quartz/src/main/java/org/jpos/q2/TestJob.java
+++ b/modules/quartz/src/main/java/org/jpos/quartz/TestJob.java
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package org.jpos.q2;
+package org.jpos.quartz;
import org.jpos.core.annotation.Config;
diff --git a/modules/quartz/src/test/java/org/jpos/q2/QuartzAdaptorTest.java b/modules/quartz/src/test/java/org/jpos/quartz/QuartzAdaptorTest.java
similarity index 98%
rename from modules/quartz/src/test/java/org/jpos/q2/QuartzAdaptorTest.java
rename to modules/quartz/src/test/java/org/jpos/quartz/QuartzAdaptorTest.java
index 09d07918d..e55b1280a 100644
--- a/modules/quartz/src/test/java/org/jpos/q2/QuartzAdaptorTest.java
+++ b/modules/quartz/src/test/java/org/jpos/quartz/QuartzAdaptorTest.java
@@ -16,10 +16,11 @@
* along with this program. If not, see .
*/
-package org.jpos.q2;
+package org.jpos.quartz;
import org.jdom2.Element;
import org.jpos.core.SimpleConfiguration;
+import org.jpos.q2.Q2;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
diff --git a/modules/saf/src/main/java/module-info.java b/modules/saf/src/main/java/module-info.java
new file mode 100644
index 000000000..c771fd0f3
--- /dev/null
+++ b/modules/saf/src/main/java/module-info.java
@@ -0,0 +1,5 @@
+module org.jpos.saf {
+ requires org.jpos.jpos;
+
+ exports org.jpos.saf;
+}
diff --git a/publishing.gradle b/publishing.gradle
index f6ec90e86..1ee03950c 100644
--- a/publishing.gradle
+++ b/publishing.gradle
@@ -6,7 +6,9 @@ def mavenCentralRepo = isSnapshot ?
'https://oss.sonatype.org/content/repositories/snapshots/' :
'https://oss.sonatype.org/service/local/staging/deploy/maven2';
-project.archivesBaseName="jposee-${project.name}"
+base {
+ archivesName="jposee-${project.name}"
+}
publishing {
repositories {
@@ -24,14 +26,11 @@ publishing {
}
}
}
-} // publishing
+}
repositories {
mavenCentral()
maven { url 'https://jpos.org/maven' }
- maven { url 'https://download.oracle.com/maven' }
- maven { url 'https://maven.vaadin.com/vaadin-addons' }
- maven { url 'https://maven.vaadin.com/vaadin-prereleases' }
mavenLocal()
}