/**
  * {@inheritdoc}
  */
 protected function composeDetails(PaymentInterface $payment, TokenInterface $token)
 {
     if ($payment->getDetails()) {
         return;
     }
     $order = $payment->getOrder();
     $details = array();
     $details['payment_method'] = $this->apiMethod($payment->getMethod()->getName());
     $details['payment_type'] = 1;
     $details['checkout_url'] = $this->tokenFactory->createNotifyToken($token->getPaymentName(), $payment)->getTargetUrl();
     $details['order_code'] = $order->getNumber() . '-' . $payment->getId();
     $details['cur_code'] = $order->getCurrency();
     $details['total_amount'] = round($order->getTotal() / 100, 2);
     $details['total_item'] = count($order->getItems());
     $m = 0;
     foreach ($order->getItems() as $item) {
         $details['item_name' . $m] = $item->getId();
         $details['item_amount' . $m] = round($item->getTotal() / $item->getQuantity() / 100, 2);
         $details['item_quantity' . $m] = $item->getQuantity();
         $m++;
     }
     if (0 !== ($taxTotal = $this->calculateNonNeutralTaxTotal($order))) {
         $details['tax_amount'] = $taxTotal;
     }
     if (0 !== ($promotionTotal = $order->getAdjustmentsTotal(AdjustmentInterface::PROMOTION_ADJUSTMENT))) {
         $details['discount_amount'] = $promotionTotal;
     }
     if (0 !== ($shippingTotal = $order->getAdjustmentsTotal(AdjustmentInterface::SHIPPING_ADJUSTMENT))) {
         $details['fee_shipping'] = $shippingTotal;
     }
     $payment->setDetails($details);
 }
 /**
  * {@inheritDoc}
  */
 protected function composeDetails(PaymentInterface $payment, TokenInterface $token)
 {
     if ($payment->getDetails()) {
         return;
     }
     $order = $payment->getOrder();
     $total = $this->currencyConverter->convert($order->getTotal(), $order->getCurrency());
     $payment->setDetails(array('amount' => round($total / 100, 2), 'currency' => $order->getCurrency()));
 }
 /**
  * {@inheritDoc}
  */
 protected function composeDetails(PaymentInterface $payment, TokenInterface $token)
 {
     if ($payment->getDetails()) {
         return;
     }
     $this->payment->execute($httpRequest = new GetHttpRequest());
     $order = $payment->getOrder();
     $details = array();
     $details['AMOUNT'] = $order->getTotal();
     $details['CLIENTEMAIL'] = $order->getCustomer()->getEmail();
     $details['CLIENTUSERAGENT'] = $httpRequest->userAgent ?: 'Unknown';
     $details['CLIENTIP'] = $httpRequest->clientIp;
     $details['CLIENTIDENT'] = $order->getCustomer()->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;
     }
     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->getEmail();
     $details['CLIENTUSERAGENT'] = $this->httpRequest->headers->get('User-Agent', 'Unknown');
     $details['CLIENTIP'] = $this->httpRequest->getClientIp();
     $details['CLIENTIDENT'] = $order->getUser() ? $order->getUser()->getId() : $order->getEmail();
     $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 (0 !== ($taxTotal = $this->calculateNonNeutralTaxTotal($order))) {
         $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Tax Total';
         $details['L_PAYMENTREQUEST_0_AMT' . $m] = round($taxTotal / 100, 2);
         $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;
         $m++;
     }
     if (0 !== ($promotionTotal = $order->getAdjustmentsTotal(AdjustmentInterface::PROMOTION_ADJUSTMENT))) {
         $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Discount';
         $details['L_PAYMENTREQUEST_0_AMT' . $m] = round($promotionTotal / 100, 2);
         $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;
         $m++;
     }
     if (0 !== ($shippingTotal = $order->getAdjustmentsTotal(AdjustmentInterface::SHIPPING_ADJUSTMENT))) {
         $details['L_PAYMENTREQUEST_0_NAME' . $m] = 'Shipping Total';
         $details['L_PAYMENTREQUEST_0_AMT' . $m] = round($shippingTotal / 100, 2);
         $details['L_PAYMENTREQUEST_0_QTY' . $m] = 1;
     }
     $payment->setDetails($details);
 }
 /**
  * {@inheritdoc}
  */
 public function supports(BasePaymentInterface $payment)
 {
     return $payment instanceof PaymentInterface && null !== $payment->getOrder() && null !== $payment->getOrder()->getChannel();
 }