Skip to content

Commit

Permalink
feat!: remove src from namespace and deprecated items
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanveen committed Jan 31, 2025
1 parent 459d878 commit 353ace2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 25 additions & 2 deletions test/Bootstrap/ConsignmentTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ConsignmentTestCase extends TestCase
protected const API_KEY = 'api_key';
protected const AUTO_DETECT_PICKUP = 'auto_detect_pickup';
protected const CARRIER_ID = 'carrier_id';
/** @deprecated */
protected const CHECKOUT_DATA = 'checkout_data';
protected const CITY = 'city';
protected const COMPANY = 'company';
Expand Down Expand Up @@ -106,7 +105,31 @@ protected function addCheckoutData(array $data, AbstractConsignment $consignment
return;
}

$consignment->setPickupAddressFromCheckout($data[self::CHECKOUT_DATA]);
$checkoutData = json_decode($data[self::CHECKOUT_DATA], true);

if (! is_array($checkoutData) ||
! array_key_exists('location', $checkoutData)
) {
return;
}

if (null === $consignment->getDeliveryDate()) {
$consignment->setDeliveryDate($checkoutData['date']);
}

$consignment
->setDeliveryType(AbstractConsignment::DELIVERY_TYPE_PICKUP)
->setPickupPostalCode($checkoutData['postal_code'])
->setPickupStreet($checkoutData['street'])
->setPickupCity($checkoutData['city'])
->setPickupNumber($checkoutData['number'])
->setPickupCountry($checkoutData['cc'])
->setPickupLocationName($checkoutData['location'])
->setPickupLocationCode($checkoutData['location_code']);

if (isset($checkoutData['retail_network_id'])) {
$consignment->setRetailNetworkId($checkoutData['retail_network_id']);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/Model/MyParcelRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testGetHeaders(): void
);

$headers = $request->getHeaders();
self::assertContains('MyECommercePlatform/4.4.0', $headers['User-Agent']);
self::assertStringContainsString('MyECommercePlatform/4.4.0', $headers['User-Agent']);
}

/**
Expand Down

0 comments on commit 353ace2

Please sign in to comment.