Billing Central Apex API Developer Reference

ffbc.PlansService

global with sharing class PlansService

This class provides service functionality for the Plan object.

Enums

Status

An enum that represents the valid options for the status of plans.

Value Description
Draft Option to show the status of the plan is Draft.
Active Option to show the status of the plan is Active.
Expired Option to show the status of the plan is Expired.

Methods

convertToContracts

global static Set<Id> convertToContracts(List<ffbc.PlansService.ContractConversion> conversions)

Creates new contracts from plans.

Input Parameters

Name Type Description
conversions List<ffbc.PlansService.ContractConversion> List of wrappers for the conversion criteria to be used when creating contracts such as plan ID, account ID, name and start date.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if:
- Any of the conversions do not have an account ID.
- Any of the conversions do not have a plan ID.
- A plan for the given ID is not Active.
- The start date is null.
- The soft date used by a plan is invalid.

Return Value

The Ids of the created contracts.

addToContracts

global static Set<Id> addToContracts(List<ffbc.PlansService.ContractAddition> additions)

Creates new contract line items from plans.

Input Parameters

Name Type Description
additions List<ffbc.PlansService.ContractAddition> The list of wrappers for the addition criteria to be used such as plan Id, contract Id and start date.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if:
- Any of the additions have no plan ID.
- Any of the additions have no contract ID.
- A plan with a given ID is not Active.
- A contract with a given ID is not in Draft status.
- The start date is null.
- The soft date used by a plan is invalid.
- Any of the contract line items would be created with an invalid state.

Return Value

The IDs of the contract line items that were created.

load

global static List<ffbc.PlansService.Plan> load(Set<Id> planIds)

Retrieves the plans from the IDs provided and returns a wrapper for each plan and its line items.

Input Parameters

Name Type Description
planIds Set<Id> The plans to query.

Return Value

The wrapper for each plan and its list of line items.

save

global static Set<Id> save(List<ffbc.PlansService.Plan> plansToSave)

Saves new or existing plans and plan line items. Existing plan line items which are not included in the parent plan are deleted.

Input Parameters

Name Type Description
plansToSave List<ffbc.PlansService.Plan> The list of plans to be saved including their plan line items.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if any of the records have invalid data, or if an existing plan line item is associated with a plan other than its parent.

Return Value

The set of IDs of plans that have been saved.

getAllActivePlanSummaries

global static List<ffbc.PlansService.PlanSummary> getAllActivePlanSummaries()

Retrieves a list of summarised Plan details from all active plans.

Return Value

A list of summarised active Plans

deletePlans

global static void deletePlans(Set<Id> planIds)

Deletes the plans with the given IDs.

Input Parameters

Name Type Description
planIds Set<Id> The IDs of the plans to be deleted.

ffbc.PlansService.ContractConversion

global class ContractConversion

This class sets the data required to convert a plan to a contract.

Properties

Name Type Description
PlanId Id The ID of the Plan.
AccountId Id The ID of the Account.
Name String The Contract Name.
StartDate Date The Start Date of the Contract.
FirstBillDate Date The First Bill Date of the Contract.

Methods

ContractConversion

global ContractConversion()

The default constructor for a ContractConversion object.

ffbc.PlansService.Plan

global class Plan

This class models a plan with plan line items, including fields that are relevant to plan creation, viewing and editing.

Properties

Name Type Description
Id Id The ID of the Plan.
Name String The Plan Name.
CompanyId Id The Company ID of the Plan SObject being represented.
Description String The Description of the Plan SObject being represented.
NumberOfTerms Integer The Number Of Terms of the Plan SObject being represented.
IsContinuous Boolean The Continuous status of the Plan SObject being represented.
TermId Id The Term ID of the Plan SObject being represented.
StartDate Date The Start Date of the Plan SObject being represented.
EndDate Date The End Date of the Plan SObject being represented.
Status ffbc.PlansService.Status The Status of the Plan SObject being represented.
CurrencyIsoCode String The Currency ISO Code of the Plan SObject being represented.
LineItems List<ffbc.PlansService.PlanLineItem> The Plan Line Items related to the Plan SObject being represented. See PlanLineItem for details of that object.
TotalValue Decimal The Total Value of the Plan SObject being represented.
AnnualValue Decimal The Annual Value of the Plan SObject being represented.
OneOffValue Decimal The One-off Value of the Plan SObject being represented.
TermValue Decimal The Term Value of the Plan SObject being represented.

Methods

Plan

global Plan()

The default constructor for a Plan object.

ffbc.PlansService.PlanLineItem

global class PlanLineItem

This class models a Plan Line Item, including fields that are relevant to plan creation, viewing and editing.

Properties

Name Type Description
Id Id The ID of the Plan Line Item SObject being represented.
ProductId Id The Product ID of the Plan Line Item SObject being represented.
UnitOfMeasureId Id The Unit of Measure ID of the Plan Line Item SObject being represented.
BillingType ffbc.BillingService.BillingType The Billing Type of the Plan Line Item SObject being represented.
Description String The Description of the Plan Line Item SObject being represented.
UnitPrice Decimal The Unit Price of the Plan Line Item SObject being represented.
Quantity Decimal The Quantity of the Plan Line Item SObject being represented.
ProductName String Read only. The Name of the Product associated with the Plan Line Item SObject being represented.

Methods

PlanLineItem

global PlanLineItem()

The default constructor for a PlanLineItem object.

ffbc.PlansService.ContractAddition

global class ContractAddition

This class wraps the criteria to be used when adding plans to contracts.

Properties

Name Type Description
ContractId Id The ID of the Contract.
PlanId Id The ID of the Plan.
StartDate Date The Start Date of the Contract Line Items to be created.
FirstBillDate Date The First Bill Date of the Contract Line Items to be created. If this is not specified, the First Bill Date of the Contract is used.

Methods

ContractAddition

global ContractAddition()

The default constructor for a ContractAddition object.

ffbc.PlansService.PlanSummary

global class PlanSummary

This class presents a summarised detail of the Plan object

Properties

Name Type Description
Id Id Read only. The Salesforce ID of the Plan being summarised
Name String Read only. The Salesforce Name of the Plan being summarised
TotalValue Decimal Read only. The Total Value of the Plan being summarised
CurrencyIsoCode String Read only. The Currency Iso Code of the Plan being summarised