Skip to content

Commit

Permalink
Add module-info, remove unnecessary dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Oct 13, 2024
1 parent a483f89 commit 5392e8b
Show file tree
Hide file tree
Showing 26 changed files with 88 additions and 509 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}


Expand Down
2 changes: 2 additions & 0 deletions gradle/modules.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
quartz=org.quartz-scheduler:quartz

2 changes: 0 additions & 2 deletions modules/cmf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ description = 'jPOS-EE :: CMF Utils'

dependencies {
api libs.jpos
api libs.commonsLang3

testImplementation testlibs.junit
testRuntimeOnly testlibs.junitRuntime
}
Expand Down
6 changes: 6 additions & 0 deletions modules/cmf/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module org.jpos.ee.cmf {
requires org.jpos.jpos;

exports org.jpos.cmf;
exports org.jpos.cmf.iso;
}
152 changes: 0 additions & 152 deletions modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmount.java

This file was deleted.

128 changes: 0 additions & 128 deletions modules/cmf/src/main/java/org/jpos/cmf/AdditionalAmountsWrapper.java

This file was deleted.

4 changes: 2 additions & 2 deletions modules/cmf/src/main/java/org/jpos/cmf/AmountType.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 10 additions & 9 deletions modules/cmf/src/main/java/org/jpos/cmf/CMFAdditionalAmount.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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");
Expand Down
Loading

0 comments on commit 5392e8b

Please sign in to comment.