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.
$cost = $wizard->getCost();
$cost
will return total cost with fuel surcharge (nett).
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.
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)