Billing Central Apex API Developer Reference

ffbc.ContractsAmendmentService

global with sharing class ContractsAmendmentService

This class provides services for automated amendments to active contracts.

Enums

RoundingScale

The scale to be used when rounding calculated values for price amendments. The exact numerical precision used during rounding will depend on a combination of the RoundingScale and other factors such as the line currency.

Value Description
NONE Do not round. Calculated values will be stored to the highest possible precision and may include fractional currency units.
WHOLE_NUMBER Calculated values will be rounded to the nearest whole number.
CURRENCY_DECIMAL_PLACES Calculated values will be rounded to the nearest currency decimal places.

Methods

changeContractPricesByPercentage

global static ffbc.ContractsAmendmentService.ChangeContractPricesByPercentageResponse changeContractPricesByPercentage(ffbc.ContractsAmendmentService.ChangeContractPricesByPercentageRequest request)

Create change requests that will change the unit prices on the given contracts by a fixed percentage value, taking effect on the date given. This service will only create the change requests, they must be applied separately using ContractsService.applyChangeRequests.
If any contract lines contain pricing structures, the prices on these lines will not be amended and a warning to this effect will be reported in the response.
If this API is used on a contract that has been renewed, a change request will be created and the response will contain a warning as a reminder to correct the prices on the renewal.

Exceptions Thrown

Value Description
BillingCentralException If the AllowPartialSuccess flag is false, an exception is thrown if there is an error creating or saving any of the change requests.
DmlException An exception is thrown if there is an unexpected error saving the change requests.

Return Value

Response containing the IDs of the change requests that have been created, and may contain errors if AllowPartialSuccess flag is true in the Request.

changeContractPricesByPercentageAsync

global static Id changeContractPricesByPercentageAsync(ffbc.ContractsAmendmentService.ChangeContractPricesByPercentageRequest request)

Using a background process, create change requests that will change the unit prices on the given contracts by a fixed percentage value, taking effect on the date given. The background process will only create the change requests, they must be applied separately using ContractsService.applyChangeRequests. Any warnings or errors will be written to the logs.
If any contract lines contain pricing structures, the prices on these lines will not be amended and a warning to this effect will be reported in the logs.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if the request is invalid, such as:
- providing an empty collection of contract IDs; or
- providing an invalid percentage; or
- not providing an effective from date

Return Value

The ID of the background process that is to change the prices on the given contracts.

calculatePriceChargedFromDates

global static ffbc.ContractsAmendmentService.PriceChargedFromDatesResponse calculatePriceChargedFromDates(ffbc.ContractsAmendmentService.PriceChargedFromDatesRequest request)

Given a list of contract line Ids and corresponding effective-from dates, calculate and return the dates at which price amendments will be charged from.
When the custom setting ApplyPriceChangeWhenNextBilled is false: If an amendment can be made, the date will be the same as the effective-from date. When the custom setting ApplyPriceChangeWhenNextBilled is true: If an amendment can be made, the date will be the start of the next unbilled billing period after the supplied effective-from date. If an amendment cannot be made, the date will be null.

Return Value

Response containing a map of dates by the IDs of the contract line items.

calculateNewPricesByPercentageIncrease

global static ffbc.ContractsAmendmentService.NewPriceByPercentageIncreaseResponse calculateNewPricesByPercentageIncrease(ffbc.ContractsAmendmentService.NewPriceByPercentageIncreaseRequest request)

Given a list of contract line IDs and a percentage increase value, calculate the amended unit price for each line.

Input Parameters

Name Type Description
request ffbc.ContractsAmendmentService.NewPriceByPercentageIncreaseRequest Request object containing a set of contract line item IDs to calculate new prices for, a percentage for increase and a rounding scale option to use.

Return Value

Response containing a map of new unit prices by the IDs of the contract line items.

changeContractLinePrices

global static ffbc.ContractsAmendmentService.ChangeContractLinePricesResponse changeContractLinePrices(List<ffbc.ContractsAmendmentService.ChangeContractLinePricesRequest> requests)

Create change requests that will change the unit prices on the given contracts by given amounts for each line, taking effect on the date given. This service will only create the change requests, they must be applied separately using ContractsService.applyChangeRequests.
If any contract lines contain pricing structures, the prices on these lines will not be amended and a warning to this effect will be reported in the response.
If this API is used on a contract that has been renewed, a change request will be created and the response will contain a warning as a reminder to correct the prices on the renewal.

Exceptions Thrown

Value Description
BillingCentralException An exception is thrown if there is an error creating or saving any of the change requests.
DmlException An exception is thrown if there is an unexpected error saving the change requests.

