Models
EsbCalculateBasicOfferRestReturn
Represents the result of a basic offer calculation, including offer variants and basket-level flags.
Namespace and purpose
Imoli\EflLeasingSdk\Model\Calculation\EsbCalculateBasicOfferRestReturn models the response of the /Calculation/CalculateBasicOffer endpoint.
It aggregates metadata about the calculation and a list of OfferVariant instances.
Class definition
- Namespace:
Imoli\EflLeasingSdk\Model\Calculation - Class: final
EsbCalculateBasicOfferRestReturn
final class EsbCalculateBasicOfferRestReturn
{
public ?string $transactionId;
public ?int $calculationId;
public ?\DateTimeImmutable $calculationTimestamp;
/** @var OfferVariant[] */
public array $variants;
public bool $basketCalculation;
public static function fromArray(array $data): self;
public static function emptyForTransaction(string $transactionId): self;
}
Properties
| Name | Type | Required | Description |
|---|---|---|---|
transactionId | string|null | No | Identifier of the transaction for which the calculation was performed. |
calculationId | int|null | No | Internal calculation identifier. |
calculationTimestamp | \DateTimeImmutable|null | No | Timestamp of the calculation, if parseable. |
variants | OfferVariant[] | Yes | List of available offer variants. |
basketCalculation | bool | Yes | Whether the calculation was done for the whole basket. |
Methods
| Method | Kind | Return type | Description |
|---|---|---|---|
fromArray() | static | EsbCalculateBasicOfferRestReturn | Creates a calculation result from raw API data, parsing timestamp and building variants. |
emptyForTransaction() | static | EsbCalculateBasicOfferRestReturn | Creates an empty calculation result for the given transaction id, with no variants and flags cleared. |
fromArray() reads transactionId and calculationId, parses calculationTimestamp into a \DateTimeImmutable when possible, builds an array of OfferVariant from the variants field, and interprets basketCalculation as a boolean flag.
emptyForTransaction() is used by the high-level EflClient when the /Calculation/CalculateBasicOffer endpoint returns a successful response with an empty body, producing a result with the given transactionId, an empty variants array and basketCalculation set to false.
Usage in the SDK
- Returned by
EflClient::calculateBasicOffer. - Embedded inside
CalculationDataunder thecalculationfield.