Billing Central Apex API Developer Reference

ffbc.BillingService

global with sharing class BillingService

This class provides services for generating billing documents.

Enums

BillingType

An enum that represents the valid options for billing types on contract line items, plan line items and products.

Value Description
RecurringFixed Option that shows the billing type of the object is Recurring Fixed.
RecurringVariable Option that shows the billing type of the object is Recurring Variable.
OneOffFlat Option that shows the billing type of the object is One-off.

DocumentOutput

An enum that represents the strategies for generating the billing documents.

Value Description
Single Option that creates a single billing document for each contract.
PerBillingType Option that creates a separate billing document for every billing type on each contract.

Methods

run

global static ffbc.BillingService.RunResponse run(ffbc.BillingService.RunRequest request)

This method runs the billing process and generates billing documents based on the RunRequest provided.

Input Parameters

Name Type Description
request ffbc.BillingService.RunRequest A RunRequest object that contains the contracts to be processed, the date for which the billing documents are to be created and the date on which payment is due for the billing documents.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if:
- The Document Date is null
- The Contract IDs are null
- The Document Due Date is before the Document Date
- The Bill To date is null
- The Bill From date is after the Bill To date
- The Output Type is null

Return Value

A RunResponse object which contains the errors that occurred when the billing engine ran and a list of Billing Document IDs for the billing documents that were created.

runAsync

global static Id runAsync(ffbc.BillingService.RunRequest request)

This method schedules billing to run with the values from the RunRequest provided. If no Contract IDs are provided, billing runs for all active contracts. Billing is scheduled to run as soon as possible.

Input Parameters

Name Type Description
request ffbc.BillingService.RunRequest A RunRequest object containing the specifications of the contracts to bill and the way in which they are to be billed.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if:
- The Document Date is null
- The Contract IDs are null
- The Document Due Date is before the Document Date
- The Bill To Date is null
- The Bill From Date is after the Bill To Date

Return Value

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

schedule

global static Id schedule(ffbc.BillingService.ScheduleRequest request)

This method creates a scheduled job to run the billing process. Existing scheduled jobs for the billing process are overwritten by this new schedule.

Input Parameters

Name Type Description
request ffbc.BillingService.ScheduleRequest A ScheduleRequest object containing the Cron expression that specifies when the schedule is to run.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if the request does not provide a valid schedule.

Return Value

The Id of the CronTrigger representing this scheduled job.

getBillingSummary

global static List<ffbc.BillingService.BillingSummary> getBillingSummary(ffbc.BillingService.SummaryRequest request)

Retrieves summarized billing document information.

Input Parameters

Name Type Description
request ffbc.BillingService.SummaryRequest A wrapper object containing the parameters for which to retrieve billing documents.

Return Value

A list of summaries of billing documents.

ffbc.BillingService.RunRequest

global with sharing class RunRequest

This class provides the run method with the required information to generate billing documents.

Properties

Name Type Description
DocumentDueDate Date Optional. The date on which payment is due for the billing documents to be generated.
DocumentDate Date The Document Date of the billing documents to be generated.
BillingFromDate Date Optional. The start date for the billing period.
BillingToDate Date The end date for the billing period. Billing schedules that are to be billed on this date are included.
ContractIds Set<Id> The IDs of contracts for which to generate billing documents.
OutputType ffbc.BillingService.DocumentOutput Determines the billing documents to be created for this run. The initial value is set using the Billing Document Output field of the Billing Central Settings custom setting.

Methods

RunRequest

global RunRequest()

The default constuctor for a RunRequest object.

ffbc.BillingService.RunResponse

global with sharing class RunResponse extends Response

This class is returned by the run method. You can use this class to discover if there were any errors when generating the Billing Documents, and to get a list of the IDs of the Billing Documents that were created.

This class extends ffbc.Response

Properties

Name Type Description
CalculateTaxResult ffbc.BillingService.CalculateTaxResult This provides any warnings related to tax calculation that occurred during the billing process.

