Skip to content

Commit 6399587

Browse files
Merge branch 'develop' of https://github.com/magento/magento2ce into pr3
2 parents aac0d40 + 84d382b commit 6399587

File tree

14 files changed

+235
-138
lines changed

14 files changed

+235
-138
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Magento\Payment\Model\IframeConfigProvider;
1717
use Magento\Quote\Api\CartManagementInterface;
1818
use Magento\Framework\Exception\LocalizedException;
19+
use Psr\Log\LoggerInterface;
20+
use Magento\Framework\App\ObjectManager;
1921

2022
/**
2123
* Class Place
@@ -44,26 +46,36 @@ class Place extends Payment
4446
*/
4547
protected $jsonHelper;
4648

49+
/**
50+
* Logger for exception details
51+
*
52+
* @var LoggerInterface
53+
*/
54+
private $logger;
55+
4756
/**
4857
* @param Context $context
4958
* @param Registry $coreRegistry
5059
* @param DataFactory $dataFactory
5160
* @param CartManagementInterface $cartManagement
5261
* @param Onepage $onepageCheckout
5362
* @param JsonHelper $jsonHelper
63+
* @param LoggerInterface|null $logger
5464
*/
5565
public function __construct(
5666
Context $context,
5767
Registry $coreRegistry,
5868
DataFactory $dataFactory,
5969
CartManagementInterface $cartManagement,
6070
Onepage $onepageCheckout,
61-
JsonHelper $jsonHelper
71+
JsonHelper $jsonHelper,
72+
LoggerInterface $logger = null
6273
) {
6374
$this->eventManager = $context->getEventManager();
6475
$this->cartManagement = $cartManagement;
6576
$this->onepageCheckout = $onepageCheckout;
6677
$this->jsonHelper = $jsonHelper;
78+
$this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
6779
parent::__construct($context, $coreRegistry, $dataFactory);
6880
}
6981

