DHL: First test candidate ;-)

This commit is contained in:
Andreas Palm 2022-11-22 00:21:57 +01:00
parent 8ad45ed723
commit c37f0d3847
11 changed files with 5674 additions and 157 deletions

View File

@ -5,7 +5,7 @@ namespace Xentral\Carrier\Dhl\Data;
class Receiver
{
public string $name1;
public ?NativeAddress $Address;
public ?ReceiverNativeAddress $Address;
public ?PackStation $Packstation;
public ?Postfiliale $Postfiliale;
public ?Communication $Communication;

View File

@ -0,0 +1,17 @@
<?php
namespace Xentral\Carrier\Dhl\Data;
class ReceiverNativeAddress
{
public ?string $name2;
public ?string $name3;
public string $streetName;
public ?string $streetNumber;
public array|string|null $addressAddition;
public ?string $dispatchingInformation;
public string $zip;
public string $city;
public ?string $province;
public ?Country $Origin;
}

View File

@ -24,9 +24,9 @@ class DhlApi
public function __construct(string $user, string $signature)
{
$this->soapClient = new SoapClient(__DIR__ . '/Wsdl/geschaeftskundenversand-api-3.4.0.wsdl', [
'login' => 'ewsp',
'password' => 'rZ*twrzJ5@wr&$',
'location' => self::SANDBOX_URL,
'login' => 'OpenXE_1',
'password' => 'cjzNEpGXxbbnRwcYLISX3ZTTcQrQrz',
'location' => self::PRODUCTION_URL,
'trace' => 1,
'connection_timeout' => 30,
'classmap' => [

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,340 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Version: 3.4.0
Date: 2022-08-01T22:00:51Z
--><wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:cis="http://dhl.de/webservice/cisbase"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:bcs="http://dhl.de/webservices/businesscustomershipping/3.0"
targetNamespace="http://dhl.de/webservices/businesscustomershipping/3.0">
<wsdl:types>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xs:import namespace="http://dhl.de/webservice/cisbase"
schemaLocation="geschaeftskundenversand-api-3.4.0-schema-cis_base.xsd"/>
<xs:import namespace="http://dhl.de/webservices/businesscustomershipping/3.0"
schemaLocation="geschaeftskundenversand-api-3.4.0-schema-bcs_base.xsd"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="AuthentificationHeaderMessage">
<wsdl:documentation>The authentication data.</wsdl:documentation>
<wsdl:part name="header" element="cis:Authentification"/>
</wsdl:message>
<wsdl:message name="createShipmentOrderMessage">
<wsdl:documentation>The shipmentdata for creating a shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:CreateShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="createShipmentOrderResponseMessage">
<wsdl:documentation>The status of the createShipment operation and the identifier for the
shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:CreateShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="validateShipmentMessage">
<wsdl:documentation>The shipmentdata for validating a shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:ValidateShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="validateShipmentResponseMessage">
<wsdl:documentation>The status of the validateShipment operation and the identifier for the
shipment.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:ValidateShipmentResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="deleteShipmentOrderMessage">
<wsdl:documentation>The identifier for the shipment which should be
deleted.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DeleteShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="deleteShipmentOrderResponseMessage">
<wsdl:documentation>The status of the deletion operation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DeleteShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="doManifestMessage">
<wsdl:documentation>The identifier for the shipment which should be
manifested.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DoManifestRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="doManifestResponseMessage">
<wsdl:documentation>The status of the manifest operation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:DoManifestResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getLabelMessage">
<wsdl:documentation>The identifier for the DD shipment for which the label url is
requested.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetLabelRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getLabelResponseMessage">
<wsdl:documentation>The status of the operation and the label url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetLabelResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getVersionRequestMessage">
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:Version"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getVersionResponseMessage">
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetVersionResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getExportDocMessage">
<wsdl:documentation>The identifier for the DD shipment for which the label url is
requested.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetExportDocRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getExportDocResponseMessage">
<wsdl:documentation>The status of the operation and the label url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetExportDocResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getManifestRequestMessage">
<wsdl:documentation>Request a manifest of the given date / date range.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetManifestRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="getManifestResponseMessage">
<wsdl:documentation>The status of the operation and the manifest url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:GetManifestResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="updateShipmentOrderRequestMessage">
<wsdl:documentation>Request a manifest of the given date / date range.</wsdl:documentation>
<wsdl:part name="part1" element="bcs:UpdateShipmentOrderRequest"> </wsdl:part>
</wsdl:message>
<wsdl:message name="updateShipmentOrderResponseMessage">
<wsdl:documentation>The status of the operation and the manifest url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:UpdateShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:message name="readShipmentOrderResponseMessage">
<wsdl:documentation>The status of the operation and the manifest url (if
available).</wsdl:documentation>
<wsdl:part name="part1" element="bcs:ReadShipmentOrderResponse"> </wsdl:part>
</wsdl:message>
<wsdl:portType name="GKV3XAPIServicePortType">
<wsdl:operation name="createShipmentOrder">
<wsdl:documentation>Creates shipments.</wsdl:documentation>
<wsdl:input message="bcs:createShipmentOrderMessage">
<wsdl:documentation>The shipment data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:createShipmentOrderResponseMessage">
<wsdl:documentation>The status of the createShipment operation and the identifier for the
shipment.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="validateShipment">
<wsdl:documentation>Creates shipments.</wsdl:documentation>
<wsdl:input message="bcs:validateShipmentMessage">
<wsdl:documentation>The shipment data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:validateShipmentResponseMessage">
<wsdl:documentation>The status of the validateShipment operation and the identifier for the
shipment.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="deleteShipmentOrder">
<wsdl:documentation>Deletes the requested shipments.</wsdl:documentation>
<wsdl:input message="bcs:deleteShipmentOrderMessage">
<wsdl:documentation>The identifier for the shipment which should be
deleted.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:deleteShipmentOrderResponseMessage">
<wsdl:documentation>The status of the deletion operation.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doManifest">
<wsdl:documentation>Manifest the requested DD shipments.</wsdl:documentation>
<wsdl:input message="bcs:doManifestMessage">
<wsdl:documentation>The identifier for the shipment which should be
manifested.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:doManifestResponseMessage">
<wsdl:documentation>The status of the manifest operation.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getLabel">
<wsdl:documentation>Returns the request-url for getting a label.</wsdl:documentation>
<wsdl:input message="bcs:getLabelMessage">
<wsdl:documentation>The identifier for the shipment for which the label url is
requested.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:getLabelResponseMessage">
<wsdl:documentation>The status of the operation and the label url (if
available).</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getVersion">
<wsdl:documentation>Returns the actual version of the implementation of the whole ISService
webservice.</wsdl:documentation>
<wsdl:input message="bcs:getVersionRequestMessage"/>
<wsdl:output message="bcs:getVersionResponseMessage">
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getExportDoc">
<wsdl:documentation>Returns the request-url for getting a export
document.</wsdl:documentation>
<wsdl:input message="bcs:getExportDocMessage">
<wsdl:documentation>The identifier for the shipment for which the export document url is
requested.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:getExportDocResponseMessage">
<wsdl:documentation>The status of the operation and the export document url (if
available).</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getManifest">
<wsdl:documentation>Request the manifest.</wsdl:documentation>
<wsdl:input message="bcs:getManifestRequestMessage">
<wsdl:documentation>The request data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:getManifestResponseMessage">
<wsdl:documentation>The status of the getManifest operation and the manifest
url.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateShipmentOrder">
<wsdl:documentation>Updates a shipment order.</wsdl:documentation>
<wsdl:input message="bcs:updateShipmentOrderRequestMessage">
<wsdl:documentation>The shipment data.</wsdl:documentation>
</wsdl:input>
<wsdl:output message="bcs:updateShipmentOrderResponseMessage">
<wsdl:documentation>The status of the updateShipment operation and the identifier for the
shipment.</wsdl:documentation>
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GKV3XAPISOAP11Binding" type="bcs:GKV3XAPIServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="createShipmentOrder">
<wsdl:documentation>Creates shipments.</wsdl:documentation>
<soap:operation soapAction="urn:createShipmentOrder" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the shipment
identifier.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="validateShipment">
<wsdl:documentation>Validates shipments.</wsdl:documentation>
<soap:operation soapAction="urn:validateShipment" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the shipment
identifier.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="deleteShipmentOrder">
<wsdl:documentation>Deletes the requested shipments.</wsdl:documentation>
<soap:operation soapAction="urn:deleteShipmentOrder" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="doManifest">
<wsdl:documentation>Manifest the requested shipments.</wsdl:documentation>
<soap:operation soapAction="urn:doManifest" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getLabel">
<wsdl:documentation>Returns the request-url for getting a label.</wsdl:documentation>
<soap:operation soapAction="urn:getLabel" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the url for requesting the
label.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getVersion">
<wsdl:documentation>Returns the actual version of the implementation of the whole ISService
webservice.</wsdl:documentation>
<soap:operation soapAction="urn:getVersion" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The version of the implementation.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getExportDoc">
<wsdl:documentation>Returns the request-url for getting a export
document.</wsdl:documentation>
<soap:operation soapAction="urn:getExportDoc" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment
identifier.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the url for requesting the export
document.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getManifest">
<wsdl:documentation>Requests the manifest.</wsdl:documentation>
<soap:operation soapAction="urn:getManifest" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation and the manifest url.</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateShipmentOrder">
<wsdl:documentation>Updates a shipment order.</wsdl:documentation>
<soap:operation soapAction="urn:updateShipmentOrder" style="document"/>
<wsdl:input>
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<wsdl:documentation>The status of the operation</wsdl:documentation>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GVAPI_2_0_de">
<wsdl:port name="GKVAPISOAP11port0" binding="bcs:GKV3XAPISOAP11Binding">
<soap:address location="https://cig.dhl.de/services/production/soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -73,19 +73,19 @@ abstract class Versanddienstleister
$ret['original'] = array_filter($docArr, fn($key) => in_array($key, $addressfields), ARRAY_FILTER_USE_KEY);
$ret['name'] = empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : trim($docArr['ansprechpartner']);
$ret['companyname'] = !empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : '';
$ret['address2'] = join(';', array_filter([
$ret['name2'] = !empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : '';
$ret['name3'] = join(';', array_filter([
$docArr['abteilung'],
$docArr['unterabteilung'],
$docArr['adresszusatz']
$docArr['unterabteilung']
], fn(string $item) => !empty(trim($item))));
$ret['address2'] = $docArr['adresszusatz'];
$ret['city'] = $docArr['ort'];
$ret['zip'] = $docArr['plz'];
$ret['country'] = $docArr['land'];
$ret['phone'] = $docArr['telefon'];
$ret['email'] = $docArr['email'];
$ret['addresstype'] = 0;
$strasse = trim($docArr['strasse']);
$ret['streetwithnumber'] = $strasse;
@ -99,6 +99,20 @@ abstract class Versanddienstleister
}
$ret['street'] = $strasse;
$ret['streetnumber'] = $hausnummer;
if (str_contains($docArr['strasse'], 'Packstation')) {
$ret['addresstype'] = 1;
$ret['parcelstationNumber'] = $hausnummer;
} else if (str_contains($docArr['strasse'], 'Postfiliale')) {
$ret['addresstype'] = 2;
$ret['postofficeNumber'] = $hausnummer;
}
$tmp = join(' ', [$docArr['ansprechpartner'], $docArr['abteilung'], $docArr['unterabteilung']]);
if (preg_match("/\d{6,10}/", $tmp, $match)) {
$ret['postnumber'] = $match[0];
}
}
// wenn rechnung im spiel entweder durch versand oder direkt rechnung
@ -350,7 +364,6 @@ abstract class Versanddienstleister
VALUES
({$address['addressId']}, {$address['lieferscheinId']}, '$this->type',
'$json->weight', '$result->TrackingNumber', '$result->TrackingUrl', 1)";
print_r($sql);
$this->app->DB->Insert($sql);
$filename = $this->app->erp->GetTMP() . join('_', [$this->type, 'Label', $result->TrackingNumber]) . '.pdf';

View File

@ -9,21 +9,47 @@
<h2>{|Empf&auml;nger|}</h2>
<table>
<tr>
<td>{|Name|}:</td>
<td>{|Adresstyp|}:</td>
<td>
<select v-model.number="form.addresstype">
<option value="0">Haus</option>
<option value="1">Packstation</option>
<option value="2">Filiale</option>
</select>
</td>
</tr>
<tr>
<td>{|Name / Zeile 1|}:</td>
<td><input type="text" size="36" v-model.trim="form.name"></td>
</tr>
<tr>
<td>{|Firmenname|}:</td>
<td><input type="text" size="36" v-model.trim="form.companyname"></td>
<tr v-if="form.addresstype === 0">
<td>{|Firmenname / Zeile 2|}:</td>
<td><input type="text" size="36" v-model.trim="form.name2"></td>
</tr>
<tr>
<tr v-if="form.addresstype === 1 || form.addresstype === 2">
<td>{|Postnummer|}:</td>
<td><input type="text" size="36" v-model.trim="form.postnumber"></td>
</tr>
<tr v-if="form.addresstype === 0">
<td>{|Firmenname / Zeile 3|}:</td>
<td><input type="text" size="36" v-model.trim="form.name3"></td>
</tr>
<tr v-if="form.addresstype === 0">
<td>{|Strasse/Hausnummer|}:</td>
<td>
<input type="text" size="30" v-model.trim="form.street">
<input type="text" size="5" v-model.trim="form.streetnumber">
</td>
</tr>
<tr>
<tr v-if="form.addresstype === 1">
<td>{|Packstationsnummer|}:</td>
<td><input type="text" size="10" v-model.trim="form.parcelstationNumber"></td>
</tr>
<tr v-if="form.addresstype === 2">
<td>{|Postfilialnummer|}:</td>
<td><input type="text" size="10" v-model.trim="form.postofficeNumber"></td>
</tr>
<tr v-if="form.addresstype === 0">
<td>{|Adresszeile 2|}:</td>
<td><input type="text" size="36" v-model.trim="form.address2"></td>
</tr>
@ -45,6 +71,10 @@
</select>
</td>
</tr>
<tr>
<td>{|Ansprechpartner|}:</td>
<td><input type="text" size="36" v-model="form.contactperson"></td>
</tr>
<tr>
<td>{|E-Mail|}:</td>
<td><input type="text" size="36" v-model.trim="form.email"></td>
@ -119,7 +149,7 @@
<tr>
<td>{|Produkt|}:</td>
<td>
<select v-model="form.product">
<select v-model="form.product" required>
<option v-for="prod in products" :value="prod.Id">{{prod.Name}}</option>
</select>
</td>
@ -167,15 +197,16 @@
<th>{|Einzelgewicht|}</th>
<th>{|Gesamtwert|}</th>
<th>{|Gesamtgewicht|}</th>
<th><a v-on:click="addPosition"><img src="themes/new/images/add.png"></a></</th>
<th><a v-on:click="addPosition"><img src="themes/new/images/add.png"></a></
</th>
</tr>
<tr v-for="(pos, index) in form.positions">
<td><input type="text" v-model.trim="pos.bezeichnung" required></td>
<td><input type="text" v-model.number="pos.menge" required></td>
<td><input type="text" v-model.trim="pos.zolltarifnummer" required></td>
<td><input type="text" v-model.trim="pos.herkunftsland" required></td>
<td><input type="text" v-model.number="pos.zolleinzelwert" required></td>
<td><input type="text" v-model.number="pos.zolleinzelgewicht" required></td>
<td><input type="text" v-model.trim="pos.zolltarifnummer"></td>
<td><input type="text" v-model.trim="pos.herkunftsland"></td>
<td><input type="text" v-model.number="pos.zolleinzelwert"></td>
<td><input type="text" v-model.number="pos.zolleinzelgewicht"></td>
<td>{{Number(pos.menge*pos.zolleinzelwert || 0).toFixed(2)}}</td>
<td>{{Number(pos.menge*pos.zolleinzelgewicht || 0).toFixed(3)}}</td>
<td><a v-on:click="deletePosition(index)"><img src="themes/new/images/delete.svg"></a></td>
@ -201,21 +232,21 @@
computed: {
total_value() {
let sum = 0;
for(const pos of this.form.positions) {
for (const pos of this.form.positions) {
sum += (pos.menge * pos.zolleinzelwert) || 0;
}
return sum;
},
total_weight() {
let sum = 0;
for(const pos of this.form.positions) {
for (const pos of this.form.positions) {
sum += (pos.menge * pos.zolleinzelgewicht) || 0;
}
return sum;
}
},
methods: {
submit: function() {
submit: function () {
let app = this;
let xhr = new XMLHttpRequest();
xhr.open('POST', location.href, true);
@ -226,13 +257,13 @@
}
xhr.send(JSON.stringify($.extend({submit:'print'}, this.form)));
},
addPosition: function() {
this.form.positions.push({ });
addPosition: function () {
this.form.positions.push({});
},
deletePosition: function(index) {
deletePosition: function (index) {
this.form.positions.splice(index, 1);
},
serviceAvailable: function(service) {
serviceAvailable: function (service) {
if (!this.products.hasOwnProperty(this.form.product))
return false;
return this.products[this.form.product].AvailableServices.indexOf(service) >= 0;

View File

@ -1,84 +1,249 @@
<br><br><table id="paketmarketab" align="center">
<tr>
<td align="center">
<br>
<form action="" method="post">
[ERROR]
<h1>Paketmarken Drucker f&uuml;r [ZUSATZ]</h1>
<br>
<b>Empf&auml;nger</b>
<br>
<br>
<table>
<tr><td>
<div class="container-fluid" id="sendcloudapp">
<form action="" method="post" v-on:submit.prevent="submit">
<div class="row">
<div v-for="msg in messages" :class="msg.class">{{msg.text}}</div>
<div>
<h1>{|Paketmarken Drucker f&uuml;r|} SendCloud</h1>
</div>
<div class="col-md-4">
<h2>{|Empf&auml;nger|}</h2>
<table>
<tr>
<td>{|Name|}:</td>
<td><input type="text" size="36" v-model="form.name"></td>
</tr>
<tr>
<td>{|Name 2|}:</td>
<td><input type="text" size="36" v-model="form.name2"></td>
</tr>
<tr>
<td>{|Name 3|}:</td>
<td><input type="text" size="36" v-model="form.name3"></td>
</tr>
<tr>
<td>{|Strasse/Hausnummer|}:</td>
<td>
<input type="text" size="30" v-model="form.strasse">
<input type="text" size="5" v-model="form.hausnummer">
</td>
</tr>
<tr>
<td>{|PLZ/Ort|}:</td>
<td><input type="text" size="5" v-model="form.plz">
<input type="text" size="30" v-model="form.ort">
</td>
</tr>
<tr>
<td>{|Bundesland|}:</td>
<td><input type="text" size="36" v-model="form.bundesland"></td>
</tr>
<tr>
<td>{|Land|}:</td>
<td>
<select v-model="form.land">
<option v-for="(value, key) in countries" :value="key">{{value}}</option>
</select>
</td>
</tr>
<tr>
<td>{|E-Mail|}:</td>
<td><input type="text" size="36" v-model="form.email"></td>
</tr>
<tr>
<td>{|Telefon|}:</td>
<td><input type="text" size="36" v-model="form.telefon"></td>
</tr>
<table style="float:left;">
<tr><td>Name:</td><td><input type="text" size="36" value="[NAME]" name="name" id="name"><script type="text/javascript">document.getElementById("name").focus(); </script></td></tr>
<tr><td>Name 2:</td><td><input type="text" size="36" value="[NAME2]" name="name2"></td></tr>
<tr><td>Name 3:</td><td><input type="text" size="36" value="[NAME3]" name="name3"></td></tr>
<tr><td>Land:</td><td>[EPROO_SELECT_LAND]</td></tr>
<tr><td>PLZ/ort:</td><td><input type="text" name="plz" size="5" value="[PLZ]">&nbsp;<input type="text" size="30" name="ort" value="[ORT]"></td></tr>
<tr><td>Strasse/Hausnummer:</td><td><input type="text" size="30" value="[STRASSE]" name="strasse">&nbsp;<input type="text" size="5" name="hausnummer" value="[HAUSNUMMER]"></td></tr>
<tr><td>E-Mail:</td><td><input type="text" size="36" value="[EMAIL]" name="email"></td></tr>
<tr><td>Telefon:</td><td><input type="text" size="36" value="[TELEFON]" name="telefon"></td></tr>
</table>
<table style="float:left;">
<!--<tr><td width="180">Anzahl Pakete:</td><td nowrap><input type="text" name="anzahl" size="5" value="[ANZAHL]" id="anzahl">&nbsp;<input type="button" onclick=window.location.href="index.php?module=versanderzeugen&action=frankieren&id=[ID]&land=[LAND]&anzahl="+document.getElementById('anzahl').value value="erstellen"></td></tr>-->
[GEWICHT]
<!--<tr><td>Foto:</td><td><img src="http://t3.gstatic.com/images?q=tbn:QTV_X4YJEI2p7M:http://notebook.pege.org/2005-inode/paket.jpg"></td></tr>
<tr><td></td><td><input type="button" value="Nochmal Wiegen+Foto"></td></tr>-->
</table>
<!--
<table>
<tr><td>Gewicht:</td><td><input type="text" size="5"></td></tr>
<tr><td>Foto:</td><td><img src="http://t3.gstatic.com/images?q=tbn:QTV_X4YJEI2p7M:http://notebook.pege.org/2005-inode/paket.jpg"></td></tr>
<tr><td></td><td><input type="button" value="Nochmal Wiegen+Foto"></td></tr>
</table>
-->
</tr>
</table>
<br><br>
<table align="center">
<tr><td colspan="2"><b>Service</b></td></tr>
<tr><td>Nachnahme:</td><td style="min-width:200px;"><input type="checkbox" name="nachnahme" value="1" [NACHNAHME]> (Betrag: [BETRAG] EUR)<input type="hidden" name="betrag" value="[BETRAG]"></td></tr>
<!--<tr><td>Versichert 2500 EUR:</td><td><input type="checkbox" name="versichert" value="1" [VERSICHERT]></td></tr>
<tr><td>Versichert 25000 EUR:</td><td><input type="checkbox" name="extraversichert" value="1" [EXTRAVERSICHERT]></td></tr>-->
<tr><td nowrap>Extra Versicherung:</td><td><input type="checkbox" name="versichert" value="1" [VERSICHERT] /></td></tr>
<tr class="versicherung"><td>Versicherungssumme:</td><td><input type="text" size="10" id="versicherungssumme" name="versicherungssumme" value="[VERSICHERUNGSSUMME]" /></td></tr>
<tr><td>Leitcodierung:</td><td style="min-width:200px;"><input type="checkbox" name="leitcodierung" value="1" [LEITCODIERUNG]>&nbsp;<i>ohne Leitcodierung können extra Kosten entstehen</i></td></tr>
<tr><td>Abholdatum:</td><td><input type="text" size="10" id="abholdatum" name="abholdatum" value="[ABHOLDATUM]" /></td></tr>
<tr><td>Wunschtermin:</td><td><input type="checkbox" name="wunschtermin" value="1" [WUNSCHTERMIN] /></td></tr>
<tr class="wunschzeitraum"><td>Wunschlieferdatum:</td><td><input type="text" size="10" id="wunschlieferdatum" name="wunschlieferdatum" value="[WUNSCHLIEFERDATUM]" /></td></tr>
<tr class="wunschzeitraum"><td>Wunschlieferzeitraum:</td>
<td><!--<input type="radio" name="wunschzeitraum" id="wunsch10001200" value="10001200" [WUNSCH10001200] /> 10:00 - 12:00
<input type="radio" name="wunschzeitraum" id="wunsch12001400" value="12001400" [WUNSCH12001400] /> 12:00 - 14:00
<input type="radio" name="wunschzeitraum" id="wunsch14001600" value="14001600" [WUNSCH14001600] /> 14:00 - 16:00
<input type="radio" name="wunschzeitraum" id="wunsch16001800" value="16001800" [WUNSCH16001800] /> 16:00 - 18:00 -->
<input type="radio" name="wunschzeitraum" id="wunsch18002000" value="18002000" [WUNSCH18002000] /> 18:00 - 20:00
<input type="radio" name="wunschzeitraum" id="wunsch19002100" value="19002100" [WUNSCH19002100] /> 19:00 - 21:00
</td></tr>
[VORRETOURENLABEL]<tr><td nowrap>Retourenlabel drucken:</td><td><input type="checkbox" value="1" id="retourenlabel" name="retourenlabel" [RETOURENLABEL] /></td></tr>[NACHRETOURENLABEL]
[VORALTERSFREIGABE]<tr><td nowrap>Altersfreigabe notwendig:</td><td><input type="checkbox" name="altersfreigabe" value="1" [ALTERSFREIGABE]></td></tr>[NACHALTERSFREIGABE]
</table>
<br><br>
<center><input class="btnGreen" type="submit" value="Paketmarke drucken" name="drucken">&nbsp;
[TRACKINGMANUELL]
&nbsp;<input type="button" value="{|Andere Versandart auswählen|}" onclick="window.location.href='index.php?module=versanderzeugen&action=wechsel&id=[ID]'" name="anders">&nbsp;
<!--<input type="button" value="Abbrechen">--></center>
</form>
</td></tr></table>
<br><br>
<script type="text/JavaScript" language="javascript">
$(document).ready(function() {
$( "#abholdatum" ).datepicker({ dateFormat: 'dd.mm.yy',dayNamesMin: ['SO', 'MO', 'DI', 'MI', 'DO', 'FR', 'SA'], firstDay:1,
showWeek: true, monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai',
'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], });
});
</table>
</div>
<div class="col-md-4" v-once>
<h2>vollst. Adresse</h2>
<table>
<tr>
<td>{|Name|}</td>
<td>{{form.name}}</td>
</tr>
<tr>
<td>{|Ansprechpartner|}</td>
<td>{{form.ansprechpartner}}</td>
</tr>
<tr>
<td>{|Abteilung|}</td>
<td>{{form.abteilung}}</td>
</tr>
<tr>
<td>{|Unterabteilung|}</td>
<td>{{form.unterabteilung}}</td>
</tr>
<tr>
<td>{|Adresszusatz|}</td>
<td>{{form.adresszusatz}}</td>
</tr>
<tr>
<td>{|Strasse|}</td>
<td>{{form.streetwithnumber}}</td>
</tr>
<tr>
<td>{|PLZ/Ort|}</td>
<td>{{form.plz}} {{form.ort}}</td>
</tr>
<tr>
<td>{|Bundesland|}</td>
<td>{{form.bundesland}}</td>
</tr>
<tr>
<td>{|Land|}</td>
<td>{{form.land}}</td>
</tr>
</table>
</div>
<div class="col-md-4">
<h2>{|Paket|}</h2>
<table>
<tr>
<td>{|Gewicht (in kg)|}:</td>
<td><input type="text" v-model="form.weight"></td>
</tr>
<tr>
<td>{|H&ouml;he (in cm)|}:</td>
<td><input type="text" size="10" v-model="form.height"></td>
</tr>
<tr>
<td>{|Breite (in cm)|}:</td>
<td><input type="text" size="10" v-model="form.width"></td>
</tr>
<tr>
<td>{|L&auml;nge (in cm)|}:</td>
<td><input type="text" size="10" v-model="form.length"></td>
</tr>
<tr>
<td>{|Produkt|}:</td>
<td>
<select v-model="form.method">
<option v-for="(value, key, index) in methods" :value="key">{{value}}</option>
</select>
</td>
</tr>
<tr>
<td>{|Nachnahme|}:</td>
<td><input type="checkbox" v-model="form.cashOnDelivery"> (Betrag: {{ form.codvalue }}</td>
</tr>
<tr>
<td>{|Wunschtermin|}:</td>
<td><input type="date" v-model="form.preferredDay"></td>
</tr>
</table>
</div>
<div class="clearfix"></div>
<div class="col-md-12">
<h2>{|Bestellung|}</h2>
<table>
<tr>
<td>{|Bestellnummer|}:</td>
<td><input type="text" size="36" v-model="form.order_number"></td>
</tr>
<tr>
<td>{|Rechnungsnummer|}:</td>
<td><input type="text" size="36" v-model="form.invoice_number"></td>
</tr>
<tr>
<td>{|Sendungsart|}:</td>
<td>
<select v-model="form.sendungsart">
<option v-for="(value, key) in customs_shipment_types" :value="key">{{value}}</option>
</select>
</td>
</tr>
<tr>
<td>{|Versicherungssumme|}:</td>
<td><input type="text" size="10" v-model="form.total_insured_value"/></td>
</tr>
</table>
</div>
<div class="col-md-12">
<table>
<tr>
<th>{|Bezeichnung|}</th>
<th>{|Menge|}</th>
<th>{|HSCode|}</th>
<th>{|Herkunftsland|}</th>
<th>{|Einzelwert|}</th>
<th>{|Einzelgewicht|}</th>
<th>{|Währung|}</th>
<th>{|Gesamtwert|}</th>
<th>{|Gesamtgewicht|}</th>
<th><a v-on:click="addPosition"><img src="themes/new/images/add.png"></a></</th>
</tr>
<tr v-for="(pos, index) in form.positions">
<td><input type="text" v-model="pos.bezeichnung" required></td>
<td><input type="text" v-model="pos.menge" required></td>
<td><input type="text" v-model="pos.zolltarifnummer" required></td>
<td><input type="text" v-model="pos.herkunftsland" required></td>
<td><input type="text" v-model="pos.zolleinzelwert" required></td>
<td><input type="text" v-model="pos.zolleinzelgewicht" required></td>
<td><input type="text" v-model="pos.zollwaehrung" required></td>
<td>{{Number(pos.menge*pos.zolleinzelwert || 0).toFixed(2)}}</td>
<td>{{Number(pos.menge*pos.zolleinzelgewicht || 0).toFixed(3)}}</td>
<td><a v-on:click="deletePosition(index)"><img src="themes/new/images/delete.svg"></a></td>
</tr>
<tr>
<td colspan="7"></td>
<td>{{total_value.toFixed(2)}}</td>
<td>{{total_weight.toFixed(3)}}</td>
</tr>
</table>
</div>
<div>
<input class="btnGreen" type="submit" value="{|Paketmarke drucken|}" name="drucken">&nbsp;
<input type="button" value="{|Andere Versandart auswählen|}" name="anders">&nbsp;
</div>
</div>
</form>
</div>
<script type="text/javascript">
const sendcloudApp = new Vue({
el: '#sendcloudapp',
data: {
form: [JSON],
countries: [JSON_COUNTRIES],
methods: [JSON_METHODS],
customs_shipment_types: [JSON_CUSTOMS_SHIPMENT_TYPES],
messages: []
},
computed: {
total_value() {
let sum = 0;
for(const pos of this.form.positions) {
sum += pos.menge * pos.zolleinzelwert;
}
return sum;
},
total_weight() {
let sum = 0;
for(const pos of this.form.positions) {
sum += pos.menge * pos.zolleinzelgewicht;
}
return sum;
}
},
methods: {
submit: function() {
let app = this;
let xhr = new XMLHttpRequest();
xhr.open('POST', location.href, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function () {
let json = JSON.parse(this.response);
app.messages = json.messages;
}
xhr.send(JSON.stringify($.extend({submit:'print'}, this.form)));
},
addPosition: function() {
this.form.positions.push({ });
},
deletePosition: function(index) {
this.form.positions.splice(index, 1);
}
}
})
</script>

View File

@ -7,7 +7,9 @@
use Xentral\Carrier\Dhl\Data\Communication;
use Xentral\Carrier\Dhl\Data\Country;
use Xentral\Carrier\Dhl\Data\CreateShipmentOrderResponse;
use Xentral\Carrier\Dhl\Data\NativeAddress;
use Xentral\Carrier\Dhl\Data\PackStation;
use Xentral\Carrier\Dhl\Data\Postfiliale;
use Xentral\Carrier\Dhl\Data\ReceiverNativeAddress;
use Xentral\Carrier\Dhl\Data\Shipment;
use Xentral\Carrier\Dhl\Data\ShipmentItem;
use Xentral\Carrier\Dhl\DhlApi;
@ -77,7 +79,7 @@ class Versandart_dhl extends Versanddienstleister{
{
$shipment = new Shipment();
$shipment->ShipmentDetails->product = $json->product;
$shipment->ShipmentDetails->accountNumber = '22222222220101';
$shipment->ShipmentDetails->accountNumber = $this->GetAccountNumber($json->product);
$shipment->ShipmentDetails->SetShipmentDate(new DateTimeImmutable('today'));
$shipment->ShipmentDetails->ShipmentItem = new ShipmentItem();
$shipment->ShipmentDetails->ShipmentItem->weightInKG = $json->weight ?? 0;
@ -95,12 +97,35 @@ class Versandart_dhl extends Versanddienstleister{
$shipment->Shipper->Communication->email = $this->settings->sender_email;
$shipment->Shipper->Communication->contactPerson = $this->settings->sender_contact_person;
$shipment->Receiver->name1 = $json->name;
$shipment->Receiver->Address = new NativeAddress();
switch ($json->addresstype) {
case 0:
$shipment->Receiver->Address = new ReceiverNativeAddress();
$shipment->Receiver->Address->name2 = $json->name2;
$shipment->Receiver->Address->streetName = $json->street ?? '';
$shipment->Receiver->Address->streetNumber = $json->streetnumber ?? '';
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
$shipment->Receiver->Address->city = $json->city ?? '';
$shipment->Receiver->Address->zip = $json->zip ?? '';
$shipment->Receiver->Address->Origin = Country::Create($json->country ?? 'DE', $json->state);
if (isset($json->address2) && !empty($json->address2))
$shipment->Receiver->Address->addressAddition[] = $json->address2;
break;
case 1:
$shipment->Receiver->Packstation = new PackStation();
$shipment->Receiver->Packstation->postNumber = $json->postnumber;
$shipment->Receiver->Packstation->packstationNumber = $json->parcelstationNumber;
$shipment->Receiver->Packstation->city = $json->city ?? '';
$shipment->Receiver->Packstation->zip = $json->zip ?? '';
$shipment->Receiver->Packstation->Origin = Country::Create($json->country ?? 'DE', $json->state);
break;
case 2:
$shipment->Receiver->Postfiliale = new Postfiliale();
$shipment->Receiver->Postfiliale->postNumber = $json->postnumber;
$shipment->Receiver->Postfiliale->postfilialeNumber = $json->postofficeNumber;
$shipment->Receiver->Postfiliale->city = $json->city ?? '';
$shipment->Receiver->Postfiliale->zip = $json->zip ?? '';
$shipment->Receiver->Postfiliale->Origin = Country::Create($json->country ?? 'DE', $json->state);
break;
}
$shipment->Receiver->Communication = new Communication();
$shipment->Receiver->Communication->email = $json->email;
$shipment->Receiver->Communication->phone = $json->phone;
@ -120,11 +145,13 @@ class Versandart_dhl extends Versanddienstleister{
$ret->Label = base64_decode($result->CreationState->LabelData->labelData);
if (isset($result->CreationState->LabelData->exportLabelData))
$ret->ExportDocuments = base64_decode($result->CreationState->LabelData->exportLabelData);
} else {
} else if (isset($result->CreationState)) {
if (is_array($result->CreationState->LabelData->Status->statusMessage))
$ret->Errors = $result->CreationState->LabelData->Status->statusMessage;
else
$ret->Errors[] = $result->CreationState->LabelData->Status->statusMessage;
} else {
$ret->Errors[] = $result->Status->statusText;
}
return $ret;
}
@ -132,38 +159,62 @@ class Versandart_dhl extends Versanddienstleister{
public function GetShippingProducts(): array
{
$result = [];
if ($this->settings->accountnumber) {
$result[] = Product::Create('V01PAK', 'DHL Paket')
->WithLength(15, 120)
->WithWidth(11, 60)
->WithHeight(1, 60)
->WithWeight(0.01, 31.5);
}
if ($this->settings->accountnumber_int) {
$result[] = Product::Create('V53WPAK', 'DHL Paket International')
->WithLength(15, 120)
->WithWidth(11, 60)
->WithHeight(1, 60)
->WithWeight(0.01, 31.5)
->WithServices([Product::SERVICE_PREMIUM]);
}
if ($this->settings->accountnumber_euro) {
$result[] = Product::Create('V54EPAK', 'DHL Europaket')
->WithLength(15, 120)
->WithWidth(11, 60)
->WithHeight(3.5, 60)
->WithWeight(0.01, 31.5);
}
if ($this->settings->accountnumber_connect) {
$result[] = Product::Create('V55PAK', 'DHL Paket Connect')
->WithLength(15, 120)
->WithWidth(11, 60)
->WithHeight(3.5, 60)
->WithWeight(0.01, 31.5);
}
if ($this->settings->accountnumber_wp) {
$result[] = Product::Create('V62WP', 'DHL Warenpost')
->WithLength(10, 35)
->WithWidth(7, 25)
->WithHeight(0.1, 5)
->WithWeight(0.01, 1);
}
if ($this->settings->accountnumber_wpint) {
$result[] = Product::Create('V66WPI', 'DHL Warenpost International')
->WithLength(10, 35)
->WithWidth(7, 25)
->WithHeight(0.1, 10)
->WithWeight(0.01, 1)
->WithServices([Product::SERVICE_PREMIUM]);
}
return $result;
}
private function GetAccountNumber(string $product):?string {
switch ($product) {
case 'V01PAK': return $this->settings->accountnumber;
case 'V53WPAK': return $this->settings->accountnumber_int;
case 'V54EPAK': return $this->settings->accountnumber_euro;
case 'V55PAK': return $this->settings->accountnumber_connect;
case 'V62WP': return $this->settings->accountnumber_wp;
case 'V66WPI': return $this->settings->accountnumber_wpint;
}
return null;
}
}

View File

@ -75,13 +75,27 @@ class Versandart_sendcloud extends Versanddienstleister
$parcel->SenderAddressId = $this->settings->sender_address;
$parcel->ShippingMethodId = $json->product;
$parcel->Name = $json->name;
$parcel->CompanyName = $json->companyname;
$parcel->Country = $json->country;
$parcel->PostalCode = $json->zip;
$parcel->City = $json->city;
switch ($json->addresstype) {
case 0:
$parcel->CompanyName = trim("$json->name2 $json->name3");
$parcel->Address = $json->street;
$parcel->Address2 = $json->address2;
$parcel->HouseNumber = $json->streetnumber;
break;
case 1:
$parcel->CompanyName = $json->postnumber;
$parcel->Address = "Packstation";
$parcel->HouseNumber = $json->parcelstationNumber;
break;
case 2:
$parcel->CompanyName = $json->postnumber;
$parcel->Address = "Postfiliale";
$parcel->HouseNumber = $json->postofficeNumber;
break;
}
$parcel->Country = $json->country;
$parcel->PostalCode = $json->zip;
$parcel->City = $json->city;
$parcel->EMail = $json->email;
$parcel->Telephone = $json->phone;
$parcel->CountryState = $json->state;