<?php
namespace App\DTO\LicenciasOnline;
use App\Entity\License;
use App\Entity\User;
class ActivateLicenseDTO
{
private License $license;
private User $user;
private ?string $purchaseOrderNumber;
private string $customerUserEmail;
private string $partnerUserEmail;
private string $contactId;
private ?string $domain;
private ?string $countryCode;
private ?string $address;
private ?string $city;
private ?string $companyName;
private ?string $phoneNumber;
private ?string $postalCode;
private ?string $state;
private ?string $firstName;
private ?string $lastName;
public function __construct(
License $license,
User $user,
string $contactId,
?string $purchaseOrderNumber = null,
?string $domain = null,
?string $countryCode = null,
?string $address = null,
?string $city = null,
?string $companyName = null,
?string $phoneNumber = null,
?string $postalCode = null,
?string $state = null,
?string $firstName = null,
?string $lastName = null,
string $customerUserEmail,
?string $partnerUserEmail = null
) {
$this->license = $license;
$this->user = $user;
$this->contactId = $contactId;
$this->purchaseOrderNumber = $purchaseOrderNumber;
$this->domain = $domain;
$this->countryCode = $countryCode;
$this->address = $address;
$this->city = $city;
$this->companyName = $companyName;
$this->phoneNumber = $phoneNumber;
$this->postalCode = $postalCode;
$this->state = $state;
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->customerUserEmail = $customerUserEmail;
$this->partnerUserEmail = $partnerUserEmail;
}
public function getLicense(): License
{
return $this->license;
}
public function getUser(): User
{
return $this->user;
}
public function getContactId(): string
{
return $this->contactId;
}
public function getPurchaseOrderNumber(): ?string
{
return $this->purchaseOrderNumber;
}
public function getDomain(): ?string
{
return $this->domain;
}
public function getCountryCode(): ?string
{
return $this->countryCode;
}
public function getAddress(): ?string
{
return $this->address;
}
public function getCity(): ?string
{
return $this->city;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function getPhoneNumber(): ?string
{
return $this->phoneNumber;
}
public function getPostalCode(): ?string
{
return $this->postalCode;
}
public function getState(): ?string
{
return $this->state;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function getCustomerUserEmail(): ?string
{
return $this->customerUserEmail;
}
public function getPartnerUserEmail(): ?string
{
return $this->partnerUserEmail;
}
public static function fromEntities(License $license, User $user, array $data): self
{
return new self(
$license,
$user,
$data['data']['csp']['agreement']['contact_id'] ?? '',
$data['purchaseOrderNumber'] ?? '',
$data['data']['csp']['agreement']['domain'] ?? '',
$data['data']['csp']['agreement']['countryCode'] ?? '',
$data['data']['csp']['customer']['address'] ?? '',
$data['data']['csp']['customer']['city'] ?? '',
$data['data']['csp']['customer']['companyName'] ?? '',
$data['data']['csp']['customer']['phoneNumber'] ?? '',
$data['data']['csp']['customer']['postalCode'] ?? '',
$data['data']['csp']['customer']['state'] ?? '',
$data['data']['csp']['customer']['firstName'] ?? '',
$data['data']['csp']['customer']['lastName'] ?? '',
$data['extraData']['customerUserEmail'],
$data['partnerUserEmail'] ?? ''
);
}
public function withContactId(string $contactId): self
{
$copy = clone $this;
$copy->contactId = $contactId;
return $copy;
}
}