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

fix(shipment): include address2 in street #214

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion src/Shipment/Request/PostShipmentsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ private function getPickupLocation(Shipment $shipment): ?array
private function getRecipient(Shipment $shipment): array
{
$recipient = $shipment->recipient;
$street = trim(implode(' ', [$recipient->address1, $recipient->address2])) ?: null;
Mark-Ernst marked this conversation as resolved.
Show resolved Hide resolved

return Utils::filterNull([
'area' => $recipient->area,
Expand All @@ -272,7 +273,7 @@ private function getRecipient(Shipment $shipment): array
'postal_code' => $recipient->postalCode,
'region' => $recipient->region,
'state' => $recipient->state,
'street' => $recipient->address1,
'street' => $street,
'street_additional_info' => $recipient->address2,
'eori_number' => $recipient->eoriNumber,
'vat_number' => $recipient->vatNumber,
Expand Down
12 changes: 12 additions & 0 deletions tests/Unit/Shipment/Repository/CreateConceptsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@
],
],
],
'address with address1 and address2 combined' => [
'input' => [
[
'carrier' => ['id' => Carrier::CARRIER_POSTNL_ID],
'recipient' => array_merge(DEFAULT_INPUT_RECIPIENT, [
'address1' => 'Tuinstraat',
'address2' => '35',
]),
],
],
],

'simple domestic shipment' => [
'input' => [
[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"carrier": 1,
"general_settings": {
"save_recipient_address": 0
},
"options": {
"package_type": 1,
"delivery_type": 2
},
"physical_properties": {
"weight": 0
},
"recipient": {
"cc": "NL",
"city": "Hoofddorp",
"person": "Jaap Krekel",
"postal_code": "2132JE",
"street": "Tuinstraat 35",
"street_additional_info": "35"
}
}
]