Skip to content

Commit

Permalink
Merge pull request #274 from alcarraz/feature/client-simulator-use-en…
Browse files Browse the repository at this point in the history
…v-in-fields

Allow fields to be resolved by environment properties.
  • Loading branch information
ar authored Dec 28, 2022
2 parents 8a020d9 + 218cbcd commit bdefbda
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.FileInputStream;
import java.util.*;

import org.jpos.core.Environment;
import org.jpos.iso.*;
import org.jpos.iso.packager.XMLPackager;
import org.jpos.util.Logger;
Expand Down Expand Up @@ -352,14 +353,17 @@ private ISOMsg applyRequestProps (ISOMsg m, Interpreter bsh)
if (c instanceof ISOMsg) {
applyRequestProps ((ISOMsg) c, bsh);
} else if (c instanceof ISOField) {
String value = (String) c.getValue();
String value = Environment.get((String) c.getValue());
if (value.length() > 0) {
try {
if (value.charAt (0) == '!') {
m.set (i, bsh.eval (value.substring(1)).toString());
}
else if (value.charAt (0) == '#') {
m.set (i, ISOUtil.hex2byte(bsh.eval (value.substring(1)).toString()));
}
else if (!value.equals(c.getValue())) {
m.set (i, value);
}
} catch (NullPointerException e) {
m.unset (i);
Expand Down

0 comments on commit bdefbda

Please sign in to comment.