private function checkHash(OrderInterface $order) { if ($this->request->getHash() != ($hashOrder = $this->hashOrderGenerator->hashOrder($order))) { $this->logger->info('Bitpay ipn request is invalid due to invalid hash', array('id' => $this->request->getId(), 'orderId' => $this->request->getOrderId(), 'requestHash' => $this->request->getHash(), 'orderHash' => $hashOrder)); throw new InvalidIpnRequestException(); } }
public function getParametersFromOrder(OrderInterface $order) { $params = array('amount' => round($order->getPaymentInstruction()->getAmount(), 2), 'currency' => $order->getPaymentInstruction()->getCurrency(), 'returnUrl' => $this->router->generate('payment_successful', array('order' => $order->getId()), RouterInterface::ABSOLUTE_URL), 'notifyUrl' => $this->router->generate("hyper_ads.omnipay.ipn.bitpay", array(), RouterInterface::ABSOLUTE_URL), 'transactionSpeed' => $this->transactionSpeed, 'fullNotifications' => $this->fullNotifications, 'orderId' => $order->getOrderNumber(), 'description' => $this->translator->trans('payment.info', array('%orderNumber%' => $order->getOrderNumber()), 'HyperAdsBundle')); if (!empty($this->notificationEmail)) { $params['notifyEmail'] = $this->notificationEmail; } $params['transactionId'] = json_encode(array('hash' => $this->hashGenerator->hashOrder($order), 'posData' => $this->getPosData($order))); return $params; }