public function retrieveUrlForOrder(OrderInterface $order) { $paymentMethod = $this->getPaymentMethodFromSystemName($order->getPaymentInstruction()->getPaymentSystemName()); /** @var $gateway \Omnipay\Common\AbstractGateway */ $gateway = $this->container->get('hyper_ads.payment.gateway.' . $paymentMethod); /** @var $response \Omnipay\BitPay\Message\PurchaseResponse */ $response = $gateway->purchase($this->getParameters($order))->send(); if ($response->isRedirect()) { return $response->getRedirectUrl(); } elseif (!$response->isSuccessful()) { throw new PaymentException('Problem with getting payment URL. Cause: ' . $response->getMessage()); } else { throw new PaymentException('Payment that does not return redirects to the payment page are not supported'); } }
private function getPosData(OrderInterface $order) { return array('order' => $order->getId()); }
private function getHash(OrderInterface $order) { return $order->getId() . '_' . $order->getPaymentInstruction()->getId(); }
/** * @return \JMS\Payment\CoreBundle\Model\PaymentInterface */ private function getPaymentFromOrder(OrderInterface $order) { if (null === ($pendingTransaction = $order->getPaymentInstruction()->getPendingTransaction())) { $this->logger->info('Pending transaction for order not found', array('orderId' => $order->getId(), 'requestId' => $this->request->getId())); $payment = $this->pluginController->createPayment($order->getPaymentInstruction()->getId(), round($order->getPaymentInstruction()->getAmount() - $order->getPaymentInstruction()->getDepositedAmount(), 2)); } else { $payment = $pendingTransaction->getPayment(); } return $payment; }