@@ -127,9 +139,11 @@ protected function placeCheckoutOrder()
127139
]
128140
);
129141
} catch (LocalizedException $exception) {
142+
$this->logger->critical($exception);
130143
$result->setData('error', true);
131144
$result->setData('error_messages', $exception->getMessage());
132145
} catch (\Exception $exception) {
146+
$this->logger->critical($exception);
133147
$result->setData('error', true);
134148
$result->setData(
135149
'error_messages',

app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Payment\Model\IframeConfigProvider;
2121
use Magento\Quote\Api\CartManagementInterface;
2222
use Magento\Quote\Model\Quote;
23+
use Magento\Framework\Exception\LocalizedException;
2324

2425
/**
2526
* Class PlaceTest
@@ -94,6 +95,11 @@ class PlaceTest extends \PHPUnit_Framework_TestCase
9495
*/
9596
protected $quoteMock;
9697

98+
/**
99+
* @var \PHPUnit_Framework_MockObject_MockObject
100+
*/
101+
private $loggerMock;
102+
97103
/**
98104
* @var CheckoutSession|\PHPUnit_Framework_MockObject_MockObject
99105
*/
@@ -152,6 +158,9 @@ protected function setUp()
152158
->getMockBuilder(\Magento\Framework\App\Response\Http::class)
153159
->disableOriginalConstructor()
154160
->getMockForAbstractClass();
161+
$this->loggerMock = $this
162+
->getMockBuilder(\Psr\Log\LoggerInterface::class)
163+
->getMock();
155164

156165
$this->objectManager = new ObjectManager($this);
157166
$this->placeOrderController = $this->objectManager->getObject(
@@ -165,6 +174,7 @@ protected function setUp()
165174
'cartManagement' => $this->cartManagementMock,
166175
'onepageCheckout' => $this->onepageCheckout,
167176
'jsonHelper' => $this->jsonHelperMock,
177+
'logger' => $this->loggerMock,
168178
]
169179
);
170180
}
@@ -214,13 +224,15 @@ public function testExecute(
214224
* @param $controller
215225
* @param $quoteId
216226
* @param $result
227+
* @param \Exception $exception Exception to check
217228
* @dataProvider textExecuteFailedPlaceOrderDataProvider
218229
*/
219230
public function testExecuteFailedPlaceOrder(
220231
$paymentMethod,
221232
$controller,
222233
$quoteId,
223-
$result
234+
$result,
235+
$exception
224236
) {
225237
$this->requestMock->expects($this->at(0))
226238
->method('getParam')
@@ -238,7 +250,11 @@ public function testExecuteFailedPlaceOrder(
238250

239251
$this->cartManagementMock->expects($this->once())
240252
->method('placeOrder')
241-
->willThrowException(new \Exception());
253+
->willThrowException($exception);
254+
255+
$this->loggerMock->expects($this->once())
256+
->method('critical')
257+
->with($exception);
242258

243259
$this->jsonHelperMock->expects($this->any())
244260
->method('jsonEncode')
@@ -278,19 +294,35 @@ public function textExecuteDataProvider()
278294
*/
279295
public function textExecuteFailedPlaceOrderDataProvider()
280296
{
281-
$objectFailed = new \Magento\Framework\DataObject();
282-
$objectFailed->setData('error', true);
283-
$objectFailed->setData(
284-
'error_messages',
285-
__('An error occurred on the server. Please try to place the order again.')
297+
$objectFailed1 = new \Magento\Framework\DataObject(
298+
[
299+
'error' => true,
300+
'error_messages' => __('An error occurred on the server. Please try to place the order again.')
301+
]
302+
);
303+
$generalException = new \Exception('Exception logging will save the world!');
304+
$localizedException = new LocalizedException(__('Electronic payments save the trees.'));
305+
$objectFailed2 = new \Magento\Framework\DataObject(
306+
[
307+
'error' => true,
308+
'error_messages' => $localizedException->getMessage()
309+
]
286310
);
287311

288312
return [
289313
[
290314
['method' => 'authorizenet_directpost'],
291315
IframeConfigProvider::CHECKOUT_IDENTIFIER,
292316
1,
293-
$objectFailed
317+
$objectFailed1,
318+
$generalException,
319+
],
320+
[
321+
['method' => 'authorizenet_directpost'],
322+
IframeConfigProvider::CHECKOUT_IDENTIFIER,
323+
1,
324+
$objectFailed2,
325+
$localizedException,
294326
],
295327
];
296328
}

app/code/Magento/Braintree/Controller/Paypal/PlaceOrder.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Framework\Controller\ResultFactory;
1212
use Magento\Framework\Exception\LocalizedException;
1313
use Magento\Braintree\Gateway\Config\PayPal\Config;
14+
use Psr\Log\LoggerInterface;
15+
use Magento\Framework\App\ObjectManager;
1416

1517
/**
1618
* Class PlaceOrder
@@ -22,22 +24,32 @@ class PlaceOrder extends AbstractAction
2224
*/
2325
private $orderPlace;
2426

27+
/**
28+
* Logger for exception details
29+
*
30+
* @var LoggerInterface
31+
*/
32+
private $logger;
33+
2534
/**
2635
* Constructor
2736
*
2837
* @param Context $context
2938
* @param Config $config
3039
* @param Session $checkoutSession
3140
* @param Helper\OrderPlace $orderPlace
41+
* @param LoggerInterface|null $logger
3242
*/
3343
public function __construct(
3444
Context $context,
3545
Config $config,
3646
Session $checkoutSession,
37-
Helper\OrderPlace $orderPlace
47+
Helper\OrderPlace $orderPlace,
48+
LoggerInterface $logger = null
3849
) {
3950
parent::__construct($context, $config, $checkoutSession);
4051
$this->orderPlace = $orderPlace;
52+
$this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
4153
}
4254

4355
/**
@@ -58,6 +70,7 @@ public function execute()
5870
/** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
5971
return $resultRedirect->setPath('checkout/onepage/success', ['_secure' => true]);
6072
} catch (\Exception $e) {
73+
$this->logger->critical($e);
6174
$this->messageManager->addExceptionMessage($e, $e->getMessage());
6275
}
6376

app/code/Magento/Braintree/Test/Unit/Controller/Paypal/PlaceOrderTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class PlaceOrderTest extends \PHPUnit_Framework_TestCase
6060
*/
6161
private $placeOrder;
6262

63+
/**
64+
* @var \PHPUnit_Framework_MockObject_MockObject
65+
*/
66+
private $loggerMock;
67+
6368
protected function setUp()
6469
{
6570
/** @var Context|\PHPUnit_Framework_MockObject_MockObject $contextMock */
@@ -94,11 +99,15 @@ protected function setUp()
9499
->method('getMessageManager')
95100
->willReturn($this->messageManagerMock);
96101

102+
$this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
103+
->disableOriginalConstructor()
104+
->getMock();
97105
$this->placeOrder = new PlaceOrder(
98106
$contextMock,
99107
$this->configMock,
100108
$this->checkoutSessionMock,
101-
$this->orderPlaceMock
109+
$this->orderPlaceMock,
110+
$this->loggerMock
102111
);
103112
}
104113

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ window.setRowVisibility = setRowVisibility;
337337
window.showDefaultRows = showDefaultRows;
338338
window.switchDefaultValueField = switchDefaultValueField;
339339
window.switchIsFilterable = switchIsFilterable;
340-
window.switchIsFilterable = switchIsFilterable;
341340
window.bindAttributeInputType = bindAttributeInputType;
342341
window.checkOptionsPanelVisibility = checkOptionsPanelVisibility;
343342
window.getFrontTab = getFrontTab;

app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
<?php echo($block->getPriceDisplayLabel()) ? 'data-label="' . $block->getPriceDisplayLabel() . $block->getPriceDisplayInclExclTaxes() . '"' : '' ?>
2020
data-price-amount="<?php /* @escapeNotVerified */ echo $block->getDisplayValue(); ?>"
2121
data-price-type="<?php /* @escapeNotVerified */ echo $block->getPriceType(); ?>"
22-
class="price-wrapper <?php /* @escapeNotVerified */ echo $block->getPriceWrapperCss(); ?>"
23-
<?php echo $block->getSchema() ? ' itemprop="price"' : '' ?>>
22+
class="price-wrapper <?php /* @escapeNotVerified */ echo $block->getPriceWrapperCss(); ?>">
2423
<?php /* @escapeNotVerified */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>
2524
</span>
2625
<?php if ($block->hasAdjustmentsHtml()): ?>
2726
<?php echo $block->getAdjustmentsHtml() ?>
2827
<?php endif; ?>
2928
<?php if ($block->getSchema()): ?>
29+
<meta itemprop="price" content="<?php /* @escapeNotVerified */ echo $block->getDisplayValue(); ?>" />
3030
<meta itemprop="priceCurrency" content="<?php /* @escapeNotVerified */ echo $block->getDisplayCurrencyCode()?>" />
3131
<?php endif; ?>
3232
</span>

app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ define([
5757

5858
return Component.extend({
5959
defaults: {
60-
template: 'Magento_Checkout/shipping'
60+
template: 'Magento_Checkout/shipping',
61+
shippingFormTemplate: 'Magento_Checkout/shipping-address/form',
62+
shippingMethodListTemplate: 'Magento_Checkout/shipping-address/shipping-method-list',
63+
shippingMethodItemTemplate: 'Magento_Checkout/shipping-address/shipping-method-item'
6164
},
6265
visible: ko.observable(!quote.isVirtual()),
6366
errorValidationMessage: ko.observable(false),
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!--
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<tr class="row"
8+
click="element.selectShippingMethod">
9+
<td class="col col-method">
10+
<input type="radio"
11+
class="radio"
12+
ifnot="method.error_message"
13+
ko-checked="element.isSelected"
14+
ko-value="method.carrier_code + '_' + method.method_code"
15+
attr="'aria-labelledby': 'label_method_' + method.method_code + '_' + method.carrier_code + ' ' + 'label_carrier_' + method.method_code + '_' + method.carrier_code,
16+
'checked': element.rates().length == 1 || element.isSelected" />
17+
</td>
18+
<td class="col col-price">
19+
<each args="element.getRegion('price')" render="" />
20+
</td>
21+
<td class="col col-method"
22+
attr="'id': 'label_method_' + method.method_code + '_' + method.carrier_code"
23+
text="method.method_title" />
24+
<td class="col col-carrier"
25+
attr="'id': 'label_carrier_' + method.method_code + '_' + method.carrier_code"
26+
text="method.carrier_title" />
27+
</tr>
28+
<tr class="row row-error"
29+
if="method.error_message">
30+
<td class="col col-error" colspan="4">
31+
<div role="alert" class="message error">
32+
<div text="method.error_message"></div>
33+
</div>
34+
<span class="no-display">
35+
<input type="radio"
36+
attr="'value' : method.method_code, 'id': 's_method_' + method.method_code" />
37+
</span>
38+
</td>
39+
</tr>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<div id="checkout-shipping-method-load">
8+
<table class="table-checkout-shipping-method">
9+
<thead>
10+
<tr class="row">
11+
<th class="col col-method" translate="'Select Method'"></th>
12+
<th class="col col-price" translate="'Price'"></th>
13+
<th class="col col-method" translate="'Method Title'"></th>
14+
<th class="col col-carrier" translate="'Carrier Title'"></th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
<!-- ko foreach: { data: rates(), as: 'method'} -->
19+
<!--ko template: { name: element.shippingMethodItemTemplate} --><!-- /ko -->
20+
<!-- /ko -->
21+
</tbody>
22+
</table>
23+
</div>

0 commit comments

Comments
 (0)