From c11b114a85a4525f15977a896d3fa25743de4d33 Mon Sep 17 00:00:00 2001 From: jaroslawmajcher Date: Fri, 16 Feb 2024 11:57:26 +0100 Subject: [PATCH] Add parcel template param --- src/Api/WebClient.php | 7 +++++-- src/Resources/config/config.yml | 1 + src/Resources/config/services.xml | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Api/WebClient.php b/src/Api/WebClient.php index 5450e43..545aeec 100644 --- a/src/Api/WebClient.php +++ b/src/Api/WebClient.php @@ -37,10 +37,13 @@ final class WebClient implements WebClientInterface private string $labelType = 'normal'; - public function __construct(Client $client, string $labelType) + private string $parcelTemplate = 'large'; + + public function __construct(Client $client, string $labelType, string $parcelTemplate) { $this->apiClient = $client; $this->labelType = $labelType; + $this->parcelTemplate = $parcelTemplate; } public function setShippingGateway(ShippingGatewayInterface $shippingGateway): WebClientInterface @@ -307,7 +310,7 @@ private function createParcel(ShipmentInterface $shipment): array 'unit' => 'kg', ], 'dimensions' => [], - 'template' => 'large', + 'template' => $this->parcelTemplate, 'tracking_number' => null, 'is_non_standard' => false, ]; diff --git a/src/Resources/config/config.yml b/src/Resources/config/config.yml index 141e502..9d27259 100644 --- a/src/Resources/config/config.yml +++ b/src/Resources/config/config.yml @@ -1,5 +1,6 @@ parameters: bitbag.inpost.label_type: 'normal' + bitbag.inpost.parcel_template: 'large' imports: - { resource: "@BitBagSyliusInPostPlugin/Resources/config/services.xml" } - { resource: "@BitBagSyliusInPostPlugin/Resources/config/resource/bitbag_inpost.yml" } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 8e9cb84..b9d324d 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -40,6 +40,7 @@ > %bitbag.inpost.label_type% + %bitbag.inpost.parcel_template%