Skip to content

Commit 4b3021a

Browse files
committed
MAGETWO-57461: [Backport] - Exception occurs when tracking shipment with invalid FedEx tracking number - for 2.0.x
2 parents aa55542 + ece763f commit 4b3021a

File tree

21 files changed

+504
-229
lines changed

21 files changed

+504
-229
lines changed

app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,19 @@ public function execute()
5252
$user->setPassword($password);
5353
$user->setPasswordConfirmation($passwordConfirmation);
5454
}
55-
$user->save();
56-
/** Send password reset email notification only when password was changed */
57-
if ($password !== '') {
58-
$user->sendPasswordResetNotificationEmail();
55+
$errors = $user->validate();
56+
if ($errors !== true && !empty($errors)) {
57+
foreach ($errors as $error) {
58+
$this->messageManager->addError($error);
59+
}
60+
} else {
61+
$user->save();
62+
/** Send password reset email notification only when password was changed */
63+
if ($password !== '') {
64+
$user->sendPasswordResetNotificationEmail();
65+
}
66+
$this->messageManager->addSuccess(__('You saved the account.'));
5967
}
60-
$this->messageManager->addSuccess(__('You saved the account.'));
6168
} catch (ValidatorException $e) {
6269
$this->messageManager->addMessages($e->getMessages());
6370
if ($e->getMessage()) {

app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ protected function setUp()
7676
$this->_userMock = $this->getMockBuilder('Magento\User\Model\User')
7777
->disableOriginalConstructor()
7878
->setMethods(
79-
['load', 'save', 'sendPasswordResetNotificationEmail', 'verifyIdentity', '__sleep', '__wakeup']
79+
[
80+
'load', 'save', 'sendPasswordResetNotificationEmail',
81+
'verifyIdentity', 'validate', '__sleep', '__wakeup'
82+
]
8083
)
8184
->getMock();
8285

@@ -193,6 +196,7 @@ public function testSaveAction()
193196

194197
$this->_userMock->expects($this->once())->method('save');
195198
$this->_userMock->expects($this->once())->method('verifyIdentity')->will($this->returnValue(true));
199+
$this->_userMock->expects($this->once())->method('validate')->willReturn(true);
196200
$this->_userMock->expects($this->once())->method('sendPasswordResetNotificationEmail');
197201

198202
$this->_requestMock->setParams($requestParams);

app/code/Magento/Checkout/view/frontend/web/js/model/address-converter.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,25 @@ define(
116116

117117
addressToEstimationAddress: function (address) {
118118
var estimatedAddressData = {
119-
country_id: address.countryId,
120-
region: address.region,
121-
region_id: address.regionId,
122-
postcode: address.postcode
119+
'street': address.street,
120+
'city': address.city,
121+
'region_id': address.regionId,
122+
'region': address.region,
123+
'country_id': address.countryId,
124+
'postcode': address.postcode,
125+
'email': address.email,
126+
'customer_id': address.customerId,
127+
'firstname': address.firstname,
128+
'lastname': address.lastname,
129+
'middlename': address.middlename,
130+
'prefix': address.prefix,
131+
'suffix': address.suffix,
132+
'vat_id': address.vatId,
133+
'company': address.company,
134+
'telephone': address.telephone,
135+
'fax': address.fax,
136+
'custom_attributes': address.customAttributes
137+
123138
};
124139
return this.formAddressDataToQuoteAddress(estimatedAddressData);
125140
}

app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@ define(
2525
serviceUrl = resourceUrlManager.getUrlForEstimationShippingMethodsForNewAddress(quote),
2626
payload = JSON.stringify({
2727
address: {
28-
country_id: address.countryId,
29-
region_id: address.regionId,
30-
region: address.region,
31-
postcode: address.postcode
28+
'street': address.street,
29+
'city': address.city,
30+
'region_id': address.regionId,
31+
'region': address.region,
32+
'country_id': address.countryId,
33+
'postcode': address.postcode,
34+
'email': address.email,
35+
'customer_id': address.customerId,
36+
'firstname': address.firstname,
37+
'lastname': address.lastname,
38+
'middlename': address.middlename,
39+
'prefix': address.prefix,
40+
'suffix': address.suffix,
41+
'vat_id': address.vatId,
42+
'company': address.company,
43+
'telephone': address.telephone,
44+
'fax': address.fax,
45+
'custom_attributes': address.customAttributes,
46+
'save_in_address_book': address.saveInAddressBook
3247
}
3348
}
3449
);

app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validation-rules.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ define(
1515
},
1616
'country_id': {
1717
'required': true
18+
},
19+
'city': {
20+
'required': true
1821
}
1922
};
2023
}

app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validation-rules.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ define(
1515
},
1616
'country_id': {
1717
'required': true
18+
},
19+
'city': {
20+
'required': true
1821
}
1922
};
2023
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Quote\Api;
7+
8+
/**
9+
* Interface GuestShipmentEstimationInterface
10+
* @api
11+
*/
12+
interface GuestShipmentEstimationInterface extends ShipmentEstimationInterface
13+
{
14+
15+
}

app/code/Magento/Quote/Api/GuestShippingMethodManagementInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function getList($cartId);
2727
* @param string $cartId The shopping cart ID.
2828
* @param \Magento\Quote\Api\Data\EstimateAddressInterface $address The estimate address
2929
* @return \Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods.
30+
* @deprecated
3031
*/
3132
public function estimateByAddress($cartId, \Magento\Quote\Api\Data\EstimateAddressInterface $address);
3233
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Quote\Api;
7+
8+
use Magento\Quote\Api\Data\AddressInterface;
9+
10+
/**
11+
* Interface ShipmentManagementInterface
12+
* @api
13+
*/
14+
interface ShipmentEstimationInterface
15+
{
16+
/**
17+
* Estimate shipping by address and return list of available shipping methods
18+
* @param mixed $cartId
19+
* @param AddressInterface $address
20+
* @return \Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods
21+
*/
22+
public function estimateByExtendedAddress($cartId, AddressInterface $address);
23+
}

app/code/Magento/Quote/Api/ShippingMethodManagementInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface ShippingMethodManagementInterface
1717
* @param int $cartId The shopping cart ID.
1818
* @param \Magento\Quote\Api\Data\EstimateAddressInterface $address The estimate address
1919
* @return \Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods.
20+
* @deprecated
2021
*/
2122
public function estimateByAddress($cartId, \Magento\Quote\Api\Data\EstimateAddressInterface $address);
2223

0 commit comments

Comments
 (0)