Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
$quote->getShippingAddress(),
[
'address_type' => 'shipping',
'email' => $quote->getCustomerEmail()
'email' => $quote->getCustomerEmail(),
'quote_address_id' => $quote->getShippingAddress()->getId()
]
);
$addresses[] = $shippingAddress;
Expand All @@ -474,7 +475,8 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
$quote->getBillingAddress(),
[
'address_type' => 'billing',
'email' => $quote->getCustomerEmail()
'email' => $quote->getCustomerEmail(),
'quote_address_id' => $quote->getBillingAddress()->getId()
]
);
$addresses[] = $billingAddress;
Expand Down
12 changes: 8 additions & 4 deletions app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ public function testSubmit()
$shippingAddress,
[
'address_type' => 'shipping',
'email' => '[email protected]'
'email' => '[email protected]',
'quote_address_id' => null
]
)
->willReturn($convertedShippingAddress);
Expand All @@ -571,7 +572,8 @@ public function testSubmit()
$billingAddress,
[
'address_type' => 'billing',
'email' => '[email protected]'
'email' => '[email protected]',
'quote_address_id' => null
]
)
->willReturn($convertedBillingAddress);
Expand Down Expand Up @@ -1013,7 +1015,8 @@ public function testSubmitForCustomer()
$shippingAddress,
[
'address_type' => 'shipping',
'email' => '[email protected]'
'email' => '[email protected]',
'quote_address_id' => null
]
)
->willReturn($convertedShippingAddress);
Expand All @@ -1023,7 +1026,8 @@ public function testSubmitForCustomer()
$billingAddress,
[
'address_type' => 'billing',
'email' => '[email protected]'
'email' => '[email protected]',
'quote_address_id' => null
]
)
->willReturn($convertedBillingAddress);
Expand Down
20 changes: 20 additions & 0 deletions app/code/Magento/Sales/Api/Data/OrderAddressInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ interface OrderAddressInterface extends \Magento\Framework\Api\ExtensibleDataInt
*/
const CUSTOMER_ADDRESS_ID = 'customer_address_id';

/**
* Quote address ID.
*/
const QUOTE_ADDRESS_ID = 'quote_address_id';

/**
* Region ID.
*/
Expand Down Expand Up @@ -181,6 +186,13 @@ public function getCountryId();
*/
public function getCustomerAddressId();

/**
* Gets the quote address ID for the order address.
*
* @return int|null Quote address ID.
*/
public function getQuoteAddressId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately you cannot add these new methods to an interface without breaking BC http://devdocs.magento.com/guides/v2.2/contributor-guide/backward-compatible-development/index.html#introduction-of-a-method-to-a-class-or-interface in this case I would recommend adding a new interface to handle these new methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okey, i didnt know that policy, i will implement your solution and update the PR as soon as i a can. Thanks!! @dmanners


/**
* Gets the customer ID for the order address.
*
Expand Down Expand Up @@ -352,6 +364,14 @@ public function setParentId($id);
*/
public function setCustomerAddressId($id);

/**
* Sets the quote address ID for the order address.
*
* @param int $addressId
* @return $this
*/
public function setQuoteAddressId($addressId);

/**
* Sets the region ID for the order address.
*
Expand Down
18 changes: 18 additions & 0 deletions app/code/Magento/Sales/Model/Order/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,16 @@ public function getCustomerAddressId()
return $this->getData(OrderAddressInterface::CUSTOMER_ADDRESS_ID);
}

/**
* Returns quote_address_id
*
* @return int
*/
public function getQuoteAddressId()
{
return $this->getData(OrderAddressInterface::QUOTE_ADDRESS_ID);
}

/**
* Returns customer_id
*
Expand Down Expand Up @@ -523,6 +533,14 @@ public function setCustomerAddressId($id)
return $this->setData(OrderAddressInterface::CUSTOMER_ADDRESS_ID, $id);
}

/**
* {@inheritdoc}
*/
public function setQuoteAddressId($addressId)
{
return $this->setData(OrderAddressInterface::QUOTE_ADDRESS_ID, $addressId);
}

/**
* {@inheritdoc}
*/
Expand Down