public function finishPayment(Payment $payment, $status) { try { $this->entityManager->beginTransaction(); $order = $payment->getOrder(); $payment->setStatus($status); $order->setStatus($status === $payment::STATUS_COMPLETE ? $order::STATUS_FINISHED_PAID : $order::STATUS_FINISHED_UNPAID); $this->entityManager->persist($order); $this->persistPayment($payment); $this->eventDispatcher->dispatch("agit.payment.finished", new PaymentEvent($payment)); $this->entityManager->commit(); } catch (Exception $e) { $this->entityManager->rollback(); throw $e; } }
public function fillStatus(PaymentEntity $payment) { $this->status = self::$availableStatus[$payment->getStatus()]; }
public function createProcessorUrl(Payment $payment, $action) { $path = $this->router->generate("order_payment", ["reference" => $payment->getFullCode(), "locale" => $this->localeService->getLocale(), "action" => $action]); return $this->urlService->createAppUrl($path); }