Skip to content

Commit 0f5ced9

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-62621' into 2.1-develop-pr35
2 parents bf254e7 + 5e3bfbf commit 0f5ced9

File tree

13 files changed

+865
-13
lines changed

13 files changed

+865
-13
lines changed

app/code/Magento/Authorizenet/Controller/Directpost/Payment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ protected function _responseAction($area = 'frontend')
7373
$helper = $this->dataFactory->create($area);
7474

7575
$params = [];
76-
$data = $this->getRequest()->getPostValue();
76+
$data = $this->getRequest()->getParams();
77+
7778
/* @var $paymentMethod \Magento\Authorizenet\Model\DirectPost */
7879
$paymentMethod = $this->_objectManager->create('Magento\Authorizenet\Model\Directpost');
7980

@@ -110,9 +111,8 @@ protected function _responseAction($area = 'frontend')
110111
$params['redirect'] = $helper->getRedirectIframeUrl($result);
111112
}
112113

114+
//registering parameter for iframe content
113115
$this->_coreRegistry->register(Iframe::REGISTRY_KEY, $params);
114-
$this->_view->addPageLayoutHandles();
115-
$this->_view->loadLayout(false)->renderLayout();
116116
}
117117

118118
/**

app/code/Magento/Authorizenet/Controller/Directpost/Payment/BackendResponse.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct(
5252
* Response action.
5353
* Action for Authorize.net SIM Relay Request.
5454
*
55-
* @return void
55+
* @return \Magento\Framework\Controller\ResultInterface
5656
*/
5757
public function execute()
5858
{
@@ -67,10 +67,11 @@ public function execute()
6767
$paymentMethod->validateResponse();
6868
} catch (LocalizedException $e) {
6969
$this->logger->critical($e->getMessage());
70-
$this->_redirect('noroute');
71-
return;
70+
71+
return $this->_redirect('noroute');
7272
}
7373
$this->_responseAction('adminhtml');
74-
$this->resultFactory->create(ResultFactory::TYPE_PAGE);
74+
75+
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
7576
}
7677
}

app/code/Magento/Authorizenet/Controller/Directpost/Payment/Response.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ class Response extends \Magento\Authorizenet\Controller\Directpost\Payment
1212
* Response action.
1313
* Action for Authorize.net SIM Relay Request.
1414
*
15-
* @return void
15+
* @return \Magento\Framework\Controller\ResultInterface
1616
*/
1717
public function execute()
1818
{
1919
$this->_responseAction('frontend');
20+
21+
return $this->resultFactory->create(\Magento\Framework\Controller\ResultFactory::TYPE_PAGE);
2022
}
2123
}

app/code/Magento/Authorizenet/Model/Authorizenet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ protected function buildRequest(\Magento\Framework\DataObject $payment)
332332
->setXCity($billing->getCity())
333333
->setXState($billing->getRegion())
334334
->setXZip($billing->getPostcode())
335-
->setXCountry($billing->getCountry())
335+
->setXCountry($billing->getCountryId())
336336
->setXPhone($billing->getTelephone())
337337
->setXFax($billing->getFax())
338338
->setXCustId($order->getCustomerId())
@@ -352,7 +352,7 @@ protected function buildRequest(\Magento\Framework\DataObject $payment)
352352
->setXShipToCity($shipping->getCity())
353353
->setXShipToState($shipping->getRegion())
354354
->setXShipToZip($shipping->getPostcode())
355-
->setXShipToCountry($shipping->getCountry());
355+
->setXShipToCountry($shipping->getCountryId());
356356
}
357357

358358
$request->setXPoNum($payment->getPoNumber())

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,11 @@ protected function processPaymentFraudStatus(\Magento\Sales\Model\Order\Payment
747747
return $this;
748748
}
749749

