Interface · implements JsonSerializable
BalanceInterface is used as part of the WHMCS\Module\Gateway\Balance object to ensure that all required methods are present for output. Utilise the factory method to initialise the BalanceInterface object that will be added to a BalanceCollection object in your custom gateway module.
public function getAmount(): PriceGet the amount for the BalanceInterface object as a WHMCS\View\Formatter\Price object.
Returns Price
public function getColor(): stringGet the color for the BalanceInterface object. e.g. #5dc560
Returns string
public function getCurrencyCode(): stringGet the currency code for the BalanceInterface object.
Returns string
public function getCurrencyObject(): ?CurrencyGet the WHMCS\Billing\Currency object for the BalanceInterface object using the currencyCode as the query term. Will return null for an unknown currency.
Returns Currency\|null
public function getLabel(): stringGet the label for the BalanceInterface item. This should be the translated value.
Returns string
public static function factory(float $amount, string $currencyCode, ?string $label = null, ?string $color = null): BalanceInterfaceInitialise the BalanceInterface object providing the data that will be used on output.
Parameters
| Type | Name | Description |
|---|---|---|
float | $amount | The amount for the BalanceInterface object. e.g. 10.00 |
string | $currencyCode | The currency code for the BalanceInterface object. e.g. USD |
string|null | $label | The language string to be used for the label. e.g. status.available |
string|null | $color | The color to be used for the BalanceInterface object output. e.g. #5dc560 |
Returns BalanceInterface