EFL
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

NameTypeRequiredDescription
transactionIdstring|nullNoIdentifier of the transaction for which the calculation was performed.
calculationIdint|nullNoInternal calculation identifier.
calculationTimestamp\DateTimeImmutable|nullNoTimestamp of the calculation, if parseable.
variantsOfferVariant[]YesList of available offer variants.
basketCalculationboolYesWhether the calculation was done for the whole basket.

Methods

MethodKindReturn typeDescription
fromArray()staticEsbCalculateBasicOfferRestReturnCreates a calculation result from raw API data, parsing timestamp and building variants.
emptyForTransaction()staticEsbCalculateBasicOfferRestReturnCreates 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