PaymentController
extends AbstractController
in package
Table of Contents
Properties
- $logger : LoggerInterface
- $stripeService : StripeService
Methods
- __construct() : mixed
- checkoutPricingPlan() : Response
- Prepare the selected plan and store it in the session.
- downloadInvoice() : Response
- Generates and downloads an invoice PDF for a given payment.
- handleCheckoutTransition() : Response
- Handle the transition between plan selection and payment.
- payment() : Response
- Display the payment method selection page.
- paymentCancel() : Response
- Handles the payment cancellation process.
- paymentsHistory() : Response
- Handles the display of the payment history for the authenticated user.
- paymentSuccess() : Response
- processPayment() : Response
- Entry point for payment processing.
- webhookForOrangePayment() : JsonResponse
- generateOrderId() : string
- getCallbackUrls() : array<string|int, mixed>
- handleCreditCardPayment() : Response
- Handle Credit Card payment processing.
- handleOrangeMoneyPayment() : Response
- Handle Orange Money payment processing.
- handlePaypalPayment() : Response
- Handle PayPal payment processing.
Properties
$logger
private
LoggerInterface
$logger
$stripeService
private
StripeService
$stripeService
Methods
__construct()
public
__construct(StripeService $stripeService, LoggerInterface $logger) : mixed
Parameters
- $stripeService : StripeService
- $logger : LoggerInterface
checkoutPricingPlan()
Prepare the selected plan and store it in the session.
public
checkoutPricingPlan(PricingPlan $pricingPlan, Request $request, SessionInterface $session) : Response
Parameters
- $pricingPlan : PricingPlan
- $request : Request
- $session : SessionInterface
Attributes
- #[Route]
- '/selected-plan/{id}'
- $name: 'checkout_pricing_plan'
Return values
ResponsedownloadInvoice()
Generates and downloads an invoice PDF for a given payment.
public
downloadInvoice(Payment $payment, DomPdfService $pdfGenerator) : Response
Parameters
- $payment : Payment
-
The payment entity containing payment details.
- $pdfGenerator : DomPdfService
-
The service used to generate PDF files.
Attributes
- #[Route]
- '/invoice/payment/{id}'
- $name: 'download_invoice'
Return values
Response —The response containing the generated PDF file.
The method prepares the data required for the invoice template, including payment details, company configuration, and logo image. It then renders the HTML content for the invoice using a Twig template and generates a PDF file with the rendered content.
handleCheckoutTransition()
Handle the transition between plan selection and payment.
public
handleCheckoutTransition(Request $request, SessionInterface $session, UserAuthenticatorInterface $authenticator, AuthControllerAuthenticator $authControllerAuthenticator, ActivitySectorRepository $activitySectorRepository, UserRegistrationService $registrationService, EntityManagerInterface $entityManager) : Response
If the user is not logged in, redirect them to registration.
Parameters
- $request : Request
- $session : SessionInterface
- $authenticator : UserAuthenticatorInterface
- $authControllerAuthenticator : AuthControllerAuthenticator
- $activitySectorRepository : ActivitySectorRepository
- $registrationService : UserRegistrationService
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/continue-checkout'
- $name: 'checkout_payment'
Return values
Responsepayment()
Display the payment method selection page.
public
payment(User $user, SessionInterface $session) : Response
Parameters
- $user : User
- $session : SessionInterface
Attributes
- #[Route]
- '/payment-method-selection/{id}'
- $name: 'payment_method_selection'
Return values
ResponsepaymentCancel()
Handles the payment cancellation process.
public
paymentCancel() : Response
Attributes
- #[Route]
- '/payment-cancel'
- $name: 'payment_cancel'
Return values
Response —Renders the payment cancellation page.
paymentsHistory()
Handles the display of the payment history for the authenticated user.
public
paymentsHistory(EntityManagerInterface $em) : Response
Parameters
- $em : EntityManagerInterface
-
The entity manager interface.
Attributes
- #[IsGranted]
- "IS_AUTHENTICATED"
- #[Route]
- "/billing/payments"
- $name: "billing_payments"
Return values
Response —The response object containing the rendered payment history.
paymentSuccess()
public
paymentSuccess(SessionInterface $session, SubscriptionService $subscriptionService, EntityManagerInterface $em, MailerService $mailerService) : Response
Parameters
- $session : SessionInterface
- $subscriptionService : SubscriptionService
- $em : EntityManagerInterface
- $mailerService : MailerService
Tags
Attributes
- #[Route]
- '/payment-success'
- $name: 'payment_success'
Return values
ResponseprocessPayment()
Entry point for payment processing.
public
processPayment(Request $request, SessionInterface $session, OrangeMoneyService $orangeMoneyService, CacheInterface $cache) : Response
Delegate logic based on the selected payment method.
Parameters
- $request : Request
- $session : SessionInterface
- $orangeMoneyService : OrangeMoneyService
- $cache : CacheInterface
Attributes
- #[Route]
- '/process-payment'
- $name: 'process_payment'
- $methods: ['POST']
Return values
ResponsewebhookForOrangePayment()
public
webhookForOrangePayment(Request $request, SubscriptionService $subscriptionService, MailerService $mailerService, OrangeMoneyService $orangeMoneyService, CacheInterface $cache, LoggerInterface $logger, EntityManagerInterface $entityManager) : JsonResponse
Parameters
- $request : Request
- $subscriptionService : SubscriptionService
- $mailerService : MailerService
- $orangeMoneyService : OrangeMoneyService
- $cache : CacheInterface
- $logger : LoggerInterface
- $entityManager : EntityManagerInterface
Attributes
- #[Route]
- '/payment/orange/webhook'
- $name: 'payment_orange_webhook'
- $methods: ['POST']
Return values
JsonResponsegenerateOrderId()
private
generateOrderId() : string
Return values
stringgetCallbackUrls()
private
getCallbackUrls() : array<string|int, mixed>
Return values
array<string|int, mixed>handleCreditCardPayment()
Handle Credit Card payment processing.
private
handleCreditCardPayment(SessionInterface $session) : Response
Parameters
- $session : SessionInterface
-
The session interface.
Return values
Response —The HTTP response object.
handleOrangeMoneyPayment()
Handle Orange Money payment processing.
private
handleOrangeMoneyPayment(SessionInterface $session, OrangeMoneyService $orangeMoneyService, CacheInterface $cache) : Response
Parameters
- $session : SessionInterface
- $orangeMoneyService : OrangeMoneyService
- $cache : CacheInterface
Return values
ResponsehandlePaypalPayment()
Handle PayPal payment processing.
private
handlePaypalPayment(Request $request) : Response
Parameters
- $request : Request