Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
Handle CHARGE_REFUNDED and REFUND_CREATED events for Non-SaaS Stripe Integration on Refunds 🤖 (#1156)
mrjbj081c1a0de173
diff --git a/backend/app/Services/Application/Handlers/Order/Payment/Stripe/IncomingWebhookHandler.php b/backend/app/Services/Application/Handlers/Order/Payment/Stripe/IncomingWebhookHandler.phpindex b9dca7566..13e04f003 100644--- a/backend/app/Services/Application/Handlers/Order/Payment/Stripe/IncomingWebhookHandler.php+++ b/backend/app/Services/Application/Handlers/Order/Payment/Stripe/IncomingWebhookHandler.php@@ -13,6 +13,7 @@ use HiEvents\Services\Domain\Payment\Stripe\EventHandlers\PayoutPaidHandler;use Illuminate\Cache\Repository;use Illuminate\Log\Logger;use JsonException;+use Stripe\Charge;use Stripe\Event;use Stripe\Exception\SignatureVerificationException;use Stripe\Webhook;@@ -27,6 +28,8 @@ class IncomingWebhookHandlerEvent::PAYMENT_INTENT_PAYMENT_FAILED,Event::ACCOUNT_UPDATED,Event::REFUND_UPDATED,+ Event::REFUND_CREATED,+ Event::CHARGE_REFUNDED,Event::CHARGE_SUCCEEDED,Event::CHARGE_UPDATED,Event::PAYOUT_PAID,@@ -92,8 +95,12 @@ class IncomingWebhookHandler$this->chargeSucceededHandler->handleEvent($event->data->object);break;case Event::REFUND_UPDATED:+ case Event::REFUND_CREATED:$this->refundEventHandlerService->handleEvent($event->data->object);break;+ case Event::CHARGE_REFUNDED:+ $this->handleChargeRefunded($event->data->object);+ break;case Event::ACCOUNT_UPDATED:$this->accountUpdateHandler->handleEvent($event->data->object);break;@@ -170,6 +177,15 @@ class IncomingWebhookHandlerreturn $this->cache->has('stripe_event_' . $event->id);}+ private function handleChargeRefunded(Charge $charge): void+ {+ $refunds = $charge->refunds->data ?? [];++ foreach ($refunds as $refund) {+ $this->refundEventHandlerService->handleEvent($refund);+ }+ }+private function markEventAsHandled(Event $event): void{$this->logger->info('Marking Stripe event as handled', [