Solution for DMCommunity Challenge “Pay-As-You-Go Pricing Rules”

There are already 3 solutions to DMCommunity May-2020 Challenge. I especially like how Carol-Ann Berlioz created her solution using a test-driven approach when test cases prompt her which rules should be added. So, I’ve tried to reproduce her solution but instead of a product specific GUI I decided to use OpenRules decision tables defined in Excel. So, here are our test-cases with input data and expected results:

The following table defines several more decision variables:

And here are the rules defined exactly in the same way Carole-Ann did:

Please note that (while Carole-Ann didn’t stress it) the execution order of these rules is very important. So, I created a table of the type “Decision” that specifies this order:

To complete the decision model, I defined this glossary that includes all decision variables used by the above rules:

Then I called the default “test.bat” to execute this decision model and received the following results (shown only for the most complex Test E):

Blue color highlights the decision variables that were actually changed showing their values before and after rules execution.

Here is a summary for all test cases:

The same results can be seen in a more friendly html report:

To deploy this decision model as AWS Lambda function and make it available from any JSON client (e.g. POSTMAN), I simply double-clicked on “deployLambda.bat” with 0 configuration efforts.

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.