christoph-schaeffer / dhl-business-shipping

An unofficial library for the DHL business shipping soap API (Version 3.3) and the dhl shipment tracking rest API written in PHP.
MIT License
29 stars 8 forks source link

Export Position #15

Closed marcelsatgithub closed 2 years ago

marcelsatgithub commented 2 years ago

Hey Christoph,

thanks for your project. How i add the export doc positions to the export doc object? In my example I get an error.

Thanks from Leipzig Marcel

------------ CODE ----------------------

$exportDocPosition = new \ChristophSchaeffer\Dhl\BusinessShipping\Resource\ShipmentOrder\Shipment\ExportDocument\ExportDocPosition;
$exportDocPosition->description = $description;
$exportDocPosition->countryCodeOrigin = $countryCodeOrigin;
$exportDocPosition->customsTariffNumber = $customsTariffNumber;
$exportDocPosition->amount = $amount;
$exportDocPosition->netWeightInKG = $netWeightInKG;
$exportDocPosition->customsValue = $customsValue;
$exportDocPositions = [0 => $exportDocPosition];

// document
$shipmentOrder->Shipment->ExportDocument->invoiceNumber = $invoiceNumber;
$shipmentOrder->Shipment->ExportDocument->exportType = ((string)self::EXPORT_TYPE_OTHER);
$shipmentOrder->Shipment->ExportDocument->exportTypeDescription = 'Permanent';
$shipmentOrder->Shipment->ExportDocument->termsOfTrade = ((string)self::TERMS_OF_TRADE_DDP);
$shipmentOrder->Shipment->ExportDocument->placeOfCommital = $placeOfCommital;
$shipmentOrder->Shipment->ExportDocument->exportDocPosition = $exportDocPositions;
$shipmentOrder->Shipment->ExportDocument->additionalFee = $additionalFee;

------------ ERROR ----------------------

[Status] => Array
(
    [0] => ChristophSchaeffer\Dhl\BusinessShipping\Response\Status\EmptyExportPositionDescription Object
        (
            [messageEnglish:protected] => Please enter a description.
            [messageGerman:protected] => Bitte geben Sie die Beschreibung an.
            [code] => 1101
            [text] => Hard validation error occured.
            [message] => Bitte geben Sie die Beschreibung an.
            [messageRaw] => Bitte geben Sie die Beschreibung an.
        )

    [1] => ChristophSchaeffer\Dhl\BusinessShipping\Response\Status\EmptyExportAmount Object
        (
            [messageEnglish:protected] => Please specify an amount.
            [messageGerman:protected] => Bitte geben Sie die Anzahl an.
            [code] => 1101
            [text] => Hard validation error occured.
            [message] => Bitte geben Sie die Anzahl an.
            [messageRaw] => Bitte geben Sie die Anzahl an.
        )

    [2] => ChristophSchaeffer\Dhl\BusinessShipping\Response\Status\EmptyCustomsValue Object
        (
            [messageEnglish:protected] => Please enter a customs value.
            [messageGerman:protected] => Bitte geben Sie den Warenwert an.
            [code] => 1101
            [text] => Hard validation error occured.
            [message] => Bitte geben Sie den Warenwert an.
            [messageRaw] => Bitte geben Sie den Warenwert an.
        )

    [3] => ChristophSchaeffer\Dhl\BusinessShipping\Response\Status\EmptyExportWeight Object
        (
            [messageEnglish:protected] => Please enter the weight.
            [messageGerman:protected] => Bitte geben Sie das Gewicht an.
            [code] => 1101
            [text] => Hard validation error occured.
            [message] => Bitte geben Sie das Gewicht an.
            [messageRaw] => Bitte geben Sie das Gewicht an.
        )

    [4] => ChristophSchaeffer\Dhl\BusinessShipping\Response\Status\InvalidExportDocPositionNetWeight Object
        (
            [messageEnglish:protected] => The weight/unit field for the items in the customs form must have the format 0.000 kg and contain a value greater than 0.
            [messageGerman:protected] => Das Feld Gewicht / Einheit für die Positionen im Zollformular muss das Format 0,000 kg aufweisen und einen Wert größer 0 enthalten.
            [code] => 1101
            [text] => Hard validation error occured.
            [message] => Das Feld Gewicht / Einheit für die Positionen im Zollformular muss das Format 0,000 kg aufweisen und einen Wert größer 0 enthalten.
            [messageRaw] => Das Feld Gewicht / Einheit muss das Format 0,000 kg aufweisen und einen Wert größer 0 enthalten.
        )

    [5] => ChristophSchaeffer\Dhl\BusinessShipping\Response\Status\UnknownError Object
        (
            [code] => 9999
            [messageEnglish:protected] => An unknown error has occurred
            [messageGerman:protected] => Ein Unbekannter Fehler ist aufgetreten
            [text] => Unknown error occurred
            [message] => Ein Unbekannter Fehler ist aufgetreten
            [messageRaw] => Bitte beachten Sie, dass der Service Vorausverfügung für Sendungen mit DHL Paket International verpflichtend ist.
        )

)
marcelsatgithub commented 2 years ago

a mistake has crept in:

$shipmentOrder->Shipment->ExportDocument->ExportDocPosition = $exportDocPositions;

Thanks