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.
ScheduledFixed DEPRECATED This option should not be used. Using this value in our APIs will result in an exception.

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

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.

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 RunRequest object is invalid
- The user calling BillingService.run has insufficient permissions
- Another process is trying to update the same billing schedules

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 using the scheduler configuration. 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.

schedule

global static Id schedule(ffbc.BillingService.ScheduleDetail detail)

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

Input Parameters

Name Type Description
detail ffbc.BillingService.ScheduleDetail A ScheduleDetail object containing the details that specifies when the schedule is to run.

Exceptions Thrown

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

Return Value

The Id of the CronTrigger representing this scheduled job.

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.

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.ScheduleDetail

global with sharing class ScheduleDetail

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.
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.
CronExpression String the cron expression to be used to run this schedule.

Methods

ScheduleDetail

global ScheduleDetail()

The default constructor for a ScheduleDetail 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.RunRequest

global with sharing class RunRequest

This class provides the run method with the required information to generate billing documents.
The RunRequest is considered invalid 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

Properties

Name Type Description
DocumentDueDate Date Optional. The date on which payment is due for the billing documents to be generated. If left null, the value will be defaulted using the account and company credit terms.
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.

© Copyright 2009–2022 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.