src/Domain/User/Model/OrganizationLicense.php line 28

Open in your IDE?
  1. <?php
  2. namespace Whater\Domain\User\Model;
  3. use BornFree\TacticianDomainEvent\Recorder\ContainsRecordedEvents;
  4. use BornFree\TacticianDomainEvent\Recorder\EventRecorderCapabilities;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Whater\Domain\Common\Exception\InvalidUUIDException;
  8. use Ramsey\Uuid\Uuid;
  9. use Whater\Domain\Product\Exception\InvalidCartOrderChangeUserException;
  10. use Whater\Domain\Product\Model\CartOrder;
  11. use Whater\Domain\User\Exception\IllegalOrganizationLicenseDatesException;
  12. use Whater\Domain\User\Exception\IllegalOrganizationLicenseStatusException;
  13. use Whater\Domain\User\Exception\InvalidLicensePlanException;
  14. use Whater\Domain\User\Exception\InvalidLicenseScopeException;
  15. use Whater\Domain\User\Exception\InvalidLicenseTypeException;
  16. use Whater\Domain\Whater\Model\DistributionNetwork;
  17. use Whater\Domain\Whater\Model\WhaterOrganization;
  18. use Whater\Domain\Whater\Model\WhaterPoint;
  19. use Whater\Domain\Zones\Model\Town;
  20. /**
  21. * Class OrganizationLicense
  22. *
  23. * @package Whater\Domain\User\Model
  24. */
  25. class OrganizationLicense implements ContainsRecordedEvents
  26. {
  27. use EventRecorderCapabilities;
  28. // *** DEPRECATED*****
  29. public const LICENSE_DATABASE_ACCESS = 'LICENSE_DATABASE_ACCESS';
  30. public const LICENSE_MANAGE_ORGANIZATION = 'LICENSE_MANAGE_ORGANIZATION';
  31. public const LICENSE_MARKETPLACE = 'LICENSE_MARKETPLACE';
  32. // *******************
  33. public const LICENSE_STATUS_CONFIRMED = 'LICENSE_STATUS_CONFIRMED';
  34. public const LICENSE_STATUS_REQUESTED = 'LICENSE_STATUS_REQUESTED';
  35. public const LICENSE_STATUS_CANCELED = 'LICENSE_STATUS_CANCELED';
  36. public const LICENSE_TYPE_BASIC = 'LICENSE_TYPE_BASIC';
  37. public const LICENSE_TYPE_STANDARD = 'LICENSE_TYPE_STANDARD';
  38. public const LICENSE_TYPE_PREMIUM = 'LICENSE_TYPE_PREMIUM';
  39. public const LICENSE_PAYMENT_PLAN_MONTHLY = 'LICENSE_PAYMENT_PLAN_MONTHLY';
  40. public const LICENSE_PAYMENT_PLAN_ANNUAL = 'LICENSE_PAYMENT_PLAN_ANNUAL';
  41. public const LICENSE_PAYMENT_PLAN_ADMIN = 'LICENSE_PAYMENT_PLAN_ADMIN';
  42. public const LICENSE_SCOPE_TOWNS = 'LICENSE_SCOPE_TOWNS';
  43. public const LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS = 'LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS';
  44. public const LICENSE_SCOPE_ESTABLISHMENTS = 'LICENSE_SCOPE_ESTABLISHMENTS';
  45. public const LICENSE_SCOPE_PROFESSIONALS = 'LICENSE_SCOPE_PROFESSIONALS';
  46. public const LICENSE_SCOPE_SELLERS = 'LICENSE_SCOPE_SELLERS';
  47. /**
  48. * @var string
  49. */
  50. private $uuid;
  51. /**
  52. * @var string
  53. */
  54. private $status;
  55. /**
  56. * @var \DateTime
  57. */
  58. private $startDate;
  59. /**
  60. * @var \DateTime
  61. */
  62. private $endDate;
  63. /**
  64. * @var \DateTime
  65. */
  66. private $createdAt;
  67. /**
  68. * @var \DateTime
  69. */
  70. private $updatedAt;
  71. /**
  72. * @var \Whater\Domain\Whater\Model\WhaterOrganization
  73. */
  74. private $organization;
  75. /**
  76. * @var Collection
  77. */
  78. private $countries;
  79. /**
  80. * @var Collection
  81. */
  82. private $countryAreas;
  83. /**
  84. * @var Collection
  85. */
  86. private $whaterpoints;
  87. /**
  88. * @var Collection
  89. */
  90. private $agrupations;
  91. /**
  92. * @var Collection
  93. */
  94. private $towns;
  95. /**
  96. * @var Collection
  97. */
  98. private $establishments;
  99. /**
  100. * @var string
  101. */
  102. private $licenseType;
  103. /**
  104. * @var array
  105. */
  106. private $widgetAllowedDomains;
  107. /**
  108. * @var CartOrder
  109. */
  110. private $cartOrder;
  111. /**
  112. * @var int
  113. */
  114. private $totalPopulation;
  115. /**
  116. * @var string
  117. */
  118. private $licenseScope;
  119. /**
  120. * @var float
  121. */
  122. private $licenseFee;
  123. /**
  124. * @var string
  125. */
  126. private $paymentPlan;
  127. public function __construct(
  128. string $userLicenseId = null,
  129. \DateTime $startDate,
  130. \DateTime $endDate,
  131. WhaterOrganization $organization,
  132. string $licenseType,
  133. string $licenseScope,
  134. float $licenseFee,
  135. string $paymentPlan
  136. ) {
  137. try {
  138. $this->uuid = Uuid::fromString($userLicenseId ?: Uuid::uuid4())->toString();
  139. } catch (\InvalidArgumentException $e) {
  140. throw new InvalidUUIDException();
  141. }
  142. $this->status = OrganizationLicense::LICENSE_STATUS_REQUESTED;
  143. $this->startDate = $startDate;
  144. $this->endDate = $endDate;
  145. if ($startDate > $endDate) {
  146. throw new IllegalOrganizationLicenseDatesException();
  147. }
  148. $this->organization = $organization;
  149. switch ($licenseType) {
  150. case OrganizationLicense::LICENSE_TYPE_BASIC:
  151. case OrganizationLicense::LICENSE_TYPE_STANDARD:
  152. case OrganizationLicense::LICENSE_TYPE_PREMIUM:
  153. $this->licenseType = $licenseType;
  154. break;
  155. default:
  156. throw new InvalidLicenseTypeException();
  157. }
  158. switch ($licenseScope) {
  159. case OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS:
  160. case OrganizationLicense::LICENSE_SCOPE_TOWNS:
  161. case OrganizationLicense::LICENSE_SCOPE_ESTABLISHMENTS:
  162. case OrganizationLicense::LICENSE_SCOPE_PROFESSIONALS:
  163. case OrganizationLicense::LICENSE_SCOPE_SELLERS:
  164. $this->licenseScope = $licenseScope;
  165. break;
  166. default:
  167. throw new InvalidLicenseScopeException();
  168. }
  169. switch ($paymentPlan) {
  170. case OrganizationLicense::LICENSE_PAYMENT_PLAN_MONTHLY:
  171. case OrganizationLicense::LICENSE_PAYMENT_PLAN_ANNUAL:
  172. case OrganizationLicense::LICENSE_PAYMENT_PLAN_ADMIN:
  173. $this->paymentPlan = $paymentPlan;
  174. break;
  175. default:
  176. throw new InvalidLicensePlanException();
  177. }
  178. $this->licenseFee = $licenseFee;
  179. if ($this->licenseFee <= 0) {
  180. $this->licenseFee = 0;
  181. }
  182. $this->countries = new ArrayCollection();
  183. $this->countryAreas = new ArrayCollection();
  184. $this->whaterpoints = new ArrayCollection();
  185. $this->agrupations = new ArrayCollection();
  186. $this->towns = new ArrayCollection();
  187. $this->establishments = new ArrayCollection();
  188. $this->createdAt = new \DateTime();
  189. $this->updatedAt = new \DateTime();
  190. }
  191. /**
  192. * @param \DateTime $startDate
  193. * @param \DateTime $endDate
  194. * @return OrganizationLicense
  195. */
  196. public function editDates(
  197. \DateTime $startDate,
  198. \DateTime $endDate
  199. ): OrganizationLicense {
  200. $this->startDate = $startDate;
  201. $this->endDate = $endDate;
  202. if ($startDate > $endDate) {
  203. throw new IllegalOrganizationLicenseDatesException();
  204. }
  205. $this->updatedAt = new \DateTime();
  206. return $this;
  207. }
  208. public function editStatus(string $status)
  209. {
  210. switch ($status) {
  211. case OrganizationLicense::LICENSE_STATUS_CANCELED:
  212. case OrganizationLicense::LICENSE_STATUS_CONFIRMED:
  213. case OrganizationLicense::LICENSE_STATUS_REQUESTED:
  214. $this->status = $status;
  215. break;
  216. default:
  217. throw new IllegalOrganizationLicenseStatusException();
  218. }
  219. }
  220. public function updateCountriesLicense(
  221. Collection $countries
  222. ) {
  223. if ($this->licenseScope() != OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS) {
  224. throw new InvalidLicenseScopeException($this->licenseScope());
  225. }
  226. $this->countries = $countries;
  227. //Calculate propulation
  228. $totalPopulation = 0;
  229. foreach ($this->countries() as $country) {
  230. $totalPopulation += $country->population();
  231. }
  232. $this->totalPopulation = $totalPopulation;
  233. $this->countryAreas->clear();
  234. $this->whaterpoints->clear();
  235. $this->agrupations->clear();
  236. $this->towns->clear();
  237. $this->establishments->clear();
  238. $this->updatedAt = new \DateTime();
  239. return $this;
  240. }
  241. public function updateCountryAreasLicense(
  242. Collection $countryAreas
  243. ) {
  244. if ($this->licenseScope() != OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS) {
  245. throw new InvalidLicenseScopeException();
  246. }
  247. $this->countryAreas = $countryAreas;
  248. //Calculate propulation
  249. $totalPopulation = 0;
  250. foreach ($this->countryAreas() as $countryArea) {
  251. $totalPopulation += $countryArea->population();
  252. }
  253. $this->totalPopulation = $totalPopulation;
  254. $this->countries->clear();
  255. $this->whaterpoints->clear();
  256. $this->agrupations->clear();
  257. $this->towns->clear();
  258. $this->establishments->clear();
  259. $this->updatedAt = new \DateTime();
  260. return $this;
  261. }
  262. public function updateAgrupationsLicense(
  263. Collection $agrupations
  264. ) {
  265. if ($this->licenseScope() != OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS) {
  266. throw new InvalidLicenseScopeException();
  267. }
  268. $this->agrupations = $agrupations;
  269. //Calculate propulation
  270. $totalPopulation = 0;
  271. foreach ($this->agrupations() as $agrupation) {
  272. foreach ($agrupation->towns() as $town) {
  273. $totalPopulation += $town->population();
  274. }
  275. }
  276. $this->totalPopulation = $totalPopulation;
  277. $this->countries->clear();
  278. $this->countryAreas->clear();
  279. $this->whaterpoints->clear();
  280. $this->towns->clear();
  281. $this->establishments->clear();
  282. $this->updatedAt = new \DateTime();
  283. return $this;
  284. }
  285. public function updateTownsLicense(
  286. Collection $towns
  287. ) {
  288. if (
  289. $this->licenseScope() == OrganizationLicense::LICENSE_SCOPE_TOWNS ||
  290. $this->licenseScope() == OrganizationLicense::LICENSE_SCOPE_PROFESSIONALS
  291. ) {
  292. $this->towns = $towns;
  293. //Calculate propulation
  294. $totalPopulation = 0;
  295. foreach ($this->towns() as $town) {
  296. $totalPopulation += $town->population();
  297. }
  298. $this->totalPopulation = $totalPopulation;
  299. $this->countries->clear();
  300. $this->countryAreas->clear();
  301. $this->whaterpoints->clear();
  302. $this->agrupations->clear();
  303. $this->establishments->clear();
  304. $this->updatedAt = new \DateTime();
  305. } else {
  306. throw new InvalidLicenseScopeException();
  307. }
  308. return $this;
  309. }
  310. public function updateEstablishmentsLicense(
  311. Collection $establishments
  312. ) {
  313. if ($this->licenseScope() != OrganizationLicense::LICENSE_SCOPE_ESTABLISHMENTS) {
  314. throw new InvalidLicenseScopeException();
  315. }
  316. $this->establishments = $establishments;
  317. $totalPopulation = null;
  318. $this->totalPopulation = $totalPopulation;
  319. $this->countries->clear();
  320. $this->countryAreas->clear();
  321. $this->whaterpoints->clear();
  322. $this->agrupations->clear();
  323. $this->towns->clear();
  324. $this->updatedAt = new \DateTime();
  325. return $this;
  326. }
  327. public function licenseScopeDescription()
  328. {
  329. $names = [];
  330. switch ($this->licenseScope) {
  331. case OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS:
  332. foreach ($this->countries() as $country) {
  333. array_push($names, $country->name());
  334. }
  335. foreach ($this->countryAreas() as $countryArea) {
  336. array_push($names, $countryArea->name());
  337. }
  338. foreach ($this->agrupations() as $agrupation) {
  339. array_push($names, $agrupation->name());
  340. }
  341. break;
  342. case OrganizationLicense::LICENSE_SCOPE_TOWNS:
  343. foreach ($this->towns() as $town) {
  344. array_push($names, $town->name());
  345. }
  346. break;
  347. case OrganizationLicense::LICENSE_SCOPE_ESTABLISHMENTS:
  348. foreach ($this->establishments() as $establishment) {
  349. array_push($names, $establishment->name());
  350. }
  351. break;
  352. case OrganizationLicense::LICENSE_SCOPE_PROFESSIONALS:
  353. foreach ($this->towns() as $town) {
  354. array_push($names, $town->name());
  355. }
  356. break;
  357. case OrganizationLicense::LICENSE_SCOPE_SELLERS:
  358. break;
  359. }
  360. return join(", ", $names);
  361. }
  362. public function updateWidgetAllowedDomains(array $widgetAllowedDomains)
  363. {
  364. $this->widgetAllowedDomains = $widgetAllowedDomains;
  365. $this->updatedAt = new \DateTime();
  366. }
  367. public function setCartOrder(CartOrder $cartOrder)
  368. {
  369. if ($this->cartOrder == null) {
  370. $this->cartOrder = $cartOrder;
  371. } else {
  372. throw new InvalidCartOrderChangeUserException();
  373. }
  374. $this->updatedAt = new \DateTime();
  375. }
  376. /**
  377. * @return string
  378. */
  379. public function id(): string
  380. {
  381. return $this->uuid;
  382. }
  383. /**
  384. * @return string
  385. */
  386. public function licenseType(): string
  387. {
  388. return $this->licenseType;
  389. }
  390. /**
  391. * @return string
  392. */
  393. public function status(): string
  394. {
  395. return $this->status;
  396. }
  397. /**
  398. * @return array
  399. */
  400. public function widgetAllowedDomains(): array
  401. {
  402. return $this->widgetAllowedDomains;
  403. }
  404. /**
  405. * @return string
  406. */
  407. public function licenseScope(): string
  408. {
  409. return $this->licenseScope;
  410. }
  411. /**
  412. * @return float
  413. */
  414. public function licenseFee(): float
  415. {
  416. return $this->licenseFee;
  417. }
  418. /**
  419. * @return string
  420. */
  421. public function paymentPlan(): string
  422. {
  423. return $this->paymentPlan;
  424. }
  425. /**
  426. * @return int
  427. */
  428. public function totalPopulation(): ?int
  429. {
  430. return $this->totalPopulation;
  431. }
  432. /**
  433. * @return \DateTime
  434. */
  435. public function endDate(): \DateTime
  436. {
  437. return $this->endDate;
  438. }
  439. /**
  440. * @return \DateTime
  441. */
  442. public function startDate(): \DateTime
  443. {
  444. return $this->startDate;
  445. }
  446. /**
  447. * @return \DateTime
  448. */
  449. public function createdAt(): \DateTime
  450. {
  451. return $this->createdAt;
  452. }
  453. /**
  454. * @return \DateTime|null
  455. */
  456. public function updatedAt()
  457. {
  458. return $this->updatedAt;
  459. }
  460. /**
  461. * @return WhaterOrganization
  462. */
  463. public function organization(): WhaterOrganization
  464. {
  465. return $this->organization;
  466. }
  467. /**
  468. * @return CartOrder
  469. */
  470. public function cartOrder(): ?CartOrder
  471. {
  472. return $this->cartOrder;
  473. }
  474. /**
  475. * @return Collection
  476. */
  477. public function countries(): Collection
  478. {
  479. return $this->countries;
  480. }
  481. /**
  482. * @return Collection
  483. */
  484. public function countryAreas(): Collection
  485. {
  486. return $this->countryAreas;
  487. }
  488. /**
  489. * @return Collection
  490. */
  491. public function whaterpoints(): Collection
  492. {
  493. return $this->whaterpoints;
  494. }
  495. /**
  496. * @return Collection
  497. */
  498. public function agrupations(): Collection
  499. {
  500. return $this->agrupations;
  501. }
  502. /**
  503. * @return Collection
  504. */
  505. public function towns(): Collection
  506. {
  507. return $this->towns;
  508. }
  509. /**
  510. * @return Collection
  511. */
  512. public function establishments(): Collection
  513. {
  514. return $this->establishments;
  515. }
  516. public function licenseSortingPosition()
  517. {
  518. switch ($this->licenseScope) {
  519. case OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS:
  520. return 1;
  521. break;
  522. case OrganizationLicense::LICENSE_SCOPE_TOWNS:
  523. return 2;
  524. break;
  525. case OrganizationLicense::LICENSE_SCOPE_ESTABLISHMENTS:
  526. return 3;
  527. break;
  528. case OrganizationLicense::LICENSE_SCOPE_PROFESSIONALS:
  529. return 4;
  530. break;
  531. case OrganizationLicense::LICENSE_SCOPE_SELLERS:
  532. return 5;
  533. break;
  534. }
  535. }
  536. public function isValidForWhaterpoint(WhaterPoint $whaterPoint)
  537. {
  538. if ($this->status() == OrganizationLicense::LICENSE_STATUS_REQUESTED) {
  539. return false;
  540. } else {
  541. $now = new \DateTime();
  542. if ($now > $this->endDate()) {
  543. return false;
  544. }
  545. if ($now < $this->startDate()) {
  546. return false;
  547. }
  548. }
  549. switch ($this->licenseScope()) {
  550. case OrganizationLicense::LICENSE_SCOPE_SELLERS:
  551. return false;
  552. case OrganizationLicense::LICENSE_SCOPE_ESTABLISHMENTS:
  553. return false;
  554. case OrganizationLicense::LICENSE_SCOPE_TOWNS:
  555. $whaterpointTown = $whaterPoint->town();
  556. foreach ($this->towns() as $licenseTown) {
  557. if ($licenseTown->equals($whaterpointTown)) {
  558. return true;
  559. }
  560. }
  561. break;
  562. case OrganizationLicense::LICENSE_SCOPE_PROFESSIONALS:
  563. $whaterpointTown = $whaterPoint->town();
  564. foreach ($this->towns() as $licenseTown) {
  565. if ($licenseTown->equals($whaterpointTown)) {
  566. return true;
  567. }
  568. }
  569. break;
  570. case OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS:
  571. $whaterpointTown = $whaterPoint->town();
  572. foreach ($this->countries() as $country) {
  573. if ($country->equals($whaterpointTown->country())) {
  574. return true;
  575. }
  576. }
  577. foreach ($this->countryAreas() as $licenseCountryArea) {
  578. if (
  579. $whaterpointTown->countryArea() != null &&
  580. $licenseCountryArea->equals($whaterpointTown->countryArea())
  581. ) {
  582. return true;
  583. }
  584. }
  585. foreach ($this->agrupations() as $licenseAgrupation) {
  586. foreach ($licenseAgrupation->towns() as $licenseAgrupationTown) {
  587. if ($whaterpointTown->equals($licenseAgrupationTown)) {
  588. return true;
  589. }
  590. }
  591. }
  592. break;
  593. }
  594. return false;
  595. }
  596. public function isValidForDistributionNetwork(DistributionNetwork $distributionNetwork)
  597. {
  598. if ($this->status() == OrganizationLicense::LICENSE_STATUS_REQUESTED) {
  599. return false;
  600. } else {
  601. $now = new \DateTime();
  602. if ($now > $this->endDate()) {
  603. return false;
  604. }
  605. if ($now < $this->startDate()) {
  606. return false;
  607. }
  608. }
  609. switch ($this->licenseScope()) {
  610. case OrganizationLicense::LICENSE_SCOPE_SELLERS:
  611. return false;
  612. case OrganizationLicense::LICENSE_SCOPE_ESTABLISHMENTS:
  613. return false;
  614. case OrganizationLicense::LICENSE_SCOPE_TOWNS:
  615. $distributionNetworkTowns = $distributionNetwork->towns();
  616. foreach ($distributionNetworkTowns as $distributionNetworkTown) {
  617. foreach ($this->towns() as $licenseTown) {
  618. if ($licenseTown->equals($distributionNetworkTown)) {
  619. return true;
  620. }
  621. }
  622. }
  623. break;
  624. case OrganizationLicense::LICENSE_SCOPE_PROFESSIONALS:
  625. $distributionNetworkTowns = $distributionNetwork->towns();
  626. foreach ($distributionNetworkTowns as $distributionNetworkTown) {
  627. foreach ($this->towns() as $licenseTown) {
  628. if ($licenseTown->equals($distributionNetworkTown)) {
  629. return true;
  630. }
  631. }
  632. }
  633. break;
  634. case OrganizationLicense::LICENSE_SCOPE_COUNTRIES_COUNTRY_AREAS_AGRUPATIONS:
  635. $distributionNetworkTowns = $distributionNetwork->towns();
  636. foreach ($distributionNetworkTowns as $distributionNetworkTown) {
  637. foreach ($this->countries() as $country) {
  638. if ($country->equals($distributionNetworkTown->country())) {
  639. return true;
  640. }
  641. }
  642. foreach ($this->countryAreas() as $licenseCountryArea) {
  643. if (
  644. $distributionNetworkTown->countryArea() != null &&
  645. $licenseCountryArea->equals($distributionNetworkTown->countryArea())
  646. ) {
  647. return true;
  648. }
  649. }
  650. foreach ($this->agrupations() as $licenseAgrupation) {
  651. foreach ($licenseAgrupation->towns() as $licenseAgrupationTown) {
  652. if ($distributionNetworkTown->equals($licenseAgrupationTown)) {
  653. return true;
  654. }
  655. }
  656. }
  657. }
  658. break;
  659. }
  660. return false;
  661. }
  662. public function isValidForTown(Town $town)
  663. {
  664. throw new \Exception('Need to refactoring!!');
  665. // if ($this->status() != OrganizationLicense::LICENSE_STATUS_CONFIRMED) {
  666. // return false;
  667. // }
  668. // foreach ($this->countries() as $country) {
  669. // if ($town->country()->equals($country)) {
  670. // return true;
  671. // }
  672. // }
  673. // foreach ($this->countryAreas() as $countryArea) {
  674. // if (
  675. // $town->countryArea() != null &&
  676. // $town->countryArea()->equals($countryArea)
  677. // ) {
  678. // return true;
  679. // }
  680. // }
  681. // return false;
  682. }
  683. public function isActive(): bool
  684. {
  685. if ($this->status() != OrganizationLicense::LICENSE_STATUS_CONFIRMED) {
  686. return false;
  687. }
  688. $now = new \DateTime();
  689. if ($this->startDate() != null && $now < $this->startDate() ) {
  690. return false;
  691. }
  692. if ($this->endDate() != null && $now > $this->endDate()) {
  693. return false;
  694. }
  695. return true;
  696. }
  697. /**
  698. * @return bool
  699. */
  700. public function equals(OrganizationLicense $organizationLicense)
  701. {
  702. return $this->id() === $organizationLicense->id();
  703. }
  704. }