This commit is contained in:
Constantin Simonis 2025-01-31 10:51:10 +01:00
parent 443ebe5c0d
commit 0fd38d7b47
Signed by: csimonis
GPG Key ID: 758DD9C506603183

View File

@ -10,7 +10,10 @@ use App\Entity\Ticket;
use App\Enum\TicketData as TicketEnum;
use App\Repository\PaymentRepository;
use Doctrine\ORM\EntityManagerInterface;
use Stripe\Charge;
use Stripe\Checkout\Session;
use Stripe\PaymentIntent;
use Stripe\Stripe;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class TicketService
@ -43,6 +46,18 @@ class TicketService
}
public function completePayment(string $sessionId): bool
{
if (!$payment = $this->paymentRepository->findOneBy(['sessionId' => $sessionId])) {
return false;
}
$payment->setCompleted(true);
$this->em->flush();
return true;
}
private function getLineItems(array $tickets): array
{
$lineItems = [];
@ -109,18 +124,4 @@ class TicketService
return $entities;
}
public function completePayment(string $sessionId): bool
{
$payment = $this->paymentRepository->findOneBy(['sessionId' => $sessionId]);
if (!$payment) {
return false;
}
$payment->setCompleted(true);
$this->em->flush();
return true;
}
}