Builders
CustomerDataBuilder
Fluent builder for constructing CustomerData payloads sent to the EFL API.
Namespace and purpose
Imoli\EflLeasingSdk\Builder\CustomerDataBuilder is a fluent helper for building CustomerData instances.
It is typically used before calling /Customer/PostCustomerDataForLon via EflClient::submitCustomerData().
Class definition
- Namespace:
Imoli\EflLeasingSdk\Builder - Class: final
CustomerDataBuilder - Builds:
Imoli\EflLeasingSdk\Model\Customer\CustomerData
namespace Imoli\EflLeasingSdk\Builder;
use Imoli\EflLeasingSdk\Model\Customer\Company;
use Imoli\EflLeasingSdk\Model\Customer\CustomerData;
final class CustomerDataBuilder
{
public function __construct(string $transactionId, int $offerId);
public function withCompany(Company $company): self;
public function build(): CustomerData;
}
Fluent API
- __construct(string $transactionId, int $offerId)
Initialises the builder with the requiredtransactionIdandofferIdcoming from the offer calculation. - withCompany(Company $company): self
Sets the company‑level customer data associated with this transaction. - build(): CustomerData
- Requires
companyto be set. - Throws
\LogicExceptionifcompanyis missing. - Returns a new
CustomerDatainstance ready to be serialised and sent to the API.
- Requires
Usage example
use Imoli\EflLeasingSdk\Builder\CustomerDataBuilder;
// $company is a Company model, e.g. built via CompanyBuilder
$customerData = (new CustomerDataBuilder('tx-1', 1234))
->withCompany($company)
->build();