Skip to content

Latest commit

 

History

History
62 lines (39 loc) · 1.33 KB

cost.md

File metadata and controls

62 lines (39 loc) · 1.33 KB

Shipment cost

You can check shipment cost event before shipment is created.

Please use ShipmentWizard and set all of required options. Let's assume you have prepared wizard handled by $wizard variable.

FROM WIZARD

$cost = $wizard->getCost();

$cost will return total cost with fuel surcharge (nett).

FROM STORED SHIPMENT

use xGrz\Dhl24\Facades\DHL24;

$cost = DHL24::wizard(DHLShipment)->getCost();

$cost will return total cost with fuel surcharge (nett).

Received cost will be stored in DHLShipment->cost automatically.

DETAILED COST

You can get cost details by a little harder way.

PREPARE WIZARD as mention in ShipmentWizard docs.

use xGrz\Dhl24\Facades\DHL24;
$wizard DHL24::wizard()
    // -> ...

or open existing shipment in Wizard:

use xGrz\Dhl24\Facades\DHL24;
use xGrz\Dhl24\Models\DHLShipment;

$wizard DHL24::wizard(DHLShipment::first());

Get cost action:

$cost = (new \xGrz\Dhl24\Actions\Cost($wizard));

Now you can check some additional cost information on $cost object:

  • $cost->basePrice() (float) cost without fuel surcharge (nett)
  • $cost->price() (float) total cost (nett) with fuel surcharge
  • $cost->fuelSurcharge() (float) fuel surcharge (amount)
  • $cost->fuelSurchargePercent() (float) fuel surcharge (percent)