Providers

Estimated reading: 2 minutes 4 views

Overview

Wattyo Billing makes use of what we named Providers to load the different data that is required to calculate the billing.

The data required to execute the billing process is divided into two categories:

  • Metadata: this is the data that is required to configure the billing process. This includes Calculation Rules, Pricing, Taxes, Settings, Validations and Estimators.
  • Business Data: The Billable Element (and the related data that is required to calculate the billing), the Usage data and the Technical Characteristics.

The Providers are technically Apex Classes that are responsible for retrieving the data required to perform the calculations and pass it to the Calculation engine. Wattyo comes with out of the box providers for each providers and these cover all the common scenarios and more complex ones.
However, in case your business requires a specific behaviour not covered by the out of the box providers, you can create your own provider and plug it into the system.

Custom Providers

In order to create your custom provider, you need to create a new Apex Class that implements the corresponding Provider interface. Depending on the interface the required methods to implement are different but in general, the interface defines two methods that must be implemented:

  • loadData. This method is responsible for loading the data required. They always receive and returns DTOs (Data Transfer Objects) that are used to pass the data between the different components of the system.
  • postProcess. This method is responsible for processing the data after the invoice have been generated. This is useful when you need to update the data in the system after the invoice has been generated, for instance if you want to link the billed usages to the invoice.

You can find more information about the different providers in the specific providers sections.

Leave a Comment

       
Euphoria, forever till the end of times

Euphoria

Share this Doc

Providers

Or copy link

CONTENTS