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
Fix: Expired order refund handler (#856)
Dave Earley5e08a8c99ddf
diff --git a/backend/app/Services/Domain/Payment/Stripe/StripeRefundExpiredOrderService.php b/backend/app/Services/Domain/Payment/Stripe/StripeRefundExpiredOrderService.phpindex c5473ce8c..4336f5386 100644--- a/backend/app/Services/Domain/Payment/Stripe/StripeRefundExpiredOrderService.php+++ b/backend/app/Services/Domain/Payment/Stripe/StripeRefundExpiredOrderService.php@@ -10,9 +10,11 @@ use HiEvents\DomainObjects\EventSettingDomainObject;use HiEvents\DomainObjects\OrderDomainObject;use HiEvents\DomainObjects\OrganizerDomainObject;use HiEvents\DomainObjects\StripePaymentDomainObject;+use HiEvents\Exceptions\Stripe\StripeClientConfigurationException;use HiEvents\Mail\Order\PaymentSuccessButOrderExpiredMail;use HiEvents\Repository\Eloquent\Value\Relationship;use HiEvents\Repository\Interfaces\EventRepositoryInterface;+use HiEvents\Services\Infrastructure\Stripe\StripeClientFactory;use HiEvents\Values\MoneyValue;use Illuminate\Contracts\Mail\Mailer;use Psr\Log\LoggerInterface;@@ -26,6 +28,8 @@ readonly class StripeRefundExpiredOrderServiceprivate Mailer $mailer,private LoggerInterface $logger,private EventRepositoryInterface $eventRepository,+ private StripeClientFactory $stripeClientFactory,+){}@@ -36,6 +40,7 @@ readonly class StripeRefundExpiredOrderService* @throws MathException* @throws UnknownCurrencyException* @throws NumberFormatException+ * @throws StripeClientConfigurationException*/public function refundExpiredOrder(PaymentIntent $paymentIntent,@@ -48,10 +53,17 @@ readonly class StripeRefundExpiredOrderService->loadRelation(new Relationship(OrganizerDomainObject::class, name: 'organizer'))->findById($order->getEventId());+ // Determine the correct Stripe platform for this refund+ // Use the platform that was used for the original payment+ $paymentPlatform = $stripePayment->getStripePlatformEnum();++ // Create Stripe client for the original payment's platform+ $stripeClient = $this->stripeClientFactory->createForPlatform($paymentPlatform);$this->refundService->refundPayment(MoneyValue::fromMinorUnit($paymentIntent->amount, strtoupper($paymentIntent->currency)),$stripePayment,+ $stripeClient);$this->mailer