Add second example
This commit is contained in:
parent
c1bc760601
commit
fe10b4cf12
16
README.md
16
README.md
@ -16,6 +16,22 @@ $retail_rate = RetailPriceChart::getPrice(
|
||||
true);
|
||||
```
|
||||
|
||||
More complete example for getting the retail rate from EasyPost, then falling back to this tool if possible:
|
||||
```php
|
||||
$retail_rate = $rate->retail_rate ?? ($rate->list_rate ?? $rate->rate);
|
||||
if ($rate->carrier == "USPS" && ($rate->retail_rate == $rate->rate) && ($rate->service == "Priority" || $rate->service == "GroundAdvantage")) {
|
||||
// EasyPost not providing retail rate, let's look it up ourselves
|
||||
if ($shipment->parcel->predefined_package == null) {
|
||||
try {
|
||||
$retail_rate = RetailPriceChart::getPrice($shipment->parcel->weight, $shipment->usps_zone, $rate->service,
|
||||
[$shipment->parcel->length, $shipment->parcel->width, $shipment->parcel->height], true);
|
||||
} catch (Exception $ex) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
```php
|
||||
|
Loading…
x
Reference in New Issue
Block a user