Basic DHL implementation, Refactor redundant code
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Bank
|
||||
{
|
||||
public string $accountOwner;
|
||||
public string $bankName;
|
||||
public string $iban;
|
||||
public string $note1;
|
||||
public string $note2;
|
||||
public ?string $bic;
|
||||
public ?string $accountreference;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Communication
|
||||
{
|
||||
public ?string $phone;
|
||||
public ?string $email;
|
||||
public ?string $contactPerson;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Contact
|
||||
{
|
||||
public ?Communication $Communication;
|
||||
public ?NativeAddress $Address;
|
||||
public ?Name $Name;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Country
|
||||
{
|
||||
public ?string $country;
|
||||
public string $countryISOCode;
|
||||
public ?string $state;
|
||||
|
||||
public static function Create(string $isoCode, ?string $state = null):Country {
|
||||
$obj = new Country();
|
||||
$obj->countryISOCode = $isoCode;
|
||||
$obj->state = $state;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class CreateShipmentOrderRequest
|
||||
{
|
||||
public Version $Version;
|
||||
public ShipmentOrder $ShipmentOrder;
|
||||
public ?string $labelResponseType;
|
||||
public ?string $groupProfileName;
|
||||
public ?string $labelFormat;
|
||||
public ?string $labelFormatRetoure;
|
||||
public ?string $combinedPrinting;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class CreateShipmentOrderResponse
|
||||
{
|
||||
public Version $Version;
|
||||
public Statusinformation $Status;
|
||||
public ?CreationState $CreationState;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class CreationState
|
||||
{
|
||||
public string $sequenceNumber;
|
||||
public ?string $shipmentNumber;
|
||||
public ?string $returnShipmentNumber;
|
||||
public LabelData $LabelData;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Customer
|
||||
{
|
||||
public Name $Name;
|
||||
public ?string $vatID;
|
||||
public string $EKP;
|
||||
public NativeAddress $Address;
|
||||
public Contact $Contact;
|
||||
public ?Bank $Bank;
|
||||
public ?string $note;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeleteShipmentOrderRequest
|
||||
{
|
||||
public Version $Version;
|
||||
public string $shipmentNumber;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeleteShipmentOrderResponse
|
||||
{
|
||||
public Version $Version;
|
||||
public Statusinformation $Status;
|
||||
public ?DeletionState $DeletionState;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeletionState
|
||||
{
|
||||
public string $shipmentNumber;
|
||||
public Statusinformation $Status;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeliveryAddress
|
||||
{
|
||||
public ?NativeAddress $NativeAddress;
|
||||
public ?Postfiliale $PostOffice;
|
||||
public ?PackStation $PackStation;
|
||||
public ?string $streetNameCode;
|
||||
public ?string $streetNumberCode;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Dimension
|
||||
{
|
||||
public int $length;
|
||||
public int $width;
|
||||
public int $height;
|
||||
public ?string $unit;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ExportDocPosition
|
||||
{
|
||||
public string $description;
|
||||
public string $countryCodeOrigin;
|
||||
public string $customsTariffNumber;
|
||||
public int $amount;
|
||||
public float $netWeightInKG;
|
||||
public float $customsValue;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ExportDocument
|
||||
{
|
||||
const TYPE_PRESENT = 'PRESENT';
|
||||
const TYPE_DOCUMENT = 'DOCUMENT';
|
||||
const TYPE_COMMERCIAL_GOODS = 'COMMERCIAL_GOODS';
|
||||
const TYPE_COMMERCIAL_SAMPLE = 'COMMERCIAL_SAMPLE';
|
||||
const TYPE_RETURN_OF_GOODS= 'RETURN_OF_GOODS';
|
||||
const TYPE_OTHER = 'OTHER';
|
||||
|
||||
const TERMS_DDP = 'DDP';
|
||||
const TERMS_DXV = 'DXV';
|
||||
const TERMS_DAP = 'DAP';
|
||||
const TERMS_DDX = 'DDX';
|
||||
const TERMS_CPT = 'CPT';
|
||||
|
||||
public ?string $invoiceNumber;
|
||||
public string $exportType;
|
||||
public ?string $exportTypeDescription;
|
||||
public ?string $termsOfTrade;
|
||||
public string $placeOfCommital;
|
||||
public ?float $additionalFee;
|
||||
public ?string $customsCurrency;
|
||||
public ?string $permitNumber;
|
||||
public ?string $attestationNumber;
|
||||
public ?string $addresseesCustomsReference;
|
||||
public ?string $sendersCustomsReference;
|
||||
public ?bool $WithElectronicExportNtfctn;
|
||||
/** @var ExportDocPosition[] $ExportDocPosition */
|
||||
public array $ExportDocPosition;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class LabelData
|
||||
{
|
||||
public Statusinformation $Status;
|
||||
public ?string $shipmentNumber;
|
||||
public ?string $labelUrl;
|
||||
public ?string $labelData;
|
||||
public ?string $returnLabelUrl;
|
||||
public ?string $returnLabelData;
|
||||
public ?string $exportLabelUrl;
|
||||
public ?string $exportLabelData;
|
||||
public ?string $codLabelUrl;
|
||||
public ?string $codLabelData;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Name
|
||||
{
|
||||
public string $name1;
|
||||
public ?string $name2;
|
||||
public ?string $name3;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class NativeAddress
|
||||
{
|
||||
public string $streetName;
|
||||
public ?string $streetNumber;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public array $addressAddition;
|
||||
public ?string $dispatchingInformation;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?string $province;
|
||||
public ?Country $Origin;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class NativeAddressNew
|
||||
{
|
||||
public string $streetName;
|
||||
public ?string $streetNumber;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?Country $Origin;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class PackStation
|
||||
{
|
||||
public string $postNumber;
|
||||
public string $packstationNumber;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?string $province;
|
||||
public ?Country $Origin;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Postfiliale
|
||||
{
|
||||
public string $postfilialeNumber;
|
||||
public string $postNumber;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?Country $Origin;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Receiver
|
||||
{
|
||||
public string $name1;
|
||||
public ?NativeAddress $Address;
|
||||
public ?PackStation $Packstation;
|
||||
public ?Postfiliale $Postfiliale;
|
||||
public ?Communication $Communication;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Shipment
|
||||
{
|
||||
public ShipmentDetails $ShipmentDetails;
|
||||
public Shipper $Shipper;
|
||||
public string $ShipperReference;
|
||||
public Receiver $Receiver;
|
||||
public ?Shipper $ReturnReceiver;
|
||||
public ?ExportDocument $ExportDocument;
|
||||
public ?string $feederSystem;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ShipmentDetails = new ShipmentDetails();
|
||||
$this->Shipper = new Shipper();
|
||||
$this->ShipperReference = '';
|
||||
$this->Receiver = new Receiver();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
class ShipmentDetails
|
||||
{
|
||||
public string $product;
|
||||
public string $accountNumber;
|
||||
public string $customerReference;
|
||||
private string $shipmentDate;
|
||||
public string $costCentre;
|
||||
public string $returnShipmentAccountNumber;
|
||||
public string $returnShipmentReference;
|
||||
public ShipmentItem $ShipmentItem;
|
||||
public ShipmentService $Service;
|
||||
public ShipmentNotification $Notification;
|
||||
public Bank $BankData;
|
||||
|
||||
public function SetShipmentDate(DateTimeImmutable $date): void {
|
||||
$this->shipmentDate = $date->format('Y-m-d');
|
||||
}
|
||||
|
||||
public function GetShipmentDate(): DateTimeImmutable {
|
||||
return DateTimeImmutable::createFromFormat('Y-m-d', $this->shipmentDate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentItem
|
||||
{
|
||||
public float $weightInKG;
|
||||
public ?int $lengthInCM;
|
||||
public ?int $widthInCM;
|
||||
public ?int $heightInCM;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentNotification
|
||||
{
|
||||
public string $recipientEmailAddress;
|
||||
public ?string $templateId;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentOrder
|
||||
{
|
||||
public string $sequenceNumber;
|
||||
public Shipment $Shipment;
|
||||
public ?Serviceconfiguration $PrintOnlyIfCodeable;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentService
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Shipper
|
||||
{
|
||||
public Name $Name;
|
||||
public NativeAddressNew $Address;
|
||||
public ?Communication $Communication;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->Name = new Name();
|
||||
$this->Address = new NativeAddressNew();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Status
|
||||
{
|
||||
public string $statuscode;
|
||||
public string $statusDescription;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class StatusElement
|
||||
{
|
||||
public string $statusElement;
|
||||
public string $statusMessage;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Statusinformation
|
||||
{
|
||||
public int $statusCode;
|
||||
public string $statusText;
|
||||
public array|string $statusMessage;
|
||||
public string $statusType;
|
||||
public StatusElement $errorMessage;
|
||||
public StatusElement $warningMessage;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Version
|
||||
{
|
||||
public string $majorRelease;
|
||||
public string $minorRelease;
|
||||
public ?string $build;
|
||||
}
|
||||
Reference in New Issue
Block a user