26 private $dateTimeFactory;
36 private $signifydOrderSessionId;
41 private $paymentVerificationFactory;
46 private $paymentMethodMapper;
64 $this->dateTimeFactory = $dateTimeFactory;
65 $this->scope = $scope;
66 $this->signifydOrderSessionId = $signifydOrderSessionId;
67 $this->paymentVerificationFactory = $paymentVerificationFactory;
68 $this->paymentMethodMapper = $paymentMethodMapper;
80 $orderPayment =
$order->getPayment();
81 $createdAt = $this->dateTimeFactory->create(
83 new \DateTimeZone(
'UTC')
88 'orderSessionId' => $this->signifydOrderSessionId->get(
$order->getQuoteId()),
89 'browserIpAddress' =>
$order->getRemoteIp(),
90 'orderId' =>
$order->getIncrementId(),
91 'createdAt' => $createdAt->format(\DateTime::ATOM),
92 'paymentGateway' => $this->getPaymentGateway($orderPayment->getMethod()),
93 'transactionId' => $orderPayment->getLastTransId(),
94 'currency' =>
$order->getOrderCurrencyCode(),
95 'avsResponseCode' => $this->getAvsCode($orderPayment),
96 'cvvResponseCode' => $this->getCvvCode($orderPayment),
97 'orderChannel' => $this->getOrderChannel(),
98 'totalPrice' =>
$order->getGrandTotal(),
99 'paymentMethod' => $this->paymentMethodMapper
100 ->getSignifydPaymentMethodCode($orderPayment->getMethod())
104 $shippingDescription =
$order->getShippingDescription();
105 if ($shippingDescription !==
null) {
106 $result[
'purchase'][
'shipments'] = [
108 'shipper' => $this->getShipper(
$order->getShippingDescription()),
109 'shippingMethod' => $this->getShippingMethod(
$order->getShippingDescription()),
110 'shippingPrice' =>
$order->getShippingAmount()
137 'itemQuantity' => (int)
$orderItem->getQtyOrdered(),
138 'itemUrl' =>
$orderItem->getProduct()->getProductUrl(),
139 'itemWeight' =>
$orderItem->getProduct()->getWeight()
152 private function getShipper($shippingDescription)
154 $result = explode(
' - ', $shippingDescription, 2);
165 private function getShippingMethod($shippingDescription)
167 $result = explode(
' - ', $shippingDescription, 2);
178 private function getPaymentGateway($gatewayCode)
189 return in_array($gatewayCode, $payPalCodeList) ?
'paypal_account' : $gatewayCode;
197 private function getOrderChannel()
209 private function getAvsCode(OrderPaymentInterface $orderPayment)
211 $avsAdapter = $this->paymentVerificationFactory->createPaymentAvs($orderPayment->getMethod());
212 return $avsAdapter->getCode($orderPayment);
222 private function getCvvCode(OrderPaymentInterface $orderPayment)
224 $cvvAdapter = $this->paymentVerificationFactory->createPaymentCvv($orderPayment->getMethod());
225 return $cvvAdapter->getCode($orderPayment);
__construct(DateTimeFactory $dateTimeFactory, ScopeInterface $scope, SignifydOrderSessionId $signifydOrderSessionId, PaymentVerificationFactory $paymentVerificationFactory, PaymentMethodMapper $paymentMethodMapper)