Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/order entities #5

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
223 changes: 223 additions & 0 deletions src/ApiEntity/Order.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
<?php

namespace Wickedreports\ApiCore\ApiEntity;

use Wickedreports\ApiCore\Collections\ApiEntityCollections\OrderItemCollection;
use Wickedreports\ApiCore\Collections\ApiEntityCollections\OrderPaymentCollection;

final class Order
{
private string $sourceSystem;
private string $sourceId;
private \DateTime $createDate;
private string $contactId;
private string $contactEmail;
private float $total = 0;

private ?string $currency = null;
private ?string $city = null;
private ?string $state = null;
private ?string $country = null;
private ?string $ipAddress = null;
private ?string $subscriptionId = null;
private ?OrderItemCollection $items = null;
private ?OrderPaymentCollection $payments = null;

private ?\DateTime $modifiedDate;

public function __construct(
string $sourceSystem,
string $sourceId,
\DateTime $createDate,
string $contactId,
string $contactEmail,
float $total
) {
$this->sourceSystem = $sourceSystem;
$this->sourceId = $sourceId;
$this->createDate = $createDate;
$this->contactId = $contactId;
$this->contactEmail = $contactEmail;
$this->total = $total;
}

public function getSourceSystem(): ?string
{
return $this->sourceSystem;
}

public function setSourceSystem(?string $value): self
{
$this->sourceSystem = $value;

return $this;
}

public function getSourceId(): ?string
{
return $this->sourceId;
}

public function setSourceId(?string $value): self
{
$this->sourceId = $value;

return $this;
}

public function getCreateDate(): ?\DateTime
{
return $this->createDate;
}

public function setCreateDate(?\DateTime $value): self
{
$this->createDate = $value;

return $this;
}

public function getContactId(): ?string
{
return $this->contactId;
}

public function setContactId(?string $value): self
{
$this->contactId = $value;

return $this;
}

public function getContactEmail(): ?string
{
return $this->contactEmail;
}

public function setContactEmail(?string $value): self
{
$this->contactEmail = $value;

return $this;
}

public function getTotal(): ?float
{
return $this->total;
}

public function setTotal(?float $value): self
{
$this->total = $value;

return $this;
}

public function getCurrency(): ?string
{
return $this->currency;
}

public function setCurrency(?string $value): self
{
$this->currency = $value;

return $this;
}

public function getCity(): ?string
{
return $this->city;
}

public function setCity(?string $value): self
{
$this->city = $value;

return $this;
}

public function getState(): ?string
{
return $this->state;
}

public function setState(?string $value): self
{
$this->state = $value;

return $this;
}

public function getCountry(): ?string
{
return $this->country;
}

public function setCountry(?string $value): self
{
$this->country = $value;

return $this;
}

public function getIpAddress(): ?string
{
return $this->ipAddress;
}

public function setIpAddress(?string $value): self
{
$this->ipAddress = $value;

return $this;
}

public function getSubscriptionId(): ?string
{
return $this->subscriptionId;
}

public function setSubscriptionId(?string $value): self
{
$this->subscriptionId = $value;

return $this;
}

public function getItems(): ?OrderItemCollection
{
return $this->items;
}

public function setItems(?OrderItemCollection $value): self
{
$this->items = $value;

return $this;
}

public function getPayments(): ?OrderPaymentCollection
{
return $this->payments;
}

public function setPayments(?OrderPaymentCollection $value): self
{
$this->payments = $value;

return $this;
}

public function getModifiedDate(): \DateTime
{
return $this->modifiedDate;
}

public function setModifiedDate(\DateTime $value): self
{
$this->modifiedDate = $value;

return $this;
}
}
96 changes: 96 additions & 0 deletions src/ApiEntity/OrderItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

namespace Wickedreports\ApiCore\ApiEntity;

final class OrderItem
{
private string $sourceSystem;
private string $sourceId;
private string $orderId;

private ?string $productId = null;
private ?int $quantity = null;
private ?float $PPU = null;

public function __construct(
string $sourceSystem,
string $sourceId,
string $orderId
) {
$this->sourceSystem = $sourceSystem;
$this->sourceId = $sourceId;
$this->orderId = $orderId;
}

public function getSourceSystem(): ?string
{
return $this->sourceSystem;
}

public function setSourceSystem(?string $value): self
{
$this->sourceSystem = $value;

return $this;
}

public function getSourceId(): ?string
{
return $this->sourceId;
}

public function setSourceId(?string $value): self
{
$this->sourceId = $value;

return $this;
}

public function getOrderId(): ?string
{
return $this->orderId;
}

public function setOrderId(?string $value): self
{
$this->orderId = $value;

return $this;
}

public function getProductId(): ?string
{
return $this->productId;
}

public function setProductId(?string $value): self
{
$this->productId = $value;

return $this;
}

public function getQuantity(): ?int
{
return $this->quantity;
}

public function setQuantity(?int $value): self
{
$this->quantity = $value;

return $this;
}

public function getPPU(): ?float
{
return $this->PPU;
}

public function setPPU(?float $value): self
{
$this->PPU = $value;

return $this;
}
}
Loading