/** * @param Attendee $attendee * @param string $redirectTo * @return array */ public function createPayment(Attendee $attendee, $redirectTo) { $payment = $this->paymentManager->create($this->costCalculator->getCost($attendee, new DateTime()), $this->getItemDescription($attendee->getEvent())); $this->attendeeManager->appendPayment($attendee, $payment); if ($attendee->getEvent()->isLateRegistrationPeriod($payment->getCreationTime())) { return array('data' => array('id' => $attendee->getId(), 'redirectTo' => $redirectTo)); } $paymentResponse = $this->paymentManager->requestPayment($payment, $attendee->getUser()->getEmail(), $redirectTo); //TODO Refactor this! return array('data' => array('id' => $attendee->getId(), 'redirectTo' => $paymentResponse->getRedirectionUrl())); }
/** * {@inheritdoc} */ public function confirm(PaymentEvent $event) { $this->manager->confirmPayment($event->getPayment()); }