Skip to content

Commit c91e667

Browse files
authored
void label docs (#29)
1 parent a5a7b83 commit c91e667

6 files changed

Lines changed: 104 additions & 0 deletions

docs/addressesValidateExample.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Output
1212
The `validateAddresses` method returns an array of address validation result objects.
1313

1414
Example
15+
==============================
1516
```php
1617
use ShipEngine\ShipEngine;
1718
use ShipEngine\Message\ShipEngineException;

docs/createLabelFromRate.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Output
1212
The `createLabelFromRate` method returns the label that was created.
1313

1414
Example
15+
==============================
1516
```php
1617
use ShipEngine\ShipEngine;
1718
use ShipEngine\Message\ShipEngineException;

docs/createLabelFromShipmentDetailsExample.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Output
1111
The `createLabelFromShipmentDetails` method returns the label that was created.
1212

1313
Example
14+
==============================
1415
```php
1516
use ShipEngine\ShipEngine;
1617
use ShipEngine\Message\ShipEngineException;

docs/getRatesWithShipmentDetailsExample.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,64 @@ The `getRatesWithShipmentDetails` method returns the rates that were calculated
1212

1313
Example
1414
==============================
15+
```php
16+
use ShipEngine\ShipEngine;
17+
use ShipEngine\Message\ShipEngineException;
18+
19+
function getRatesWithShipmentDetailsDemoFunction() {
20+
$client = new ShipEngine('API-Key');
21+
22+
$details = [
23+
"rate_options" => [
24+
"carrier_ids" => [
25+
"se-423887"
26+
]
27+
],
28+
"shipment" => [
29+
"validate_address" => "no_validation",
30+
"ship_to" => [
31+
"name" => "Amanda Miller",
32+
"phone" => "555-555-5555",
33+
"address_line1" => "525 S Winchester Blvd",
34+
"city_locality" => "San Jose",
35+
"state_province" => "CA",
36+
"postal_code" => "95128",
37+
"country_code" => "US",
38+
"address_residential_indicator" => "yes"
39+
],
40+
"ship_from" => [
41+
"company_name" => "Example Corp.",
42+
"name" => "John Doe",
43+
"phone" => "111-111-1111",
44+
"address_line1" => "4008 Marathon Blvd",
45+
"address_line2" => "Suite 300",
46+
"city_locality" => "Austin",
47+
"state_province" => "TX",
48+
"postal_code" => "78756",
49+
"country_code" => "US",
50+
"address_residential_indicator" => "no"
51+
],
52+
"packages" => [
53+
[
54+
"weight" => [
55+
"value" => 1.0,
56+
"unit" => "ounce"
57+
]
58+
]
59+
]
60+
]
61+
];
62+
63+
try {
64+
print_r($client->getRatesWithShipmentDetails($details));
65+
} catch (ShipEngineException $e) {
66+
print_r($e -> getMessage());
67+
}
68+
}
69+
70+
getRatesWithShipmentDetailsDemoFunction();
71+
72+
```
1573

1674
### Array of Shipment Rates
1775
```php

docs/listCarriersExample.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Output
88
The `listCarriers` method returns an array of connected carrier accounts.
99

1010
Example
11+
==============================
1112
```php
1213
use ShipEngine\ShipEngine;
1314
use ShipEngine\Message\ShipEngineException;

docs/voidLabelExample.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Void Label With Label Id
2+
================================
3+
[ShipEngine](www.shipengine.com) allows you to attempt to void a previously purchased label. Please see [our docs](https://www.shipengine.com/docs/labels/voiding/) to learn more about voiding a label.
4+
5+
Input Parameters
6+
-------------------------------------
7+
8+
The `voidLabelWithLabelId` method accepts a string that contains the label Id that is being voided.
9+
10+
Output
11+
--------------------------------
12+
The `voidLabelWithLabelId` method returns an object that indicates the status of the void label request.
13+
14+
Example
15+
==============================
16+
```php
17+
use ShipEngine\ShipEngine;
18+
use ShipEngine\Message\ShipEngineException;
19+
20+
function voidLabelWithLabelIdDemoFunction() {
21+
$client = new ShipEngine('API-Key');
22+
try {
23+
print_r($client->voidLabelWithLabelId('se-75449505'));
24+
} catch (ShipEngineException $e) {
25+
print_r($e -> getMessage());
26+
}
27+
}
28+
29+
voidLabelWithLabelIdDemoFunction();
30+
```
31+
32+
Example Output
33+
-----------------------------------------------------
34+
35+
### Successful Void Label
36+
```php
37+
Array
38+
(
39+
[approved] =>
40+
[message] => No shipment found within the allowed void period
41+
)
42+
```

0 commit comments

Comments
 (0)