750-
$payment->setIsFraudDetected(true);
750+
$fdsFilterAction = (string)$fraudDetailsResponse->getFdsFilterAction();
751+
if ($this->fdsFilterActionIsReportOnly($fdsFilterAction) === false) {
752+
$payment->setIsFraudDetected(true);
753+
}
754+
751755
$payment->setAdditionalInformation('fraud_details', $fraudData);
752756
} catch (\Exception $e) {
753757
//this request is optional
@@ -993,4 +997,16 @@ private function getPsrLogger()
993997
}
994998
return $this->psrLogger;
995999
}
1000+
1001+
/**
1002+
* Checks if filter action is Report Only. Transactions that trigger this filter are processed as normal,
1003+
* but are also reported in the Merchant Interface as triggering this filter.
1004+
*
1005+
* @param string $fdsFilterAction
1006+
* @return bool
1007+
*/
1008+
private function fdsFilterActionIsReportOnly($fdsFilterAction)
1009+
{
1010+
return $fdsFilterAction === (string)$this->dataHelper->getFdsFilterActionLabel('report');
1011+
}
9961012
}

app/code/Magento/Authorizenet/Model/Directpost/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function setDataFromOrder(
123123
->setXCity(strval($billing->getCity()))
124124
->setXState(strval($billing->getRegion()))
125125
->setXZip(strval($billing->getPostcode()))
126-
->setXCountry(strval($billing->getCountry()))
126+
->setXCountry(strval($billing->getCountryId()))
127127
->setXPhone(strval($billing->getTelephone()))
128128
->setXFax(strval($billing->getFax()))
129129
->setXCustId(strval($billing->getCustomerId()))
@@ -151,7 +151,7 @@ public function setDataFromOrder(
151151
)->setXShipToZip(
152152
strval($shipping->getPostcode())
153153
)->setXShipToCountry(
154-
strval($shipping->getCountry())
154+
strval($shipping->getCountryId())
155155
);
156156
}
157157

dev/tests/functional/tests/app/Magento/Authorizenet/Test/Repository/ConfigData.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,21 @@
7171
<item name="value" xsi:type="number">0</item>
7272
</field>
7373
</dataset>
74+
<dataset name="authorizenet_authorize_capture">
75+
<field name="payment/authorizenet_directpost/payment_action" xsi:type="array">
76+
<item name="scope" xsi:type="string">payment</item>
77+
<item name="scope_id" xsi:type="number">1</item>
78+
<item name="label" xsi:type="string"/>
79+
<item name="value" xsi:type="string">authorize_capture</item>
80+
</field>
81+
</dataset>
82+
<dataset name="authorizenet_authorize_capture_rollback">
83+
<field name="payment/authorizenet_directpost/payment_action" xsi:type="array">
84+
<item name="scope" xsi:type="string">payment</item>
85+
<item name="scope_id" xsi:type="number">1</item>
86+
<item name="label" xsi:type="string"/>
87+
<item name="value" xsi:type="string">authorize</item>
88+
</field>
89+
</dataset>
7490
</repository>
7591
</config>

dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Info.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ class Info extends Block
2929
*/
3030
protected $group = '//th[text()="Customer Group"]/following-sibling::*';
3131

32+
/**
33+
* Item options.
34+
*
35+
* @var string
36+
*/
37+
protected $itemOptions = '//div[@class=\'product-sku-block\' and contains(normalize-space(.), \'{SKU}\')]'
38+
. '/following-sibling::*[@class="item-options"]';
39+
3240
/**
3341
* Get email from the data inside block
3442
*
@@ -48,4 +56,29 @@ public function getCustomerGroup()
4856
{
4957
return $this->_rootElement->find($this->group, Locator::SELECTOR_XPATH)->getText();
5058
}
59+
60+
/**
61+
* Get Product options.
62+
*
63+
* @param string $sku
64+
* @return array
65+
*/
66+
public function getProductOptions($sku)
67+
{
68+
$selector = str_replace('{SKU}', $sku, $this->itemOptions);
69+
$productOption = $this->_rootElement->find($selector, Locator::SELECTOR_XPATH);
70+
$result = [];
71+
if ($productOption->isVisible()) {
72+
$keyItem = $productOption->getElements('dt');
73+
$valueItem = $productOption->getElements('dd');
74+
foreach ($keyItem as $key => $item) {
75+
$result[$item->getText()] = null;
76+
if (isset($valueItem[$key])) {
77+
$result[$item->getText()] = $valueItem[$key]->getText();
78+
}
79+
}
80+
}
81+
82+
return $result;
83+
}
5184
}

0 commit comments

Comments
 (0)