Skip to content

Commit

Permalink
Merge pull request #372 from magento-folks/develop
Browse files Browse the repository at this point in the history
[Folks] Bug-fix (P0)
  • Loading branch information
irenelagno committed Jun 23, 2015
2 parents b6654ab + c9c44ae commit 0fecd76
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/code/Magento/Quote/Model/BillingAddressManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres
$shippingAddress = $quote->getShippingAddress()->importCustomerAddressData($addressData);
$shippingAddress->setSaveInAddressBook($saveInAddressBook);
}
} elseif ($quote->getCustomerId()) {
$address->setEmail($quote->getCustomerEmail());
}
$address->setSaveInAddressBook($saveInAddressBook);
$quote->setBillingAddress($address);
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Quote/Model/ShippingAddressManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres
if ($customerAddressId) {
$addressData = $this->addressRepository->getById($customerAddressId);
$address = $quote->getShippingAddress()->importCustomerAddressData($addressData);
} elseif ($quote->getCustomerId()) {
$address->setEmail($quote->getCustomerEmail());
}
$address->setSameAsBilling($sameAsBilling);
$address->setSaveInAddressBook($saveInAddressBook);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testSetAddress()
$addressData = [
'firstname' => 'John',
'lastname' => 'Smith',
'email' => '[email protected]',
'email' => '',
'company' => 'eBay Inc',
'street' => ['Typical Street', 'Tiny House 18'],
'city' => 'Big City',
Expand Down Expand Up @@ -134,6 +134,7 @@ public function testSetAddress()
$this->assertContains($streetLine, $quote->getBillingAddress()->getStreet());
}
unset($addressData['street']);
unset($addressData['email']);
$this->assertEquals('billing', $savedData['address_type']);
//check the rest of fields
foreach ($addressData as $key => $value) {
Expand Down Expand Up @@ -226,7 +227,6 @@ public function testSetMyAddress()
$addressData = [
'firstname' => 'John',
'lastname' => 'Smith',
'email' => '[email protected]',
'company' => 'eBay Inc',
'street' => ['Typical Street', 'Tiny House 18'],
'city' => 'Big City',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testSetAddress()
$addressData = [
'firstname' => 'John',
'lastname' => 'Smith',
'email' => '[email protected]',
'email' => '',
'company' => 'eBay Inc',
'street' => ['Typical Street', 'Tiny House 18'],
'city' => 'Big City',
Expand Down Expand Up @@ -143,6 +143,7 @@ public function testSetAddress()
$this->assertContains($streetLine, $quote->getBillingAddress()->getStreet());
}
unset($addressData['street']);
unset($addressData['email']);
$this->assertEquals('billing', $savedData['address_type']);
//check the rest of fields
foreach ($addressData as $key => $value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function testSetAddress()
$addressData = [
'firstname' => 'John',
'lastname' => 'Smith',
'email' => '[email protected]',
'email' => '',
'company' => 'eBay Inc',
'street' => ['Typical Street', 'Tiny House 18'],
'city' => 'Big City',
Expand Down Expand Up @@ -183,6 +183,7 @@ public function testSetAddress()
//custom checks for street, region and address_type
$this->assertEquals($addressData['street'], $quote->getShippingAddress()->getStreet());
unset($addressData['street']);
unset($addressData['email']);

$this->assertEquals('shipping', $savedData['address_type']);
//check the rest of fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function testSetAddress()
$addressData = [
'firstname' => 'John',
'lastname' => 'Smith',
'email' => '[email protected]',
'email' => '',
'company' => 'eBay Inc',
'street' => ['Typical Street', 'Tiny House 18'],
'city' => 'Big City',
Expand Down Expand Up @@ -158,6 +158,7 @@ public function testSetAddress()
//custom checks for street, region and address_type
$this->assertEquals($addressData['street'], $quote->getShippingAddress()->getStreet());
unset($addressData['street']);
unset($addressData['email']);

$this->assertEquals('shipping', $savedData['address_type']);
//check the rest of fields
Expand Down Expand Up @@ -306,7 +307,6 @@ public function testSetMyAddress()
$addressData = [
'firstname' => 'John',
'lastname' => 'Smith',
'email' => '[email protected]',
'company' => 'eBay Inc',
'street' => ['Typical Street', 'Tiny House 18'],
'city' => 'Big City',
Expand Down

0 comments on commit 0fecd76

Please sign in to comment.