Skip to content

Commit 85d8015

Browse files
author
Ievgen Shakhsuvarov
committed
Merge branch 'MAGETWO-32078-CheckoutAgreements' of github.corp.ebay.com:magento-folks/magento2ce into develop
2 parents cd25f92 + dcb356c commit 85d8015

File tree

8 files changed

+25
-17
lines changed

8 files changed

+25
-17
lines changed

app/code/Magento/Bundle/Model/Plugin/QuoteItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function aroundConvert(
2323
\Magento\Quote\Model\Quote\Item\ToOrderItem $subject,
2424
Closure $proceed,
2525
\Magento\Quote\Model\Quote\Item\AbstractItem $item,
26-
$additional
26+
$additional = []
2727
) {
2828
/** @var $orderItem \Magento\Sales\Model\Order\Item */
2929
$orderItem = $proceed($item, $additional);

app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
<script>
4646
require([
4747
"jquery",
48-
"mage/mage"
48+
"mage/mage",
49+
"Magento_Catalog/product/view/validation"
4950
], function($){
5051
$('#product_addtocart_form').mage('validation', {
5152
radioCheckboxClosest: '.nested'

app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ define([
3737
var isAgreementValid = true;
3838
agreementFormsGroup.find('form').each(
3939
function(){
40-
$(this).validation();
41-
isAgreementValid = isAgreementValid && $(this).validation && $(this).validation('isValid');
40+
isAgreementValid = $(this).validation() && $(this).validation('isValid') && isAgreementValid;
4241
}
4342
);
4443

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ define([
1111
"mage/translate"
1212
], function($){
1313
"use strict";
14-
14+
1515
$.widget('mage.orderOverview', {
1616
options: {
1717
opacity: 0.5, // CSS opacity for the 'Place Order' button when it's clicked and then disabled.
1818
pleaseWaitLoader: 'span.please-wait', // 'Submitting order information...' Ajax loader.
19-
placeOrderSubmit: 'button[type="submit"]', // The 'Place Order' button.
20-
agreements: '#checkout-agreements' // Container for all of the checkout agreements and terms/conditions
19+
placeOrderSubmit: 'button[type="submit"]' // The 'Place Order' button.
2120
},
2221

2322
/**
@@ -29,21 +28,19 @@ define([
2928
},
3029

3130
/**
32-
* Verify that all agreements and terms/conditions are checked. Show the Ajax loader. Disable
33-
* the submit button (i.e. Place Order).
31+
* Show the Ajax loader. Disable the submit button (i.e. Place Order).
3432
* @return {Boolean}
3533
* @private
3634
*/
3735
_showLoader: function() {
38-
if ($(this.options.agreements).find('input[type="checkbox"]:not(:checked)').length > 0) {
39-
alert($.mage.__('Please agree to all Terms and Conditions before placing the orders.'));
36+
if (!this.element.validation('isValid')) {
4037
return false;
4138
}
4239
this.element.find(this.options.pleaseWaitLoader).show().end()
4340
.find(this.options.placeOrderSubmit).prop('disabled', true).css('opacity', this.options.opacity);
4441
return true;
4542
}
4643
});
47-
44+
4845
return $.mage.orderOverview;
4946
});

app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,10 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address)
604604
if ($address->getAddressType() == 'billing') {
605605
$order->setIsVirtual(1);
606606
} else {
607-
$order->setShippingAddress($this->quoteAddressToOrderAddress->addressToOrderAddress($address));
607+
$order->setShippingAddress($this->quoteAddressToOrderAddress->convert($address));
608608
}
609609

610-
$order->setPayment($this->quotePaymentToOrderPayment->paymentToOrderPayment($quote->getPayment()));
610+
$order->setPayment($this->quotePaymentToOrderPayment->convert($quote->getPayment()));
611611
if ($this->priceCurrency->round($address->getGrandTotal()) == 0) {
612612
$order->getPayment()->setMethod('free');
613613
}
@@ -622,7 +622,7 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address)
622622
)->setProductOptions(
623623
$_quoteItem->getProduct()->getTypeInstance()->getOrderOptions($_quoteItem->getProduct())
624624
);
625-
$orderItem = $this->quoteItemToOrderItem->itemToOrderItem($item);
625+
$orderItem = $this->quoteItemToOrderItem->convert($_quoteItem);
626626
if ($item->getParentItem()) {
627627
$orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
628628
}

app/code/Magento/Multishipping/view/frontend/templates/checkout/overview.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66
?>
7-
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="review-order-form" data-mage-init='{"orderOverview": {}}' class="form multicheckout order-review">
7+
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="review-order-form" data-mage-init='{"orderOverview": {}, "validation":{}}' class="form multicheckout order-review">
88
<?php echo $this->getBlockHtml('formkey'); ?>
99
<div class="block block-billing">
1010
<div class="block-title"><strong><?php echo __('Billing Information') ?></strong></div>

app/code/Magento/Tax/Model/Quote/ToOrderConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ToOrderConverter
2222
* @param array $additional
2323
* @return array
2424
*/
25-
public function beforeConvert(QuoteAddressToOrder $subject, QuoteAddress $address, $additional)
25+
public function beforeConvert(QuoteAddressToOrder $subject, QuoteAddress $address, $additional = [])
2626
{
2727
$this->quoteAddress = $address;
2828
return [$address, $additional];

dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerInjectable.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class CustomerInjectable extends AbstractRepository
1919
* @param array $defaultData
2020
*
2121
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
22+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
2223
*/
2324
public function __construct(array $defaultConfig = [], array $defaultData = [])
2425
{
@@ -116,5 +117,15 @@ public function __construct(array $defaultConfig = [], array $defaultData = [])
116117
'password_confirmation' => '123123q',
117118
'address' => ['presets' => 'US_address_TX'],
118119
];
120+
121+
$this->_data['johndoe_with_multiple_addresses'] = [
122+
'firstname' => 'John',
123+
'lastname' => 'Doe',
124+
'group_id' => ['dataSet' => 'General'],
125+
'email' => 'JohnDoe_%isolation%@example.com',
126+
'password' => '123123q',
127+
'password_confirmation' => '123123q',
128+
'address' => ['presets' => 'US_address_NY, US_address'],
129+
];
119130
}
120131
}

0 commit comments

Comments
 (0)