/** * {@inheritdoc} */ public function handleError(TransactionInterface $transaction) { if ($transaction->getOrder()->isOpen()) { $transaction->getOrder()->setPaymentStatus($transaction->getStatusCode()); } $this->report($transaction); return new Response('ko', 200, array('Content-Type' => 'text/plain')); }
/** * {@inheritdoc} */ public function handleError(TransactionInterface $transaction) { $order = $transaction->getOrder(); switch ($transaction->getStatusCode()) { case TransactionInterface::STATUS_ORDER_UNKNOWN: if ($this->getLogger()) { $this->getLogger()->emergency('[Paypal:handlerError] ERROR_ORDER_UNKNOWN'); } break; case TransactionInterface::STATUS_ERROR_VALIDATION: if ($this->getLogger()) { $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_ERROR_VALIDATION - Order %s - Paypal reject the postback validation', $order->getReference())); } break; case TransactionInterface::STATUS_CANCELLED: // cancelled $order->setStatus(OrderInterface::STATUS_CANCELLED); if ($this->getLogger()) { $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_CANCELLED - Order %s - The Order has been cancelled, see callback dump for more information', $order->getReference())); } break; case TransactionInterface::STATUS_PENDING: // pending $order->setStatus(OrderInterface::STATUS_PENDING); if ($this->getLogger()) { $reasons = self::getPendingReasonsList(); $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_PENDING - Order %s - reason code : %s - reason : %s', $order->getReference(), $reasons[$transaction->get('pending_reason')], $transaction->get('pending_reason'))); } break; default: if ($this->getLogger()) { $this->getLogger()->emergency(sprintf('[Paypal:handlerError] STATUS_PENDING - uncaught error')); } } $transaction->setState(TransactionInterface::STATE_KO); if ($order->getStatus() === null) { $order->setStatus(OrderInterface::STATUS_CANCELLED); } if ($transaction->getStatusCode() == null) { $transaction->setStatusCode(TransactionInterface::STATUS_UNKNOWN); } }