|
8 | 8 | use Brick\Money\Exception\UnknownCurrencyException; |
9 | 9 | use Carbon\Carbon; |
10 | 10 | use HiEvents\DomainObjects\Enums\PaymentProviders; |
| 11 | +use HiEvents\DomainObjects\EventSettingDomainObject; |
| 12 | +use HiEvents\DomainObjects\Generated\EventSettingDomainObjectAbstract; |
11 | 13 | use HiEvents\DomainObjects\Generated\OrderDomainObjectAbstract; |
12 | 14 | use HiEvents\DomainObjects\Generated\StripePaymentDomainObjectAbstract; |
13 | 15 | use HiEvents\DomainObjects\OrderDomainObject; |
|
23 | 25 | use HiEvents\Repository\Eloquent\Value\Relationship; |
24 | 26 | use HiEvents\Repository\Interfaces\AffiliateRepositoryInterface; |
25 | 27 | use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface; |
| 28 | +use HiEvents\Repository\Interfaces\EventSettingsRepositoryInterface; |
26 | 29 | use HiEvents\Repository\Interfaces\OrderRepositoryInterface; |
27 | 30 | use HiEvents\Services\Domain\Order\OrderApplicationFeeService; |
28 | 31 | use HiEvents\Services\Domain\Payment\Stripe\StripeRefundExpiredOrderService; |
|
40 | 43 | class PaymentIntentSucceededHandler |
41 | 44 | { |
42 | 45 | public function __construct( |
43 | | - private readonly OrderRepositoryInterface $orderRepository, |
44 | | - private readonly StripePaymentsRepository $stripePaymentsRepository, |
45 | | - private readonly AffiliateRepositoryInterface $affiliateRepository, |
46 | | - private readonly ProductQuantityUpdateService $quantityUpdateService, |
47 | | - private readonly StripeRefundExpiredOrderService $refundExpiredOrderService, |
48 | | - private readonly AttendeeRepositoryInterface $attendeeRepository, |
49 | | - private readonly DatabaseManager $databaseManager, |
50 | | - private readonly LoggerInterface $logger, |
51 | | - private readonly Repository $cache, |
52 | | - private readonly DomainEventDispatcherService $domainEventDispatcherService, |
53 | | - private readonly OrderApplicationFeeService $orderApplicationFeeService, |
| 46 | + private readonly OrderRepositoryInterface $orderRepository, |
| 47 | + private readonly StripePaymentsRepository $stripePaymentsRepository, |
| 48 | + private readonly AffiliateRepositoryInterface $affiliateRepository, |
| 49 | + private readonly ProductQuantityUpdateService $quantityUpdateService, |
| 50 | + private readonly StripeRefundExpiredOrderService $refundExpiredOrderService, |
| 51 | + private readonly AttendeeRepositoryInterface $attendeeRepository, |
| 52 | + private readonly DatabaseManager $databaseManager, |
| 53 | + private readonly LoggerInterface $logger, |
| 54 | + private readonly Repository $cache, |
| 55 | + private readonly DomainEventDispatcherService $domainEventDispatcherService, |
| 56 | + private readonly OrderApplicationFeeService $orderApplicationFeeService, |
| 57 | + private readonly EventSettingsRepositoryInterface $eventSettingsRepository, |
54 | 58 | ) |
55 | 59 | { |
56 | 60 | } |
@@ -94,7 +98,12 @@ public function handleEvent(PaymentIntent $paymentIntent): void |
94 | 98 |
|
95 | 99 | $this->quantityUpdateService->updateQuantitiesFromOrder($updatedOrder); |
96 | 100 |
|
97 | | - OrderStatusChangedEvent::dispatch($updatedOrder); |
| 101 | + /** @var EventSettingDomainObject $eventSettings */ |
| 102 | + $eventSettings = $this->eventSettingsRepository->findFirstWhere([ |
| 103 | + EventSettingDomainObjectAbstract::EVENT_ID => $updatedOrder->getEventId(), |
| 104 | + ]); |
| 105 | + |
| 106 | + event(new OrderStatusChangedEvent($updatedOrder, createInvoice: $eventSettings->getEnableInvoicing())); |
98 | 107 |
|
99 | 108 | $this->domainEventDispatcherService->dispatch( |
100 | 109 | new OrderEvent( |
|
0 commit comments