Skip to content

Commit

Permalink
fix bug with cancel and delete shipment
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Paul authored and Joshua Paul committed Jul 18, 2023
1 parent 22ca7e4 commit 37d5de3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
14 changes: 4 additions & 10 deletions docs/shipment/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,17 @@ $shipment = TerminalAfrica::trackShipment($shipmentId);
This method allows you to cancel a shipment before carrier pickup.

```php
$shipmentPayload = [
'shipment_id' => 'xxxxxxxxx'
];

$shipment = TerminalAfrica::cancelShipment($shipmentPayload);
$shipmentId = 'xxxxxxxxx';
$shipment = TerminalAfrica::cancelShipment($shipmentId);
```

## Delete Shipment

This method allows you to delete a draft shipment.

```php
$shipmentPayload = [
'shipment_id' => 'xxxxxxxxx'
];

$shipment = TerminalAfrica::deleteShipment($shipmentPayload);
$shipmentId = 'xxxxxxxxx';
$shipment = TerminalAfrica::deleteShipment($shipmentId);
```

## Arrange Pickup and Delivery for Shipment
Expand Down
12 changes: 10 additions & 2 deletions src/Traits/ShipmentApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ public function trackShipment(string $shipmentId): array
/**
* This method allows you to cancel a shipment.
*/
public function cancelShipment(array $formParams): array
public function cancelShipment(string $shipmentId): array
{
$endpoint = sprintf('%s/cancel', TerminalAfricaConstant::SHIPMENT_ENDPOINT);

$formParams = [
'shipment_id' => $shipmentId
];

return $this->makeRequest(
method: 'POST',
endpoint: $endpoint,
Expand All @@ -105,10 +109,14 @@ public function cancelShipment(array $formParams): array
/**
* This method allows you to delete a shipment.
*/
public function deleteShipment(array $formParams): array
public function deleteShipment(string $shipmentId): array
{
$endpoint = sprintf('%s', TerminalAfricaConstant::SHIPMENT_ENDPOINT);

$formParams = [
'shipment_id' => $shipmentId
];

return $this->makeRequest(
method: 'DELETE',
endpoint: $endpoint,
Expand Down

1 comment on commit 37d5de3

@vercel
Copy link

@vercel vercel bot commented on 37d5de3 Jul 18, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.