Methods

getBillDocumentsCreated

global List<Id> getBillDocumentsCreated()

This method is used to access the list of billing documents generated by the billing process.

Return Value

A list of Ids of the Billing Documents created.

ffbc.BillingService.CalculateTaxResult

global with sharing class CalculateTaxResult

This class provides any warnings related to the tax calculation that occurs during Billing Document generation.

Properties

Name Type Description
Warnings List<String> A list of warnings not related to any specific Billing Documents.
WarningsById Map<Id, List<String>> A map containing the IDs of the Billing Documents for which warnings were generated, and the lists of warnings corresponding to each.

ffbc.BillingService.ScheduleRequest

global with sharing class ScheduleRequest

This class provides the information for creating or updating a Scheduled Job to run the billing process.

Properties

Name Type Description
StartTime Time The preferred time to start running this job. The exact start time depends on job queue activity.
SchedulingFrequency ffbc.Schedules.Frequency The frequency with which to run this schedule.
HourlyRecurrenceInterval Integer The number of hours between this schedule running. This is only used when SchedulingFrequency is 'Hourly'.
WeeklyDaysToRecurOn List<ffbc.Schedules.DayOfWeek> A list of days of the week on which to recur.
MonthlyRecurMode ffbc.Schedules.MonthlyRecurrenceMode Mode that determines the day of the month on which to run the schedule.
DayOfMonthToRecurOn Integer The day of the month to recur on. This is only used when SchedulingFrequency is 'Monthly' and MonthlyRecurMode is 'FixedDate'. To run on the last day of every month, or on the last weekday if 'RunOnNearestWeekday' is true, set this to 99.
MonthlyRelativeDateType ffbc.Schedules.MonthlyRelativeDateType The type of day to recur on for a relative monthly date. This is only used when SchedulingFrequency is 'Monthly' and MonthlyRecurMode is 'RelativeDate'.
MonthlyRelativeDateOrdinal ffbc.Schedules.MonthlyRelativeDateOrdinal The day in MonthlyRelativeDateType on which to run the schedule. For example, if the value is 'First' and the value of MonthlyRelativeDateType is 'Monday', the schedule runs on the first Monday of each month. This is only used when SchedulingFrequency is 'Monthly' and MonthlyRecurMode is 'RelativeDate'.
StartDate Date Optional. The date to start running this schedule. If not specified the job will start running as soon as the scheduling parameters are satisfied.
EndDate Date Optional. The date to stop running this schedule. If this and NumberOfTimesToRun are not specified the job will continue recurring until manually aborted.
NumberOfTimesToRun Integer Optional. The maximum number of times to run this schedule. If this and EndDate are not specified the job will continue recurring until manually aborted.
RunOnNearestWeekday Boolean Whether to run this schedule on the nearest weekday. If true, when the schedule lands on a weekend it runs on the closest weekday instead. This is only used when SchedulingFrequency is 'Monthly' and MonthlyRecurMode is 'FixedDate'.

Methods

ScheduleRequest

global ScheduleRequest()

The default constructor for a ScheduleRequest object.

ffbc.BillingService.SummaryRequest

global with sharing class SummaryRequest

A request to retrieve billing document summaries.

Properties

Name Type Description
DocumentIds Set<Id> The IDs of the documents for which to retrieve summaries.

Methods

SummaryRequest

global SummaryRequest()

The default constructor for this object

ffbc.BillingService.BillingSummary

global with sharing class BillingSummary

A summary of a billing document.

Properties

Name Type Description
Id Id Read only. The ID of the billing document.
Name String Read only. The name of the billing document.
NumberOfLineItems Integer Read only. The number of line items on the billing document.
DocumentTotal Decimal Read only. The document total of the billing document.
CurrencyIsoCode String Read only. The currency ISO code of the billing document.
© Copyright 2009–2018 FinancialForce.com, inc. Confidential – all rights reserved. Various trademarks held by their respective owners.