From 16bf5117838f2f6e3e36181ae79e56e49ccc32f7 Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Fri, 10 Jan 2025 15:13:49 +0100 Subject: [PATCH] GO: Improve error output, add info to settings --- classes/Carrier/Go/GoApi.php | 8 ++++++-- www/lib/versandarten/go.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/classes/Carrier/Go/GoApi.php b/classes/Carrier/Go/GoApi.php index 0dffdd55..25eb594d 100644 --- a/classes/Carrier/Go/GoApi.php +++ b/classes/Carrier/Go/GoApi.php @@ -16,7 +16,7 @@ class GoApi { protected string $baseUrl; - public function __construct(protected string $username, protected string $password, bool $testMode) { + public function __construct(protected string $username, protected string $password, bool $testMode = true) { if ($testMode) $this->baseUrl = self::BASE_URL_TEST; else @@ -49,6 +49,10 @@ class GoApi { $ret->barcodes = array_map(function ($item) { return $item->barcode; }, $response->package); return $ret; } - return $response->message; + if (isset($response->message)) + return $response->message; + if (isset($response->Message)) + return $response->Message; + return print_r($response, TRUE); } } \ No newline at end of file diff --git a/www/lib/versandarten/go.php b/www/lib/versandarten/go.php index d6b7c688..53ba826f 100644 --- a/www/lib/versandarten/go.php +++ b/www/lib/versandarten/go.php @@ -55,7 +55,7 @@ class Versandart_go extends Versanddienstleister 'consignorHouseNumber' => ['typ' => 'text', 'bezeichnung' => 'Absender Hausnummer:'], 'consignorZipCode' => ['typ' => 'text', 'bezeichnung' => 'Absender PLZ:'], 'consignorCity' => ['typ' => 'text', 'bezeichnung' => 'Absender Stadt:'], - 'consignorCountry' => ['typ' => 'text', 'bezeichnung' => 'Absender Land:'], + 'consignorCountry' => ['typ' => 'text', 'bezeichnung' => 'Absender Land:', 'info' => '2-Letter-Code (z.B. \'DE\')'], 'consignorPhoneNumber' => ['typ' => 'text', 'bezeichnung' => 'Absender Telefon:'], 'consignorRemarks' => ['typ' => 'text', 'bezeichnung' => 'Absender Bemerkungen:'], 'consignorEmail' => ['typ' => 'text', 'bezeichnung' => 'Absender Email:'],