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.
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.
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
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
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
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
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
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. This method differs from the other `schedule` method by not requiring a CRON expression. Instead, you can specify a description of the schedule bin terms of concepts based on the calendar / clock and the system will work out a CRON expression for you.
Input Parameters
Exceptions Thrown
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. This method differs from the other `schedule` method by allowing you to specify an exact CRON expression to use for scheduling the billing process.
Input Parameters
Exceptions Thrown
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. This class is marked as serializable and deserializable to work around an issue in enforcing JsonAccess for Visualforce remoting requests. Warning: Do not rely on any behavior available via serializing as or deserializing from JSON that is not part of the global API because it might be subject to change.
Properties
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. This class is marked as serializable and deserializable to work around an issue in enforcing JsonAccess for Visualforce remoting requests. Warning: Do not rely on any behavior available via serializing as or deserializing from JSON that is not part of the global API because it might be subject to change.
Properties
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
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
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
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
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.
Properties
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.
|