Billing Central Apex API Developer Reference

ffbc.BillingSchedulesService

global with sharing class BillingSchedulesService


This class provides the basic functionality to generate billing schedules.

Methods

generate

global static ffbc.BillingSchedulesService.GenerateResponse generate(ffbc.BillingSchedulesService.GenerateRequest request)

Generates billing schedules for active contracts.

Input Parameters

Name Type Description
request ffbc.BillingSchedulesService.GenerateRequest A wrapper object containing the list of contracts and the criteria for billing schedule generation.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if no generation End Date is provided, or if the generation End Date is before the generation Start Date.

Return Value

A response containing information about the billing schedules that were generated and the errors that occurred.

generateAllAsync

global static Id generateAllAsync(ffbc.BillingSchedulesService.GenerateAllRequest request)

Generates billing schedules for all contract line items. The billing schedules are generated asynchronously by queueable Apex.

Input Parameters

Name Type Description
request ffbc.BillingSchedulesService.GenerateAllRequest A request object containing the parameters that determine the contract line items for which billing schedules are to be generated.

Exceptions Thrown

Value Description
An exception is thrown if:
- The request is null.
- The billing date for which to generate schedules is not specified.

Return Value

The ID of the asynchronous process that is to generate the billing schedules.

generateAsync

global static Id generateAsync(ffbc.BillingSchedulesService.GenerateRequest request)

Generates billing schedules for active and expired contracts. The billing schedules are generated asynchronously by queueable Apex.

Input Parameters

Name Type Description
request ffbc.BillingSchedulesService.GenerateRequest A GenerateRequest object containing the list of contracts and criteria for which to generate billing schedules.

Return Value

The ID of the asynchronous process that will generate the billing schedules.

generateForLines

global static ffbc.BillingSchedulesService.GenerateResponse generateForLines(ffbc.BillingSchedulesService.GenerateForLineRequest request)

Generates billing schedules for the contract lines specified. Contract lines that are canceled will not have any schedules generated.

Input Parameters

Name Type Description
request ffbc.BillingSchedulesService.GenerateForLineRequest A wrapper object containing the list of contract line items and the criteria for billing schedule generation.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if no generation End Date is provided, or if the generation End Date is before the generation Start Date.

Return Value

A response containing information about the billing schedules that were generated and the errors that occurred.

calculateNextBillDates

global static ffbc.BillingSchedulesService.NextBillDateResponse calculateNextBillDates(ffbc.BillingSchedulesService.NextBillDateRequest request)

Calculates the date on which a given contract will be next billed. If the contract will never be billed, then a `null` date is returned for that particular contract.

Input Parameters

Name Type Description
request ffbc.BillingSchedulesService.NextBillDateRequest A request containing the contract IDs in scope.

Return Value

Response containing a method accepting contract ID and returning the date on which the corresponding contract will be billed next.

getNumberOfMonthsToGenerateBillingSchedules

global static Integer getNumberOfMonthsToGenerateBillingSchedules()

Returns the default number of future months for which to generate billing schedules. This is determined by the Billing Schedule Number of Months field in the Billing Central Settings custom setting. If the custom field does not contain a value, the default value of 12 is used.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if the value of the custom setting is negative.

Return Value

The default number of months for which to generate billing schedules.

ffbc.BillingSchedulesService.BaseGenerateRequest

global with sharing abstract class BaseGenerateRequest

Properties

Name Type Description
GenerationStartDate Date Generates billing schedules for each contract line item from the GenerationStartDate if provided. If the GenerationStartDate is not provided, billing schedules are generated from whichever of these is the latest:
- contract line item start date
- period end date of the latest billing schedule for the line
GenerationEndDate Date Billing schedules for each contract line item will be generated up to the latest period where the billing date is before this date.
SchedulesPerLine Integer Determines the maximum number of billing schedules per line. This property is only used by the generate and generateForLines methods.

ffbc.BillingSchedulesService.GenerateAllRequest

global with sharing class GenerateAllRequest

Contains the parameters for generating billing schedules for all contract line items.

Properties

Name Type Description
GenerationEndDate Date The billing date up to which billing schedules are to be generated for all contract line items.

Methods

GenerateAllRequest

global GenerateAllRequest()

The default constructor for this object.

ffbc.BillingSchedulesService.GenerateForLineRequest

global with sharing class GenerateForLineRequest extends BaseGenerateRequest

This class provides the criteria for generating billing schedules from contract line items. Contract lines that are canceled will not have any schedules generated.
Use this class to provide:
- GenerationStartDate The date to generate billing schedules from.
- GenerationEndDate The date to generate billing schedules to.
- ContractLineItemIds The list of Contract Line Item Ids for which to generate billing schedules.
- SchedulesPerLine The maximum number of billing schedules to generate for each line item.

This class extends ffbc.BillingSchedulesService.BaseGenerateRequest

Properties

Name Type Description
ContractLineItemIds Set<Id> The set of contract line items for which to generate billing schedules. Contract lines that are canceled will not have any schedules generated.

Methods

GenerateForLineRequest

global GenerateForLineRequest()

The default constructor for a GenerateForLineRequest object.

ffbc.BillingSchedulesService.GenerateRequest

global with sharing class GenerateRequest extends BaseGenerateRequest

This class provides the criteria for generating billing schedules from contracts.

This class extends ffbc.BillingSchedulesService.BaseGenerateRequest

Properties

Name Type Description
ContractIds Set<Id> Holds the list of contracts for which to generate billing schedules.

Methods

GenerateRequest

global GenerateRequest()

The default constuctor for a GenerateRequest object.

ffbc.BillingSchedulesService.GenerateResponse

global with sharing class GenerateResponse extends Response

Returned by the service methods. Contains the Ids of the billing schedules generated and errors that occurred.

This class extends ffbc.Response

Properties

Name Type Description
GeneratedBillingScheduleIdsByContractId Map<Id, Set<Id>> Read only. The IDs of the billing schedules that were generated. These are mapped by the ID of the contract to which they are associated.
GeneratedBillingScheduleIdsByContractLineItemId Map<Id, Set<Id>> Read only. The IDs of the billing schedules that were generated. These are mapped by the ID of the contract line item to which they are associated.

ffbc.BillingSchedulesService.NextBillDateRequest

global with sharing class NextBillDateRequest

A request to calculate and return the dates on which the contracts will be next billed.

Properties

Name Type Description
ContractIds Set<Id> IDs of the contracts in scope.

Methods

NextBillDateRequest

global NextBillDateRequest(Set<Id> contractIds)

Creates a request with the given contract IDs in scope.

ffbc.BillingSchedulesService.NextBillDateResponse

global with sharing class NextBillDateResponse extends Response

The result of calculating the date on which a given contract will be billed next.

This class extends ffbc.Response

Methods

getNextBillDateForContract

global Date getNextBillDateForContract(Id contractId)

Retrieves the date on which the given contract will be next billed

© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.