Setting an upper limit
When a software house uses the Wizdome system, there is always the scenario where you need to check (and display) the remaining credit which the end-user has. Another scenario could be checking the status of a pending payment initiated via our Payment gateway (powered by PayPal).
This remaining credit can be anything billable: amount of data (MB), time of use (hours / days) and we even had once a customer who measured their diamonds….
We assume that a customer should pay up to a certain amount and after paying it, he will get an unlimited license or unlimited access to this specific feature / resources that is currently restricted. To embed this functionality in the Wizdome system, we have added an attribute named “Max Billable Value”. When the Max Billable Value is reached, the customer doesn’t have to pay any further. For example, if the Restriction is ‘amount of data (MB)’, then if we set the Max Billable Value to 200 (MB), then the moment 200 MB were purchased, any additional MB will be added for free, or there will be no limitation on using any number of MB from that moment.
From the source code point of view, the constant RESTRICTION_REACHED_UNLIMITED which is -2, when returned by the GetRemainingCredit(Restriction Name), indicates that the upper limit has been reached.
For example, the following source code can be used to generate a message based on the situation which could either be:
- Additional credit has been added.
- Credit has been added to the point, the Max Billable Value was reached.
if (Global.GetRemainingCredit(MB_LIMIT) == RESTRICTION_REACHED_UNLIMITED) message.Format(L"You have reached the maximum billable credit "); else message.Format(L"You have %dMB credit. Payment was successful ", Global.GetRemainingCredit(MB_LIMIT));
Originally published on securedglobe.wordpress.com.