Skip to content

Commit

Permalink
Package version updates, FedEx create shipment fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmitrikeski committed Sep 3, 2024
1 parent a6212e2 commit 6634d19
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"ext-soap": "*",
"openlss/lib-array2xml": "^1.0",
"psr/log": "^3.0",
"illuminate/collections": "^10.0",
"illuminate/collections": "^10.0|^11.0",
"guzzlehttp/guzzle": "^7.6"
},
"require-dev": {
Expand Down
4 changes: 3 additions & 1 deletion src/ServiceProviders/ServiceCanadaPost/ServiceCanadaPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ public function ship(ShipFrom $shipFrom, ShipTo $shipTo, BoxCollection $boxes, S

$results = new ServiceProviderShipmentCollection();

$group = time();

/** @var BoxInterface $box */
foreach ($boxes as $box) {
// The weight of the parcel in kilograms. (99.999)
Expand All @@ -245,7 +247,7 @@ public function ship(ShipFrom $shipFrom, ShipTo $shipTo, BoxCollection $boxes, S
rsort($dimensions, SORT_NUMERIC);

$body = [
'group-id' => 'grp1',
'group-id' => $group,
'requested-shipping-point' => $shipFrom->address()->postalCode(),
'cpc-pickup-indicator' => true,
'expected-mailing-date' => $shipFrom->shipDate()->format('Y-m-d'),
Expand Down
10 changes: 7 additions & 3 deletions src/ServiceProviders/ServiceFedEx/ServiceFedEx.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ public function rate(Address $addressFrom, Address $addressTo, BoxCollection $bo
default => $e,
};
} catch (Exception $e) {
if (str_contains($e->getMessage(), 'credentials were not valid')) {
throw new InvalidCredentials('Invalid ' . self::NAME . ' credentials');
}

throw $e;
}

Expand Down Expand Up @@ -328,8 +332,8 @@ public function ship(ShipFrom $shipFrom, ShipTo $shipTo, BoxCollection $boxes, S
"shipper" => [
"contact" => [
"personName" => $shipFrom->name(),
"phoneNumber" => $shipFrom->phone(),
"phoneExtension" => $shipFrom->phone()->extension(),
"phoneNumber" => $shipFrom->phone() . '',
"phoneExtension" => $shipFrom->phone()->extension() . '',
"emailAddress" => $shipFrom->email(),
"company" => $shipFrom->company(),
],
Expand All @@ -348,7 +352,7 @@ public function ship(ShipFrom $shipFrom, ShipTo $shipTo, BoxCollection $boxes, S
[
"contact" => [
"personName" => $shipTo->name(),
"phoneNumber" => $shipTo->phone(),
"phoneNumber" => $shipTo->phone() . '',
"emailAddress" => $shipFrom->email(),
"company" => $shipFrom->company(),
],
Expand Down
3 changes: 2 additions & 1 deletion src/ServiceProviders/ServiceFlat/ServiceFlat.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Mitrik\Shipping\ServiceProviders\ServiceProviderRate\ServiceProviderRateCollection;
use Mitrik\Shipping\ServiceProviders\ServiceProviderService\ServiceProviderService;
use Mitrik\Shipping\ServiceProviders\ServiceProviderShipment\ServiceProviderShipmentCollection;
use Mitrik\Shipping\ServiceProviders\ServiceProviderShipment\ServiceProviderShipmentCustomsValue;
use Mitrik\Shipping\ServiceProviders\ShipFrom\ShipFrom;
use Mitrik\Shipping\ServiceProviders\ShipTo\ShipTo;

Expand Down Expand Up @@ -149,7 +150,7 @@ public function rate(Address $addressFrom, Address $addressTo, BoxCollection $bo
return $results;
}

public function ship(ShipFrom $shipFrom, ShipTo $shipTo, BoxCollection $boxes, ServiceProviderService $serviceProviderService): ServiceProviderShipmentCollection
public function ship(ShipFrom $shipFrom, ShipTo $shipTo, BoxCollection $boxes, ServiceProviderService $serviceProviderService, ServiceProviderShipmentCustomsValue|null $serviceProviderShipmentCustomsValue = null, $customData = []): ServiceProviderShipmentCollection
{
throw new \Exception('Not implemented yet.');
}
Expand Down

0 comments on commit 6634d19

Please sign in to comment.