Return Value

Response containing the IDs of the change requests that have been created.

ffbc.ContractsAmendmentService.ChangeContractPricesByPercentageRequest

global with sharing class ChangeContractPricesByPercentageRequest

A request to amend contract prices by a certain percentage, used with changeContractPricesByPercentage.

Properties

Name Type Description
ContractIds Set<Id> The IDs of the contracts to have their prices amended. These must be active contracts.
Percentage Decimal The percentage by which to adjust the prices, with 100 being a 100% increase. A positive value will increase the prices, a negative value will decrease the prices.
EffectiveFromDate Date The earliest date on which the new prices will take effect. If the setting "Apply Price Change When Next Billed" is turned on, the price changes will start from the beginning of the next unbilled billing period that falls on or after the Effective from Date.
AllowPartialSuccess Boolean When calling the changeContractPricesByPercentageAsync or changeContractPricesByPercentage methods, setting this Boolean to true means that if an error occurs with one contract, Billing Central logs the error then skips the contract and continues amending prices for the remaining contracts. When false and running synchronously, if an error occurs with one contract then all the contracts fail. When false and running asynchronously, if an error occurs with one contract then all contracts in the same scope fail. So if the scope size is 4, contracts will fail in groups of 4; if the scope size is 30, contracts will fail in groups of 30. Contracts in other scopes are not affected.
RoundingScaleOption ffbc.ContractsAmendmentService.RoundingScale The rounding option using the RoundingScale Enum type, which will be used to round contract line values after their unit prices have been adjusted by a given percentage. This is an optional setting so it will be blank by default and hence is not set within the constructor methods. Leaving as blank will mean no rounding option is used.

Methods

ChangeContractPricesByPercentageRequest

global ChangeContractPricesByPercentageRequest()

Creates a request with an empty set of contract IDs, a percentage change of 0, and an effective from date of tomorrow.

ChangeContractPricesByPercentageRequest

global ChangeContractPricesByPercentageRequest(Set<Id> contractIds, Decimal percentage, Date effectiveFromDate)

Creates a request with the given contract IDs, percentage change, and effective from date.

ffbc.ContractsAmendmentService.ChangeContractPricesResponse

global virtual with sharing class ChangeContractPricesResponse extends Response

The result of amending contract prices using changeContractPricesByPercentage or changeContractLinePrices. This class contains the data that is common to both the line and percentage amendment variants. The two variants then extend this class to provide their own responses. This class currently may report errors. If AllowPartialSuccess is false, errors when creating a change request for any contract will produce an exception. Can contain errors if AllowPartialSuccess is true and the object is a ChangeContractPricesByPercentageResponse This response may contain warnings.

This class extends ffbc.Response

Properties

Name Type Description
ChangeRequestIdsByActiveContractId Map<Id, Id> The IDs of the change requests created, keyed by active contract ID.

Methods

ChangeContractPricesResponse

global ChangeContractPricesResponse()

Creates a response with no change request IDs.

ChangeContractPricesResponse

global ChangeContractPricesResponse(Map<Id, Id> changeRequestIdsByActiveContractId)

Creates a response with the given change request IDs keyed by active contract ID.

ffbc.ContractsAmendmentService.ChangeContractPricesByPercentageResponse

global with sharing class ChangeContractPricesByPercentageResponse extends ChangeContractPricesResponse

The result of amending contract prices using changeContractPricesByPercentage. This class currently may report errors. If AllowPartialSuccess is false, errors when creating a change request for any contract will produce an exception. It can contain errors if AllowPartialSuccess is true This response may contain warnings.

This class extends ffbc.ContractsAmendmentService.ChangeContractPricesResponse

Methods

ChangeContractPricesByPercentageResponse

global ChangeContractPricesByPercentageResponse()

Creates a response with no change request IDs.

ChangeContractPricesByPercentageResponse

global ChangeContractPricesByPercentageResponse(Map<Id, Id> changeRequestIdsByActiveContractId)

Creates a response with the given change request IDs keyed by active contract ID.

ffbc.ContractsAmendmentService.ChangeContractLinePricesRequest

global with sharing class ChangeContractLinePricesRequest

A request to amend prices for a contract by given amounts for each line, used with changeContractLinePrices.

Properties

Name Type Description
ContractId Id The ID of the contract to have its prices amended. This must be an active contract.
linePrices Map<Id, ffbc.ContractsAmendmentService.ContractLinePriceInfo> A Map of line/price info objects where each object contains pricing information for the contract line item whose ID provides the key.

Methods

ChangeContractLinePricesRequest

global ChangeContractLinePricesRequest()

Creates an empty request

ChangeContractLinePricesRequest

global ChangeContractLinePricesRequest(Id contractId, Map<Id, ffbc.ContractsAmendmentService.ContractLinePriceInfo> linePrices)

Creates a request with the given contract ID and line amendments.

ffbc.ContractsAmendmentService.ContractLinePriceInfo

global with sharing class ContractLinePriceInfo

Contains new price information for a contract line item. Includes the new unit price and effective from date. Used with ChangeContractLinePricesRequest.

Properties

Name Type Description
UnitPrice Decimal The new unit price for the line.
EffectiveFromDate Date The earliest date on which the new price will take effect. If the setting "Apply Price Change When Next Billed" is turned on, the price changes will start from the beginning of the next unbilled billing period that falls on or after the Effective from Date.

Methods

ContractLinePriceInfo

global ContractLinePriceInfo()

Creates an empty object

ContractLinePriceInfo

global ContractLinePriceInfo(Decimal unitPrice, Date effectiveFromDate)

Creates an object with the given line unit price and effective from date

ffbc.ContractsAmendmentService.ChangeContractLinePricesResponse

global with sharing class ChangeContractLinePricesResponse extends ChangeContractPricesResponse

The result of amending contract prices using changeContractLinePrices. This class currently will never report any errors. Errors in creating a change request for any contract will produce an exception. This response may contain warnings.

This class extends ffbc.ContractsAmendmentService.ChangeContractPricesResponse

Methods

ChangeContractLinePricesResponse

global ChangeContractLinePricesResponse()

Creates a response with no change request IDs.

ChangeContractLinePricesResponse

global ChangeContractLinePricesResponse(Map<Id, Id> changeRequestIdsByActiveContractId)

Creates a response with the given change request IDs keyed by active contract ID.

ffbc.ContractsAmendmentService.PriceChargedFromDatesRequest

global with sharing class PriceChargedFromDatesRequest

A request to calculate and return the dates at which price amendments will be charged from, used with calculatePriceChargedFromDates.

Properties

Name Type Description
effectiveFromDatesByContractLineId Map<Id, Date> A map of effective from dates by contract line id.

Methods

PriceChargedFromDatesRequest

global PriceChargedFromDatesRequest(Map<Id, Date> effectiveFromDatesByContractLineId)

Creates a request with the given map of effective from dates by contract line id.

ffbc.ContractsAmendmentService.PriceChargedFromDatesResponse

global with sharing class PriceChargedFromDatesResponse

The result of calculating dates at which price amendments will be charged from, using calculatePriceChargedFromDates. This class contains a map of charge dates by contract line id.

Properties

Name Type Description
priceChargedFromDatesByContractLineId Map<Id, Date> A map of charge dates by contract line id.

Methods

PriceChargedFromDatesResponse

global PriceChargedFromDatesResponse()

Creates a response with an empty map of charge dates by contract id.

PriceChargedFromDatesResponse

global PriceChargedFromDatesResponse(Map<Id, Date> priceChargedFromDates)

Creates a response with the given map of charge dates by contract id.

ffbc.ContractsAmendmentService.NewPriceByPercentageIncreaseRequest

global with sharing class NewPriceByPercentageIncreaseRequest

A request to calculate new unit prices for contract line items after a percentage increase using calculateNewPricesByPercentageIncrease.

Properties

Name Type Description
LineIds Set<Id> The IDs of the contract line items to be amended.
PercentageIncrease Decimal The decimal value that specifies the percentage increase to apply to the current unit price.
RoundingScaleOption ffbc.ContractsAmendmentService.RoundingScale The rounding option using the RoundingScale Enum type, which will be used to round contract line values after their unit prices have been adjusted by a given percentage. This is an optional setting so it will be blank by default and hence is not set within the constructor methods. Leaving as blank will mean no rounding option is used.

Methods

NewPriceByPercentageIncreaseRequest

global NewPriceByPercentageIncreaseRequest(Set<Id> lineIds, Decimal percentageIncrease)

Creates a request with the lineIds and the percentage increase value.

ffbc.ContractsAmendmentService.NewPriceByPercentageIncreaseResponse

global with sharing class NewPriceByPercentageIncreaseResponse extends Response

The result of calculating new unit prices for contract line items after a percentage increase using calculateNewPricesByPercentageIncrease. This class contains a map of new unit prices by contract line ID.

This class extends ffbc.Response

Properties

Name Type Description
NewPricesByIds Map<Id, Decimal> A map of new unit prices by the IDs of the contract line items.
© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.