| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\Services\Payment; |
| 4 |
|
| 5 |
use IvyForms\Entity\Payment\Order; |
| 6 |
use IvyForms\Repository\Payment\OrderRepositoryInterface; |
| 7 |
|
| 8 |
class OrderManager |
| 9 |
{ |
| 10 |
private OrderRepositoryInterface $orderRepository; |
| 11 |
|
| 12 |
public function __construct(OrderRepositoryInterface $orderRepository) |
| 13 |
{ |
| 14 |
$this->orderRepository = $orderRepository; |
| 15 |
} |
| 16 |
|
| 17 |
public function createOrder(Order $order): int |
| 18 |
{ |
| 19 |
return $this->orderRepository->add($order); |
| 20 |
} |
| 21 |
|
| 22 |
public function getOrderBySquareOrderId(string $squareOrderId): ?Order |
| 23 |
{ |
| 24 |
return $this->orderRepository->getBySquareOrderId($squareOrderId); |
| 25 |
} |
| 26 |
|
| 27 |
public function updateOrderStatus(string $squareOrderId, string $status): bool |
| 28 |
{ |
| 29 |
return $this->orderRepository->updateStatus($squareOrderId, $status); |
| 30 |
} |
| 31 |
} |
| 32 |
|