/** * {@inheritdoc} */ public function sendConfirmationReceipt(TransactionInterface $transaction) { if (!$transaction->isValid()) { return new \Symfony\Component\HttpFoundation\Response(''); } $params = $transaction->getParameters(); $params['cmd'] = '_notify-validate'; //$this->getLogger()-> // retrieve the client $client = $this->getWebConnectorProvider()->getNamedClient($this->getOption('web_connector_name', 'default')); $client->request('POST', $this->getOption('url_action'), $params); if ($client->getResponse()->getContent() == 'VERIFIED') { $transaction->setState(TransactionInterface::STATE_OK); $transaction->setStatusCode(TransactionInterface::STATUS_VALIDATED); $transaction->getOrder()->setValidatedAt(new \DateTime()); $transaction->getOrder()->setStatus(OrderInterface::STATUS_VALIDATED); $transaction->getOrder()->setPaymentStatus(TransactionInterface::STATUS_VALIDATED); } else { $transaction->setState(TransactionInterface::STATE_KO); $transaction->setStatusCode(TransactionInterface::STATUS_ERROR_VALIDATION); // TODO error in status -> setting payment status to an order status value $transaction->getOrder()->setPaymentStatus(OrderInterface::STATUS_ERROR); if ($this->getLogger()) { $this->getLogger()->emergency('[Paypal::sendAccuseReception] Paypal failed to check the postback'); } } return new \Symfony\Component\HttpFoundation\Response(''); }