CC Pricing Macro

light111CC Pricing Macro 


The post talks about how to design a pricing macro which looks into the mapping table to derive the correct output column. Here we are going to use the price table which is a special kind of mapping table class.

Price Table is the mapping table class which has two input columns price key and currency and output is the amount.

1

Now let’s create a mapping table instance of the mapping table class[price table].

2

Provide mapping table name and the mapping table class as Price Table and create some mapping table records.

When the pricing macro will look into the table with a specific price key, currency and date it derives a particular amount.

3


A pricing macro is a reusable entity which can be used in different charges.

Now let’s create a Pricing Macro.

4

Below Screen appears.

5

Provide the name and description. As previously we set the context that the price macro will look into the price table to derive an amount – we need to pass three fields: what is the price table, what is the price key and date. Also need to pass the currency but for the currency we dont need any field in the price macro. When the price macro become the part of the charge the currency automatically flows with the standard parameter called CURRENCY_CODE.

Now create 3 input parameters with appropriate types and 1 output parameter as amount.

6

Now add a mapping table introducer to the price macro.

7

Below screen appears.

8

Provide name and description. Map the price macro input parameters to the mapping table parameter.

The mapping table introducer has two parts – row found and row not found.

9

Add  Out Property Update to the row found section which updates the price found from the mapping table introducer to the price macro.

10

Below screen appears.

11

Now map the mapping table introducer property : amount to the price macro parameter: pm_amount.

12

To the Row Not Found- Add no access function.

13

Below screen appears.

14

Provide a message and select some properties that will be displayed as popup message when price macro don’t find a price.

15

Add a Flat/linear function to the row found section.

16

Once the mapping table introducer find an amount from the price table, we can take this value and then we can make some more calculation like we can add some value to it or multiply. But here in this case we have added a flat function. 

17


Up to this the price macro design is over. 

Now lets create a charge and use the price macro inside this and then will test the charge.

20

Provide charge name and description.

21

Add twp parameters in the charge one is mapping table id and the mapping table key.

22

Provide name and description to the price plan.

23

Add Recurring Rate to the Price plan.

24

Provide name & description and mention what is the cycle of the recurring rate. IT can be day/week/month/year. Here lets set as every day.

25

Add Macro operator to the recurring rate.

29

Provide name and description.  Provide – Pricing Macro as designed above. 

30

Now map the charge parameter to the price macro parameter.

31

Add a flat function to the recurring rate.

32

Set the price macro generated property in the function.

33

Save the charge.

34


Trial the charge.

35

Provide date, currency.

36

Also fill the mapping table id and the price key. Execute and it displays the price.

37

Again run with a different price key.

3839

The price macro error appears: no row found.

40

Provide date in feb.

42

It finds the correct price from the mapping table and as the charge has recurring fee which is every day, the recurring fee calculated accordingly.

43

Try with  different price key and we receive an error.

44


 

Advertisements

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