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
| Name | Type | Required | Description |
|---|---|---|---|
transactionId | string | Yes | Identifier of the current transaction. |
offerItems | OfferItem[] | Yes | List of items included in the calculation. |
returnToBasketUrl | string|null | No | Optional URL to redirect the user back to the basket. |
basketCalculation | bool|null | No | Indicates whether the calculation is done for the entire basket. |
Methods
| Method | Kind | Return type | Description |
|---|---|---|---|
builder() | static | AssetToCalculationBuilder | Returns a fluent builder for constructing AssetToCalculation instances. |
getOfferItems() | instance | OfferItem[] | Returns the list of offer items. |
getTransactionId() | instance | string | Returns the transaction identifier. |
getReturnToBasketUrl() | instance | string|null | Returns the return to basket URL, if set. |
isBasketCalculation() | instance | bool|null | Returns whether basket calculation is enabled. |
toRequestPayload() | instance | array<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
- Used by
EflClient::calculateBasicOffer. - Passed to
CalculationApiClient::calculateBasicOffer()as the request payload.