refactor
This commit is contained in:
parent
443ebe5c0d
commit
0fd38d7b47
@ -10,7 +10,10 @@ use App\Entity\Ticket;
|
|||||||
use App\Enum\TicketData as TicketEnum;
|
use App\Enum\TicketData as TicketEnum;
|
||||||
use App\Repository\PaymentRepository;
|
use App\Repository\PaymentRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Stripe\Charge;
|
||||||
use Stripe\Checkout\Session;
|
use Stripe\Checkout\Session;
|
||||||
|
use Stripe\PaymentIntent;
|
||||||
|
use Stripe\Stripe;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
class TicketService
|
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
|
private function getLineItems(array $tickets): array
|
||||||
{
|
{
|
||||||
$lineItems = [];
|
$lineItems = [];
|
||||||
@ -109,18 +124,4 @@ class TicketService
|
|||||||
|
|
||||||
return $entities;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user