Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getShippingAddress() to order interface (resolves #6919) #9125

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/code/Magento/Sales/Api/Data/OrderInterface.php
Expand Up @@ -1528,6 +1528,13 @@ public function setItems($items);
*/
public function getBillingAddress();

/**
* Gets the shipping address, if any, for the order.
*
* @return \Magento\Sales\Api\Data\OrderAddressInterface|null Shipping address. Otherwise, null.
*/
public function getShippingAddress();

/**
* Sets the billing address, if any, for the order.
*
Expand All @@ -1536,6 +1543,14 @@ public function getBillingAddress();
*/
public function setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $billingAddress = null);

/**
* Sets the shipping address, if any, for the order.
*
* @param \Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress
* @return $this
*/
public function setShippingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress = null);

/**
* Gets order payment
*
Expand Down
Expand Up @@ -39,7 +39,7 @@ public function testOrderGet()
'increment_id' => self::ORDER_INCREMENT_ID,
];
$expectedPayments = ['method' => 'checkmo'];
$expectedBillingAddressNotEmpty = [
$expectedAddressNotEmpty = [
'city',
'postcode',
'lastname',
Expand Down Expand Up @@ -78,8 +78,18 @@ public function testOrderGet()
}

$this->assertArrayHasKey('billing_address', $result);
foreach ($expectedBillingAddressNotEmpty as $field) {
$this->assertArrayHasKey($field, $result['billing_address']);
$this->assertArrayHasKey('shipping_address', $result);
foreach ($expectedAddressNotEmpty as $field) {
$this->assertArrayHasKey(
$field,
$result['billing_address'],
"Billing address should have field {$field}"
);
$this->assertArrayHasKey(
$field,
$result['shipping_address'],
"Shipping address should have field {$field}"
);
}

//check that nullable fields were marked as optional and were not sent
Expand Down