function it_should_mark_new_if_order_have_empty_payment_details(PaymentInterface $payment, StatusRequestInterface $statusRequest)
 {
     $payment->getDetails()->willReturn(array());
     $statusRequest->getModel()->willReturn($payment);
     $statusRequest->markNew()->shouldBeCalled();
     $this->execute($statusRequest);
 }
 /**
  * {@inheritDoc}
  */
 protected function composeDetails(PaymentInterface $payment, TokenInterface $token)
 {
     if ($payment->getDetails()) {
         return;
     }
     $order = $payment->getOrder();
     $this->payment->execute($obtainCreditCardRequest = new ObtainCreditCardRequest($order));
     $creditCard = $obtainCreditCardRequest->getCreditCard();
     $total = $this->currencyConverter->convert($order->getTotal(), $order->getCurrency());
     $payment->setDetails(array('card' => new SensitiveValue(array('number' => $creditCard->getNumber(), 'expiryMonth' => $creditCard->getExpiryMonth(), 'expiryYear' => $creditCard->getExpiryYear(), 'cvv' => $creditCard->getSecurityCode())), 'amount' => round($total / 100, 2), 'currency' => $order->getCurrency()));
 }
 /**
  * @param PaymentInterface $payment
  * @param TokenInterface   $token
  *
  * @throws LogicException
  */
 protected function composeDetails(PaymentInterface $payment, TokenInterface $token)
 {
     if ($payment->getDetails()) {
         return;
     }
     if (!$this->httpRequest) {
         throw new LogicException('The action can be run only when http request is set.');
     }
     $order = $payment->getOrder();
     $details = array();
     $details['AMOUNT'] = $order->getTotal();
     $details['CLIENTEMAIL'] = $order->getUser()->getEmail();
     $details['HIDECLIENTEMAIL'] = 'yes';
     $details['CLIENTUSERAGENT'] = $this->httpRequest->headers->get('User-Agent', 'Unknown');
     $details['CLIENTIP'] = $this->httpRequest->getClientIp();
     $details['CLIENTIDENT'] = $order->getUser()->getId();
     $details['DESCRIPTION'] = sprintf('Order containing %d items for a total of %01.2f', $order->getItems()->count(), $order->getTotal() / 100);
     $details['ORDERID'] = $payment->getId();
     $payment->setDetails($details);
 }
 /**
  * {@inheritDoc}
  */
 protected function composeDetails(PaymentInterface $payment, TokenInterface $token)
 {
     if ($payment->getDetails()) {
         return;
     }
     $order = $payment->getOrder();
     $details = array();
     $details['PAYMENTREQUEST_0_NOTIFYURL'] = $this->tokenFactory->createNotifyToken($token->getPaymentName(), $payment)->getTargetUrl();
     $details['PAYMENTREQUEST_0_INVNUM'] = $order->getNumber() . '-' . $payment->getId();
     $details['PAYMENTREQUEST_0_CURRENCYCODE'] = $order->getCurrency();
     $details['PAYMENTREQUEST_0_AMT'] = round($order->getTotal() / 100, 2);
     $details['PAYMENTREQUEST_0_ITEMAMT'] = round($order->getTotal() / 100, 2);
     $m = 0;
     foreach ($order->getItems() as $item) {
         $details['L_PAYMENTREQUEST_0_AMT' . $m] = round($item->getTotal() / $item->getQuantity() / 100, 2);
         $details['L_PAYMENTREQUEST_0_QTY' . $m] = $item->getQuantity();
         $m++;
     }
     if ($order->getTaxTotal() !== 0) {
         $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Tax Total';
         $details['L_PAYMENTREQUEST_0_AMT' . $m] = round($order->getTaxTotal() / 100, 2);
         $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;
         $m++;
     }
     if ($order->getPromotionTotal() !== 0) {
         $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Discount';
         $details['L_PAYMENTREQUEST_0_AMT' . $m] = round($order->getPromotionTotal() / 100, 2);
         $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;
         $m++;
     }
     if ($order->getShippingTotal() !== 0) {
         $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Shipping Total';
         $details['L_PAYMENTREQUEST_0_AMT' . $m] = round($order->getShippingTotal() / 100, 2);
         $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;
     }
     $payment->setDetails($details);
 }
 /**
  * {@inheritDoc}
  */
 protected function composeDetails(PaymentInterface $payment, TokenInterface $token)
 {
     if ($payment->getDetails()) {
         return;
     }
     if (!$this->httpRequest) {
         throw new LogicException('The action can be run only when http request is set.');
     }
     $order = $payment->getOrder();
     $this->payment->execute($obtainCreditCardRequest = new ObtainCreditCardRequest($order));
     $details = array();
     $details['AMOUNT'] = $order->getTotal();
     $details['CLIENTEMAIL'] = $order->getUser()->getEmail();
     $details['CLIENTUSERAGENT'] = $this->httpRequest->headers->get('User-Agent', 'Unknown');
     $details['CLIENTIP'] = $this->httpRequest->getClientIp();
     $details['CLIENTIDENT'] = $order->getUser()->getId();
     $details['DESCRIPTION'] = sprintf('Order containing %d items for a total of %01.2f', $order->getItems()->count(), $order->getTotal() / 100);
     $details['ORDERID'] = $payment->getId();
     $details['CARDCODE'] = new SensitiveValue($obtainCreditCardRequest->getCreditCard()->getNumber());
     $details['CARDCVV'] = new SensitiveValue($obtainCreditCardRequest->getCreditCard()->getSecurityCode());
     $details['CARDFULLNAME'] = new SensitiveValue($obtainCreditCardRequest->getCreditCard()->getCardholderName());
     $details['CARDVALIDITYDATE'] = new SensitiveValue(sprintf('%02d-%02d', $obtainCreditCardRequest->getCreditCard()->getExpiryMonth(), substr($obtainCreditCardRequest->getCreditCard()->getExpiryYear(), -2)));
     $payment->setDetails($details);
 }