Skip to content

Instantly share code, notes, and snippets.

@ashkrit
Created August 11, 2020 02:59
Show Gist options
  • Save ashkrit/5213fc7898eb15f72f69cef263558788 to your computer and use it in GitHub Desktop.
Save ashkrit/5213fc7898eb15f72f69cef263558788 to your computer and use it in GitHub Desktop.
decisionSystem("FX Transaction", tradeSchema, s -> {
s.rule("High Transfer discount", condition -> {
condition
.gt("amount", 1000d)
.eq("source", "SGD")
.eq("target", "INR")
.action((rule, row) -> row.setDiscount(2.0d));
});
s.rule("less than minimum", condition -> {
condition
.lt("amount", 1000d)
.action((rule, row) -> row.setDiscount(-1.0d));
});
s.rule("limited time period", conditions -> {
conditions
.between("date", 20200805, 20200831)
.action((rule, row) -> row.setDiscount(5.0d));
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment