Billing Central Apex API Developer Reference

ffbc.ContractsAmendmentService

global with sharing class ContractsAmendmentService

This class provides services for automated amendments to active contracts.

Methods

changeContractPricesByPercentage

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

Create change requests that will increase 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.
This cannot be used for contracts that contain lines using pricing structures. An exception will be thrown if any pricing structures are found.
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.

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.

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.
This cannot be used to amend prices on lines using pricing structures. An exception will be thrown if any pricing structures are found.
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.

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

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.

© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.