In order keep configuration simple, please perform the following steps in Salesforce Classic (Booker25 is Lightning-Ready, you may afterwards use the app in Salesforce Lightning as you please)
Use the following procedure to define custom price calculations on resources and services.
1. Create your custom price calculator class
Create a class that implements the interface B25.Util_PluginManager.ReservationPrice. Implementing that interface means the class must have a method with the following signature:
This method will be called whenever a reservation is saved, or whenever the reservation form gets rerendered. You can control when the reservation form gets rerendered, more on that in a bit. The B25.Util_PluginManager.ReservationPriceData object that gets passed along to the calculate method has two properties that will help you to make your own price calculation.
Name
Type
Purpose
reservation
B25__Reservation__c
Contains the service costs as shown on the reservation form when you have the setting 'Services have a price' enabled. [link to other doc page] Go here for more information about configuring Booker25's system settings.
serviceCosts
Decimal
Contains the reservation as it is at the moment the calculate method is called. It will have all the fields populated that are visible on the reservation form.
In the calculate method you will be able to set any fields on the reservation property record, such as the B25__Subtotal__c field, in order to control the final price of the reservation, or to start an approval process.
For a full overview of the Booker25 global classes, methods and properties mentioned on this page:
Go to Setup
Search for ApexClasses
Open the Util_PluginManager class
2. Activate the custom price calculator class
Now, let Booker25 know that it should use your custom class instead of the default price calculation
To do this:
Go to Setup
Search for CustomSettings
Click Manage next to SystemSetting
Click New
Name the record ReservationPriceCalculatorClass, and for StringValue enter the name of your custom price calculator class
As long as this setting exists, Booker25 will execute the calculate method every time the reservation form gets rerendered or when the reservation is saved.