0
votes

I'm new to wso2 esb.I'm creating a proxy service, which will call two end points,
1st service will return the user id and type. 2nd service will return the amount to be paid. I need to apply some discount on the amount to be paid, based on the type of user.

ex- if user is, Gold Card holder then 20% discount if he is platinum card holder 10% discount like this.

I don't know how to do the arithmetic calculations inside proxy service. Can you please help me in this. Thanks in advance!!

1

1 Answers

2
votes

Not sure you should do such things inside WSO2 ESB that is about connecting, routing and transformation, but business rules should be made in tools like BPM

However, you can achieve your need inside WSO2 ESB using script mediator : write a little javascript for exemple and code your "arithmetic calculation"

Inside a javascript, you can access to the message context that hold payload, properties, ...

<script language="js"><![CDATA[
   mc.getPayloadXML(); // to access the payload
   mc.getProperty("MY_PROPERTY"); // where MY_PROPERTY has been set inside your mediation with property mediator
]]></script>