EFL
Models

AssetToCalculation

Represents the request payload for /Calculation/CalculateBasicOffer.

Namespace and purpose

Imoli\EflLeasingSdk\Model\Calculation\AssetToCalculation represents the body sent to the /Calculation/CalculateBasicOffer endpoint. It holds the transaction identifier, a list of OfferItem entries and optional fields controlling basket calculation behaviour.

Class definition

  • Namespace: Imoli\EflLeasingSdk\Model\Calculation
  • Class: final AssetToCalculation
final class AssetToCalculation
{
    public static function builder(string $transactionId): AssetToCalculationBuilder;

    public function __construct(
        string $transactionId,
        array $offerItems,
        ?string $returnToBasketUrl = null,
        ?bool $basketCalculation = null
    );

    public function getOfferItems(): array;
    public function getTransactionId(): string;
    public function getReturnToBasketUrl(): ?string;
    public function isBasketCalculation(): ?bool;
    public function toRequestPayload(): array;
}

Properties

NameTypeRequiredDescription
transactionIdstringYesIdentifier of the current transaction.
offerItemsOfferItem[]YesList of items included in the calculation.
returnToBasketUrlstring|nullNoOptional URL to redirect the user back to the basket.
basketCalculationbool|nullNoIndicates whether the calculation is done for the entire basket.

Methods

MethodKindReturn typeDescription
builder()staticAssetToCalculationBuilderReturns a fluent builder for constructing AssetToCalculation instances.
getOfferItems()instanceOfferItem[]Returns the list of offer items.
getTransactionId()instancestringReturns the transaction identifier.
getReturnToBasketUrl()instancestring|nullReturns the return to basket URL, if set.
isBasketCalculation()instancebool|nullReturns whether basket calculation is enabled.
toRequestPayload()instancearray<string,mixed>Serialises the calculation request into the structure expected by EFL.

toRequestPayload() returns an array with transactionId, offerItems (each converted via OfferItem::toRequestPayload()), and optionally returnToBasketUrl and basketCalculation when they are not null.

Usage in the SDK