diff --git a/modules/dpdpoland/classes/Log.php b/modules/dpdpoland/classes/Log.php index 08dffbf6..c9e09ee6 100644 --- a/modules/dpdpoland/classes/Log.php +++ b/modules/dpdpoland/classes/Log.php @@ -3,12 +3,12 @@ if (!defined('_PS_VERSION_')) exit; - + require_once(_DPDPOLAND_CLASSES_DIR_.'Configuration.php'); require_once(_DPDPOLAND_MODULE_DIR_.'dpdpoland.php'); class DpdPolandLog -{ +{ const LOG_DEBUG = 'LOG_DEBUG'; const LOG_ERROR = 'LOG_ERROR'; diff --git a/modules/dpdpoland/config_pl.xml b/modules/dpdpoland/config_pl.xml index 6afc5f1b..1a819a3b 100644 --- a/modules/dpdpoland/config_pl.xml +++ b/modules/dpdpoland/config_pl.xml @@ -1,12 +1,12 @@ - dpdpoland - - - - - - 1 - 1 + dpdpoland + + + + + + 1 + 1 \ No newline at end of file diff --git a/modules/dpdpoland/dpdpoland.php b/modules/dpdpoland/dpdpoland.php index 6fa23fe8..d6b767f4 100644 --- a/modules/dpdpoland/dpdpoland.php +++ b/modules/dpdpoland/dpdpoland.php @@ -336,7 +336,7 @@ class DpdPoland extends CarrierModule `id_sender_address` int(11) NOT NULL, `cud` tinyint(1) NOT NULL, `rod` tinyint(1) NOT NULL, - `dpde` tinyint(1) NOT NULL, + `dpde` tinyint(1) NOT NULL, `dpdnd` tinyint(1) NOT NULL, `duty` tinyint(1) NOT NULL, `duty_amount` decimal(17,2) DEFAULT NULL, @@ -1741,7 +1741,7 @@ class DpdPoland extends CarrierModule return Db::getInstance()->getValue(' SELECT `id_reference` - FROM `' . _DB_PREFIX_ . 'carrier` + FROM `' . _DB_PREFIX_ . 'carrier` WHERE `id_carrier`=' . (int)$id_carrier ); } @@ -2578,8 +2578,18 @@ class DpdPoland extends CarrierModule */ public function getOrderShippingCostExternal($cart) { - if (!$this->soapClientExists() || !$this->checkModuleAvailability()) + if (!$this->soapClientExists()) { + DpdPolandLog::addLog('getOrderShippingCostExternal: SOAP client not exists - returning false'); return false; + } + + if (!$this->checkModuleAvailability()) { + $plCountry = Country::getByIso(self::POLAND_ISO_CODE); + $plnCurrency = Currency::getIdByIsoCode(_DPDPOLAND_CURRENCY_ISO_); + $curlExists = function_exists('curl_init'); + DpdPolandLog::addLog('getOrderShippingCostExternal: Module not available - PL country: ' . ($plCountry ? $plCountry : 'NOT FOUND') . ', PLN currency: ' . ($plnCurrency ? $plnCurrency : 'NOT FOUND') . ', CURL: ' . ($curlExists ? 'YES' : 'NO')); + return false; + } $disabled_countries_ids = DpdPolandCountry::getDisabledCountriesIDs(); @@ -2595,20 +2605,27 @@ class DpdPoland extends CarrierModule } if (!$id_method = self::getMethodIdByCarrierId($this->id_carrier)) { + DpdPolandLog::addLog('getOrderShippingCostExternal: No method found for carrier ' . $this->id_carrier . ' - returning false'); self::$carriers[$this->id_carrier] = false; return false; } - if (!$id_country || in_array($id_country, $disabled_countries_ids) && $id_method == _DPDPOLAND_CLASSIC_ID_) + if (!$id_country || in_array($id_country, $disabled_countries_ids) && $id_method == _DPDPOLAND_CLASSIC_ID_) { + DpdPolandLog::addLog('getOrderShippingCostExternal: Country disabled or invalid - id_country: ' . $id_country . ', method: ' . $id_method); return false; + } if ($id_country) $zone = Country::getIdZone($id_country); - else + else { + DpdPolandLog::addLog('getOrderShippingCostExternal: No country - returning false'); return false; + } - if (!$this->id_carrier) + if (!$this->id_carrier) { + DpdPolandLog::addLog('getOrderShippingCostExternal: No id_carrier set - returning false'); return false; + } $is_poland_country = $this->isPolandCountry((int)$id_country); @@ -2617,6 +2634,7 @@ class DpdPoland extends CarrierModule !$is_poland_country && $id_method == _DPDPOLAND_STANDARD_ID_ || !$is_poland_country && $id_method == _DPDPOLAND_PUDO_ID_ ) { + DpdPolandLog::addLog('getOrderShippingCostExternal: Country/method mismatch - is_poland: ' . ($is_poland_country ? 'YES' : 'NO') . ', method: ' . $id_method); return false; } @@ -2627,26 +2645,50 @@ class DpdPoland extends CarrierModule if (Configuration::get(DpdPolandConfiguration::PRICE_CALCULATION_TYPE) == DpdPolandConfiguration::PRICE_CALCULATION_PRESTASHOP) { $carrier = new Carrier($this->id_carrier); - $price = $carrier->getDeliveryPriceByWeight($total_weight, $zone); + + // Check carrier billing method: 1 = by weight, 2 = by price + if ($carrier->shipping_method == Carrier::SHIPPING_METHOD_PRICE) { + // Calculate by cart price + $order_total = $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); + $price = $carrier->getDeliveryPriceByPrice($order_total, $zone); + DpdPolandLog::addLog('getOrderShippingCostExternal: PrestaShop calc BY PRICE - carrier: ' . $this->id_carrier . ', order_total: ' . $order_total . ', zone: ' . $zone . ', price: ' . ($price === false ? 'FALSE' : $price)); + } else { + // Calculate by weight (default) + $price = $carrier->getDeliveryPriceByWeight($total_weight, $zone); + DpdPolandLog::addLog('getOrderShippingCostExternal: PrestaShop calc BY WEIGHT - carrier: ' . $this->id_carrier . ', weight: ' . $total_weight . ', zone: ' . $zone . ', price: ' . ($price === false ? 'FALSE' : $price)); + } + + if ($price === false) { + $method_name = ($carrier->shipping_method == Carrier::SHIPPING_METHOD_PRICE) ? 'price ranges' : 'weight ranges'; + DpdPolandLog::addLog('getOrderShippingCostExternal: No price found - check carrier ' . $method_name . ' in PrestaShop'); + self::$carriers[$this->id_carrier] = false; + return false; + } $id_currency_pl = Currency::getIdByIsoCode(_DPDPOLAND_CURRENCY_ISO_, (int)$this->context->shop->id); $currency_from = new Currency((int)$id_currency_pl); $currency_to = $this->context->currency; self::$carriers[$this->id_carrier] = Tools::convertPriceFull($price, $currency_from, $currency_to); + DpdPolandLog::addLog('getOrderShippingCostExternal: SUCCESS - final price: ' . self::$carriers[$this->id_carrier]); return self::$carriers[$this->id_carrier]; } $price = DpdPolandCSV::getPrice($total_weight, $id_method, $cart); - if ($price === false) + DpdPolandLog::addLog('getOrderShippingCostExternal: CSV calc - weight: ' . $total_weight . ', method: ' . $id_method . ', price: ' . ($price === false ? 'FALSE' : $price)); + + if ($price === false) { + DpdPolandLog::addLog('getOrderShippingCostExternal: No CSV price found - check CSV import in module config'); return false; + } $id_currency_pl = Currency::getIdByIsoCode(_DPDPOLAND_CURRENCY_ISO_, (int)$this->context->shop->id); $currency_from = new Currency((int)$id_currency_pl); $currency_to = $this->context->currency; self::$carriers[$this->id_carrier] = Tools::convertPriceFull($price, $currency_from, $currency_to); + DpdPolandLog::addLog('getOrderShippingCostExternal: SUCCESS - final price: ' . self::$carriers[$this->id_carrier]); return self::$carriers[$this->id_carrier]; } diff --git a/modules/dpdpoland/libraries/PDFMerger/fpdf/font/desktop.ini b/modules/dpdpoland/libraries/PDFMerger/fpdf/font/desktop.ini new file mode 100644 index 00000000..c5547ea5 --- /dev/null +++ b/modules/dpdpoland/libraries/PDFMerger/fpdf/font/desktop.ini @@ -0,0 +1,4 @@ +[ViewState] +Mode= +Vid= +FolderType=NotSpecified diff --git a/modules/dpdpoland/log/logs.log b/modules/dpdpoland/log/logs.log index ff72e181..a590aaca 100644 --- a/modules/dpdpoland/log/logs.log +++ b/modules/dpdpoland/log/logs.log @@ -1,1033 +1,11 @@ -*DEBUG* 2021/02/28 - 10:16:29: savePackageFromPost -*DEBUG* 2021/02/28 - 10:16:29: Array -( - [openUMLFeV3] => Array - ( - [packages] => Array - ( - [parcels] => Array - ( - [0] => Array - ( - [content] => 1_1, 2_7, 3_13 - [customerData1] => - [customerData2] => - [customerData3] => - [reference] => FMDNNJYDY_1 - [sizeX] => 0 - [sizeY] => 0 - [sizeZ] => 0 - [weight] => 10 - ) - - ) - - [payerType] => THIRD_PARTY - [thirdPartyFID] => 124118 - [receiver] => Array - ( - [address] => 16, Main street 2nd floor - [city] => Paris - [company] => My Company - [countryCode] => FR - [email] => pub@prestashop.com - [fid] => - [name] => John DOE - [phone] => 0102030405 - [postalCode] => 75002 - ) - - [ref1] => 5 - [ref2] => - [ref3] => PSMODUL# - [reference] => - [sender] => Array - ( - [address] => Wesoła, 22 - [city] => Poznań - [company] => NEXTMA Mateusz Kumanowski - [countryCode] => PL - [email] => mateusz.kumanowski@gmail.com - [name] => NEXTMA Mateusz Kumanowski - [phone] => 12345678 - [postalCode] => 60149 - ) - - [services] => Array - ( - [declaredValue] => Array - ( - [amount] => 0 - [currency] => PLN - ) - - ) - - ) - - ) - - [pkgNumsGenerationPolicyV1] => STOP_ON_FIRST_ERROR - [langCode] => PL -) - -*ERROR* 2021/02/28 - 10:16:29: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [0] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_DECL_VALUE_AMOUNT_RANGE_PLN - [FieldNames] => - [Info] => Dla waluty PLN: Maksymalna kwota to 500 000 PLN - ) - - [1] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_DECL_VALUE_AMOUNT_RANGE_PLN - [FieldNames] => - [Info] => Dla waluty PLN: Maksymalna kwota to 500 000 PLN - ) - - [2] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_DECL_VALUE_AMOUNT_RANGE_PLN - [FieldNames] => - [Info] => Dla waluty PLN: Maksymalna kwota to 500 000 PLN - ) - - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:16:29: error in package create -*ERROR* 2021/02/28 - 10:16:29: ["Dla waluty PLN: Maksymalna kwota to 500 000 PLN"] -*DEBUG* 2021/02/28 - 10:17:27: savePackageFromPost -*DEBUG* 2021/02/28 - 10:17:27: Array -( - [openUMLFeV3] => Array - ( - [packages] => Array - ( - [parcels] => Array - ( - [0] => Array - ( - [content] => 1_1, 2_7, 3_13 - [customerData1] => - [customerData2] => - [customerData3] => - [reference] => OKRJLSHAA_1 - [sizeX] => 0 - [sizeY] => 0 - [sizeZ] => 0 - [weight] => 10 - ) - - ) - - [payerType] => THIRD_PARTY - [thirdPartyFID] => 124118 - [receiver] => Array - ( - [address] => 16, Main street 2nd floor - [city] => Paris - [company] => My Company - [countryCode] => FR - [email] => pub@prestashop.com - [fid] => - [name] => John DOE - [phone] => 0102030405 - [postalCode] => 75002 - ) - - [ref1] => 5 - [ref2] => - [ref3] => PSMODUL# - [reference] => - [sender] => Array - ( - [address] => Wesoła, 22 - [city] => Poznań - [company] => NEXTMA Mateusz Kumanowski - [countryCode] => PL - [email] => mateusz.kumanowski@gmail.com - [name] => NEXTMA Mateusz Kumanowski - [phone] => 12345678 - [postalCode] => 60149 - ) - - [services] => Array - ( - ) - - ) - - ) - - [pkgNumsGenerationPolicyV1] => STOP_ON_FIRST_ERROR - [langCode] => PL -) - -*ERROR* 2021/02/28 - 10:17:30: Wystąpił błąd podczas wysyłania wiadomości email do klienta -*ERROR* 2021/02/28 - 10:17:30: addTrackingNumber An error occurred while sending an email to the customer. -*ERROR* 2021/02/28 - 10:17:30: ["Wyst\u0105pi\u0142 b\u0142\u0105d podczas wysy\u0142ania wiadomo\u015bci email do klienta"] -*DEBUG* 2021/02/28 - 10:17:55: Ustawienia zapisane -*DEBUG* 2021/02/28 - 10:18:03: savePackageFromPost -*DEBUG* 2021/02/28 - 10:18:03: Array -( - [openUMLFeV3] => Array - ( - [packages] => Array - ( - [parcels] => Array - ( - [0] => Array - ( - [content] => 1_1, 2_7, 3_13 - [customerData1] => - [customerData2] => - [customerData3] => - [reference] => IXKNKBFPK_1 - [sizeX] => 0 - [sizeY] => 0 - [sizeZ] => 0 - [weight] => 0 - ) - - ) - - [payerType] => THIRD_PARTY - [thirdPartyFID] => 124118 - [receiver] => Array - ( - [address] => 16, Main street 2nd floor - [city] => Paris - [company] => My Company - [countryCode] => FR - [email] => pub@prestashop.com - [fid] => - [name] => John DOE - [phone] => 0102030405 - [postalCode] => 75002 - ) - - [ref1] => 5 - [ref2] => - [ref3] => PSMODUL# - [reference] => - [sender] => Array - ( - [address] => Wesoła, 22 - [city] => Poznań - [company] => NEXTMA Mateusz Kumanowski - [countryCode] => PL - [email] => mateusz.kumanowski@gmail.com - [name] => NEXTMA Mateusz Kumanowski - [phone] => 12345678 - [postalCode] => 60149 - ) - - [services] => Array - ( - [declaredValue] => Array - ( - [amount] => 0 - [currency] => PLN - ) - - [duty] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - ) - - ) - - ) - - [pkgNumsGenerationPolicyV1] => STOP_ON_FIRST_ERROR - [langCode] => PL -) - -*ERROR* 2021/02/28 - 10:18:03: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [0] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - [1] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_DECL_VALUE_AMOUNT_RANGE_PLN - [FieldNames] => - [Info] => Dla waluty PLN: Maksymalna kwota to 500 000 PLN - ) - - [2] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_DECL_VALUE_AMOUNT_RANGE_PLN - [FieldNames] => - [Info] => Dla waluty PLN: Maksymalna kwota to 500 000 PLN - ) - - [3] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_DECL_VALUE_AMOUNT_RANGE_PLN - [FieldNames] => - [Info] => Dla waluty PLN: Maksymalna kwota to 500 000 PLN - ) - - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:18:03: error in package create -*ERROR* 2021/02/28 - 10:18:03: ["Us\u0142uga 'Odprawa celna' jest niedozwolona dla wybranego kraju dor\u0119czenia"] -*DEBUG* 2021/02/28 - 10:18:13: savePackageFromPost -*DEBUG* 2021/02/28 - 10:18:13: Array -( - [openUMLFeV3] => Array - ( - [packages] => Array - ( - [parcels] => Array - ( - [0] => Array - ( - [content] => 1_1, 2_7, 3_13 - [customerData1] => - [customerData2] => - [customerData3] => - [reference] => YMFVWFFSH_1 - [sizeX] => 0 - [sizeY] => 0 - [sizeZ] => 0 - [weight] => 0 - ) - - ) - - [payerType] => THIRD_PARTY - [thirdPartyFID] => 124118 - [receiver] => Array - ( - [address] => 16, Main street 2nd floor - [city] => Paris - [company] => My Company - [countryCode] => FR - [email] => pub@prestashop.com - [fid] => - [name] => John DOE - [phone] => 0102030405 - [postalCode] => 75002 - ) - - [ref1] => 5 - [ref2] => - [ref3] => PSMODUL# - [reference] => - [sender] => Array - ( - [address] => Wesoła, 22 - [city] => Poznań - [company] => NEXTMA Mateusz Kumanowski - [countryCode] => PL - [email] => mateusz.kumanowski@gmail.com - [name] => NEXTMA Mateusz Kumanowski - [phone] => 12345678 - [postalCode] => 60149 - ) - - [services] => Array - ( - [declaredValue] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - [duty] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - ) - - ) - - ) - - [pkgNumsGenerationPolicyV1] => STOP_ON_FIRST_ERROR - [langCode] => PL -) - -*ERROR* 2021/02/28 - 10:18:13: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:18:13: error in package create -*ERROR* 2021/02/28 - 10:18:13: ["Us\u0142uga 'Odprawa celna' jest niedozwolona dla wybranego kraju dor\u0119czenia"] -*DEBUG* 2021/02/28 - 10:18:15: savePackageFromPost -*DEBUG* 2021/02/28 - 10:18:15: Array -( - [openUMLFeV3] => Array - ( - [packages] => Array - ( - [parcels] => Array - ( - [0] => Array - ( - [content] => 1_1, 2_7, 3_13 - [customerData1] => - [customerData2] => - [customerData3] => - [reference] => QPVUDSXOS_1 - [sizeX] => 0 - [sizeY] => 0 - [sizeZ] => 0 - [weight] => 10 - ) - - ) - - [payerType] => THIRD_PARTY - [thirdPartyFID] => 124118 - [receiver] => Array - ( - [address] => 16, Main street 2nd floor - [city] => Paris - [company] => My Company - [countryCode] => FR - [email] => pub@prestashop.com - [fid] => - [name] => John DOE - [phone] => 0102030405 - [postalCode] => 75002 - ) - - [ref1] => 5 - [ref2] => - [ref3] => PSMODUL# - [reference] => - [sender] => Array - ( - [address] => Wesoła, 22 - [city] => Poznań - [company] => NEXTMA Mateusz Kumanowski - [countryCode] => PL - [email] => mateusz.kumanowski@gmail.com - [name] => NEXTMA Mateusz Kumanowski - [phone] => 12345678 - [postalCode] => 60149 - ) - - [services] => Array - ( - [declaredValue] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - [duty] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - ) - - ) - - ) - - [pkgNumsGenerationPolicyV1] => STOP_ON_FIRST_ERROR - [langCode] => PL -) - -*ERROR* 2021/02/28 - 10:18:15: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:18:15: error in package create -*ERROR* 2021/02/28 - 10:18:15: ["Us\u0142uga 'Odprawa celna' jest niedozwolona dla wybranego kraju dor\u0119czenia"] -*DEBUG* 2021/02/28 - 10:18:33: savePackageFromPost -*DEBUG* 2021/02/28 - 10:18:33: Array -( - [openUMLFeV3] => Array - ( - [packages] => Array - ( - [parcels] => Array - ( - [0] => Array - ( - [content] => 1_1, 2_7, 3_13 - [customerData1] => - [customerData2] => - [customerData3] => - [reference] => DMXJFREFU_1 - [sizeX] => 0 - [sizeY] => 0 - [sizeZ] => 0 - [weight] => 10 - ) - - ) - - [payerType] => THIRD_PARTY - [thirdPartyFID] => 124118 - [receiver] => Array - ( - [address] => 16, Main street 2nd floor - [city] => Paris - [company] => My Company - [countryCode] => FR - [email] => pub@prestashop.com - [fid] => - [name] => John DOE - [phone] => 0102030405 - [postalCode] => 75002 - ) - - [ref1] => 5 - [ref2] => - [ref3] => PSMODUL# - [reference] => - [sender] => Array - ( - [address] => Wesoła, 22 - [city] => Poznań - [company] => NEXTMA Mateusz Kumanowski - [countryCode] => PL - [email] => mateusz.kumanowski@gmail.com - [name] => NEXTMA Mateusz Kumanowski - [phone] => 12345678 - [postalCode] => 60149 - ) - - [services] => Array - ( - [declaredValue] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - [duty] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - ) - - ) - - ) - - [pkgNumsGenerationPolicyV1] => STOP_ON_FIRST_ERROR - [langCode] => PL -) - -*ERROR* 2021/02/28 - 10:18:34: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:18:34: error in package create -*ERROR* 2021/02/28 - 10:18:34: ["Us\u0142uga 'Odprawa celna' jest niedozwolona dla wybranego kraju dor\u0119czenia"] -*DEBUG* 2021/02/28 - 10:18:38: savePackageFromPost -*DEBUG* 2021/02/28 - 10:18:38: Array -( - [openUMLFeV3] => Array - ( - [packages] => Array - ( - [parcels] => Array - ( - [0] => Array - ( - [content] => 1_1, 2_7, 3_13 - [customerData1] => - [customerData2] => - [customerData3] => - [reference] => EHIVEDYRN_1 - [sizeX] => 0 - [sizeY] => 0 - [sizeZ] => 0 - [weight] => 10 - ) - - ) - - [payerType] => THIRD_PARTY - [thirdPartyFID] => 124118 - [receiver] => Array - ( - [address] => 16, Main street 2nd floor - [city] => Paris - [company] => My Company - [countryCode] => FR - [email] => pub@prestashop.com - [fid] => - [name] => John DOE - [phone] => 0102030405 - [postalCode] => 75002 - ) - - [ref1] => 5 - [ref2] => - [ref3] => PSMODUL# - [reference] => - [sender] => Array - ( - [address] => Wesoła, 22 - [city] => Poznań - [company] => NEXTMA Mateusz Kumanowski - [countryCode] => PL - [email] => mateusz.kumanowski@gmail.com - [name] => NEXTMA Mateusz Kumanowski - [phone] => 12345678 - [postalCode] => 60149 - ) - - [services] => Array - ( - [declaredValue] => Array - ( - [amount] => 10 - [currency] => PLN - ) - - ) - - ) - - ) - - [pkgNumsGenerationPolicyV1] => STOP_ON_FIRST_ERROR - [langCode] => PL -) - -*ERROR* 2021/02/28 - 10:18:40: Wystąpił błąd podczas wysyłania wiadomości email do klienta -*ERROR* 2021/02/28 - 10:18:40: addTrackingNumber An error occurred while sending an email to the customer. -*ERROR* 2021/02/28 - 10:18:41: ["Wyst\u0105pi\u0142 b\u0142\u0105d podczas wysy\u0142ania wiadomo\u015bci email do klienta"] -*DEBUG* 2021/02/28 - 10:21:14: savePackageFromPost -*ERROR* 2021/02/28 - 10:21:14: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:21:14: error in package create -*ERROR* 2021/02/28 - 10:21:14: ["Us\u0142uga 'Odprawa celna' jest niedozwolona dla wybranego kraju dor\u0119czenia"] -*DEBUG* 2021/02/28 - 10:23:27: savePackageFromPost -*ERROR* 2021/02/28 - 10:23:28: Array -( - [0] => Maksymalna dopuszczalna waga paczki to 700 kg -) - -*ERROR* 2021/02/28 - 10:23:28: error in package create -*ERROR* 2021/02/28 - 10:23:28: ["Maksymalna dopuszczalna waga paczki to 700 kg"] -*DEBUG* 2021/02/28 - 10:23:31: savePackageFromPost -*ERROR* 2021/02/28 - 10:23:32: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:23:32: error in package create -*ERROR* 2021/02/28 - 10:23:32: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:23:50: savePackageFromPost -*ERROR* 2021/02/28 - 10:23:50: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:23:50: error in package create -*ERROR* 2021/02/28 - 10:23:50: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:23:56: savePackageFromPost -*ERROR* 2021/02/28 - 10:23:56: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:23:56: error in package create -*ERROR* 2021/02/28 - 10:23:56: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:24:39: savePackageFromPost -*ERROR* 2021/02/28 - 10:24:40: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:24:40: error in package create -*ERROR* 2021/02/28 - 10:24:40: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:24:48: savePackageFromPost -*ERROR* 2021/02/28 - 10:24:49: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [0] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - [1] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - [2] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:24:49: error in package create -*ERROR* 2021/02/28 - 10:24:49: ["'Dostawa do UK, zaznacz us\u0142ug\u0119 odprawa celna i przygotuj dokumenty celne'"] -*DEBUG* 2021/02/28 - 10:24:57: savePackageFromPost -*ERROR* 2021/02/28 - 10:24:57: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:24:57: error in package create -*ERROR* 2021/02/28 - 10:24:57: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:25:05: savePackageFromPost -*ERROR* 2021/02/28 - 10:25:05: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:25:05: error in package create -*ERROR* 2021/02/28 - 10:25:05: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:25:09: savePackageFromPost -*ERROR* 2021/02/28 - 10:25:09: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:25:09: error in package create -*ERROR* 2021/02/28 - 10:25:09: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:25:25: savePackageFromPost -*ERROR* 2021/02/28 - 10:25:25: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:25:25: error in package create -*ERROR* 2021/02/28 - 10:25:25: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:25:28: savePackageFromPost -*ERROR* 2021/02/28 - 10:25:28: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:25:28: error in package create -*ERROR* 2021/02/28 - 10:25:28: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:25:31: savePackageFromPost -*ERROR* 2021/02/28 - 10:25:32: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:25:32: error in package create -*ERROR* 2021/02/28 - 10:25:32: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:25:36: savePackageFromPost -*ERROR* 2021/02/28 - 10:25:36: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* 2021/02/28 - 10:25:36: error in package create -*ERROR* 2021/02/28 - 10:25:36: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* 2021/02/28 - 10:25:43: savePackageFromPost -*ERROR* 2021/02/28 - 10:25:45: Wystąpił błąd podczas wysyłania wiadomości email do klienta -*ERROR* 2021/02/28 - 10:25:45: addTrackingNumber An error occurred while sending an email to the customer. -*ERROR* 2021/02/28 - 10:25:46: ["Wyst\u0105pi\u0142 b\u0142\u0105d podczas wysy\u0142ania wiadomo\u015bci email do klienta"] -*DEBUG* 2021/02/28 - 10:33:05: savePackageFromPost -*ERROR* 2021/02/28 - 10:33:05: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [0] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - [1] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - [2] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:33:05: error in package create -*ERROR* 2021/02/28 - 10:33:05: ["'Dostawa do UK, zaznacz us\u0142ug\u0119 odprawa celna i przygotuj dokumenty celne'"] -*DEBUG* 2021/02/28 - 10:33:13: savePackageFromPost -*ERROR* 2021/02/28 - 10:33:14: Array -( - [0] => Maksymalna dopuszczalna waga paczki to 700 kg -) - -*ERROR* 2021/02/28 - 10:33:14: error in package create -*ERROR* 2021/02/28 - 10:33:14: ["Maksymalna dopuszczalna waga paczki to 700 kg"] -*DEBUG* 2021/02/28 - 10:33:19: savePackageFromPost -*ERROR* 2021/02/28 - 10:33:19: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [0] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - [1] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - [2] => Array - ( - [ErrorId] => 1616 - [ErrorCode] => ERROR_DUTY_MUST_BE_SET_FOR_DPD_CLASSIC_GB - [FieldNames] => Services/Duty - [Info] => 'Dostawa do UK, zaznacz usługę odprawa celna i przygotuj dokumenty celne' - ) - - ) - - ) - -) - -*ERROR* 2021/02/28 - 10:33:19: error in package create -*ERROR* 2021/02/28 - 10:33:19: ["'Dostawa do UK, zaznacz us\u0142ug\u0119 odprawa celna i przygotuj dokumenty celne'"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:37:10: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:37:10: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - ) - -) - -*ERROR* v1.7.7.1 2021/02/28 - 10:37:10: error in package create -*ERROR* v1.7.7.1 2021/02/28 - 10:37:10: ["Us\u0142uga 'Odprawa celna' jest niedozwolona dla wybranego kraju dor\u0119czenia"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:37:17: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:37:18: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [0] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_SERVICES_AVAILABILITY_CLASSIC - [FieldNames] => - [Info] => Produkt bazowy niepoprawny dla wybranego kraju i kodu pocztowego odbiorcy - ) - - [1] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_SERVICES_AVAILABILITY_CLASSIC - [FieldNames] => - [Info] => Produkt bazowy niepoprawny dla wybranego kraju i kodu pocztowego odbiorcy - ) - - [2] => Array - ( - [ErrorId] => 1000 - [ErrorCode] => ERROR_SERVICES_AVAILABILITY_CLASSIC - [FieldNames] => - [Info] => Produkt bazowy niepoprawny dla wybranego kraju i kodu pocztowego odbiorcy - ) - - [3] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - ) - - ) - -) - -*ERROR* v1.7.7.1 2021/02/28 - 10:37:18: error in package create -*ERROR* v1.7.7.1 2021/02/28 - 10:37:18: ["Produkt bazowy niepoprawny dla wybranego kraju i kodu pocztowego odbiorcy"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:37:26: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:37:27: Wystąpił błąd podczas wysyłania wiadomości email do klienta -*ERROR* v1.7.7.1 2021/02/28 - 10:37:27: addTrackingNumber An error occurred while sending an email to the customer. -*ERROR* v1.7.7.1 2021/02/28 - 10:37:28: ["Wyst\u0105pi\u0142 b\u0142\u0105d podczas wysy\u0142ania wiadomo\u015bci email do klienta"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:50:11: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:50:11: ["Tw\u00f3j adres dostawy nie jest zgodny z wybran\u0105 metod\u0105 wysy\u0142ki. DPD Poland Domestic jest dost\u0119pny tylko wtedy, gdy adresem dostawy jest Polska. DPD Mi\u0119dzynarodowa metoda wysy\u0142ki jest dost\u0119pna tylko wtedy, gdy adres dostawy nie jest w Polsce."] -*DEBUG* v1.7.7.1 2021/02/28 - 10:53:30: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:53:30: Wystąpił błąd podczas wysyłania wiadomości email do klienta -*ERROR* v1.7.7.1 2021/02/28 - 10:53:30: addTrackingNumber An error occurred while sending an email to the customer. -*ERROR* v1.7.7.1 2021/02/28 - 10:53:32: ["Wyst\u0105pi\u0142 b\u0142\u0105d podczas wysy\u0142ania wiadomo\u015bci email do klienta"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:54:14: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:54:14: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* v1.7.7.1 2021/02/28 - 10:54:14: error in package create -*ERROR* v1.7.7.1 2021/02/28 - 10:54:14: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:54:24: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:54:24: Array -( - [0] => DPD Polska Sp. z o.o. : Unknown error -) - -*ERROR* v1.7.7.1 2021/02/28 - 10:54:24: error in package create -*ERROR* v1.7.7.1 2021/02/28 - 10:54:24: ["DPD Polska Sp. z o.o. : Unknown error"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:54:37: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:54:37: Array -( - [0] => Array - ( - [ValidationInfo] => Array - ( - [ErrorId] => 1014 - [ErrorCode] => ERROR_DUTY_NOT_AVAILABLE_FOR_COUNTRY - [FieldNames] => Services/Duty; - [Info] => Usługa 'Odprawa celna' jest niedozwolona dla wybranego kraju doręczenia - ) - - ) - -) - -*ERROR* v1.7.7.1 2021/02/28 - 10:54:37: error in package create -*ERROR* v1.7.7.1 2021/02/28 - 10:54:37: ["Us\u0142uga 'Odprawa celna' jest niedozwolona dla wybranego kraju dor\u0119czenia"] -*DEBUG* v1.7.7.1 2021/02/28 - 10:55:04: savePackageFromPost -*ERROR* v1.7.7.1 2021/02/28 - 10:55:04: Wystąpił błąd podczas wysyłania wiadomości email do klienta -*ERROR* v1.7.7.1 2021/02/28 - 10:55:04: addTrackingNumber An error occurred while sending an email to the customer. -*ERROR* v1.7.7.1 2021/02/28 - 10:55:05: ["Wyst\u0105pi\u0142 b\u0142\u0105d podczas wysy\u0142ania wiadomo\u015bci email do klienta"] +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:46: Ustawienia zapisane +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:48: getOrderShippingCostExternal: PrestaShop calc - carrier: 183, weight: 1, zone: 1, price: FALSE +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:48: getOrderShippingCostExternal: No price found for weight/zone - check carrier price ranges in PrestaShop +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:49: getOrderShippingCostExternal: PrestaShop calc - carrier: 183, weight: 1, zone: 1, price: FALSE +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:49: getOrderShippingCostExternal: No price found for weight/zone - check carrier price ranges in PrestaShop +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:50: getOrderShippingCostExternal: PrestaShop calc - carrier: 183, weight: 1, zone: 1, price: FALSE +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:50: getOrderShippingCostExternal: No price found for weight/zone - check carrier price ranges in PrestaShop +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:50: getOrderShippingCostExternal: PrestaShop calc - carrier: 183, weight: 1, zone: 1, price: FALSE +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:50: getOrderShippingCostExternal: No price found for weight/zone - check carrier price ranges in PrestaShop +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:51: getOrderShippingCostExternal: PrestaShop calc - carrier: 183, weight: 1, zone: 1, price: FALSE +*DEBUG* v1.7.8.7 2026/01/29 - 23:23:51: getOrderShippingCostExternal: No price found for weight/zone - check carrier price ranges in PrestaShop diff --git a/modules/dpdshipping/CHANGELOG.txt b/modules/dpdshipping/CHANGELOG.txt new file mode 100644 index 00000000..dfc71db0 --- /dev/null +++ b/modules/dpdshipping/CHANGELOG.txt @@ -0,0 +1,48 @@ +Changelog: +v2.0.2 - 27.11.2025 +- Support for decimal product quantities + +v2.0.1 - 25.10.2025 + - Support for Prestashop 9 + +v2.0.0 - 20.10.2025 + - Support for Prestashop 9 + +v1.6.6 - 15.10.2025 + - Special Price for Swip Box + +v1.6.5 - 07.10.2025 + - Fixes + +v1.6.4 - 06.10.2025 + - Support for EMPIK integration + +v1.5.0 - 12.08.2025 + - DPD Poland - Swip box shipping method + +v1.4.0 - 9.04.2025 + - Block confirm order without Pickup Point for custom checkout - Easycheckout + - Block confirm order without Pickup Point for custom checkout - One Page Checkout - PrestaTeam - Prestashop 1.7 + - Block confirm order without Pickup Point for custom checkout - One Page Checkout - PrestaTeam - Prestashop 8 + - Block confirm order without Pickup Point for custom checkout - The Checkout - PrestaSmart + - Block confirm order without Pickup Point for custom checkout - One Page Checkout - PrestaSmart + +v1.3.1 - 28.02.2025 + - Declared value service - get amount and currency + +v1.3.0 - 18.01.2025 + - Multistore support + - Special Price import and export with support pagination + - Generate shipping - Pickup map for receiver country + - Order courier fix + - Get pickup number for old carriers + - Change join carrier method + +v1.2.0 - 22.11.2024 +- Hide generate shipping form if carrier is not DPD + +v1.1.5 - 24.09.2024 + - Set default package weight when product weight is <= 0 + +v1.1.4 - 30.07.2024 + - Show courier pickup option for one time range \ No newline at end of file diff --git a/modules/dpdshipping/LICENCE.txt b/modules/dpdshipping/LICENCE.txt new file mode 100644 index 00000000..f38a10e9 --- /dev/null +++ b/modules/dpdshipping/LICENCE.txt @@ -0,0 +1,98 @@ +LICENCJA PUBLICZNA UNII EUROPEJSKIEJ wersja 1.2 +EUPL © Unia Europejska 2007, 2016 +Niniejsza licencja publiczna Unii Europejskiej („EUPL”) stosowana jest w odniesieniu do utworu (w rozumieniu definicji poniżej) udostępnianego na warunkach niniejszej licencji. Każde wykorzystanie utworu inne niż dozwolone na mocy niniejszej licencji jest zakazane (w zakresie, w jakim takie wykorzystanie wchodzi w zakres prawa przysługującego posiadaczowi praw autorskich do utworu). Utwór jest udostępniany na warunkach niniejszej licencji, jeżeli licencjodawca (w rozumieniu definicji poniżej) umieści następującą wzmiankę bezpośrednio po informacji o prawach autorskich do utworu: + Na licencji EUPL +lub w jakikolwiek inny sposób wyrazi swój zamiar udzielenia licencji na podstawie EUPL. + +1.Definicje +W niniejszej licencji stosuje się następujące definicje: +— licencja:niniejsza licencja, +— utwór oryginalny:utwór lub oprogramowanie rozpowszechniane lub udostępniane przez licencjodawcę na podstawie niniejszej licencji, dostępne w postaci kodu źródłowego, a także – stosownie do przypadku – kodu wykonywalnego, +— utwory zależne:utwory lub oprogramowanie, które mogą zostać opracowane przez licencjobiorcę na podstawie utworu oryginalnego lub modyfikacji utworu oryginalnego. Niniejsza licencja nie określa zakresu modyfikacji lub zależności od utworu oryginalnego, wymaganego dla sklasyfikowania utworu jako utworu zależnego; zakres taki wynika z przepisów prawa autorskiego obowiązującego w państwie, o którym mowa w pkt 15, +— „utwór”:utwór oryginalny lub związane z nim utwory zależne, +— „kod źródłowy”:postać utworu czytelna dla człowieka, najdogodniejsza do analizy i modyfikacji, +— „kod wykonywalny”:każdy kod, który został zasadniczo skompilowany i który jako program przeznaczony jest do interpretacji przez komputer, +— „licencjodawca”:osoba fizyczna bądź prawna, która rozpowszechnia lub udostępnia utwór na podstawie licencji, +— „współautor (współautorzy)”:każda osoba fizyczna lub prawna, która modyfikuje utwór na podstawie licencji lub w inny sposób przyczynia się do stworzenia utworu zależnego, +— „licencjobiorca”:każda osoba fizyczna lub prawna, która w jakimkolwiek zakresie korzysta z utworu na warunkach licencji, +—„rozpowszechnianie” lub „udostępnianie”:każdy przypadek sprzedaży, przekazania, wypożyczenia, najmu, rozpowszechnienia, udostępnienia, nadania lub innego oddania kopii utworu do dyspozycji innej osobie fizycznej bądź prawnej lub zapewnienia im dostępu do jego istotnych funkcji w trybie on-line lub off-line. + +2.Zakres praw przyznawanych na mocy licencji +Licencjodawca niniejszym udziela licencjobiorcy obowiązującej na całym świecie, bezpłatnej, niewyłącznej licencji, obejmującej prawo do udzielania dalszych licencji, na wykonywanie następujących czynności przez okres obowiązywania praw autorskich do utworu oryginalnego: +— korzystanie z utworu we wszelkich okolicznościach i do wszelkich celów, +— zwielokrotnianie utworu, +— modyfikacja utworu oryginalnego oraz opracowywanie utworów zależnych na podstawie utworu, +— publiczne udostępnianie, w tym, stosownie do przypadku, prawo do publicznego udostępniania lub prezentacji utworu lub jego kopii oraz publicznego wykonywania utworu, +— rozpowszechnianie utworu lub jego kopii, +— wypożyczanie i najem utworu lub jego kopii, +— sublicencjonowanie praw do utworu lub jego kopii. +Powyższe prawa mogą być wykonywane bez względu na nośnik, rodzaj wsparcia i format, znany obecnie lub opracowany w przyszłości, w zakresie dozwolonym przepisami obowiązującego prawa. W państwach, w których przysługują autorskie prawa osobiste, licencjodawca zrzeka się przysługującego mu uprawnienia do wykonywania swoich autorskich praw osobistych w zakresie dozwolonym obowiązującymi przepisami w celu umożliwienia skutecznego udzielenia licencji w zakresie autorskich praw majątkowych wyszczególnionych powyżej. Licencjodawca niniejszym przyznaje licencjobiorcy bezpłatne, niewyłączne prawa do eksploatacji wszelkich patentów posiadanych przez licencjodawcę w zakresie niezbędnym do korzystania z praw do utworu przyznanych na mocy niniejszej licencji. + +3.Udostępnienie kodu źródłowego +Licencjodawca może udostępnić utwór w postaci kodu źródłowego lub kodu wykonywalnego. Jeżeli utwór udostępnia się w postaci kodu wykonywalnego, licencjodawca udostępnia jednocześnie kopię kodu źródłowego utworu w formie przeznaczonej do odczytu maszynowego wraz z każdą kopią utworu, którą licencjodawca rozpowszechnia, bądź wskazuje, w adnotacji następującej po informacji o prawach autorskich dołączonej do utworu, repozytorium, w którym łatwo i bezpłatnie dostępny jest kod źródłowy w czasie, w którym licencjodawca rozpowszechnia lub udostępnia utwór. + +4.Ograniczenia praw autorskich +Żadne z postanowień niniejszej licencji nie ma na celu pozbawienia licencjobiorcy korzyści wynikających z wszelkich wyjątków lub ograniczeń w stosunku do wyłącznych praw przysługujących właścicielom praw do utworu, ani korzyści płynących z faktu wyczerpania powyższych praw lub innych stosownych ograniczeń tych praw. + +5.Obowiązki licencjobiorcy +Przyznanie praw, o których mowa powyżej, podlega określonym ograniczeniom i obowiązkom nałożonym na licencjobiorcę. Obowiązki te obejmują: + +Prawo do autorstwa utworu: Licencjobiorca zobowiązuje się pozostawić w niezmienionej formie wszelkie informacje o prawach autorskich, patentach lub znakach towarowych oraz wszelkie adnotacje dotyczące licencji i wyłączenia gwarancji. Licencjobiorca zobowiązany jest dołączać kopię takich informacji i adnotacji oraz kopię licencji do każdej kopii utworu przez niego rozpowszechnianej lub udostępnianej. Licencjobiorca musi zadbać o to, aby wszelkie utwory zależne opatrzone zostały w widocznym miejscu informacją, że utwór uległ modyfikacji, wraz z datą takiej modyfikacji. + +Klauzula zakazu wprowadzania zmian i ograniczeń do licencji („copyleft”): Jeżeli licencjobiorca rozpowszechnia lub udostępnia kopie utworów oryginalnych lub utworów zależnych, takie rozpowszechnianie lub udostępnianie musi odbywać się na warunkach niniejszej licencji lub późniejszej wersji niniejszej licencji, chyba że rozpowszechnianie utworu oryginalnego wyraźnie odbywa się wyłącznie na podstawie niniejszej wersji licencji – na przykład poprzez dodanie zastrzeżenia „wyłącznie na podstawie EUPL wersja 1.2”. Licencjobiorca (działając w charakterze licencjodawcy) nie może oferować ani nakładać na utwór ani na utwór zależny żadnych dodatkowych postanowień ani warunków zmieniających bądź ograniczających warunki licencji. + +Klauzula zgodności: Jeżeli licencjobiorca rozpowszechnia lub udostępnia utwory zależne lub ich kopie opracowane na podstawie utworu i innego utworu licencjonowanego na mocy zgodnej licencji, takie rozpowszechnianie lub udostępnianie może odbywać się na warunkach wspomnianej zgodnej licencji. Do celów niniejszej klauzuli termin „zgodna licencja” obejmuje licencje wymienione w załączniku do niniejszej licencji. Jeżeli obowiązki licencjobiorcy wynikające ze zgodnej licencji są sprzeczne z jego obowiązkami wynikającymi z niniejszej licencji, obowiązki określone w zgodnej licencji mają charakter nadrzędny. + +Udostępnienie kodu źródłowego: Rozpowszechniając lub udostępniając kopie utworu, licencjobiorca udostępnia przeznaczoną do odczytu maszynowego kopię kodu źródłowego lub wskazuje repozytorium, w którym ten kod będzie łatwo i bezpłatnie dostępny w czasie, w którym licencjobiorca rozpowszechnia lub udostępnia utwór. + +Ochrona prawna: Niniejsza licencja nie upoważnia do korzystania z nazw handlowych, znaków towarowych, znaków usługowych ani nazw licencjodawcy, z wyjątkiem przypadków uzasadnionego i zwyczajowo przyjętego opisu pochodzenia utworu i powielania treści informacji o prawach autorskich. + +6.Ciąg autorstwa +Pierwotny licencjodawca gwarantuje, że prawa autorskie do utworu oryginalnego przyznane na mocy niniejszej licencji stanowią jego własność lub że posiada je na mocy stosownej licencji oraz że jest uprawniony i upoważniony do udzielania licencji. Każdy współautor gwarantuje, że prawa autorskie do modyfikacji, jakie wprowadza do utworu, stanowią jego własność lub że posiada je na mocy stosownej licencji oraz że jest uprawniony i upoważniony do udzielania licencji. Każdorazowo gdy licencjobiorca akceptuje licencję, pierwotny licencjodawca i późniejsi współautorzy udzielają licencjobiorcy licencji w stosunku do ich wkładu w utwór na warunkach niniejszej licencji. + +7.Wyłączenie gwarancji +Utwór ma charakter utworu nieukończonego, wciąż udoskonalanego przez wielu współautorów. Nie stanowi on utworu gotowego i dlatego może posiadać wady lub błędy właściwe dla tej formy opracowywania utworów. Z powyższych względów utwór przekazuje się na mocy licencji w postaci, w jakiej jest udostępniany, i bez jakichkolwiek gwarancji dotyczących utworu, w tym między innymi bez gwarancji przydatności handlowej, gwarancji przydatności do określonego celu, gwarancji braku wad lub błędów, gwarancji dokładności, gwarancji braku naruszenia praw własności intelektualnej innych niż prawa autorskie, o których mowa w pkt 6 niniejszej licencji. Niniejsze wyłączenie gwarancji stanowi istotny element licencji oraz warunek przyznania jakichkolwiek praw do utworu. + +8.Wyłączenie odpowiedzialności +Z zastrzeżeniem przypadków działań umyślnych na szkodę osób fizycznych lub szkód wyrządzonych bezpośrednio osobom fizycznym, licencjodawca w żadnym wypadku nie ponosi odpowiedzialności za bezpośrednie lub pośrednie, majątkowe lub osobiste szkody dowolnego rodzaju powstałe w związku z licencją lub eksploatacją utworu, w tym między innymi za szkody związane z utratą wartości firmy, przerwami w pracy, awarią bądź zakłóceniami pracy komputera, utratą danych ani za wszelkie inne szkody gospodarcze, nawet jeżeli licencjodawca został poinformowany o możliwości ich wystąpienia. Licencjodawca ponosi jednak odpowiedzialność zgodnie z ustawowymi przepisami regulującymi kwestie odpowiedzialności za produkt w zakresie, w jakim takie przepisy mają zastosowanie do utworu. + +9.Dodatkowe umowy +Rozpowszechniając utwór, licencjobiorca może postanowić o zawarciu dodatkowej umowy określającej zobowiązania lub świadczenia zgodne z niniejszą licencją. Przyjmując takie zobowiązania, licencjobiorca może występować jedynie we własnym imieniu i na własną odpowiedzialność, a nie w imieniu pierwotnego licencjodawcy ani żadnego innego współautora, oraz tylko pod warunkiem że licencjobiorca zobowiąże się względem każdego współautora do wypłacenia mu rekompensaty, jego obrony i zwolnienia go z odpowiedzialności, jeśli w związku z faktem, że licencjobiorca przyjął dodatkowe zobowiązania lub gwarancje, po stronie takiego współautora powstanie odpowiedzialność lub wysunięte zostaną wobec niego roszczenia. + +10.Akceptacja licencji +Postanowienia niniejszej licencji mogą zostać zaakceptowane poprzez kliknięcie ikony „Wyrażam zgodę” umieszczonej na dole okna, w którym wyświetlono pełną treść niniejszej licencji, lub poprzez potwierdzenie własnej zgody w jakikolwiek inny podobny sposób zgodny z przepisami obowiązującego prawa. Kliknięcie takiej ikony jest równoznaczne z wyraźną i nieodwołalną akceptacją niniejszej licencji oraz wszystkich jej warunków. Analogicznie, nieodwołalną akceptację przez licencjobiorcę niniejszej licencji i wszystkich jej warunków stanowi także wykonanie jakiegokolwiek prawa przyznanego licencjobiorcy na mocy pkt 2 niniejszej licencji, takie jak wykorzystanie utworu, opracowanie przez licencjobiorcę utworu zależnego bądź rozpowszechnienie lub udostępnienie przez licencjobiorcę utworu lub jego kopii. + +11.Podawanie informacji do publicznej wiadomości +W przypadku rozpowszechniania lub udostępniania przez licencjobiorcę utworu drogą komunikacji elektronicznej (na przykład poprzez oferowanie utworu do pobrania z lokalizacji zdalnej), w obrębie kanału rozpowszechniania lub nośnika (na przykład witryny internetowej) należy przynajmniej podać do wiadomości publicznej informacje wymagane przepisami obowiązującego prawa dotyczące licencjodawcy, licencji oraz sposobu, w jaki może zostać udostępniona, zawarta, przechowywana i zwielokrotniana przez licencjobiorcę. + +12.Wygaśnięcie licencji +Licencja i prawa przyznane na jej mocy wygasają automatycznie z chwilą naruszenia przez licencjobiorcę warunków licencji. Takie wygaśnięcie nie skutkuje jednak wygaśnięciem licencji przysługującej którejkolwiek z osób, które otrzymały utwór od licencjobiorcy na mocy licencji, pod warunkiem że takie osoby nadal przestrzegają w pełni postanowień licencji. + +13.Postanowienia różne +Nie naruszając postanowień pkt 9, licencja stanowi całość porozumienia między stronami w odniesieniu do utworu. Jeżeli jakiekolwiek postanowienie licencji okaże się nieważne lub niewykonalne na gruncie obowiązującego prawa, pozostaje to bez wpływu na ważność lub wykonalność licencji jako całości. Takie nieważne lub niewykonalne postanowienie należy interpretować lub dostosować w taki sposób, by zapewnić jego ważność i wykonalność. Komisja Europejska może publikować inne wersje językowe lub nowe wersje niniejszej licencji bądź zaktualizowane wersje załącznika, jeżeli jest to konieczne i uzasadnione, bez zawężania zakresu praw przyznanych na mocy licencji. Nowe wersje licencji publikuje się pod niepowtarzalnym numerem wersji. Wszystkie zatwierdzone przez Komisję Europejską wersje językowe niniejszej licencji mają taką samą wartość. Strony mogą korzystać z dowolnej wybranej przez siebie wersji językowej. + +14.Jurysdykcja +Bez uszczerbku dla szczegółowych uzgodnień między stronami, +— wszelkie spory sądowe związane z interpretacją niniejszej licencji, wynikłe między instytucjami, organami, urzędami lub agencjami Unii Europejskiej jako licencjodawcą a dowolnym licencjobiorcą, podlegają jurysdykcji Trybunału Sprawiedliwości Unii Europejskiej, zgodnie z postanowieniami art. 272 Traktatu o funkcjonowaniu Unii Europejskiej, +— wszelkie spory sądowe związane z interpretacją niniejszej licencji, wynikłe między innymi stronami, podlegają wyłącznej jurysdykcji sądu właściwego miejscowo dla miejsca zamieszkania licencjodawcy bądź jego głównego miejsca prowadzenia działalności gospodarczej. + +15.Prawo właściwe +Bez uszczerbku dla szczegółowych uzgodnień między stronami, +— prawem właściwym dla wykonania niniejszej licencji jest prawo państwa członkowskiego Unii Europejskiej, w którym zamieszkuje lub posiada swą siedzibę (statutową) licencjodawca, +— prawem właściwym dla wykonania niniejszej licencji jest prawo belgijskie, jeżeli licencjodawca nie ma miejsca zamieszkania lub siedziby (statutowej) na terenie państwa członkowskiego Unii Europejskiej. + + +Załącznik +„Zgodne licencje” w rozumieniu pkt 5 EUPL to: +— GNU General Public License (GPL) wersja 2, wersja 3 +— GNU Affero General Public License (AGPL) wersja 3 +— Open Software License (OSL) wersja 2.1, wersja 3.0 +— Eclipse Public License (EPL) wersja 1.0 +— CeCILL wersja 2.0, wersja 2.1 +— Mozilla Public Licence (MPL) wersja 2 +— GNU Lesser General Public Licence (LGPL) wersja 2.1, wersja 3 +— Creative Commons Attribution-ShareAlike wersja 3.0 Unported (CC BY-SA 3.0) w odniesieniu do utworów innych niż oprogramowanie +— licencja publiczna Unii Europejskiej (EUPL) wersja 1.1, wersja 1.2 +— Québec Free and Open-Source Licence – Reciprocity (LiLiQ-R) lub Strong Reciprocity (LiLiQ-R+). +Komisja Europejska może zaktualizować ten załącznik, aby uwzględnić w nim późniejsze wersje wyżej wymienionych licencji bez sporządzania nowej wersji EUPL, o ile te nowe wersje przyznają prawa przewidziane w pkt 2 niniejszej licencji oraz chronią kod źródłowy wchodzący w jej zakres przed wyłącznym przywłaszczeniem. +Wszelkie inne zmiany lub uzupełnienia niniejszego załącznika wymagają sporządzenia nowej wersji EUPL. 19.5.2017 L 128/64 Dziennik Urzędowy Unii Europejskiej PL \ No newline at end of file diff --git a/modules/dpdshipping/README.md b/modules/dpdshipping/README.md new file mode 100644 index 00000000..0b766557 --- /dev/null +++ b/modules/dpdshipping/README.md @@ -0,0 +1,13 @@ +## Troubleshooting + +1. **Clear Cache**: + - To clear the cache, run the following command in the main PrestaShop directory: + ```bash + php bin/console cache:clear + ``` + +2. **Update Libraries**: + - To update the libraries, run the following command in the `modules/dpdshipping` directory: + ```bash + composer install + ``` \ No newline at end of file diff --git a/modules/dpdshipping/composer.json b/modules/dpdshipping/composer.json new file mode 100644 index 00000000..036c4c00 --- /dev/null +++ b/modules/dpdshipping/composer.json @@ -0,0 +1,23 @@ +{ + "name": "dpdpoland/dpdshipping", + "description": "Moduł Wysyłkowy - DPD Polska sp. z o. o.", + "license": "AFL-3.0", + "authors": [ + { + "name": "DPD Poland sp. z o.o." + } + ], + "autoload": { + "psr-4": { + "DpdShipping\\": "src/" + } + }, + "require": { + "php": ">=7.2.0" + }, + "config": { + "preferred-install": "dist", + "prepend-autoloader": false + }, + "type": "prestashop-module" +} diff --git a/modules/dpdshipping/composer.lock b/modules/dpdshipping/composer.lock new file mode 100644 index 00000000..0cfdc170 --- /dev/null +++ b/modules/dpdshipping/composer.lock @@ -0,0 +1,998 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "427332ba9bda24dc56ebb379caf743c6", + "packages": [], + "packages-dev": [ + { + "name": "prestashop/php-dev-tools", + "version": "v5", + "source": { + "type": "git", + "url": "https://github.com/PrestaShop/php-dev-tools.git", + "reference": "4b284d9b07a274505c81144536924eb4014e6fbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PrestaShop/php-dev-tools/zipball/4b284d9b07a274505c81144536924eb4014e6fbf", + "reference": "4b284d9b07a274505c81144536924eb4014e6fbf", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/console": "~3.2 || ~4.0 || ~5.0 || ~6.0 || ~7.0", + "symfony/filesystem": "~3.2 || ~4.0 || ~5.0 || ~6.0 || ~7.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2" + }, + "suggest": { + "phpstan/phpstan": "^0.12", + "prestashop/autoindex": "^2.0", + "prestashop/header-stamp": "^2.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "bin": [ + "bin/prestashop-coding-standards" + ], + "type": "library", + "autoload": { + "psr-4": { + "PrestaShop\\CodingStandards\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PrestaShop" + } + ], + "description": "PrestaShop coding standards", + "support": { + "issues": "https://github.com/PrestaShop/php-dev-tools/issues", + "source": "https://github.com/PrestaShop/php-dev-tools/tree/v5" + }, + "time": "2024-05-23T12:27:45+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "symfony/console", + "version": "v5.4.40", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "aa73115c0c24220b523625bfcfa655d7d73662dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/aa73115c0c24220b523625bfcfa655d7d73662dd", + "reference": "aa73115c0c24220b523625bfcfa655d7d73662dd", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.40" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:33:22+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/80d075412b557d41002320b96a096ca65aa2c98d", + "reference": "80d075412b557d41002320b96a096ca65aa2c98d", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-24T14:02:46+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v5.4.40", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "26dd9912df6940810ea00f8f53ad48d6a3424995" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/26dd9912df6940810ea00f8f53ad48d6a3424995", + "reference": "26dd9912df6940810ea00f8f53ad48d6a3424995", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "symfony/process": "^5.4|^6.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.40" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:33:22+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "reference": "a2329596ddc8fd568900e3fc76cba42489ecc7f3", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-04-21T15:04:16+00:00" + }, + { + "name": "symfony/string", + "version": "v5.4.40", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "142877285aa974a6f7685e292ab5ba9aae86b143" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/142877285aa974a6f7685e292ab5ba9aae86b143", + "reference": "142877285aa974a6f7685e292ab5ba9aae86b143", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.40" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-05-31T14:33:22+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.1.0" + }, + "platform-dev": [], + "plugin-api-version": "2.6.0" +} diff --git a/modules/dpdshipping/config.xml b/modules/dpdshipping/config.xml new file mode 100644 index 00000000..315c1593 --- /dev/null +++ b/modules/dpdshipping/config.xml @@ -0,0 +1,35 @@ + + + + dpdshipping + + + + + + 1 + 1 + + \ No newline at end of file diff --git a/modules/dpdshipping/config/index.php b/modules/dpdshipping/config/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/config/index.php @@ -0,0 +1,33 @@ + + + dpdshipping + + + + + + 1 + 1 + \ No newline at end of file diff --git a/modules/dpdshipping/controllers/front/PickupGetAddressAjax.php b/modules/dpdshipping/controllers/front/PickupGetAddressAjax.php new file mode 100644 index 00000000..6193a48d --- /dev/null +++ b/modules/dpdshipping/controllers/front/PickupGetAddressAjax.php @@ -0,0 +1,145 @@ +ajax = true; + } + + public function displayAjax() + { + if ($this->validate() === true) { + try { + $pudoAddress = $this->getPudoAddress($this->getPudoCode()); + if ($pudoAddress != null) { + $response = ['success' => true, 'data' => $pudoAddress]; + } else { + $response = ['success' => false, 'message' => 'Undefined error']; + } + } catch (Exception $e) { + $response = ['success' => false, 'message' => $e->getMessage()]; + } + die(json_encode($response)); + } else { + die(json_encode(['success' => false, 'message' => 'Undefined error'])); + } + } + + private function validate(): bool + { + if ($_SERVER['REQUEST_METHOD'] !== 'GET') { + die(json_encode(['success' => false, 'message' => 'Method not allowed'])); + } + + if ($this->getCsrf() != Tools::getToken(false)) { + die(json_encode(['success' => false, 'message' => 'Invalid token.'])); + } + + if ($this->getToken() != sha1(_COOKIE_KEY_ . 'dpdshipping')) { + die(json_encode(['success' => false, 'message' => 'Invalid token'])); + } + + if (empty($this->getPudoCode())) { + die(json_encode(['success' => false, 'message' => 'Invalid params'])); + } + + return true; + } + + /** + * @return false|mixed + */ + public function getCsrf() + { + return Tools::getValue('dpdshipping_csrf'); + } + + /** + * @return false|mixed + */ + public function getToken() + { + return Tools::getValue('dpdshipping_token'); + } + + /** + * @return false|mixed + */ + public function getPudoCode() + { + return Tools::getValue('dpdshipping_pudo_code'); + } + + public function getPudoAddress($pudoCode) + { + if (empty($pudoCode)) { + return null; + } + + $ch = curl_init(); + + $url = sprintf(Config::DPD_PUDO_WS_URL, $pudoCode); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate, sdch, br'); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', + 'Accept-Encoding: gzip, deflate, sdch, br', + 'Accept-Language: en-US,en;q=0.8', + 'Cache-Control: max-age=0', + 'Connection: keep-alive', + 'Host: mypudo.dpd.com.pl', + 'Upgrade-Insecure-Requests: 1', + 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', + ]); + + $result = curl_exec($ch); + curl_close($ch); + if (!$result) { + return null; + } + + $xml = new SimpleXMLElement($result); + + if (!isset($xml->PUDO_ITEMS) || !isset($xml->PUDO_ITEMS->PUDO_ITEM)) { + return null; + } + + return implode(', ', [ + $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS1, + $xml->PUDO_ITEMS->PUDO_ITEM->ZIPCODE, + $xml->PUDO_ITEMS->PUDO_ITEM->CITY, + $xml->PUDO_ITEMS->PUDO_ITEM->PUDO_ID]); + } +} diff --git a/modules/dpdshipping/controllers/front/PickupIsCodPointAjax.php b/modules/dpdshipping/controllers/front/PickupIsCodPointAjax.php new file mode 100644 index 00000000..de3f6388 --- /dev/null +++ b/modules/dpdshipping/controllers/front/PickupIsCodPointAjax.php @@ -0,0 +1,145 @@ +ajax = true; + } + + public function displayAjax() + { + if ($this->validate() === true) { + try { + $pudoAddress = $this->isPudoPointWithCod(); + if ($pudoAddress != null) { + $response = ['success' => true, 'data' => $pudoAddress]; + } else { + $response = ['success' => false, 'message' => 'Undefined error']; + } + } catch (Exception $e) { + $response = ['success' => false, 'message' => $e->getMessage()]; + } + die(json_encode($response)); + } else { + die(json_encode(['success' => false, 'message' => 'Undefined error'])); + } + } + + private function validate(): bool + { + if ($_SERVER['REQUEST_METHOD'] !== 'GET') { + die(json_encode(['success' => false, 'message' => 'Method not allowed'])); + } + + if ($this->getCsrf() != Tools::getToken(false)) { + die(json_encode(['success' => false, 'message' => 'Invalid token.'])); + } + + if ($this->getToken() != sha1(_COOKIE_KEY_ . 'dpdshipping')) { + die(json_encode(['success' => false, 'message' => 'Invalid token'])); + } + + if (empty($this->getPudoCode())) { + die(json_encode(['success' => false, 'message' => 'Invalid params'])); + } + + return true; + } + + /** + * @return false|mixed + */ + public function getCsrf() + { + return Tools::getValue('dpdshipping_csrf'); + } + + /** + * @return false|mixed + */ + public function getToken() + { + return Tools::getValue('dpdshipping_token'); + } + + /** + * @return false|mixed + */ + public function getPudoCode() + { + return Tools::getValue('dpdshipping_pudo_code'); + } + + public function isPudoPointWithCod() + { + if (empty($this->getPudoCode())) { + return 0; + } + + $ch = curl_init(); + + $url = sprintf(Config::DPD_PUDO_WS_URL, $this->getPudoCode()); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate, sdch, br'); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', + 'Accept-Encoding: gzip, deflate, sdch, br', + 'Accept-Language: en-US,en;q=0.8', + 'Cache-Control: max-age=0', + 'Connection: keep-alive', + 'Host: mypudo.dpd.com.pl', + 'Upgrade-Insecure-Requests: 1', + 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', + ]); + + $result = curl_exec($ch); + curl_close($ch); + if (!$result) { + return null; + } + + $xml = new SimpleXMLElement($result); + + if (!isset($xml->PUDO_ITEMS) || !isset($xml->PUDO_ITEMS->PUDO_ITEM) || !isset($xml->PUDO_ITEMS->PUDO_ITEM->SERVICE_PUDO)) { + return 0; + } + + if (strpos($xml->PUDO_ITEMS->PUDO_ITEM->SERVICE_PUDO, '101') !== false) { + return 1; + } + + return 0; + } +} diff --git a/modules/dpdshipping/controllers/front/PickupSavePointAjax.php b/modules/dpdshipping/controllers/front/PickupSavePointAjax.php new file mode 100644 index 00000000..45d58e6d --- /dev/null +++ b/modules/dpdshipping/controllers/front/PickupSavePointAjax.php @@ -0,0 +1,124 @@ +ajax = true; + } + + public function displayAjax() + { + if ($this->validate() === true) { + try { + $db = Db::getInstance(); + $idShop = (int) Context::getContext()->shop->id; + + $sql = ' + INSERT INTO `' . _DB_PREFIX_ . 'dpdshipping_cart_pickup` (`id_shop`, `id_cart`, `pudo_code`) + VALUES (' . $idShop . ', ' . $this->getIdCart() . ', "' . pSQL($this->getPudoCode()) . '")'; + $db->execute($sql); + + $response = ['success' => true, 'message' => $this->getPudoCode(), 'cart' => $this->getIdCart()]; + } catch (Exception $e) { + $response = ['success' => false, 'message' => $e->getMessage()]; + } + die(json_encode($response)); + } else { + die(json_encode(['success' => false, 'message' => 'Undefined error'])); + } + } + + private function validate(): bool + { + if ($_SERVER['REQUEST_METHOD'] !== 'POST') { + die(json_encode(['success' => false, 'message' => 'Method not allowed'])); + } + + if ($this->getCsrf() != Tools::getToken(false)) { + die(json_encode(['success' => false, 'message' => 'Invalid token.'])); + } + + if ($this->getToken() != sha1(_COOKIE_KEY_ . 'dpdshipping')) { + die(json_encode(['success' => false, 'message' => 'Invalid token'])); + } + + if (empty($this->getPudoCode()) || empty($this->getIdCart())) { + die(json_encode(['success' => false, 'message' => 'Invalid params'])); + } + + $cart = new Cart($this->getIdCart()); + if (!Validate::isLoadedObject($cart)) { + die(json_encode(['success' => false, 'message' => 'Cart error'])); + } + + if ($cart->orderExists()) { + die(json_encode(['success' => false, 'message' => 'Order exist'])); + } + + if (Validate::isLoadedObject($this->context->customer) && $cart->id_customer != $this->context->customer->id) { + die(json_encode(['success' => false, 'message' => 'Invalid customer'])); + } + + return true; + } + + /** + * @return false|mixed + */ + public function getCsrf() + { + return Tools::getValue('dpdshipping_csrf'); + } + + /** + * @return false|mixed + */ + public function getToken() + { + return Tools::getValue('dpdshipping_token'); + } + + /** + * @return false|mixed + */ + public function getPudoCode() + { + return Tools::getValue('dpdshipping_pudo_code'); + } + + /** + * @return int + */ + public function getIdCart(): int + { + return Tools::getValue('dpdshipping_id_cart'); + } +} diff --git a/modules/dpdshipping/controllers/front/index.php b/modules/dpdshipping/controllers/front/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/controllers/front/index.php @@ -0,0 +1,33 @@ +name = 'dpdshipping'; + $this->version = '2.0.2'; + $this->author = 'DPD Poland sp. z o. o.'; + $this->need_instance = 1; + + parent::__construct(); + + $this->displayName = $this->trans('DPD Poland sp. z o. o. shipping module', [], 'Modules.Dpdshipping.Admin'); + $this->description = $this->trans('DPD Poland sp. z o. o. shipping module', [], 'Modules.Dpdshipping.Admin'); + + $this->ps_versions_compliancy = [ + 'min' => '1.7.8.0', + 'max' => '9.99.99', + ]; + } + + public function hookActionFrontControllerSetMedia() + { + if (!$this->context || !$this->context->link) { + return; + } + + $idAddressDelivery = isset($this->context->cart) ? (int) $this->context->cart->id_address_delivery : 0; + + Media::addJsDef([ + 'dpdshipping_pickup_save_point_ajax_url' => $this->context->link->getModuleLink('dpdshipping', 'PickupSavePointAjax'), + 'dpdshipping_pickup_get_address_ajax_url' => $this->context->link->getModuleLink('dpdshipping', 'PickupGetAddressAjax'), + 'dpdshipping_pickup_is_point_with_cod_ajax_url' => $this->context->link->getModuleLink('dpdshipping', 'PickupIsCodPointAjax'), + 'dpdshipping_token' => sha1(_COOKIE_KEY_ . 'dpdshipping'), + 'dpdshipping_csrf' => Tools::getToken(false), + 'dpdshipping_id_cart' => isset($this->context->cart) ? (int) $this->context->cart->id : 0, + 'dpdshipping_iframe_url' => DpdIframe::getPickupIframeUrl(Config::DPD_PICKUP_MAP_URL_WITH_FILTERS, Config::PICKUP_MAP_BASE_URL, $idAddressDelivery), + 'dpdshipping_iframe_cod_url' => DpdIframe::getPickupIframeUrl(Config::DPD_PICKUP_COD_MAP_URL_WITH_FILTERS, Config::PICKUP_MAP_BASE_URL . '&direct_delivery_cod=1', $idAddressDelivery), + 'dpdshipping_iframe_swipbox_url' => DpdIframe::getPickupIframeUrl(Config::DPD_SWIP_BOX_MAP_URL_WITH_FILTERS, Config::PICKUP_MAP_BASE_URL . '&swip_box=1&hideFilters=1', $idAddressDelivery), + 'dpdshipping_id_pudo_carrier' => DpdCarrierPrestashopConfiguration::getConfig(Config::DPD_PICKUP), + 'dpdshipping_id_pudo_cod_carrier' => DpdCarrierPrestashopConfiguration::getConfig(Config::DPD_PICKUP_COD), + 'dpdshipping_id_pudo_swipbox_carrier' => DpdCarrierPrestashopConfiguration::getConfig(Config::DPD_SWIP_BOX), + ]); + + $this->registerPudoFrontendAssets(); + } + + public function hookDisplayCarrierExtraContent($params) + { + $this->registerPudoFrontendAssets(); + + if (!$this->context || !$this->context->controller) { + return false; + } + + if (!empty($params) && isset($params['carrier']['id']) && DpdCarrierPrestashopConfiguration::isPickup($params['carrier']['id'])) { + return $this->display(__FILE__, 'views/templates/hook/carrier-extra-content-pudo.tpl'); + } + + if (!empty($params) && isset($params['carrier']['id']) && DpdCarrierPrestashopConfiguration::isPickupCod($params['carrier']['id'])) { + return $this->display(__FILE__, 'views/templates/hook/carrier-extra-content-pudo-cod.tpl'); + } + + if (!empty($params) && isset($params['carrier']['id']) && DpdCarrierPrestashopConfiguration::isPickupSwipBox($params['carrier']['id'])) { + return $this->display(__FILE__, 'views/templates/hook/carrier-extra-content-pudo-swipbox.tpl'); + } + + return false; + } + + public function install(): bool + { + if (!parent::install()) { + return false; + } + $connection = ContainerHelper::getDatabaseConnectionForInstaller($this); + if (!$connection) { + return false; + } + + $installer = InstallerFactory::create(new HookRepository(), $connection); + + if (!$installer->install($this)) { + return false; + } + + return true; + } + + public function uninstall(): bool + { + $connection = ContainerHelper::getDatabaseConnectionForInstaller($this); + if (!$connection) { + return parent::uninstall(); + } + $installer = InstallerFactory::create(new HookRepository(), $connection); + + return $installer->uninstall() && parent::uninstall(); + } + + public function getTabs(): array + { + $name = $this->trans('DPD Poland shipping', [], 'Modules.Dpdshipping.Admin'); + return AdminMenuTab::getTabs($name); + } + + public function getContent() + { + $queryBus = ContainerHelper::getQueryBus($this); + $needOnboarding = $queryBus ? $queryBus->handle(new GetConfiguration(ConfigurationAlias::NEED_ONBOARDING)) : null; + + if ($needOnboarding == null || $needOnboarding->getValue() == '1') { + Tools::redirectAdmin(RouterHelper::generateRouteUrl($this, 'dpdshipping_onboarding_form')); + } else { + Tools::redirectAdmin(RouterHelper::generateRouteUrl($this, 'dpdshipping_connection_form')); + } + } + + public function hookDisplayAdminOrderTabLink(array $params) + { + return $this->get('prestashop.module.dpdshipping.hook.factory')->renderView(Hook::$DISPLAY_ADMIN_ORDER_TAB_LINK, $params, $this->get('twig')); + } + + public function hookDisplayAdminOrderTabContent(array $params) + { + $controller = $this->get('prestashop.module.dpdshipping.controller.dpdshipping_tracking'); + return $this->get('prestashop.module.dpdshipping.hook.factory')->renderView(Hook::$DISPLAY_ADMIN_ORDER_TAB_CONTENT, $params, $controller); + } + + public function hookDisplayBackOfficeHeader($params) + { + BackOfficeHeader::register($this, $this->context, $params); + } + + public function hookActionOrderGridDefinitionModifier($params) + { + if (isset($params['definition'])) { + GridActions::addOrderBulkActions($params['definition']); + } + } + + public function isUsingNewTranslationSystem(): bool + { + return true; + } + + private function registerPudoFrontendAssets(): void + { + if (!$this->context || !$this->context->controller) { + return; + } + AssetsRegistrar::register($this, $this->context); + } + + + public function getOrderShippingCost($params, $shipping_cost) + { + if (Configuration::get(ConfigurationAlias::SPECIAL_PRICE_ENABLED) == '1') { + return $this->getOrderShippingCostExternal($params); + } + + return $shipping_cost; + } + + public function getOrderShippingCostExternal($params) + { + $specialPrice = new SpecialPriceService($params, $this->id_carrier); + + return $specialPrice->handle(); + } + + public function hookDisplayAdminOrderMain(array $params) + { + $factory = ContainerHelper::getFromContainer($this, 'prestashop.module.dpdshipping.hook.factory'); + return $factory ? $factory->renderView(Hook::$DISPLAY_ADMIN_ORDER_MAIN, $params, $this->get('prestashop.module.dpdshipping.controller.dpdshipping_generate_shipping')) : ''; + } + + public function hookActionCarrierUpdate(array $params) + { + $commandBus = ContainerHelper::getCommandBus($this); + if ($commandBus) { + $commandBus->handle(new UpdateCarrierActionCommand($params)); + } + } +} diff --git a/modules/dpdshipping/index.php b/modules/dpdshipping/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/index.php @@ -0,0 +1,33 @@ +dpdApiClient = $dpdApiClient; + } + + public function objectToArray($obj) + { + if (is_object($obj)) { + $reflect = new \ReflectionClass($obj); + $props = $reflect->getProperties(); + $arr = []; + foreach ($props as $prop) { + $prop->setAccessible(true); + $arr[$prop->getName()] = $this->objectToArray($prop->getValue($obj)); + } + + return $arr; + } + + if (is_array($obj)) { + return array_map([$this->dpdApiClient, 'objectToArray'], $obj); + } + + return $obj; + } +} diff --git a/modules/dpdshipping/src/Api/DpdApiService.php b/modules/dpdshipping/src/Api/DpdApiService.php new file mode 100644 index 00000000..613553b9 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdApiService.php @@ -0,0 +1,116 @@ +queryBus = $queryBus; + } + + public function getAuthInfoServices($idShop, $connectionId): ?AuthDataV1 + { + $connectionConfig = $this->queryBus->handle(new GetConnection($idShop, $connectionId)); + + if ($connectionConfig == null) { + return null; + } + + return (new AuthDataV1()) + ->withLogin($connectionConfig->getLogin()) + ->withPassword($this->decrypt($connectionConfig->getPassword())) + ->withChannel(self::ITC); + } + + public function getAuth($idShop, $connectionId): ?DpdServices\Type\AuthDataV1 + { + $connectionConfig = $this->queryBus->handle(new GetConnection($idShop, $connectionId)); + + if ($connectionConfig == null) { + return null; + } + + return (new DpdServices\Type\AuthDataV1()) + ->withLogin($connectionConfig->getLogin()) + ->withPassword($this->decrypt($connectionConfig->getPassword())) + ->withMasterFid($connectionConfig->getMasterFid()); + } + + public function getInfoServicesClient(): DpdInfoServices\DpdInfoServicesClient + { + return DpdInfoServicesClientFactory::factory(Config::DPD_INFO_SERVICES_LIVE); + } + + public function getServicesClient($idShop, $connectionId): ?DpdServices\DpdServicesClient + { + $connectionConfig = $this->queryBus->handle(new GetConnection($idShop, $connectionId)); + $environment = $connectionConfig->getEnvironment(); + + if ($environment == null) { + return DpdServicesClientFactory::factory(Config::DPD_API_URL_LIVE); + } + + return DpdServicesClientFactory::factory($environment); + } + + public function getServicesClientEnv($environmentUrl): DpdServices\DpdServicesClient + { + return DpdServicesClientFactory::factory($environmentUrl); + } + + private function decrypt($password): string + { + try { + $phpEncryption = new PhpEncryption(_NEW_COOKIE_KEY_); + + return $phpEncryption->decrypt($password); + } catch (Exception $exception) { + return ''; + } + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClassmap.php b/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClassmap.php new file mode 100644 index 00000000..fe6092e9 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClassmap.php @@ -0,0 +1,60 @@ + Type\MarkEventsAsProcessedV1::class, + 'authDataV1' => Type\AuthDataV1::class, + 'markEventsAsProcessedV1Response' => Type\MarkEventsAsProcessedV1Response::class, + 'Exception' => Type\Exception::class, + 'getEventsForCustomerV4' => Type\GetEventsForCustomerV4::class, + 'getEventsForCustomerV4Response' => Type\GetEventsForCustomerV4Response::class, + 'customerEventsResponseV2' => Type\CustomerEventsResponseV2::class, + 'customerEventV2' => Type\CustomerEventV2::class, + 'customerEventDataV2' => Type\CustomerEventDataV2::class, + 'getEventsForCustomerV3' => Type\GetEventsForCustomerV3::class, + 'getEventsForCustomerV3Response' => Type\GetEventsForCustomerV3Response::class, + 'getEventsForCustomerV2' => Type\GetEventsForCustomerV2::class, + 'getEventsForCustomerV2Response' => Type\GetEventsForCustomerV2Response::class, + 'customerEventsResponseV1' => Type\CustomerEventsResponseV1::class, + 'customerEventV1' => Type\CustomerEventV1::class, + 'getEventsForCustomerV1' => Type\GetEventsForCustomerV1::class, + 'getEventsForCustomerV1Response' => Type\GetEventsForCustomerV1Response::class, + 'getEventsForWaybillV1' => Type\GetEventsForWaybillV1::class, + 'getEventsForWaybillV1Response' => Type\GetEventsForWaybillV1Response::class, + 'customerEventsResponseV3' => Type\CustomerEventsResponseV3::class, + 'customerEventV3' => Type\CustomerEventV3::class, + 'customerEventDataV3' => Type\CustomerEventDataV3::class, + ]; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClient.php b/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClient.php new file mode 100644 index 00000000..8c705463 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClient.php @@ -0,0 +1,70 @@ +soapClient = $soapClient; + $this->eventDispatcher = $eventDispatcher; + } + + public function getEventsForWaybillV1(GetEventsForWaybillV1 $parameters) + { + return $this->soapCall('getEventsForWaybillV1', $parameters); + } + + /** + * @throws \Exception + */ + private function soapCall($name, $parameters) + { + try { + $arrayRequest = $this->objectToArray($parameters); + + return $this->soapClient->__soapCall($name, [$arrayRequest]); + } catch (\SoapFault $fault) { + throw new \Exception("SOAP Fault: {$fault->faultcode}, {$fault->faultstring}"); + } + } + + public function objectToArray($obj) + { + $dpdApiUtils = new DpdApiHelper($this); + + return $dpdApiUtils->objectToArray($obj); + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClientFactory.php b/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClientFactory.php new file mode 100644 index 00000000..9b309ee6 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/DpdInfoServicesClientFactory.php @@ -0,0 +1,51 @@ + true, + 'exceptions' => true, + 'classmap' => $classmap, + ]; + + $soapClient = new SoapClient($wsdl, $options); + + return new DpdInfoServicesClient($soapClient, new EventDispatcher()); + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/AuthDataV1.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/AuthDataV1.php new file mode 100644 index 00000000..81b1ea87 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/AuthDataV1.php @@ -0,0 +1,107 @@ +channel; + } + + /** + * @param string $channel + * @return AuthDataV1 + */ + public function withChannel($channel) + { + $new = clone $this; + $new->channel = $channel; + + return $new; + } + + /** + * @return string + */ + public function getLogin() + { + return $this->login; + } + + /** + * @param string $login + * @return AuthDataV1 + */ + public function withLogin($login) + { + $new = clone $this; + $new->login = $login; + + return $new; + } + + /** + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * @param string $password + * @return AuthDataV1 + */ + public function withPassword($password) + { + $new = clone $this; + $new->password = $password; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventDataV2.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventDataV2.php new file mode 100644 index 00000000..a97cf651 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventDataV2.php @@ -0,0 +1,80 @@ +code; + } + + /** + * @param string $code + * @return CustomerEventDataV2 + */ + public function withCode($code) + { + $new = clone $this; + $new->code = $code; + + return $new; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * @return CustomerEventDataV2 + */ + public function withValue($value) + { + $new = clone $this; + $new->value = $value; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventDataV3.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventDataV3.php new file mode 100644 index 00000000..ecf10f0e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventDataV3.php @@ -0,0 +1,107 @@ +code; + } + + /** + * @param string $code + * @return CustomerEventDataV3 + */ + public function withCode($code) + { + $new = clone $this; + $new->code = $code; + + return $new; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return CustomerEventDataV3 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * @return CustomerEventDataV3 + */ + public function withValue($value) + { + $new = clone $this; + $new->value = $value; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV1.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV1.php new file mode 100644 index 00000000..751875d4 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV1.php @@ -0,0 +1,382 @@ +businessCode; + } + + /** + * @param string $businessCode + * @return CustomerEventV1 + */ + public function withBusinessCode($businessCode) + { + $new = clone $this; + $new->businessCode = $businessCode; + + return $new; + } + + /** + * @return string + */ + public function getCountry() + { + return $this->country; + } + + /** + * @param string $country + * @return CustomerEventV1 + */ + public function withCountry($country) + { + $new = clone $this; + $new->country = $country; + + return $new; + } + + /** + * @return string + */ + public function getDepot() + { + return $this->depot; + } + + /** + * @param string $depot + * @return CustomerEventV1 + */ + public function withDepot($depot) + { + $new = clone $this; + $new->depot = $depot; + + return $new; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return CustomerEventV1 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return string + */ + public function getEventData1() + { + return $this->eventData1; + } + + /** + * @param string $eventData1 + * @return CustomerEventV1 + */ + public function withEventData1($eventData1) + { + $new = clone $this; + $new->eventData1 = $eventData1; + + return $new; + } + + /** + * @return string + */ + public function getEventData2() + { + return $this->eventData2; + } + + /** + * @param string $eventData2 + * @return CustomerEventV1 + */ + public function withEventData2($eventData2) + { + $new = clone $this; + $new->eventData2 = $eventData2; + + return $new; + } + + /** + * @return string + */ + public function getEventData3() + { + return $this->eventData3; + } + + /** + * @param string $eventData3 + * @return CustomerEventV1 + */ + public function withEventData3($eventData3) + { + $new = clone $this; + $new->eventData3 = $eventData3; + + return $new; + } + + /** + * @return string + */ + public function getEventTime() + { + return $this->eventTime; + } + + /** + * @param string $eventTime + * @return CustomerEventV1 + */ + public function withEventTime($eventTime) + { + $new = clone $this; + $new->eventTime = $eventTime; + + return $new; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * @return CustomerEventV1 + */ + public function withId($id) + { + $new = clone $this; + $new->id = $id; + + return $new; + } + + /** + * @return int + */ + public function getObjectId() + { + return $this->objectId; + } + + /** + * @param int $objectId + * @return CustomerEventV1 + */ + public function withObjectId($objectId) + { + $new = clone $this; + $new->objectId = $objectId; + + return $new; + } + + /** + * @return string + */ + public function getOperationType() + { + return $this->operationType; + } + + /** + * @param string $operationType + * @return CustomerEventV1 + */ + public function withOperationType($operationType) + { + $new = clone $this; + $new->operationType = $operationType; + + return $new; + } + + /** + * @return string + */ + public function getPackageReference() + { + return $this->packageReference; + } + + /** + * @param string $packageReference + * @return CustomerEventV1 + */ + public function withPackageReference($packageReference) + { + $new = clone $this; + $new->packageReference = $packageReference; + + return $new; + } + + /** + * @return string + */ + public function getParcelReference() + { + return $this->parcelReference; + } + + /** + * @param string $parcelReference + * @return CustomerEventV1 + */ + public function withParcelReference($parcelReference) + { + $new = clone $this; + $new->parcelReference = $parcelReference; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return CustomerEventV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV2.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV2.php new file mode 100644 index 00000000..b749741e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV2.php @@ -0,0 +1,332 @@ +businessCode; + } + + /** + * @param string $businessCode + * @return CustomerEventV2 + */ + public function withBusinessCode($businessCode) + { + $new = clone $this; + $new->businessCode = $businessCode; + + return $new; + } + + /** + * @return string + */ + public function getCountry() + { + return $this->country; + } + + /** + * @param string $country + * @return CustomerEventV2 + */ + public function withCountry($country) + { + $new = clone $this; + $new->country = $country; + + return $new; + } + + /** + * @return string + */ + public function getDepot() + { + return $this->depot; + } + + /** + * @param string $depot + * @return CustomerEventV2 + */ + public function withDepot($depot) + { + $new = clone $this; + $new->depot = $depot; + + return $new; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return CustomerEventV2 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return CustomerEventDataV2 + */ + public function getEventDataList() + { + return $this->eventDataList; + } + + /** + * @param CustomerEventDataV2 $eventDataList + * @return CustomerEventV2 + */ + public function withEventDataList($eventDataList) + { + $new = clone $this; + $new->eventDataList = $eventDataList; + + return $new; + } + + /** + * @return string + */ + public function getEventTime() + { + return $this->eventTime; + } + + /** + * @param string $eventTime + * @return CustomerEventV2 + */ + public function withEventTime($eventTime) + { + $new = clone $this; + $new->eventTime = $eventTime; + + return $new; + } + + /** + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * @param int $id + * @return CustomerEventV2 + */ + public function withId($id) + { + $new = clone $this; + $new->id = $id; + + return $new; + } + + /** + * @return int + */ + public function getObjectId() + { + return $this->objectId; + } + + /** + * @param int $objectId + * @return CustomerEventV2 + */ + public function withObjectId($objectId) + { + $new = clone $this; + $new->objectId = $objectId; + + return $new; + } + + /** + * @return string + */ + public function getOperationType() + { + return $this->operationType; + } + + /** + * @param string $operationType + * @return CustomerEventV2 + */ + public function withOperationType($operationType) + { + $new = clone $this; + $new->operationType = $operationType; + + return $new; + } + + /** + * @return string + */ + public function getPackageReference() + { + return $this->packageReference; + } + + /** + * @param string $packageReference + * @return CustomerEventV2 + */ + public function withPackageReference($packageReference) + { + $new = clone $this; + $new->packageReference = $packageReference; + + return $new; + } + + /** + * @return string + */ + public function getParcelReference() + { + return $this->parcelReference; + } + + /** + * @param string $parcelReference + * @return CustomerEventV2 + */ + public function withParcelReference($parcelReference) + { + $new = clone $this; + $new->parcelReference = $parcelReference; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return CustomerEventV2 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV3.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV3.php new file mode 100644 index 00000000..15eba68a --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventV3.php @@ -0,0 +1,307 @@ +businessCode; + } + + /** + * @param string $businessCode + * @return CustomerEventV3 + */ + public function withBusinessCode($businessCode) + { + $new = clone $this; + $new->businessCode = $businessCode; + + return $new; + } + + /** + * @return string + */ + public function getCountry() + { + return $this->country; + } + + /** + * @param string $country + * @return CustomerEventV3 + */ + public function withCountry($country) + { + $new = clone $this; + $new->country = $country; + + return $new; + } + + /** + * @return string + */ + public function getDepot() + { + return $this->depot; + } + + /** + * @param string $depot + * @return CustomerEventV3 + */ + public function withDepot($depot) + { + $new = clone $this; + $new->depot = $depot; + + return $new; + } + + /** + * @return string + */ + public function getDepotName() + { + return $this->depotName; + } + + /** + * @param string $depotName + * @return CustomerEventV3 + */ + public function withDepotName($depotName) + { + $new = clone $this; + $new->depotName = $depotName; + + return $new; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return CustomerEventV3 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return CustomerEventDataV3 + */ + public function getEventDataList() + { + return $this->eventDataList; + } + + /** + * @param CustomerEventDataV3 $eventDataList + * @return CustomerEventV3 + */ + public function withEventDataList($eventDataList) + { + $new = clone $this; + $new->eventDataList = $eventDataList; + + return $new; + } + + /** + * @return string + */ + public function getEventTime() + { + return $this->eventTime; + } + + /** + * @param string $eventTime + * @return CustomerEventV3 + */ + public function withEventTime($eventTime) + { + $new = clone $this; + $new->eventTime = $eventTime; + + return $new; + } + + /** + * @return int + */ + public function getObjectId() + { + return $this->objectId; + } + + /** + * @param int $objectId + * @return CustomerEventV3 + */ + public function withObjectId($objectId) + { + $new = clone $this; + $new->objectId = $objectId; + + return $new; + } + + /** + * @return string + */ + public function getPackageReference() + { + return $this->packageReference; + } + + /** + * @param string $packageReference + * @return CustomerEventV3 + */ + public function withPackageReference($packageReference) + { + $new = clone $this; + $new->packageReference = $packageReference; + + return $new; + } + + /** + * @return string + */ + public function getParcelReference() + { + return $this->parcelReference; + } + + /** + * @param string $parcelReference + * @return CustomerEventV3 + */ + public function withParcelReference($parcelReference) + { + $new = clone $this; + $new->parcelReference = $parcelReference; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return CustomerEventV3 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV1.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV1.php new file mode 100644 index 00000000..f51c246b --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV1.php @@ -0,0 +1,82 @@ +confirmId; + } + + /** + * @param string $confirmId + * @return CustomerEventsResponseV1 + */ + public function withConfirmId($confirmId) + { + $new = clone $this; + $new->confirmId = $confirmId; + + return $new; + } + + /** + * @return CustomerEventV1 + */ + public function getEventsList() + { + return $this->eventsList; + } + + /** + * @param CustomerEventV1 $eventsList + * @return CustomerEventsResponseV1 + */ + public function withEventsList($eventsList) + { + $new = clone $this; + $new->eventsList = $eventsList; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV2.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV2.php new file mode 100644 index 00000000..8f8591ae --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV2.php @@ -0,0 +1,82 @@ +confirmId; + } + + /** + * @param string $confirmId + * @return CustomerEventsResponseV2 + */ + public function withConfirmId($confirmId) + { + $new = clone $this; + $new->confirmId = $confirmId; + + return $new; + } + + /** + * @return CustomerEventV2 + */ + public function getEventsList() + { + return $this->eventsList; + } + + /** + * @param CustomerEventV2 $eventsList + * @return CustomerEventsResponseV2 + */ + public function withEventsList($eventsList) + { + $new = clone $this; + $new->eventsList = $eventsList; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV3.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV3.php new file mode 100644 index 00000000..a3bf587c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/CustomerEventsResponseV3.php @@ -0,0 +1,82 @@ +confirmId; + } + + /** + * @param string $confirmId + * @return CustomerEventsResponseV3 + */ + public function withConfirmId($confirmId) + { + $new = clone $this; + $new->confirmId = $confirmId; + + return $new; + } + + /** + * @return CustomerEventV3 + */ + public function getEventsList() + { + return $this->eventsList; + } + + /** + * @param CustomerEventV3 $eventsList + * @return CustomerEventsResponseV3 + */ + public function withEventsList($eventsList) + { + $new = clone $this; + $new->eventsList = $eventsList; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/Exception.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/Exception.php new file mode 100644 index 00000000..7832081e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/Exception.php @@ -0,0 +1,57 @@ +message; + } + + /** + * @param string $message + * @return Exception + */ + public function withMessage($message) + { + $new = clone $this; + $new->message = $message; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV1.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV1.php new file mode 100644 index 00000000..95c23533 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV1.php @@ -0,0 +1,94 @@ +limit = $limit; + $this->authDataV1 = $authDataV1; + } + + /** + * @return int + */ + public function getLimit() + { + return $this->limit; + } + + /** + * @param int $limit + * @return GetEventsForCustomerV1 + */ + public function withLimit($limit) + { + $new = clone $this; + $new->limit = $limit; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GetEventsForCustomerV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV1Response.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV1Response.php new file mode 100644 index 00000000..d04af654 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param CustomerEventsResponseV1 $return + * @return GetEventsForCustomerV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV2.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV2.php new file mode 100644 index 00000000..f585675f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV2.php @@ -0,0 +1,121 @@ +limit = $limit; + $this->language = $language; + $this->authDataV1 = $authDataV1; + } + + /** + * @return int + */ + public function getLimit() + { + return $this->limit; + } + + /** + * @param int $limit + * @return GetEventsForCustomerV2 + */ + public function withLimit($limit) + { + $new = clone $this; + $new->limit = $limit; + + return $new; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language + * @return GetEventsForCustomerV2 + */ + public function withLanguage($language) + { + $new = clone $this; + $new->language = $language; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GetEventsForCustomerV2 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV2Response.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV2Response.php new file mode 100644 index 00000000..653ac9dc --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV2Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param CustomerEventsResponseV1 $return + * @return GetEventsForCustomerV2Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV3.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV3.php new file mode 100644 index 00000000..c4038229 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV3.php @@ -0,0 +1,94 @@ +limit = $limit; + $this->authDataV1 = $authDataV1; + } + + /** + * @return int + */ + public function getLimit() + { + return $this->limit; + } + + /** + * @param int $limit + * @return GetEventsForCustomerV3 + */ + public function withLimit($limit) + { + $new = clone $this; + $new->limit = $limit; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GetEventsForCustomerV3 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV3Response.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV3Response.php new file mode 100644 index 00000000..6b2cef4d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV3Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param CustomerEventsResponseV2 $return + * @return GetEventsForCustomerV3Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV4.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV4.php new file mode 100644 index 00000000..75b57abd --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV4.php @@ -0,0 +1,121 @@ +limit = $limit; + $this->language = $language; + $this->authDataV1 = $authDataV1; + } + + /** + * @return int + */ + public function getLimit() + { + return $this->limit; + } + + /** + * @param int $limit + * @return GetEventsForCustomerV4 + */ + public function withLimit($limit) + { + $new = clone $this; + $new->limit = $limit; + + return $new; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language + * @return GetEventsForCustomerV4 + */ + public function withLanguage($language) + { + $new = clone $this; + $new->language = $language; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GetEventsForCustomerV4 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV4Response.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV4Response.php new file mode 100644 index 00000000..6efb5ec2 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForCustomerV4Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param CustomerEventsResponseV2 $return + * @return GetEventsForCustomerV4Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForWaybillV1.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForWaybillV1.php new file mode 100644 index 00000000..daf98257 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForWaybillV1.php @@ -0,0 +1,148 @@ +waybill = $waybill; + $this->eventsSelectType = $eventsSelectType; + $this->language = $language; + $this->authDataV1 = $authDataV1; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return GetEventsForWaybillV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } + + /** + * @return string + */ + public function getEventsSelectType() + { + return $this->eventsSelectType; + } + + /** + * @param string $eventsSelectType + * @return GetEventsForWaybillV1 + */ + public function withEventsSelectType($eventsSelectType) + { + $new = clone $this; + $new->eventsSelectType = $eventsSelectType; + + return $new; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language + * @return GetEventsForWaybillV1 + */ + public function withLanguage($language) + { + $new = clone $this; + $new->language = $language; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GetEventsForWaybillV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForWaybillV1Response.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForWaybillV1Response.php new file mode 100644 index 00000000..cdc9d25b --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/GetEventsForWaybillV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param CustomerEventsResponseV3 $return + * @return GetEventsForWaybillV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/MarkEventsAsProcessedV1.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/MarkEventsAsProcessedV1.php new file mode 100644 index 00000000..61554415 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/MarkEventsAsProcessedV1.php @@ -0,0 +1,93 @@ +confirmId = $confirmId; + $this->authDataV1 = $authDataV1; + } + + /** + * @return string + */ + public function getConfirmId() + { + return $this->confirmId; + } + + /** + * @param string $confirmId + * @return MarkEventsAsProcessedV1 + */ + public function withConfirmId($confirmId) + { + $new = clone $this; + $new->confirmId = $confirmId; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return MarkEventsAsProcessedV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/MarkEventsAsProcessedV1Response.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/MarkEventsAsProcessedV1Response.php new file mode 100644 index 00000000..c7bb6376 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/MarkEventsAsProcessedV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param bool $return + * @return MarkEventsAsProcessedV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdInfoServices/Type/index.php b/modules/dpdshipping/src/Api/DpdInfoServices/Type/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdInfoServices/Type/index.php @@ -0,0 +1,33 @@ + Type\GenerateProtocolV1::class, + 'dpdServicesParamsV1' => Type\DpdServicesParamsV1::class, + 'pickupAddressDSPV1' => Type\PickupAddressDSPV1::class, + 'sessionDSPV1' => Type\SessionDSPV1::class, + 'packageDSPV1' => Type\PackageDSPV1::class, + 'parcelDSPV1' => Type\ParcelDSPV1::class, + 'authDataV1' => Type\AuthDataV1::class, + 'generateProtocolV1Response' => Type\GenerateProtocolV1Response::class, + 'documentGenerationResponseV1' => Type\DocumentGenerationResponseV1::class, + 'sessionDGRV1' => Type\SessionDGRV1::class, + 'packageDGRV1' => Type\PackageDGRV1::class, + 'parcelDGRV1' => Type\ParcelDGRV1::class, + 'statusInfoDGRV1' => Type\StatusInfoDGRV1::class, + 'generateProtocolV2' => Type\GenerateProtocolV2::class, + 'generateProtocolV2Response' => Type\GenerateProtocolV2Response::class, + 'generateShipmentV1' => Type\GenerateShipmentV1::class, + 'openUMLFeV10' => Type\OpenUMLFeV10::class, + 'packageOpenUMLFeV10' => Type\PackageOpenUMLFeV10::class, + 'parcelOpenUMLFeV4' => Type\ParcelOpenUMLFeV4::class, + 'packageAddressOpenUMLFeV1' => Type\PackageAddressOpenUMLFeV1::class, + 'servicesOpenUMLFeV9' => Type\ServicesOpenUMLFeV9::class, + 'serviceCarryInOpenUMLFeV1' => Type\ServiceCarryInOpenUMLFeV1::class, + 'serviceCODOpenUMLFeV1' => Type\ServiceCODOpenUMLFeV1::class, + 'serviceCODDedicatedAccountOpenUMLFeV1' => Type\ServiceCODDedicatedAccountOpenUMLFeV1::class, + 'serviceCUDOpenUMLeFV1' => Type\ServiceCUDOpenUMLeFV1::class, + 'serviceDeclaredValueOpenUMLFeV1' => Type\ServiceDeclaredValueOpenUMLFeV1::class, + 'serviceDedicatedDeliveryOpenUMLFeV1' => Type\ServiceDedicatedDeliveryOpenUMLFeV1::class, + 'serviceDigitalLabelUMLFeV1' => Type\ServiceDigitalLabelUMLFeV1::class, + 'serviceFlagOpenUMLF' => Type\ServiceFlagOpenUMLF::class, + 'servicePalletOpenUMLFeV1' => Type\ServicePalletOpenUMLFeV1::class, + 'serviceDPDFoodOpenUMLFeV2' => Type\ServiceDPDFoodOpenUMLFeV2::class, + 'serviceDPDLqOpenUMLFeV1' => Type\ServiceDPDLqOpenUMLFeV1::class, + 'serviceDpdPickupOpenUMLFeV1' => Type\ServiceDpdPickupOpenUMLFeV1::class, + 'serviceDutyOpenUMLeFV2' => Type\ServiceDutyOpenUMLeFV2::class, + 'serviceGuaranteeOpenUMLFeV1' => Type\ServiceGuaranteeOpenUMLFeV1::class, + 'serviceInPersOpenUMLFeV1' => Type\ServiceInPersOpenUMLFeV1::class, + 'servicePrivPersOpenUMLFeV1' => Type\ServicePrivPersOpenUMLFeV1::class, + 'serviceRODOpenUMLFeV1' => Type\ServiceRODOpenUMLFeV1::class, + 'serviceSelfColOpenUMLFeV1' => Type\ServiceSelfColOpenUMLFeV1::class, + 'serviceTiresOpenUMLFeV1' => Type\ServiceTiresOpenUMLFeV1::class, + 'serviceTiresExportOpenUMLFeV1' => Type\ServiceTiresExportOpenUMLFeV1::class, + 'generateShipmentV1Response' => Type\GenerateShipmentV1Response::class, + 'shipmentDocumentGenerationResponseV1' => Type\ShipmentDocumentGenerationResponseV1::class, + 'shipmentDocumentGenerationSessionV1' => Type\ShipmentDocumentGenerationSessionV1::class, + 'shipmentDocumentGenerationStatusInfoV1' => Type\ShipmentDocumentGenerationStatusInfoV1::class, + 'generateDomesticReturnLabelV1' => Type\GenerateDomesticReturnLabelV1::class, + 'returnedWaybillsV1' => Type\ReturnedWaybillsV1::class, + 'pudoReturnReceiver' => Type\PudoReturnReceiver::class, + 'generateDomesticReturnLabelV1Response' => Type\GenerateDomesticReturnLabelV1Response::class, + 'generateSpedLabelsV1' => Type\GenerateSpedLabelsV1::class, + 'generateSpedLabelsV1Response' => Type\GenerateSpedLabelsV1Response::class, + 'generateSpedLabelsV4' => Type\GenerateSpedLabelsV4::class, + 'generateSpedLabelsV4Response' => Type\GenerateSpedLabelsV4Response::class, + 'generateSpedLabelsV3' => Type\GenerateSpedLabelsV3::class, + 'generateSpedLabelsV3Response' => Type\GenerateSpedLabelsV3Response::class, + 'generateReturnPackages' => Type\GenerateReturnPackages::class, + 'openUMLFeV7' => Type\OpenUMLFeV7::class, + 'packageOpenUMLFeV7' => Type\PackageOpenUMLFeV7::class, + 'parcelOpenUMLFeV2' => Type\ParcelOpenUMLFeV2::class, + 'servicesOpenUMLFeV6' => Type\ServicesOpenUMLFeV6::class, + 'serviceDPDFoodOpenUMLFeV1' => Type\ServiceDPDFoodOpenUMLFeV1::class, + 'generateReturnPackagesResponse' => Type\GenerateReturnPackagesResponse::class, + 'packagesGenerationResponseV2' => Type\PackagesGenerationResponseV2::class, + 'sessionPGRV2' => Type\SessionPGRV2::class, + 'Packages' => Type\Packages::class, + 'packagePGRV2' => Type\PackagePGRV2::class, + 'ValidationDetails' => Type\ValidationDetails::class, + 'Parcels' => Type\Parcels::class, + 'validationInfoPGRV2' => Type\ValidationInfoPGRV2::class, + 'parcelPGRV2' => Type\ParcelPGRV2::class, + 'generateSpedLabelsV2' => Type\GenerateSpedLabelsV2::class, + 'generateSpedLabelsV2Response' => Type\GenerateSpedLabelsV2Response::class, + 'generatePackagesNumbersV6' => Type\GeneratePackagesNumbersV6::class, + 'openUMLFeV5' => Type\OpenUMLFeV5::class, + 'packageOpenUMLFeV5' => Type\PackageOpenUMLFeV5::class, + 'parcelOpenUMLFeV1' => Type\ParcelOpenUMLFeV1::class, + 'generatePackagesNumbersV6Response' => Type\GeneratePackagesNumbersV6Response::class, + 'generatePackagesNumbersV7' => Type\GeneratePackagesNumbersV7::class, + 'openUMLFeV8' => Type\OpenUMLFeV8::class, + 'packageOpenUMLFeV8' => Type\PackageOpenUMLFeV8::class, + 'parcelOpenUMLFeV3' => Type\ParcelOpenUMLFeV3::class, + 'servicesOpenUMLFeV8' => Type\ServicesOpenUMLFeV8::class, + 'generatePackagesNumbersV7Response' => Type\GeneratePackagesNumbersV7Response::class, + 'generatePackagesNumbersV8' => Type\GeneratePackagesNumbersV8::class, + 'openUMLFeV9' => Type\OpenUMLFeV9::class, + 'packageOpenUMLFeV9' => Type\PackageOpenUMLFeV9::class, + 'generatePackagesNumbersV8Response' => Type\GeneratePackagesNumbersV8Response::class, + 'generatePackagesNumbersV9' => Type\GeneratePackagesNumbersV9::class, + 'openUMLFeV11' => Type\OpenUMLFeV11::class, + 'packageOpenUMLFeV11' => Type\PackageOpenUMLFeV11::class, + 'servicesOpenUMLFeV11' => Type\ServicesOpenUMLFeV11::class, + 'servicePudoToSendUMLFeV1' => Type\ServicePudoToSendUMLFeV1::class, + //'generatePackagesNumbersV9Response' => Type\GeneratePackagesNumbersV9Response::class, + 'findPostalCodeV1' => Type\FindPostalCodeV1::class, + 'postalCodeV1' => Type\PostalCodeV1::class, + 'findPostalCodeV1Response' => Type\FindPostalCodeV1Response::class, + 'findPostalCodeResponseV1' => Type\FindPostalCodeResponseV1::class, + 'generateInternationalPackageNumbersV1' => Type\GenerateInternationalPackageNumbersV1::class, + 'internationalOpenUMLFeV1' => Type\InternationalOpenUMLFeV1::class, + 'internationalPackageOpenUMLFeV1' => Type\InternationalPackageOpenUMLFeV1::class, + 'internationalParcelOpenUMLFeV1' => Type\InternationalParcelOpenUMLFeV1::class, + 'internationalServicesOpenUMLFeV1' => Type\InternationalServicesOpenUMLFeV1::class, + 'serviceDPDPudoReturnUMLFeV1' => Type\ServiceDPDPudoReturnUMLFeV1::class, + 'generateInternationalPackageNumbersV1Response' => Type\GenerateInternationalPackageNumbersV1Response::class, + 'generatePackagesNumbersV1' => Type\GeneratePackagesNumbersV1::class, + 'openUMLFeV1' => Type\OpenUMLFeV1::class, + 'packageOpenUMLFeV1' => Type\PackageOpenUMLFeV1::class, + 'servicesOpenUMLFeV2' => Type\ServicesOpenUMLFeV2::class, + 'serviceDutyOpenUMLeFV1' => Type\ServiceDutyOpenUMLeFV1::class, + 'generatePackagesNumbersV1Response' => Type\GeneratePackagesNumbersV1Response::class, + 'packagesGenerationResponseV1' => Type\PackagesGenerationResponseV1::class, + 'sessionPGRV1' => Type\SessionPGRV1::class, + 'packagePGRV1' => Type\PackagePGRV1::class, + 'invalidFieldPGRV1' => Type\InvalidFieldPGRV1::class, + 'parcelPGRV1' => Type\ParcelPGRV1::class, + 'generatePackagesNumbersV2' => Type\GeneratePackagesNumbersV2::class, + 'generatePackagesNumbersV2Response' => Type\GeneratePackagesNumbersV2Response::class, + 'generatePackagesNumbersV3' => Type\GeneratePackagesNumbersV3::class, + 'openUMLFeV2' => Type\OpenUMLFeV2::class, + 'packageOpenUMLFeV2' => Type\PackageOpenUMLFeV2::class, + 'servicesOpenUMLFeV3' => Type\ServicesOpenUMLFeV3::class, + 'generatePackagesNumbersV3Response' => Type\GeneratePackagesNumbersV3Response::class, + 'generatePackagesNumbersV4' => Type\GeneratePackagesNumbersV4::class, + 'openUMLFeV3' => Type\OpenUMLFeV3::class, + 'packageOpenUMLFeV3' => Type\PackageOpenUMLFeV3::class, + 'servicesOpenUMLFeV4' => Type\ServicesOpenUMLFeV4::class, + 'generatePackagesNumbersV4Response' => Type\GeneratePackagesNumbersV4Response::class, + 'generatePackagesNumbersV5' => Type\GeneratePackagesNumbersV5::class, + 'openUMLFeV4' => Type\OpenUMLFeV4::class, + 'packageOpenUMLFeV4' => Type\PackageOpenUMLFeV4::class, + 'servicesOpenUMLFeV5' => Type\ServicesOpenUMLFeV5::class, + 'generatePackagesNumbersV5Response' => Type\GeneratePackagesNumbersV5Response::class, + 'packagesPickupCallV3' => Type\PackagesPickupCallV3::class, + 'dpdPickupCallParamsV3' => Type\DpdPickupCallParamsV3::class, + 'pickupCallSimplifiedDetailsDPPV1' => Type\PickupCallSimplifiedDetailsDPPV1::class, + 'pickupPackagesParamsDPPV1' => Type\PickupPackagesParamsDPPV1::class, + 'pickupCustomerDPPV1' => Type\PickupCustomerDPPV1::class, + 'pickupPayerDPPV1' => Type\PickupPayerDPPV1::class, + 'pickupSenderDPPV1' => Type\PickupSenderDPPV1::class, + 'packagesPickupCallV3Response' => Type\PackagesPickupCallV3Response::class, + 'packagesPickupCallResponseV3' => Type\PackagesPickupCallResponseV3::class, + 'statusInfoPCRV2' => Type\StatusInfoPCRV2::class, + 'errorDetailsPCRV2' => Type\ErrorDetailsPCRV2::class, + 'packagesPickupCallV4' => Type\PackagesPickupCallV4::class, + 'packagesPickupCallV4Response' => Type\PackagesPickupCallV4Response::class, + 'packagesPickupCallV1' => Type\PackagesPickupCallV1::class, + 'dpdPickupCallParamsV1' => Type\DpdPickupCallParamsV1::class, + 'contactInfoDPPV1' => Type\ContactInfoDPPV1::class, + 'protocolDPPV1' => Type\ProtocolDPPV1::class, + 'packagesPickupCallV1Response' => Type\PackagesPickupCallV1Response::class, + 'packagesPickupCallResponseV1' => Type\PackagesPickupCallResponseV1::class, + 'protocolPCRV1' => Type\ProtocolPCRV1::class, + 'statusInfoPCRV1' => Type\StatusInfoPCRV1::class, + 'packagesPickupCallV2' => Type\PackagesPickupCallV2::class, + 'dpdPickupCallParamsV2' => Type\DpdPickupCallParamsV2::class, + 'packagesPickupCallV2Response' => Type\PackagesPickupCallV2Response::class, + 'packagesPickupCallResponseV2' => Type\PackagesPickupCallResponseV2::class, + 'appendParcelsToPackageV1' => Type\AppendParcelsToPackageV1::class, + 'parcelsAppendV1' => Type\ParcelsAppendV1::class, + 'parcelsAppendSearchCriteriaPAV1' => Type\ParcelsAppendSearchCriteriaPAV1::class, + 'parcelAppendPAV1' => Type\ParcelAppendPAV1::class, + 'appendParcelsToPackageV1Response' => Type\AppendParcelsToPackageV1Response::class, + 'parcelsAppendResponseV1' => Type\ParcelsAppendResponseV1::class, + 'invalidFieldPAV1' => Type\InvalidFieldPAV1::class, + 'parcelsAppendParcelPAV1' => Type\ParcelsAppendParcelPAV1::class, + 'generateReturnLabelV1' => Type\GenerateReturnLabelV1::class, + 'generateReturnLabelV1Response' => Type\GenerateReturnLabelV1Response::class, + 'getCourierOrderAvailabilityV1' => Type\GetCourierOrderAvailabilityV1::class, + 'senderPlaceV1' => Type\SenderPlaceV1::class, + 'getCourierOrderAvailabilityV1Response' => Type\GetCourierOrderAvailabilityV1Response::class, + 'getCourierOrderAvailabilityResponseV1' => Type\GetCourierOrderAvailabilityResponseV1::class, + 'courierOrderAvailabilityRangeV1' => Type\CourierOrderAvailabilityRangeV1::class, + 'appendParcelsToPackageV2' => Type\AppendParcelsToPackageV2::class, + 'parcelsAppendV2' => Type\ParcelsAppendV2::class, + 'parcelAppendPAV2' => Type\ParcelAppendPAV2::class, + 'appendParcelsToPackageV2Response' => Type\AppendParcelsToPackageV2Response::class, + 'generateProtocolsWithDestinationsV1' => Type\GenerateProtocolsWithDestinationsV1::class, + 'dpdServicesParamsV2' => Type\DpdServicesParamsV2::class, + 'DeliveryDestinations' => Type\DeliveryDestinations::class, + 'sessionDSPV2' => Type\SessionDSPV2::class, + 'packageDSPV2' => Type\PackageDSPV2::class, + 'parcelDSPV2' => Type\ParcelDSPV2::class, + 'pickupAddressDSPV2' => Type\PickupAddressDSPV2::class, + 'deliveryDestination' => Type\DeliveryDestination::class, + 'DepotList' => Type\DepotList::class, + 'protocolDepot' => Type\ProtocolDepot::class, + 'generateProtocolsWithDestinationsV1Response' => Type\GenerateProtocolsWithDestinationsV1Response::class, + 'documentGenerationResponseV2' => Type\DocumentGenerationResponseV2::class, + 'DestinationDataList' => Type\DestinationDataList::class, + 'destinationsData' => Type\DestinationsData::class, + 'nonMatchingData' => Type\NonMatchingData::class, + 'sessionDGRV2' => Type\SessionDGRV2::class, + 'packageDGRV2' => Type\PackageDGRV2::class, + 'parcelDGRV2' => Type\ParcelDGRV2::class, + 'statusInfoDGRV2' => Type\StatusInfoDGRV2::class, + 'generateProtocolsWithDestinationsV2' => Type\GenerateProtocolsWithDestinationsV2::class, + 'generateProtocolsWithDestinationsV2Response' => Type\GenerateProtocolsWithDestinationsV2Response::class, + 'importDeliveryBusinessEventV1' => Type\ImportDeliveryBusinessEventV1::class, + 'dpdParcelBusinessEventV1' => Type\DpdParcelBusinessEventV1::class, + 'dpdParcelBusinessEventDataV1' => Type\DpdParcelBusinessEventDataV1::class, + 'importDeliveryBusinessEventV1Response' => Type\ImportDeliveryBusinessEventV1Response::class, + 'importDeliveryBusinessEventResponseV1' => Type\ImportDeliveryBusinessEventResponseV1::class, + 'DPDServiceException' => Type\DPDServiceException::class, + 'Exception' => Type\Exception::class, + 'DeniedAccessWSException' => Type\DeniedAccessWSException::class, + 'SchemaValidationException' => Type\SchemaValidationException::class, + ]; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/DpdServicesClient.php b/modules/dpdshipping/src/Api/DpdServices/DpdServicesClient.php new file mode 100644 index 00000000..98bebea1 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/DpdServicesClient.php @@ -0,0 +1,132 @@ +soapClient = $soapClient; + $this->eventDispatcher = $eventDispatcher; + } + + /** + * @throws \Exception + */ + public function generateProtocolV2(GenerateProtocolV2 $parameters) + { + return $this->soapCall('generateProtocolV2', $parameters); + } + + /** + * @throws \Exception + */ + public function generateDomesticReturnLabelV1(GenerateDomesticReturnLabelV1 $parameters) + { + return $this->soapCall('generateDomesticReturnLabelV1', $parameters); + } + + /** + * @throws \Exception + */ + public function generateSpedLabelsV4(GenerateSpedLabelsV4 $parameters) + { + return $this->soapCall('generateSpedLabelsV4', $parameters); + } + + /** + * @throws \Exception + */ + public function generatePackagesNumbersV9(GeneratePackagesNumbersV9 $parameters) + { + return $this->soapCall('generatePackagesNumbersV9', $parameters); + } + + /** + * @throws \Exception + */ + public function findPostalCodeV1(FindPostalCodeV1 $parameters) + { + return $this->soapCall('findPostalCodeV1', $parameters); + } + + /** + * @throws \Exception + */ + public function generateReturnLabelV1(GenerateReturnLabelV1 $parameters) + { + return $this->soapCall('generateReturnLabelV1', $parameters); + } + + /** + * @throws \Exception + */ + public function getCourierOrderAvailability(GetCourierOrderAvailabilityV1 $parameters) + { + return $this->soapCall('getCourierOrderAvailabilityV1', $parameters); + } + + /** + * @throws \Exception + */ + public function packagesPickupCall(PackagesPickupCallV4 $parameters) + { + return $this->soapCall('packagesPickupCallV4', $parameters); + } + + private function soapCall($name, $parameters) + { + try { + $arrayRequest = $this->objectToArray($parameters); + return $this->soapClient->__soapCall($name, [$arrayRequest]); + } catch (\SoapFault $fault) { + throw new \Exception("SOAP Fault: {$fault->faultcode}, {$fault->faultstring}"); + } + } + + public function objectToArray($obj) + { + $dpdApiUtils = new DpdApiHelper($this); + + return $dpdApiUtils->objectToArray($obj); + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/DpdServicesClientFactory.php b/modules/dpdshipping/src/Api/DpdServices/DpdServicesClientFactory.php new file mode 100644 index 00000000..4fe41782 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/DpdServicesClientFactory.php @@ -0,0 +1,49 @@ + true, + 'exceptions' => true, + ]; + + $soapClient = new SoapClient($wsdl, $options); + + return new DpdServicesClient($soapClient, new EventDispatcher()); + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV1.php new file mode 100644 index 00000000..250e7554 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV1.php @@ -0,0 +1,94 @@ +parcelsAppend = $parcelsAppend; + $this->authDataV1 = $authDataV1; + } + + /** + * @return ParcelsAppendV1 + */ + public function getParcelsAppend() + { + return $this->parcelsAppend; + } + + /** + * @param ParcelsAppendV1 $parcelsAppend + * @return AppendParcelsToPackageV1 + */ + public function withParcelsAppend($parcelsAppend) + { + $new = clone $this; + $new->parcelsAppend = $parcelsAppend; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return AppendParcelsToPackageV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV1Response.php new file mode 100644 index 00000000..3091ca24 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param ParcelsAppendResponseV1 $return + * @return AppendParcelsToPackageV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV2.php new file mode 100644 index 00000000..de2734ae --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV2.php @@ -0,0 +1,94 @@ +parcelsAppend = $parcelsAppend; + $this->authDataV1 = $authDataV1; + } + + /** + * @return ParcelsAppendV2 + */ + public function getParcelsAppend() + { + return $this->parcelsAppend; + } + + /** + * @param ParcelsAppendV2 $parcelsAppend + * @return AppendParcelsToPackageV2 + */ + public function withParcelsAppend($parcelsAppend) + { + $new = clone $this; + $new->parcelsAppend = $parcelsAppend; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return AppendParcelsToPackageV2 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV2Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV2Response.php new file mode 100644 index 00000000..9ce14cc0 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/AppendParcelsToPackageV2Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param ParcelsAppendResponseV1 $return + * @return AppendParcelsToPackageV2Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/AuthDataV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/AuthDataV1.php new file mode 100644 index 00000000..329795b6 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/AuthDataV1.php @@ -0,0 +1,107 @@ +login; + } + + /** + * @param string $login + * @return AuthDataV1 + */ + public function withLogin($login) + { + $new = clone $this; + $new->login = $login; + + return $new; + } + + /** + * @return int + */ + public function getMasterFid() + { + return $this->masterFid; + } + + /** + * @param int $masterFid + * @return AuthDataV1 + */ + public function withMasterFid($masterFid) + { + $new = clone $this; + $new->masterFid = $masterFid; + + return $new; + } + + /** + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * @param string $password + * @return AuthDataV1 + */ + public function withPassword($password) + { + $new = clone $this; + $new->password = $password; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ContactInfoDPPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ContactInfoDPPV1.php new file mode 100644 index 00000000..4babe726 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ContactInfoDPPV1.php @@ -0,0 +1,157 @@ +comments; + } + + /** + * @param string $comments + * @return ContactInfoDPPV1 + */ + public function withComments($comments) + { + $new = clone $this; + $new->comments = $comments; + + return $new; + } + + /** + * @return string + */ + public function getCompany() + { + return $this->company; + } + + /** + * @param string $company + * @return ContactInfoDPPV1 + */ + public function withCompany($company) + { + $new = clone $this; + $new->company = $company; + + return $new; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + * @return ContactInfoDPPV1 + */ + public function withEmail($email) + { + $new = clone $this; + $new->email = $email; + + return $new; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return ContactInfoDPPV1 + */ + public function withName($name) + { + $new = clone $this; + $new->name = $name; + + return $new; + } + + /** + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @param string $phone + * @return ContactInfoDPPV1 + */ + public function withPhone($phone) + { + $new = clone $this; + $new->phone = $phone; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/CourierOrderAvailabilityRangeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/CourierOrderAvailabilityRangeV1.php new file mode 100644 index 00000000..f9e876fa --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/CourierOrderAvailabilityRangeV1.php @@ -0,0 +1,82 @@ +offset; + } + + /** + * @param int $offset + * @return CourierOrderAvailabilityRangeV1 + */ + public function withOffset($offset) + { + $new = clone $this; + $new->offset = $offset; + + return $new; + } + + /** + * @return string + */ + public function getRange() + { + return $this->range; + } + + /** + * @param string $range + * @return CourierOrderAvailabilityRangeV1 + */ + public function withRange($range) + { + $new = clone $this; + $new->range = $range; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DPDServiceException.php b/modules/dpdshipping/src/Api/DpdServices/Type/DPDServiceException.php new file mode 100644 index 00000000..550b1ca5 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DPDServiceException.php @@ -0,0 +1,84 @@ +exceptionDate; + } + + /** + * @param DateTimeInterface $exceptionDate + * @return DPDServiceException + */ + public function withExceptionDate($exceptionDate) + { + $new = clone $this; + $new->exceptionDate = $exceptionDate; + + return $new; + } + + /** + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param string $message + * @return DPDServiceException + */ + public function withMessage($message) + { + $new = clone $this; + $new->message = $message; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DeliveryDestination.php b/modules/dpdshipping/src/Api/DpdServices/Type/DeliveryDestination.php new file mode 100644 index 00000000..c1d4346c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DeliveryDestination.php @@ -0,0 +1,82 @@ +DepotList; + } + + /** + * @param DepotList $DepotList + * @return DeliveryDestination + */ + public function withDepotList($DepotList) + { + $new = clone $this; + $new->DepotList = $DepotList; + + return $new; + } + + /** + * @return string + */ + public function getDestinationName() + { + return $this->DestinationName; + } + + /** + * @param string $DestinationName + * @return DeliveryDestination + */ + public function withDestinationName($DestinationName) + { + $new = clone $this; + $new->DestinationName = $DestinationName; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DeliveryDestinations.php b/modules/dpdshipping/src/Api/DpdServices/Type/DeliveryDestinations.php new file mode 100644 index 00000000..5a89cb91 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DeliveryDestinations.php @@ -0,0 +1,57 @@ +DeliveryDestination; + } + + /** + * @param DeliveryDestination $DeliveryDestination + * @return DeliveryDestinations + */ + public function withDeliveryDestination($DeliveryDestination) + { + $new = clone $this; + $new->DeliveryDestination = $DeliveryDestination; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DeniedAccessWSException.php b/modules/dpdshipping/src/Api/DpdServices/Type/DeniedAccessWSException.php new file mode 100644 index 00000000..a5a32b72 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DeniedAccessWSException.php @@ -0,0 +1,107 @@ +errorCode; + } + + /** + * @param int $errorCode + * @return DeniedAccessWSException + */ + public function withErrorCode($errorCode) + { + $new = clone $this; + $new->errorCode = $errorCode; + + return $new; + } + + /** + * @return string + */ + public function getExceptionDetails() + { + return $this->exceptionDetails; + } + + /** + * @param string $exceptionDetails + * @return DeniedAccessWSException + */ + public function withExceptionDetails($exceptionDetails) + { + $new = clone $this; + $new->exceptionDetails = $exceptionDetails; + + return $new; + } + + /** + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param string $message + * @return DeniedAccessWSException + */ + public function withMessage($message) + { + $new = clone $this; + $new->message = $message; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DepotList.php b/modules/dpdshipping/src/Api/DpdServices/Type/DepotList.php new file mode 100644 index 00000000..e33895dd --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DepotList.php @@ -0,0 +1,57 @@ +ProtocolDepot; + } + + /** + * @param ProtocolDepot $ProtocolDepot + * @return DepotList + */ + public function withProtocolDepot($ProtocolDepot) + { + $new = clone $this; + $new->ProtocolDepot = $ProtocolDepot; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DestinationDataList.php b/modules/dpdshipping/src/Api/DpdServices/Type/DestinationDataList.php new file mode 100644 index 00000000..ecb2c0bd --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DestinationDataList.php @@ -0,0 +1,57 @@ +DestinationsData; + } + + /** + * @param DestinationsData $DestinationsData + * @return DestinationDataList + */ + public function withDestinationsData($DestinationsData) + { + $new = clone $this; + $new->DestinationsData = $DestinationsData; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DestinationsData.php b/modules/dpdshipping/src/Api/DpdServices/Type/DestinationsData.php new file mode 100644 index 00000000..82292a37 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DestinationsData.php @@ -0,0 +1,107 @@ +DestinationName; + } + + /** + * @param string $DestinationName + * @return DestinationsData + */ + public function withDestinationName($DestinationName) + { + $new = clone $this; + $new->DestinationName = $DestinationName; + + return $new; + } + + /** + * @return string + */ + public function getDocumentId() + { + return $this->DocumentId; + } + + /** + * @param string $DocumentId + * @return DestinationsData + */ + public function withDocumentId($DocumentId) + { + $new = clone $this; + $new->DocumentId = $DocumentId; + + return $new; + } + + /** + * @return bool + */ + public function getDomestic() + { + return $this->Domestic; + } + + /** + * @param bool $Domestic + * @return DestinationsData + */ + public function withDomestic($Domestic) + { + $new = clone $this; + $new->Domestic = $Domestic; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DocumentGenerationResponseV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/DocumentGenerationResponseV1.php new file mode 100644 index 00000000..ac09c937 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DocumentGenerationResponseV1.php @@ -0,0 +1,107 @@ +documentData; + } + + /** + * @param string $documentData + * @return DocumentGenerationResponseV1 + */ + public function withDocumentData($documentData) + { + $new = clone $this; + $new->documentData = $documentData; + + return $new; + } + + /** + * @return string + */ + public function getDocumentId() + { + return $this->documentId; + } + + /** + * @param string $documentId + * @return DocumentGenerationResponseV1 + */ + public function withDocumentId($documentId) + { + $new = clone $this; + $new->documentId = $documentId; + + return $new; + } + + /** + * @return SessionDGRV1 + */ + public function getSession() + { + return $this->session; + } + + /** + * @param SessionDGRV1 $session + * @return DocumentGenerationResponseV1 + */ + public function withSession($session) + { + $new = clone $this; + $new->session = $session; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DocumentGenerationResponseV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/DocumentGenerationResponseV2.php new file mode 100644 index 00000000..215a2ca8 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DocumentGenerationResponseV2.php @@ -0,0 +1,132 @@ +DestinationDataList; + } + + /** + * @param DestinationDataList $DestinationDataList + * @return DocumentGenerationResponseV2 + */ + public function withDestinationDataList($DestinationDataList) + { + $new = clone $this; + $new->DestinationDataList = $DestinationDataList; + + return $new; + } + + /** + * @return string + */ + public function getDocumentData() + { + return $this->DocumentData; + } + + /** + * @param string $DocumentData + * @return DocumentGenerationResponseV2 + */ + public function withDocumentData($DocumentData) + { + $new = clone $this; + $new->DocumentData = $DocumentData; + + return $new; + } + + /** + * @return NonMatchingData + */ + public function getNonMatchingDataList() + { + return $this->nonMatchingDataList; + } + + /** + * @param NonMatchingData $nonMatchingDataList + * @return DocumentGenerationResponseV2 + */ + public function withNonMatchingDataList($nonMatchingDataList) + { + $new = clone $this; + $new->nonMatchingDataList = $nonMatchingDataList; + + return $new; + } + + /** + * @return SessionDGRV2 + */ + public function getSession() + { + return $this->Session; + } + + /** + * @param SessionDGRV2 $Session + * @return DocumentGenerationResponseV2 + */ + public function withSession($Session) + { + $new = clone $this; + $new->Session = $Session; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DpdParcelBusinessEventDataV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/DpdParcelBusinessEventDataV1.php new file mode 100644 index 00000000..a53ef883 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DpdParcelBusinessEventDataV1.php @@ -0,0 +1,82 @@ +code; + } + + /** + * @param string $code + * @return DpdParcelBusinessEventDataV1 + */ + public function withCode($code) + { + $new = clone $this; + $new->code = $code; + + return $new; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * @return DpdParcelBusinessEventDataV1 + */ + public function withValue($value) + { + $new = clone $this; + $new->value = $value; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DpdParcelBusinessEventV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/DpdParcelBusinessEventV1.php new file mode 100644 index 00000000..ae946a2e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DpdParcelBusinessEventV1.php @@ -0,0 +1,184 @@ +countryCode; + } + + /** + * @param string $countryCode + * @return DpdParcelBusinessEventV1 + */ + public function withCountryCode($countryCode) + { + $new = clone $this; + $new->countryCode = $countryCode; + + return $new; + } + + /** + * @return string + */ + public function getEventCode() + { + return $this->eventCode; + } + + /** + * @param string $eventCode + * @return DpdParcelBusinessEventV1 + */ + public function withEventCode($eventCode) + { + $new = clone $this; + $new->eventCode = $eventCode; + + return $new; + } + + /** + * @return DpdParcelBusinessEventDataV1 + */ + public function getEventDataList() + { + return $this->eventDataList; + } + + /** + * @param DpdParcelBusinessEventDataV1 $eventDataList + * @return DpdParcelBusinessEventV1 + */ + public function withEventDataList($eventDataList) + { + $new = clone $this; + $new->eventDataList = $eventDataList; + + return $new; + } + + /** + * @return DateTimeInterface + */ + public function getEventTime() + { + return $this->eventTime; + } + + /** + * @param DateTimeInterface $eventTime + * @return DpdParcelBusinessEventV1 + */ + public function withEventTime($eventTime) + { + $new = clone $this; + $new->eventTime = $eventTime; + + return $new; + } + + /** + * @return string + */ + public function getPostalCode() + { + return $this->postalCode; + } + + /** + * @param string $postalCode + * @return DpdParcelBusinessEventV1 + */ + public function withPostalCode($postalCode) + { + $new = clone $this; + $new->postalCode = $postalCode; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return DpdParcelBusinessEventV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV1.php new file mode 100644 index 00000000..bbd0d07c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV1.php @@ -0,0 +1,209 @@ +contactInfo; + } + + /** + * @param ContactInfoDPPV1 $contactInfo + * @return DpdPickupCallParamsV1 + */ + public function withContactInfo($contactInfo) + { + $new = clone $this; + $new->contactInfo = $contactInfo; + + return $new; + } + + /** + * @return PickupAddressDSPV1 + */ + public function getPickupAddress() + { + return $this->pickupAddress; + } + + /** + * @param PickupAddressDSPV1 $pickupAddress + * @return DpdPickupCallParamsV1 + */ + public function withPickupAddress($pickupAddress) + { + $new = clone $this; + $new->pickupAddress = $pickupAddress; + + return $new; + } + + /** + * @return DateTimeInterface + */ + public function getPickupDate() + { + return $this->pickupDate; + } + + /** + * @param DateTimeInterface $pickupDate + * @return DpdPickupCallParamsV1 + */ + public function withPickupDate($pickupDate) + { + $new = clone $this; + $new->pickupDate = $pickupDate; + + return $new; + } + + /** + * @return string + */ + public function getPickupTimeFrom() + { + return $this->pickupTimeFrom; + } + + /** + * @param string $pickupTimeFrom + * @return DpdPickupCallParamsV1 + */ + public function withPickupTimeFrom($pickupTimeFrom) + { + $new = clone $this; + $new->pickupTimeFrom = $pickupTimeFrom; + + return $new; + } + + /** + * @return string + */ + public function getPickupTimeTo() + { + return $this->pickupTimeTo; + } + + /** + * @param string $pickupTimeTo + * @return DpdPickupCallParamsV1 + */ + public function withPickupTimeTo($pickupTimeTo) + { + $new = clone $this; + $new->pickupTimeTo = $pickupTimeTo; + + return $new; + } + + /** + * @return string + */ + public function getPolicy() + { + return $this->policy; + } + + /** + * @param string $policy + * @return DpdPickupCallParamsV1 + */ + public function withPolicy($policy) + { + $new = clone $this; + $new->policy = $policy; + + return $new; + } + + /** + * @return ProtocolDPPV1 + */ + public function getProtocols() + { + return $this->protocols; + } + + /** + * @param ProtocolDPPV1 $protocols + * @return DpdPickupCallParamsV1 + */ + public function withProtocols($protocols) + { + $new = clone $this; + $new->protocols = $protocols; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV2.php new file mode 100644 index 00000000..afbebbc8 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV2.php @@ -0,0 +1,257 @@ +operationType; + } + + /** + * @param string $operationType + * @return DpdPickupCallParamsV2 + */ + public function withOperationType($operationType) + { + $new = clone $this; + $new->operationType = $operationType; + + return $new; + } + + /** + * @return string + */ + public function getOrderNumber() + { + return $this->orderNumber; + } + + /** + * @param string $orderNumber + * @return DpdPickupCallParamsV2 + */ + public function withOrderNumber($orderNumber) + { + $new = clone $this; + $new->orderNumber = $orderNumber; + + return $new; + } + + /** + * @return string + */ + public function getOrderType() + { + return $this->orderType; + } + + /** + * @param string $orderType + * @return DpdPickupCallParamsV2 + */ + public function withOrderType($orderType) + { + $new = clone $this; + $new->orderType = $orderType; + + return $new; + } + + /** + * @return PickupCallSimplifiedDetailsDPPV1 + */ + public function getPickupCallSimplifiedDetails() + { + return $this->pickupCallSimplifiedDetails; + } + + /** + * @param PickupCallSimplifiedDetailsDPPV1 $pickupCallSimplifiedDetails + * @return DpdPickupCallParamsV2 + */ + public function withPickupCallSimplifiedDetails($pickupCallSimplifiedDetails) + { + $new = clone $this; + $new->pickupCallSimplifiedDetails = $pickupCallSimplifiedDetails; + + return $new; + } + + /** + * @return string + */ + public function getPickupDate() + { + return $this->pickupDate; + } + + /** + * @param string $pickupDate + * @return DpdPickupCallParamsV2 + */ + public function withPickupDate($pickupDate) + { + $new = clone $this; + $new->pickupDate = $pickupDate; + + return $new; + } + + /** + * @return string + */ + public function getPickupTimeFrom() + { + return $this->pickupTimeFrom; + } + + /** + * @param string $pickupTimeFrom + * @return DpdPickupCallParamsV2 + */ + public function withPickupTimeFrom($pickupTimeFrom) + { + $new = clone $this; + $new->pickupTimeFrom = $pickupTimeFrom; + + return $new; + } + + /** + * @return string + */ + public function getPickupTimeTo() + { + return $this->pickupTimeTo; + } + + /** + * @param string $pickupTimeTo + * @return DpdPickupCallParamsV2 + */ + public function withPickupTimeTo($pickupTimeTo) + { + $new = clone $this; + $new->pickupTimeTo = $pickupTimeTo; + + return $new; + } + + /** + * @return string + */ + public function getUpdateMode() + { + return $this->updateMode; + } + + /** + * @param string $updateMode + * @return DpdPickupCallParamsV2 + */ + public function withUpdateMode($updateMode) + { + $new = clone $this; + $new->updateMode = $updateMode; + + return $new; + } + + /** + * @return bool + */ + public function getWaybillsReady() + { + return $this->waybillsReady; + } + + /** + * @param bool $waybillsReady + * @return DpdPickupCallParamsV2 + */ + public function withWaybillsReady($waybillsReady) + { + $new = clone $this; + $new->waybillsReady = $waybillsReady; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV3.php new file mode 100644 index 00000000..91cc660c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DpdPickupCallParamsV3.php @@ -0,0 +1,282 @@ +checkSum; + } + + /** + * @param int $checkSum + * @return DpdPickupCallParamsV3 + */ + public function withCheckSum($checkSum) + { + $new = clone $this; + $new->checkSum = $checkSum; + + return $new; + } + + /** + * @return string + */ + public function getOperationType() + { + return $this->operationType; + } + + /** + * @param string $operationType + * @return DpdPickupCallParamsV3 + */ + public function withOperationType($operationType) + { + $new = clone $this; + $new->operationType = $operationType; + + return $new; + } + + /** + * @return string + */ + public function getOrderNumber() + { + return $this->orderNumber; + } + + /** + * @param string $orderNumber + * @return DpdPickupCallParamsV3 + */ + public function withOrderNumber($orderNumber) + { + $new = clone $this; + $new->orderNumber = $orderNumber; + + return $new; + } + + /** + * @return string + */ + public function getOrderType() + { + return $this->orderType; + } + + /** + * @param string $orderType + * @return DpdPickupCallParamsV3 + */ + public function withOrderType($orderType) + { + $new = clone $this; + $new->orderType = $orderType; + + return $new; + } + + /** + * @return PickupCallSimplifiedDetailsDPPV1 + */ + public function getPickupCallSimplifiedDetails() + { + return $this->pickupCallSimplifiedDetails; + } + + /** + * @param PickupCallSimplifiedDetailsDPPV1 $pickupCallSimplifiedDetails + * @return DpdPickupCallParamsV3 + */ + public function withPickupCallSimplifiedDetails($pickupCallSimplifiedDetails) + { + $new = clone $this; + $new->pickupCallSimplifiedDetails = $pickupCallSimplifiedDetails; + + return $new; + } + + /** + * @return string + */ + public function getPickupDate() + { + return $this->pickupDate; + } + + /** + * @param string $pickupDate + * @return DpdPickupCallParamsV3 + */ + public function withPickupDate($pickupDate) + { + $new = clone $this; + $new->pickupDate = $pickupDate; + + return $new; + } + + /** + * @return string + */ + public function getPickupTimeFrom() + { + return $this->pickupTimeFrom; + } + + /** + * @param string $pickupTimeFrom + * @return DpdPickupCallParamsV3 + */ + public function withPickupTimeFrom($pickupTimeFrom) + { + $new = clone $this; + $new->pickupTimeFrom = $pickupTimeFrom; + + return $new; + } + + /** + * @return string + */ + public function getPickupTimeTo() + { + return $this->pickupTimeTo; + } + + /** + * @param string $pickupTimeTo + * @return DpdPickupCallParamsV3 + */ + public function withPickupTimeTo($pickupTimeTo) + { + $new = clone $this; + $new->pickupTimeTo = $pickupTimeTo; + + return $new; + } + + /** + * @return string + */ + public function getUpdateMode() + { + return $this->updateMode; + } + + /** + * @param string $updateMode + * @return DpdPickupCallParamsV3 + */ + public function withUpdateMode($updateMode) + { + $new = clone $this; + $new->updateMode = $updateMode; + + return $new; + } + + /** + * @return bool + */ + public function getWaybillsReady() + { + return $this->waybillsReady; + } + + /** + * @param bool $waybillsReady + * @return DpdPickupCallParamsV3 + */ + public function withWaybillsReady($waybillsReady) + { + $new = clone $this; + $new->waybillsReady = $waybillsReady; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DpdServicesParamsV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/DpdServicesParamsV1.php new file mode 100644 index 00000000..895724fa --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DpdServicesParamsV1.php @@ -0,0 +1,132 @@ +documentId; + } + + /** + * @param string $documentId + * @return DpdServicesParamsV1 + */ + public function withDocumentId($documentId) + { + $new = clone $this; + $new->documentId = $documentId; + + return $new; + } + + /** + * @return PickupAddressDSPV1 + */ + public function getPickupAddress() + { + return $this->pickupAddress; + } + + /** + * @param PickupAddressDSPV1 $pickupAddress + * @return DpdServicesParamsV1 + */ + public function withPickupAddress($pickupAddress) + { + $new = clone $this; + $new->pickupAddress = $pickupAddress; + + return $new; + } + + /** + * @return string + */ + public function getPolicy() + { + return $this->policy; + } + + /** + * @param string $policy + * @return DpdServicesParamsV1 + */ + public function withPolicy($policy) + { + $new = clone $this; + $new->policy = $policy; + + return $new; + } + + /** + * @return SessionDSPV1 + */ + public function getSession() + { + return $this->session; + } + + /** + * @param SessionDSPV1 $session + * @return DpdServicesParamsV1 + */ + public function withSession($session) + { + $new = clone $this; + $new->session = $session; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/DpdServicesParamsV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/DpdServicesParamsV2.php new file mode 100644 index 00000000..b36f43d3 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/DpdServicesParamsV2.php @@ -0,0 +1,157 @@ +Policy; + } + + /** + * @param string $Policy + * @return DpdServicesParamsV2 + */ + public function withPolicy($Policy) + { + $new = clone $this; + $new->Policy = $Policy; + + return $new; + } + + /** + * @return SessionDSPV2 + */ + public function getSession() + { + return $this->Session; + } + + /** + * @param SessionDSPV2 $Session + * @return DpdServicesParamsV2 + */ + public function withSession($Session) + { + $new = clone $this; + $new->Session = $Session; + + return $new; + } + + /** + * @return PickupAddressDSPV2 + */ + public function getPickupAddress() + { + return $this->PickupAddress; + } + + /** + * @param PickupAddressDSPV2 $PickupAddress + * @return DpdServicesParamsV2 + */ + public function withPickupAddress($PickupAddress) + { + $new = clone $this; + $new->PickupAddress = $PickupAddress; + + return $new; + } + + /** + * @return DeliveryDestinations + */ + public function getDeliveryDestinations() + { + return $this->DeliveryDestinations; + } + + /** + * @param DeliveryDestinations $DeliveryDestinations + * @return DpdServicesParamsV2 + */ + public function withDeliveryDestinations($DeliveryDestinations) + { + $new = clone $this; + $new->DeliveryDestinations = $DeliveryDestinations; + + return $new; + } + + /** + * @return bool + */ + public function getGenProtForNonMatching() + { + return $this->GenProtForNonMatching; + } + + /** + * @param bool $GenProtForNonMatching + * @return DpdServicesParamsV2 + */ + public function withGenProtForNonMatching($GenProtForNonMatching) + { + $new = clone $this; + $new->GenProtForNonMatching = $GenProtForNonMatching; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ErrorDetailsPCRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ErrorDetailsPCRV2.php new file mode 100644 index 00000000..09f47cec --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ErrorDetailsPCRV2.php @@ -0,0 +1,107 @@ +code; + } + + /** + * @param string $code + * @return ErrorDetailsPCRV2 + */ + public function withCode($code) + { + $new = clone $this; + $new->code = $code; + + return $new; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return ErrorDetailsPCRV2 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return string + */ + public function getFields() + { + return $this->fields; + } + + /** + * @param string $fields + * @return ErrorDetailsPCRV2 + */ + public function withFields($fields) + { + $new = clone $this; + $new->fields = $fields; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/Exception.php b/modules/dpdshipping/src/Api/DpdServices/Type/Exception.php new file mode 100644 index 00000000..496587f0 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/Exception.php @@ -0,0 +1,57 @@ +message; + } + + /** + * @param string $message + * @return Exception + */ + public function withMessage($message) + { + $new = clone $this; + $new->message = $message; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeResponseV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeResponseV1.php new file mode 100644 index 00000000..9393fe3b --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeResponseV1.php @@ -0,0 +1,57 @@ +status; + } + + /** + * @param string $status + * @return FindPostalCodeResponseV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeV1.php new file mode 100644 index 00000000..1accc773 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeV1.php @@ -0,0 +1,94 @@ +postalCodeV1 = $postalCodeV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return PostalCodeV1 + */ + public function getPostalCodeV1() + { + return $this->postalCodeV1; + } + + /** + * @param PostalCodeV1 $postalCodeV1 + * @return FindPostalCodeV1 + */ + public function withPostalCodeV1($postalCodeV1) + { + $new = clone $this; + $new->postalCodeV1 = $postalCodeV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return FindPostalCodeV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeV1Response.php new file mode 100644 index 00000000..606ce6ec --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/FindPostalCodeV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param FindPostalCodeResponseV1 $return + * @return FindPostalCodeV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateDomesticReturnLabelV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateDomesticReturnLabelV1.php new file mode 100644 index 00000000..6d8c4ee3 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateDomesticReturnLabelV1.php @@ -0,0 +1,229 @@ +returnedWaybillsV1 = $returnedWaybillsV1; + $this->receiver = $receiver; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->outputLabelType = $outputLabelType; + $this->labelVariant = $labelVariant; + $this->authDataV1 = $authDataV1; + } + + /** + * @return ReturnedWaybillsV1 + */ + public function getReturnedWaybillsV1() + { + return $this->returnedWaybillsV1; + } + + /** + * @param ReturnedWaybillsV1 $returnedWaybillsV1 + * @return GenerateDomesticReturnLabelV1 + */ + public function withReturnedWaybillsV1($returnedWaybillsV1) + { + $new = clone $this; + $new->returnedWaybillsV1 = $returnedWaybillsV1; + + return $new; + } + + /** + * @return PudoReturnReceiver + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PudoReturnReceiver $receiver + * @return GenerateDomesticReturnLabelV1 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateDomesticReturnLabelV1 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateDomesticReturnLabelV1 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputLabelType() + { + return $this->outputLabelType; + } + + /** + * @param string $outputLabelType + * @return GenerateDomesticReturnLabelV1 + */ + public function withOutputLabelType($outputLabelType) + { + $new = clone $this; + $new->outputLabelType = $outputLabelType; + + return $new; + } + + /** + * @return string + */ + public function getLabelVariant() + { + return $this->labelVariant; + } + + /** + * @param string $labelVariant + * @return GenerateDomesticReturnLabelV1 + */ + public function withLabelVariant($labelVariant) + { + $new = clone $this; + $new->labelVariant = $labelVariant; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateDomesticReturnLabelV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateDomesticReturnLabelV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateDomesticReturnLabelV1Response.php new file mode 100644 index 00000000..4219d81d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateDomesticReturnLabelV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateDomesticReturnLabelV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateInternationalPackageNumbersV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateInternationalPackageNumbersV1.php new file mode 100644 index 00000000..ed3f98b9 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateInternationalPackageNumbersV1.php @@ -0,0 +1,94 @@ +internationalOpenUMLFeV1 = $internationalOpenUMLFeV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return InternationalOpenUMLFeV1 + */ + public function getInternationalOpenUMLFeV1() + { + return $this->internationalOpenUMLFeV1; + } + + /** + * @param InternationalOpenUMLFeV1 $internationalOpenUMLFeV1 + * @return GenerateInternationalPackageNumbersV1 + */ + public function withInternationalOpenUMLFeV1($internationalOpenUMLFeV1) + { + $new = clone $this; + $new->internationalOpenUMLFeV1 = $internationalOpenUMLFeV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateInternationalPackageNumbersV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateInternationalPackageNumbersV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateInternationalPackageNumbersV1Response.php new file mode 100644 index 00000000..f4471875 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateInternationalPackageNumbersV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GenerateInternationalPackageNumbersV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV1.php new file mode 100644 index 00000000..eec0604d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV1.php @@ -0,0 +1,121 @@ +openUMLV1 = $openUMLV1; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV1 + */ + public function getOpenUMLV1() + { + return $this->openUMLV1; + } + + /** + * @param OpenUMLFeV1 $openUMLV1 + * @return GeneratePackagesNumbersV1 + */ + public function withOpenUMLV1($openUMLV1) + { + $new = clone $this; + $new->openUMLV1 = $openUMLV1; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV1 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV1Response.php new file mode 100644 index 00000000..46708f68 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV1 $return + * @return GeneratePackagesNumbersV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV2.php new file mode 100644 index 00000000..8c4e494d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV2.php @@ -0,0 +1,148 @@ +openUMLV1 = $openUMLV1; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV1 + */ + public function getOpenUMLV1() + { + return $this->openUMLV1; + } + + /** + * @param OpenUMLFeV1 $openUMLV1 + * @return GeneratePackagesNumbersV2 + */ + public function withOpenUMLV1($openUMLV1) + { + $new = clone $this; + $new->openUMLV1 = $openUMLV1; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV2 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV2 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV2 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV2Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV2Response.php new file mode 100644 index 00000000..98a27029 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV2Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV2Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV3.php new file mode 100644 index 00000000..717898f0 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV3.php @@ -0,0 +1,148 @@ +openUMLFeV2 = $openUMLFeV2; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV2 + */ + public function getOpenUMLFeV2() + { + return $this->openUMLFeV2; + } + + /** + * @param OpenUMLFeV2 $openUMLFeV2 + * @return GeneratePackagesNumbersV3 + */ + public function withOpenUMLFeV2($openUMLFeV2) + { + $new = clone $this; + $new->openUMLFeV2 = $openUMLFeV2; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV3 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV3 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV3 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV3Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV3Response.php new file mode 100644 index 00000000..21eb1dc1 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV3Response.php @@ -0,0 +1,61 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV3Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV4.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV4.php new file mode 100644 index 00000000..8f1aafe0 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV4.php @@ -0,0 +1,148 @@ +openUMLFeV3 = $openUMLFeV3; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV3 + */ + public function getOpenUMLFeV3() + { + return $this->openUMLFeV3; + } + + /** + * @param OpenUMLFeV3 $openUMLFeV3 + * @return GeneratePackagesNumbersV4 + */ + public function withOpenUMLFeV3($openUMLFeV3) + { + $new = clone $this; + $new->openUMLFeV3 = $openUMLFeV3; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV4 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV4 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV4 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV4Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV4Response.php new file mode 100644 index 00000000..db905b6d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV4Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV4Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV5.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV5.php new file mode 100644 index 00000000..56406046 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV5.php @@ -0,0 +1,148 @@ +openUMLFeV4 = $openUMLFeV4; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV4 + */ + public function getOpenUMLFeV4() + { + return $this->openUMLFeV4; + } + + /** + * @param OpenUMLFeV4 $openUMLFeV4 + * @return GeneratePackagesNumbersV5 + */ + public function withOpenUMLFeV4($openUMLFeV4) + { + $new = clone $this; + $new->openUMLFeV4 = $openUMLFeV4; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV5 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV5 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV5 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV5Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV5Response.php new file mode 100644 index 00000000..7a416a40 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV5Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV5Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV6.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV6.php new file mode 100644 index 00000000..93fe9d7d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV6.php @@ -0,0 +1,148 @@ +openUMLFeV5 = $openUMLFeV5; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV5 + */ + public function getOpenUMLFeV5() + { + return $this->openUMLFeV5; + } + + /** + * @param OpenUMLFeV5 $openUMLFeV5 + * @return GeneratePackagesNumbersV6 + */ + public function withOpenUMLFeV5($openUMLFeV5) + { + $new = clone $this; + $new->openUMLFeV5 = $openUMLFeV5; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV6 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV6 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV6 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV6Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV6Response.php new file mode 100644 index 00000000..caa880e3 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV6Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV6Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV7.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV7.php new file mode 100644 index 00000000..64c06cc7 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV7.php @@ -0,0 +1,148 @@ +openUMLFeV8 = $openUMLFeV8; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV8 + */ + public function getOpenUMLFeV8() + { + return $this->openUMLFeV8; + } + + /** + * @param OpenUMLFeV8 $openUMLFeV8 + * @return GeneratePackagesNumbersV7 + */ + public function withOpenUMLFeV8($openUMLFeV8) + { + $new = clone $this; + $new->openUMLFeV8 = $openUMLFeV8; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV7 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV7 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV7 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV7Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV7Response.php new file mode 100644 index 00000000..504711a9 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV7Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV7Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV8.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV8.php new file mode 100644 index 00000000..f8a05ff8 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV8.php @@ -0,0 +1,148 @@ +openUMLFeV9 = $openUMLFeV9; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV9 + */ + public function getOpenUMLFeV9() + { + return $this->openUMLFeV9; + } + + /** + * @param OpenUMLFeV9 $openUMLFeV9 + * @return GeneratePackagesNumbersV8 + */ + public function withOpenUMLFeV9($openUMLFeV9) + { + $new = clone $this; + $new->openUMLFeV9 = $openUMLFeV9; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV8 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV8 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV8 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV8Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV8Response.php new file mode 100644 index 00000000..6df04bf3 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV8Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV8Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV9.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV9.php new file mode 100644 index 00000000..7a7b8429 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV9.php @@ -0,0 +1,148 @@ +openUMLFeV11 = $openUMLFeV11; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV11 + */ + public function getOpenUMLFeV11() + { + return $this->openUMLFeV11; + } + + /** + * @param OpenUMLFeV11 $openUMLFeV11 + * @return GeneratePackagesNumbersV9 + */ + public function withOpenUMLFeV11($openUMLFeV11) + { + $new = clone $this; + $new->openUMLFeV11 = $openUMLFeV11; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GeneratePackagesNumbersV9 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GeneratePackagesNumbersV9 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GeneratePackagesNumbersV9 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV9Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV9Response.php new file mode 100644 index 00000000..cfb587a1 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GeneratePackagesNumbersV9Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GeneratePackagesNumbersV9Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV1.php new file mode 100644 index 00000000..5399a23f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV1.php @@ -0,0 +1,148 @@ +dpdServicesParamsV1 = $dpdServicesParamsV1; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1() + { + return $this->dpdServicesParamsV1; + } + + /** + * @param DpdServicesParamsV1 $dpdServicesParamsV1 + * @return GenerateProtocolV1 + */ + public function withDpdServicesParamsV1($dpdServicesParamsV1) + { + $new = clone $this; + $new->dpdServicesParamsV1 = $dpdServicesParamsV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateProtocolV1 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateProtocolV1 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateProtocolV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV1Response.php new file mode 100644 index 00000000..e446c80f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateProtocolV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV2.php new file mode 100644 index 00000000..4d9feb64 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV2.php @@ -0,0 +1,148 @@ +dpdServicesParamsV1 = $dpdServicesParamsV1; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1() + { + return $this->dpdServicesParamsV1; + } + + /** + * @param DpdServicesParamsV1 $dpdServicesParamsV1 + * @return GenerateProtocolV2 + */ + public function withDpdServicesParamsV1($dpdServicesParamsV1) + { + $new = clone $this; + $new->dpdServicesParamsV1 = $dpdServicesParamsV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateProtocolV2 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateProtocolV2 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateProtocolV2 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV2Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV2Response.php new file mode 100644 index 00000000..8857f7bd --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolV2Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateProtocolV2Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV1.php new file mode 100644 index 00000000..39cd0da4 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV1.php @@ -0,0 +1,94 @@ +dpdServicesParamsV2 = $dpdServicesParamsV2; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV2 + */ + public function getDpdServicesParamsV2() + { + return $this->dpdServicesParamsV2; + } + + /** + * @param DpdServicesParamsV2 $dpdServicesParamsV2 + * @return GenerateProtocolsWithDestinationsV1 + */ + public function withDpdServicesParamsV2($dpdServicesParamsV2) + { + $new = clone $this; + $new->dpdServicesParamsV2 = $dpdServicesParamsV2; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateProtocolsWithDestinationsV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV1Response.php new file mode 100644 index 00000000..30116a16 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV2 $return + * @return GenerateProtocolsWithDestinationsV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV2.php new file mode 100644 index 00000000..0ad333f2 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV2.php @@ -0,0 +1,94 @@ +dpdServicesParamsV2 = $dpdServicesParamsV2; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV2 + */ + public function getDpdServicesParamsV2() + { + return $this->dpdServicesParamsV2; + } + + /** + * @param DpdServicesParamsV2 $dpdServicesParamsV2 + * @return GenerateProtocolsWithDestinationsV2 + */ + public function withDpdServicesParamsV2($dpdServicesParamsV2) + { + $new = clone $this; + $new->dpdServicesParamsV2 = $dpdServicesParamsV2; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateProtocolsWithDestinationsV2 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV2Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV2Response.php new file mode 100644 index 00000000..d5f7efff --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateProtocolsWithDestinationsV2Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV2 $return + * @return GenerateProtocolsWithDestinationsV2Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnLabelV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnLabelV1.php new file mode 100644 index 00000000..5e3630fa --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnLabelV1.php @@ -0,0 +1,229 @@ +returnedWaybillsV1 = $returnedWaybillsV1; + $this->receiver = $receiver; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->outputLabelType = $outputLabelType; + $this->labelVariant = $labelVariant; + $this->authDataV1 = $authDataV1; + } + + /** + * @return ReturnedWaybillsV1 + */ + public function getReturnedWaybillsV1() + { + return $this->returnedWaybillsV1; + } + + /** + * @param ReturnedWaybillsV1 $returnedWaybillsV1 + * @return GenerateReturnLabelV1 + */ + public function withReturnedWaybillsV1($returnedWaybillsV1) + { + $new = clone $this; + $new->returnedWaybillsV1 = $returnedWaybillsV1; + + return $new; + } + + /** + * @return PudoReturnReceiver + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PudoReturnReceiver $receiver + * @return GenerateReturnLabelV1 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateReturnLabelV1 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateReturnLabelV1 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputLabelType() + { + return $this->outputLabelType; + } + + /** + * @param string $outputLabelType + * @return GenerateReturnLabelV1 + */ + public function withOutputLabelType($outputLabelType) + { + $new = clone $this; + $new->outputLabelType = $outputLabelType; + + return $new; + } + + /** + * @return string + */ + public function getLabelVariant() + { + return $this->labelVariant; + } + + /** + * @param string $labelVariant + * @return GenerateReturnLabelV1 + */ + public function withLabelVariant($labelVariant) + { + $new = clone $this; + $new->labelVariant = $labelVariant; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateReturnLabelV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnLabelV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnLabelV1Response.php new file mode 100644 index 00000000..94e5a069 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnLabelV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateReturnLabelV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnPackages.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnPackages.php new file mode 100644 index 00000000..5345951e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnPackages.php @@ -0,0 +1,148 @@ +openUMLFeV7 = $openUMLFeV7; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV7 + */ + public function getOpenUMLFeV7() + { + return $this->openUMLFeV7; + } + + /** + * @param OpenUMLFeV7 $openUMLFeV7 + * @return GenerateReturnPackages + */ + public function withOpenUMLFeV7($openUMLFeV7) + { + $new = clone $this; + $new->openUMLFeV7 = $openUMLFeV7; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GenerateReturnPackages + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GenerateReturnPackages + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateReturnPackages + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnPackagesResponse.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnPackagesResponse.php new file mode 100644 index 00000000..3e729933 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateReturnPackagesResponse.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesGenerationResponseV2 $return + * @return GenerateReturnPackagesResponse + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateShipmentV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateShipmentV1.php new file mode 100644 index 00000000..427ef393 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateShipmentV1.php @@ -0,0 +1,256 @@ +openUMLFeV10 = $openUMLFeV10; + $this->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + $this->langCode = $langCode; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->outputLabelType = $outputLabelType; + $this->labelVariant = $labelVariant; + $this->authDataV1 = $authDataV1; + } + + /** + * @return OpenUMLFeV10 + */ + public function getOpenUMLFeV10() + { + return $this->openUMLFeV10; + } + + /** + * @param OpenUMLFeV10 $openUMLFeV10 + * @return GenerateShipmentV1 + */ + public function withOpenUMLFeV10($openUMLFeV10) + { + $new = clone $this; + $new->openUMLFeV10 = $openUMLFeV10; + + return $new; + } + + /** + * @return string + */ + public function getPkgNumsGenerationPolicyV1() + { + return $this->pkgNumsGenerationPolicyV1; + } + + /** + * @param string $pkgNumsGenerationPolicyV1 + * @return GenerateShipmentV1 + */ + public function withPkgNumsGenerationPolicyV1($pkgNumsGenerationPolicyV1) + { + $new = clone $this; + $new->pkgNumsGenerationPolicyV1 = $pkgNumsGenerationPolicyV1; + + return $new; + } + + /** + * @return string + */ + public function getLangCode() + { + return $this->langCode; + } + + /** + * @param string $langCode + * @return GenerateShipmentV1 + */ + public function withLangCode($langCode) + { + $new = clone $this; + $new->langCode = $langCode; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateShipmentV1 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateShipmentV1 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputLabelType() + { + return $this->outputLabelType; + } + + /** + * @param string $outputLabelType + * @return GenerateShipmentV1 + */ + public function withOutputLabelType($outputLabelType) + { + $new = clone $this; + $new->outputLabelType = $outputLabelType; + + return $new; + } + + /** + * @return string + */ + public function getLabelVariant() + { + return $this->labelVariant; + } + + /** + * @param string $labelVariant + * @return GenerateShipmentV1 + */ + public function withLabelVariant($labelVariant) + { + $new = clone $this; + $new->labelVariant = $labelVariant; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateShipmentV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateShipmentV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateShipmentV1Response.php new file mode 100644 index 00000000..e4350ff7 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateShipmentV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param ShipmentDocumentGenerationResponseV1 $return + * @return GenerateShipmentV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV1.php new file mode 100644 index 00000000..ab16c34f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV1.php @@ -0,0 +1,148 @@ +dpdServicesParamsV1 = $dpdServicesParamsV1; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1() + { + return $this->dpdServicesParamsV1; + } + + /** + * @param DpdServicesParamsV1 $dpdServicesParamsV1 + * @return GenerateSpedLabelsV1 + */ + public function withDpdServicesParamsV1($dpdServicesParamsV1) + { + $new = clone $this; + $new->dpdServicesParamsV1 = $dpdServicesParamsV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateSpedLabelsV1 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateSpedLabelsV1 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateSpedLabelsV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV1Response.php new file mode 100644 index 00000000..192417dd --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateSpedLabelsV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV2.php new file mode 100644 index 00000000..f3ab4a1d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV2.php @@ -0,0 +1,175 @@ +dpdServicesParamsV1 = $dpdServicesParamsV1; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->outputLabelTypeV2 = $outputLabelTypeV2; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1() + { + return $this->dpdServicesParamsV1; + } + + /** + * @param DpdServicesParamsV1 $dpdServicesParamsV1 + * @return GenerateSpedLabelsV2 + */ + public function withDpdServicesParamsV1($dpdServicesParamsV1) + { + $new = clone $this; + $new->dpdServicesParamsV1 = $dpdServicesParamsV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateSpedLabelsV2 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateSpedLabelsV2 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputLabelTypeV2() + { + return $this->outputLabelTypeV2; + } + + /** + * @param string $outputLabelTypeV2 + * @return GenerateSpedLabelsV2 + */ + public function withOutputLabelTypeV2($outputLabelTypeV2) + { + $new = clone $this; + $new->outputLabelTypeV2 = $outputLabelTypeV2; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateSpedLabelsV2 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV2Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV2Response.php new file mode 100644 index 00000000..b04ecf95 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV2Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateSpedLabelsV2Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV3.php new file mode 100644 index 00000000..54020498 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV3.php @@ -0,0 +1,202 @@ +dpdServicesParamsV1 = $dpdServicesParamsV1; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->outputLabelType = $outputLabelType; + $this->labelVariant = $labelVariant; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1() + { + return $this->dpdServicesParamsV1; + } + + /** + * @param DpdServicesParamsV1 $dpdServicesParamsV1 + * @return GenerateSpedLabelsV3 + */ + public function withDpdServicesParamsV1($dpdServicesParamsV1) + { + $new = clone $this; + $new->dpdServicesParamsV1 = $dpdServicesParamsV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateSpedLabelsV3 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateSpedLabelsV3 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputLabelType() + { + return $this->outputLabelType; + } + + /** + * @param string $outputLabelType + * @return GenerateSpedLabelsV3 + */ + public function withOutputLabelType($outputLabelType) + { + $new = clone $this; + $new->outputLabelType = $outputLabelType; + + return $new; + } + + /** + * @return string + */ + public function getLabelVariant() + { + return $this->labelVariant; + } + + /** + * @param string $labelVariant + * @return GenerateSpedLabelsV3 + */ + public function withLabelVariant($labelVariant) + { + $new = clone $this; + $new->labelVariant = $labelVariant; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateSpedLabelsV3 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV3Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV3Response.php new file mode 100644 index 00000000..c1942863 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV3Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateSpedLabelsV3Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV4.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV4.php new file mode 100644 index 00000000..b8b2a8fe --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV4.php @@ -0,0 +1,202 @@ +dpdServicesParamsV1 = $dpdServicesParamsV1; + $this->outputDocFormatV1 = $outputDocFormatV1; + $this->outputDocPageFormatV1 = $outputDocPageFormatV1; + $this->outputLabelType = $outputLabelType; + $this->labelVariant = $labelVariant; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1() + { + return $this->dpdServicesParamsV1; + } + + /** + * @param DpdServicesParamsV1 $dpdServicesParamsV1 + * @return GenerateSpedLabelsV4 + */ + public function withDpdServicesParamsV1($dpdServicesParamsV1) + { + $new = clone $this; + $new->dpdServicesParamsV1 = $dpdServicesParamsV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocFormatV1() + { + return $this->outputDocFormatV1; + } + + /** + * @param string $outputDocFormatV1 + * @return GenerateSpedLabelsV4 + */ + public function withOutputDocFormatV1($outputDocFormatV1) + { + $new = clone $this; + $new->outputDocFormatV1 = $outputDocFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputDocPageFormatV1() + { + return $this->outputDocPageFormatV1; + } + + /** + * @param string $outputDocPageFormatV1 + * @return GenerateSpedLabelsV4 + */ + public function withOutputDocPageFormatV1($outputDocPageFormatV1) + { + $new = clone $this; + $new->outputDocPageFormatV1 = $outputDocPageFormatV1; + + return $new; + } + + /** + * @return string + */ + public function getOutputLabelType() + { + return $this->outputLabelType; + } + + /** + * @param string $outputLabelType + * @return GenerateSpedLabelsV4 + */ + public function withOutputLabelType($outputLabelType) + { + $new = clone $this; + $new->outputLabelType = $outputLabelType; + + return $new; + } + + /** + * @return string + */ + public function getLabelVariant() + { + return $this->labelVariant; + } + + /** + * @param string $labelVariant + * @return GenerateSpedLabelsV4 + */ + public function withLabelVariant($labelVariant) + { + $new = clone $this; + $new->labelVariant = $labelVariant; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GenerateSpedLabelsV4 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV4Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV4Response.php new file mode 100644 index 00000000..38654ff4 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GenerateSpedLabelsV4Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param DocumentGenerationResponseV1 $return + * @return GenerateSpedLabelsV4Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityResponseV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityResponseV1.php new file mode 100644 index 00000000..66f9e218 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityResponseV1.php @@ -0,0 +1,82 @@ +ranges; + } + + /** + * @param CourierOrderAvailabilityRangeV1 $ranges + * @return GetCourierOrderAvailabilityResponseV1 + */ + public function withRanges($ranges) + { + $new = clone $this; + $new->ranges = $ranges; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return GetCourierOrderAvailabilityResponseV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityV1.php new file mode 100644 index 00000000..057d0f33 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityV1.php @@ -0,0 +1,94 @@ +senderPlaceV1 = $senderPlaceV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return SenderPlaceV1 + */ + public function getSenderPlaceV1() + { + return $this->senderPlaceV1; + } + + /** + * @param SenderPlaceV1 $senderPlaceV1 + * @return GetCourierOrderAvailabilityV1 + */ + public function withSenderPlaceV1($senderPlaceV1) + { + $new = clone $this; + $new->senderPlaceV1 = $senderPlaceV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return GetCourierOrderAvailabilityV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityV1Response.php new file mode 100644 index 00000000..95b2b09c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/GetCourierOrderAvailabilityV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param GetCourierOrderAvailabilityResponseV1 $return + * @return GetCourierOrderAvailabilityV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventResponseV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventResponseV1.php new file mode 100644 index 00000000..afc4b333 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventResponseV1.php @@ -0,0 +1,82 @@ +description; + } + + /** + * @param string $description + * @return ImportDeliveryBusinessEventResponseV1 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return ImportDeliveryBusinessEventResponseV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventV1.php new file mode 100644 index 00000000..4aeecf18 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventV1.php @@ -0,0 +1,94 @@ +dpdParcelBusinessEventV1 = $dpdParcelBusinessEventV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdParcelBusinessEventV1 + */ + public function getDpdParcelBusinessEventV1() + { + return $this->dpdParcelBusinessEventV1; + } + + /** + * @param DpdParcelBusinessEventV1 $dpdParcelBusinessEventV1 + * @return ImportDeliveryBusinessEventV1 + */ + public function withDpdParcelBusinessEventV1($dpdParcelBusinessEventV1) + { + $new = clone $this; + $new->dpdParcelBusinessEventV1 = $dpdParcelBusinessEventV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return ImportDeliveryBusinessEventV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventV1Response.php new file mode 100644 index 00000000..e9a172a0 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ImportDeliveryBusinessEventV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param ImportDeliveryBusinessEventResponseV1 $return + * @return ImportDeliveryBusinessEventV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/InternationalOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalOpenUMLFeV1.php new file mode 100644 index 00000000..644beba8 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalOpenUMLFeV1.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param InternationalPackageOpenUMLFeV1 $packages + * @return InternationalOpenUMLFeV1 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/InternationalPackageOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalPackageOpenUMLFeV1.php new file mode 100644 index 00000000..47cd2d60 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalPackageOpenUMLFeV1.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param InternationalParcelOpenUMLFeV1 $parcels + * @return InternationalPackageOpenUMLFeV1 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return InternationalPackageOpenUMLFeV1 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return InternationalPackageOpenUMLFeV1 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return InternationalPackageOpenUMLFeV1 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return InternationalPackageOpenUMLFeV1 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return InternationalPackageOpenUMLFeV1 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return InternationalPackageOpenUMLFeV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return InternationalPackageOpenUMLFeV1 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return InternationalServicesOpenUMLFeV1 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param InternationalServicesOpenUMLFeV1 $services + * @return InternationalPackageOpenUMLFeV1 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return InternationalPackageOpenUMLFeV1 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/InternationalParcelOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalParcelOpenUMLFeV1.php new file mode 100644 index 00000000..c4740f5f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalParcelOpenUMLFeV1.php @@ -0,0 +1,282 @@ +reference; + } + + /** + * @param string $reference + * @return InternationalParcelOpenUMLFeV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $weight + * @return InternationalParcelOpenUMLFeV1 + */ + public function withWeight($weight) + { + $new = clone $this; + $new->weight = $weight; + + return $new; + } + + /** + * @return string + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param string $sizeX + * @return InternationalParcelOpenUMLFeV1 + */ + public function withSizeX($sizeX) + { + $new = clone $this; + $new->sizeX = $sizeX; + + return $new; + } + + /** + * @return string + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param string $sizeY + * @return InternationalParcelOpenUMLFeV1 + */ + public function withSizeY($sizeY) + { + $new = clone $this; + $new->sizeY = $sizeY; + + return $new; + } + + /** + * @return string + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param string $sizeZ + * @return InternationalParcelOpenUMLFeV1 + */ + public function withSizeZ($sizeZ) + { + $new = clone $this; + $new->sizeZ = $sizeZ; + + return $new; + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @param string $content + * @return InternationalParcelOpenUMLFeV1 + */ + public function withContent($content) + { + $new = clone $this; + $new->content = $content; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData1() + { + return $this->customerData1; + } + + /** + * @param string $customerData1 + * @return InternationalParcelOpenUMLFeV1 + */ + public function withCustomerData1($customerData1) + { + $new = clone $this; + $new->customerData1 = $customerData1; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData2() + { + return $this->customerData2; + } + + /** + * @param string $customerData2 + * @return InternationalParcelOpenUMLFeV1 + */ + public function withCustomerData2($customerData2) + { + $new = clone $this; + $new->customerData2 = $customerData2; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData3() + { + return $this->customerData3; + } + + /** + * @param string $customerData3 + * @return InternationalParcelOpenUMLFeV1 + */ + public function withCustomerData3($customerData3) + { + $new = clone $this; + $new->customerData3 = $customerData3; + + return $new; + } + + /** + * @return string + */ + public function getWeightAdr() + { + return $this->weightAdr; + } + + /** + * @param string $weightAdr + * @return InternationalParcelOpenUMLFeV1 + */ + public function withWeightAdr($weightAdr) + { + $new = clone $this; + $new->weightAdr = $weightAdr; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/InternationalServicesOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalServicesOpenUMLFeV1.php new file mode 100644 index 00000000..b29ea654 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/InternationalServicesOpenUMLFeV1.php @@ -0,0 +1,57 @@ +pudoReturn; + } + + /** + * @param ServiceDPDPudoReturnUMLFeV1 $pudoReturn + * @return InternationalServicesOpenUMLFeV1 + */ + public function withPudoReturn($pudoReturn) + { + $new = clone $this; + $new->pudoReturn = $pudoReturn; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/InvalidFieldPAV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/InvalidFieldPAV1.php new file mode 100644 index 00000000..edad95c7 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/InvalidFieldPAV1.php @@ -0,0 +1,107 @@ +fieldName; + } + + /** + * @param string $fieldName + * @return InvalidFieldPAV1 + */ + public function withFieldName($fieldName) + { + $new = clone $this; + $new->fieldName = $fieldName; + + return $new; + } + + /** + * @return string + */ + public function getInfo() + { + return $this->info; + } + + /** + * @param string $info + * @return InvalidFieldPAV1 + */ + public function withInfo($info) + { + $new = clone $this; + $new->info = $info; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return InvalidFieldPAV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/InvalidFieldPGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/InvalidFieldPGRV1.php new file mode 100644 index 00000000..aaed11f8 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/InvalidFieldPGRV1.php @@ -0,0 +1,107 @@ +fieldName; + } + + /** + * @param string $fieldName + * @return InvalidFieldPGRV1 + */ + public function withFieldName($fieldName) + { + $new = clone $this; + $new->fieldName = $fieldName; + + return $new; + } + + /** + * @return string + */ + public function getInfo() + { + return $this->info; + } + + /** + * @param string $info + * @return InvalidFieldPGRV1 + */ + public function withInfo($info) + { + $new = clone $this; + $new->info = $info; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return InvalidFieldPGRV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/NonMatchingData.php b/modules/dpdshipping/src/Api/DpdServices/Type/NonMatchingData.php new file mode 100644 index 00000000..db39d333 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/NonMatchingData.php @@ -0,0 +1,57 @@ +waybill; + } + + /** + * @param string $waybill + * @return NonMatchingData + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV1.php new file mode 100644 index 00000000..19468127 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV1.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV1 $packages + * @return OpenUMLFeV1 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV10.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV10.php new file mode 100644 index 00000000..1f429996 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV10.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV10 $packages + * @return OpenUMLFeV10 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV11.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV11.php new file mode 100644 index 00000000..5b9b5eef --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV11.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param array $packages + * @return OpenUMLFeV11 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV2.php new file mode 100644 index 00000000..60bd21dc --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV2.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV2 $packages + * @return OpenUMLFeV2 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV3.php new file mode 100644 index 00000000..75cae787 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV3.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV3 $packages + * @return OpenUMLFeV3 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV4.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV4.php new file mode 100644 index 00000000..cf540f14 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV4.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV4 $packages + * @return OpenUMLFeV4 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV5.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV5.php new file mode 100644 index 00000000..f64d36b7 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV5.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV5 $packages + * @return OpenUMLFeV5 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV7.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV7.php new file mode 100644 index 00000000..74a9dd83 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV7.php @@ -0,0 +1,57 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV7 $packages + * @return OpenUMLFeV7 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV8.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV8.php new file mode 100644 index 00000000..ce850aef --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV8.php @@ -0,0 +1,61 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV8 $packages + * @return OpenUMLFeV8 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV9.php b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV9.php new file mode 100644 index 00000000..e2cc4c24 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/OpenUMLFeV9.php @@ -0,0 +1,61 @@ +packages; + } + + /** + * @param PackageOpenUMLFeV9 $packages + * @return OpenUMLFeV9 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageAddressOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageAddressOpenUMLFeV1.php new file mode 100644 index 00000000..c6a01d58 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageAddressOpenUMLFeV1.php @@ -0,0 +1,257 @@ +address; + } + + /** + * @param string $address + * @return PackageAddressOpenUMLFeV1 + */ + public function withAddress($address) + { + $new = clone $this; + $new->address = $address; + + return $new; + } + + /** + * @return string + */ + public function getCity() + { + return $this->city; + } + + /** + * @param string $city + * @return PackageAddressOpenUMLFeV1 + */ + public function withCity($city) + { + $new = clone $this; + $new->city = $city; + + return $new; + } + + /** + * @return string + */ + public function getCompany() + { + return $this->company; + } + + /** + * @param string $company + * @return PackageAddressOpenUMLFeV1 + */ + public function withCompany($company) + { + $new = clone $this; + $new->company = $company; + + return $new; + } + + /** + * @return string + */ + public function getCountryCode() + { + return $this->countryCode; + } + + /** + * @param string $countryCode + * @return PackageAddressOpenUMLFeV1 + */ + public function withCountryCode($countryCode) + { + $new = clone $this; + $new->countryCode = $countryCode; + + return $new; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + * @return PackageAddressOpenUMLFeV1 + */ + public function withEmail($email) + { + $new = clone $this; + $new->email = $email; + + return $new; + } + + /** + * @return int + */ + public function getFid() + { + return $this->fid; + } + + /** + * @param int $fid + * @return PackageAddressOpenUMLFeV1 + */ + public function withFid($fid) + { + $new = clone $this; + $new->fid = $fid; + + return $new; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return PackageAddressOpenUMLFeV1 + */ + public function withName($name) + { + $new = clone $this; + $new->name = $name; + + return $new; + } + + /** + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @param string $phone + * @return PackageAddressOpenUMLFeV1 + */ + public function withPhone($phone) + { + $new = clone $this; + $new->phone = $phone; + + return $new; + } + + /** + * @return string + */ + public function getPostalCode() + { + return $this->postalCode; + } + + /** + * @param string $postalCode + * @return PackageAddressOpenUMLFeV1 + */ + public function withPostalCode($postalCode) + { + $new = clone $this; + $new->postalCode = $postalCode; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageDGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageDGRV1.php new file mode 100644 index 00000000..11481d56 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageDGRV1.php @@ -0,0 +1,132 @@ +packageId; + } + + /** + * @param int $packageId + * @return PackageDGRV1 + */ + public function withPackageId($packageId) + { + $new = clone $this; + $new->packageId = $packageId; + + return $new; + } + + /** + * @return ParcelDGRV1 + */ + public function getParcels() + { + return $this->parcels; + } + + /** + * @param ParcelDGRV1 $parcels + * @return PackageDGRV1 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageDGRV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return StatusInfoDGRV1 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param StatusInfoDGRV1 $statusInfo + * @return PackageDGRV1 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageDGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageDGRV2.php new file mode 100644 index 00000000..955da32d --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageDGRV2.php @@ -0,0 +1,52 @@ +packageId; + } + + /** + * @param int $packageId + * @return PackageDSPV1 + */ + public function withPackageId($packageId) + { + $new = clone $this; + $new->packageId = $packageId; + + return $new; + } + + /** + * @return ParcelDSPV1 + */ + public function getParcels() + { + return $this->parcels; + } + + /** + * @param array $parcels + * @return PackageDSPV1 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageDSPV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageDSPV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageDSPV2.php new file mode 100644 index 00000000..137e4c5f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageDSPV2.php @@ -0,0 +1,107 @@ +PackageId; + } + + /** + * @param int $PackageId + * @return PackageDSPV2 + */ + public function withPackageId($PackageId) + { + $new = clone $this; + $new->PackageId = $PackageId; + + return $new; + } + + /** + * @return Parcels + */ + public function getParcels() + { + return $this->Parcels; + } + + /** + * @param Parcels $Parcels + * @return PackageDSPV2 + */ + public function withParcels($Parcels) + { + $new = clone $this; + $new->Parcels = $Parcels; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->Reference; + } + + /** + * @param string $Reference + * @return PackageDSPV2 + */ + public function withReference($Reference) + { + $new = clone $this; + $new->Reference = $Reference; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV1.php new file mode 100644 index 00000000..53898450 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV1.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV1 $parcels + * @return PackageOpenUMLFeV1 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV1 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV1 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV1 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV1 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV1 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV1 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV2 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV2 $services + * @return PackageOpenUMLFeV1 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV1 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV10.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV10.php new file mode 100644 index 00000000..e1474d6f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV10.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV4 $parcels + * @return PackageOpenUMLFeV10 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV10 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV10 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV10 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV10 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV10 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV10 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV10 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV9 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV9 $services + * @return PackageOpenUMLFeV10 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV10 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV11.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV11.php new file mode 100644 index 00000000..fb87d461 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV11.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param array $parcels + * @return PackageOpenUMLFeV11 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV11 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV11 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV11 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV11 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV11 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV11 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV11 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV11 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV11 $services + * @return PackageOpenUMLFeV11 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV11 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV2.php new file mode 100644 index 00000000..5566a395 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV2.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV1 $parcels + * @return PackageOpenUMLFeV2 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV2 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV2 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV2 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV2 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV2 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV2 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV2 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV3 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV3 $services + * @return PackageOpenUMLFeV2 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV2 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV3.php new file mode 100644 index 00000000..f87b1201 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV3.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV1 $parcels + * @return PackageOpenUMLFeV3 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV3 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV3 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV3 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV3 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV3 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV3 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV3 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV4 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV4 $services + * @return PackageOpenUMLFeV3 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV3 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV4.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV4.php new file mode 100644 index 00000000..09fb7b9c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV4.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV1 $parcels + * @return PackageOpenUMLFeV4 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV4 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV4 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV4 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV4 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV4 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV4 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV4 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV5 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV5 $services + * @return PackageOpenUMLFeV4 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV4 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV5.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV5.php new file mode 100644 index 00000000..836a7f33 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV5.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV1 $parcels + * @return PackageOpenUMLFeV5 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV5 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV5 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV5 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV5 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV5 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV5 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV5 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV6 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV6 $services + * @return PackageOpenUMLFeV5 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV5 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV7.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV7.php new file mode 100644 index 00000000..e5948e72 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV7.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV2 $parcels + * @return PackageOpenUMLFeV7 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV7 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV7 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV7 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV7 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV7 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV7 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV7 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV6 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV6 $services + * @return PackageOpenUMLFeV7 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV7 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV8.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV8.php new file mode 100644 index 00000000..70eeca71 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV8.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV3 $parcels + * @return PackageOpenUMLFeV8 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV8 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV8 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV8 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV8 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV8 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV8 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV8 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV8 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV8 $services + * @return PackageOpenUMLFeV8 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV8 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV9.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV9.php new file mode 100644 index 00000000..5a57da78 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackageOpenUMLFeV9.php @@ -0,0 +1,282 @@ +parcels; + } + + /** + * @param ParcelOpenUMLFeV3 $parcels + * @return PackageOpenUMLFeV9 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param string $payerType + * @return PackageOpenUMLFeV9 + */ + public function withPayerType($payerType) + { + $new = clone $this; + $new->payerType = $payerType; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param PackageAddressOpenUMLFeV1 $receiver + * @return PackageOpenUMLFeV9 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } + + /** + * @return string + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param string $ref1 + * @return PackageOpenUMLFeV9 + */ + public function withRef1($ref1) + { + $new = clone $this; + $new->ref1 = $ref1; + + return $new; + } + + /** + * @return string + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param string $ref2 + * @return PackageOpenUMLFeV9 + */ + public function withRef2($ref2) + { + $new = clone $this; + $new->ref2 = $ref2; + + return $new; + } + + /** + * @return string + */ + public function getRef3() + { + return $this->ref3; + } + + /** + * @param string $ref3 + * @return PackageOpenUMLFeV9 + */ + public function withRef3($ref3) + { + $new = clone $this; + $new->ref3 = $ref3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackageOpenUMLFeV9 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return PackageAddressOpenUMLFeV1 + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param PackageAddressOpenUMLFeV1 $sender + * @return PackageOpenUMLFeV9 + */ + public function withSender($sender) + { + $new = clone $this; + $new->sender = $sender; + + return $new; + } + + /** + * @return ServicesOpenUMLFeV9 + */ + public function getServices() + { + return $this->services; + } + + /** + * @param ServicesOpenUMLFeV9 $services + * @return PackageOpenUMLFeV9 + */ + public function withServices($services) + { + $new = clone $this; + $new->services = $services; + + return $new; + } + + /** + * @return int + */ + public function getThirdPartyFID() + { + return $this->thirdPartyFID; + } + + /** + * @param int $thirdPartyFID + * @return PackageOpenUMLFeV9 + */ + public function withThirdPartyFID($thirdPartyFID) + { + $new = clone $this; + $new->thirdPartyFID = $thirdPartyFID; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagePGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagePGRV1.php new file mode 100644 index 00000000..92b07641 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagePGRV1.php @@ -0,0 +1,157 @@ +invalidFields; + } + + /** + * @param InvalidFieldPGRV1 $invalidFields + * @return PackagePGRV1 + */ + public function withInvalidFields($invalidFields) + { + $new = clone $this; + $new->invalidFields = $invalidFields; + + return $new; + } + + /** + * @return int + */ + public function getPackageId() + { + return $this->packageId; + } + + /** + * @param int $packageId + * @return PackagePGRV1 + */ + public function withPackageId($packageId) + { + $new = clone $this; + $new->packageId = $packageId; + + return $new; + } + + /** + * @return ParcelPGRV1 + */ + public function getParcels() + { + return $this->parcels; + } + + /** + * @param ParcelPGRV1 $parcels + * @return PackagePGRV1 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return PackagePGRV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return PackagePGRV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagePGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagePGRV2.php new file mode 100644 index 00000000..c75cf30b --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagePGRV2.php @@ -0,0 +1,157 @@ +Status; + } + + /** + * @param string $Status + * @return PackagePGRV2 + */ + public function withStatus($Status) + { + $new = clone $this; + $new->Status = $Status; + + return $new; + } + + /** + * @return int + */ + public function getPackageId() + { + return $this->PackageId; + } + + /** + * @param int $PackageId + * @return PackagePGRV2 + */ + public function withPackageId($PackageId) + { + $new = clone $this; + $new->PackageId = $PackageId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->Reference; + } + + /** + * @param string $Reference + * @return PackagePGRV2 + */ + public function withReference($Reference) + { + $new = clone $this; + $new->Reference = $Reference; + + return $new; + } + + /** + * @return ValidationDetails + */ + public function getValidationDetails() + { + return $this->ValidationDetails; + } + + /** + * @param ValidationDetails $ValidationDetails + * @return PackagePGRV2 + */ + public function withValidationDetails($ValidationDetails) + { + $new = clone $this; + $new->ValidationDetails = $ValidationDetails; + + return $new; + } + + /** + * @return Parcels + */ + public function getParcels() + { + return $this->Parcels; + } + + /** + * @param Parcels $Parcels + * @return PackagePGRV2 + */ + public function withParcels($Parcels) + { + $new = clone $this; + $new->Parcels = $Parcels; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/Packages.php b/modules/dpdshipping/src/Api/DpdServices/Type/Packages.php new file mode 100644 index 00000000..dd993401 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/Packages.php @@ -0,0 +1,34 @@ +Status; + } + + /** + * @return mixed + */ + public function getPackages() + { + return $this->Packages; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV1.php new file mode 100644 index 00000000..7c129d38 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV1.php @@ -0,0 +1,82 @@ +orderNumber; + } + + /** + * @param string $orderNumber + * @return PackagesPickupCallResponseV1 + */ + public function withOrderNumber($orderNumber) + { + $new = clone $this; + $new->orderNumber = $orderNumber; + + return $new; + } + + /** + * @return ProtocolPCRV1 + */ + public function getPrototocols() + { + return $this->prototocols; + } + + /** + * @param ProtocolPCRV1 $prototocols + * @return PackagesPickupCallResponseV1 + */ + public function withPrototocols($prototocols) + { + $new = clone $this; + $new->prototocols = $prototocols; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV2.php new file mode 100644 index 00000000..a2b8ce05 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV2.php @@ -0,0 +1,82 @@ +orderNumber; + } + + /** + * @param string $orderNumber + * @return PackagesPickupCallResponseV2 + */ + public function withOrderNumber($orderNumber) + { + $new = clone $this; + $new->orderNumber = $orderNumber; + + return $new; + } + + /** + * @return StatusInfoPCRV2 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param StatusInfoPCRV2 $statusInfo + * @return PackagesPickupCallResponseV2 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV3.php new file mode 100644 index 00000000..89ab7d07 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallResponseV3.php @@ -0,0 +1,107 @@ +checkSum; + } + + /** + * @param int $checkSum + * @return PackagesPickupCallResponseV3 + */ + public function withCheckSum($checkSum) + { + $new = clone $this; + $new->checkSum = $checkSum; + + return $new; + } + + /** + * @return string + */ + public function getOrderNumber() + { + return $this->orderNumber; + } + + /** + * @param string $orderNumber + * @return PackagesPickupCallResponseV3 + */ + public function withOrderNumber($orderNumber) + { + $new = clone $this; + $new->orderNumber = $orderNumber; + + return $new; + } + + /** + * @return StatusInfoPCRV2 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param StatusInfoPCRV2 $statusInfo + * @return PackagesPickupCallResponseV3 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV1.php new file mode 100644 index 00000000..6d3f6f34 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV1.php @@ -0,0 +1,94 @@ +dpdPickupParamsV1 = $dpdPickupParamsV1; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdPickupCallParamsV1 + */ + public function getDpdPickupParamsV1() + { + return $this->dpdPickupParamsV1; + } + + /** + * @param DpdPickupCallParamsV1 $dpdPickupParamsV1 + * @return PackagesPickupCallV1 + */ + public function withDpdPickupParamsV1($dpdPickupParamsV1) + { + $new = clone $this; + $new->dpdPickupParamsV1 = $dpdPickupParamsV1; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return PackagesPickupCallV1 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV1Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV1Response.php new file mode 100644 index 00000000..2d07b458 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV1Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesPickupCallResponseV1 $return + * @return PackagesPickupCallV1Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV2.php new file mode 100644 index 00000000..d59d6f69 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV2.php @@ -0,0 +1,94 @@ +dpdPickupParamsV2 = $dpdPickupParamsV2; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdPickupCallParamsV2 + */ + public function getDpdPickupParamsV2() + { + return $this->dpdPickupParamsV2; + } + + /** + * @param DpdPickupCallParamsV2 $dpdPickupParamsV2 + * @return PackagesPickupCallV2 + */ + public function withDpdPickupParamsV2($dpdPickupParamsV2) + { + $new = clone $this; + $new->dpdPickupParamsV2 = $dpdPickupParamsV2; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return PackagesPickupCallV2 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV2Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV2Response.php new file mode 100644 index 00000000..7b553fe5 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV2Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesPickupCallResponseV2 $return + * @return PackagesPickupCallV2Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV3.php new file mode 100644 index 00000000..08a46986 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV3.php @@ -0,0 +1,94 @@ +dpdPickupParamsV3 = $dpdPickupParamsV3; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdPickupCallParamsV3 + */ + public function getDpdPickupParamsV3() + { + return $this->dpdPickupParamsV3; + } + + /** + * @param DpdPickupCallParamsV3 $dpdPickupParamsV3 + * @return PackagesPickupCallV3 + */ + public function withDpdPickupParamsV3($dpdPickupParamsV3) + { + $new = clone $this; + $new->dpdPickupParamsV3 = $dpdPickupParamsV3; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return PackagesPickupCallV3 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV3Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV3Response.php new file mode 100644 index 00000000..8fcee1b5 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV3Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesPickupCallResponseV3 $return + * @return PackagesPickupCallV3Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV4.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV4.php new file mode 100644 index 00000000..9d7bbfa6 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV4.php @@ -0,0 +1,94 @@ +dpdPickupParamsV3 = $dpdPickupParamsV3; + $this->authDataV1 = $authDataV1; + } + + /** + * @return DpdPickupCallParamsV3 + */ + public function getDpdPickupParamsV3() + { + return $this->dpdPickupParamsV3; + } + + /** + * @param DpdPickupCallParamsV3 $dpdPickupParamsV3 + * @return PackagesPickupCallV4 + */ + public function withDpdPickupParamsV3($dpdPickupParamsV3) + { + $new = clone $this; + $new->dpdPickupParamsV3 = $dpdPickupParamsV3; + + return $new; + } + + /** + * @return AuthDataV1 + */ + public function getAuthDataV1() + { + return $this->authDataV1; + } + + /** + * @param AuthDataV1 $authDataV1 + * @return PackagesPickupCallV4 + */ + public function withAuthDataV1($authDataV1) + { + $new = clone $this; + $new->authDataV1 = $authDataV1; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV4Response.php b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV4Response.php new file mode 100644 index 00000000..d100f38a --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PackagesPickupCallV4Response.php @@ -0,0 +1,57 @@ +return; + } + + /** + * @param PackagesPickupCallResponseV3 $return + * @return PackagesPickupCallV4Response + */ + public function withReturn($return) + { + $new = clone $this; + $new->return = $return; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelAppendPAV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelAppendPAV1.php new file mode 100644 index 00000000..0e9708b1 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelAppendPAV1.php @@ -0,0 +1,257 @@ +content; + } + + /** + * @param string $content + * @return ParcelAppendPAV1 + */ + public function withContent($content) + { + $new = clone $this; + $new->content = $content; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData1() + { + return $this->customerData1; + } + + /** + * @param string $customerData1 + * @return ParcelAppendPAV1 + */ + public function withCustomerData1($customerData1) + { + $new = clone $this; + $new->customerData1 = $customerData1; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData2() + { + return $this->customerData2; + } + + /** + * @param string $customerData2 + * @return ParcelAppendPAV1 + */ + public function withCustomerData2($customerData2) + { + $new = clone $this; + $new->customerData2 = $customerData2; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData3() + { + return $this->customerData3; + } + + /** + * @param string $customerData3 + * @return ParcelAppendPAV1 + */ + public function withCustomerData3($customerData3) + { + $new = clone $this; + $new->customerData3 = $customerData3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelAppendPAV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return int + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param int $sizeX + * @return ParcelAppendPAV1 + */ + public function withSizeX($sizeX) + { + $new = clone $this; + $new->sizeX = $sizeX; + + return $new; + } + + /** + * @return int + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param int $sizeY + * @return ParcelAppendPAV1 + */ + public function withSizeY($sizeY) + { + $new = clone $this; + $new->sizeY = $sizeY; + + return $new; + } + + /** + * @return int + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param int $sizeZ + * @return ParcelAppendPAV1 + */ + public function withSizeZ($sizeZ) + { + $new = clone $this; + $new->sizeZ = $sizeZ; + + return $new; + } + + /** + * @return string + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $weight + * @return ParcelAppendPAV1 + */ + public function withWeight($weight) + { + $new = clone $this; + $new->weight = $weight; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelAppendPAV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelAppendPAV2.php new file mode 100644 index 00000000..91a24aee --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelAppendPAV2.php @@ -0,0 +1,282 @@ +content; + } + + /** + * @param string $content + * @return ParcelAppendPAV2 + */ + public function withContent($content) + { + $new = clone $this; + $new->content = $content; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData1() + { + return $this->customerData1; + } + + /** + * @param string $customerData1 + * @return ParcelAppendPAV2 + */ + public function withCustomerData1($customerData1) + { + $new = clone $this; + $new->customerData1 = $customerData1; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData2() + { + return $this->customerData2; + } + + /** + * @param string $customerData2 + * @return ParcelAppendPAV2 + */ + public function withCustomerData2($customerData2) + { + $new = clone $this; + $new->customerData2 = $customerData2; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData3() + { + return $this->customerData3; + } + + /** + * @param string $customerData3 + * @return ParcelAppendPAV2 + */ + public function withCustomerData3($customerData3) + { + $new = clone $this; + $new->customerData3 = $customerData3; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelAppendPAV2 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return int + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param int $sizeX + * @return ParcelAppendPAV2 + */ + public function withSizeX($sizeX) + { + $new = clone $this; + $new->sizeX = $sizeX; + + return $new; + } + + /** + * @return int + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param int $sizeY + * @return ParcelAppendPAV2 + */ + public function withSizeY($sizeY) + { + $new = clone $this; + $new->sizeY = $sizeY; + + return $new; + } + + /** + * @return int + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param int $sizeZ + * @return ParcelAppendPAV2 + */ + public function withSizeZ($sizeZ) + { + $new = clone $this; + $new->sizeZ = $sizeZ; + + return $new; + } + + /** + * @return string + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $weight + * @return ParcelAppendPAV2 + */ + public function withWeight($weight) + { + $new = clone $this; + $new->weight = $weight; + + return $new; + } + + /** + * @return float + */ + public function getWeightAdr() + { + return $this->weightAdr; + } + + /** + * @param float $weightAdr + * @return ParcelAppendPAV2 + */ + public function withWeightAdr($weightAdr) + { + $new = clone $this; + $new->weightAdr = $weightAdr; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDGRV1.php new file mode 100644 index 00000000..50ddd404 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDGRV1.php @@ -0,0 +1,132 @@ +parcelId; + } + + /** + * @param int $parcelId + * @return ParcelDGRV1 + */ + public function withParcelId($parcelId) + { + $new = clone $this; + $new->parcelId = $parcelId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelDGRV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return StatusInfoDGRV1 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param StatusInfoDGRV1 $statusInfo + * @return ParcelDGRV1 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelDGRV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDGRV2.php new file mode 100644 index 00000000..55ea51ff --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDGRV2.php @@ -0,0 +1,132 @@ +parcelId; + } + + /** + * @param int $parcelId + * @return ParcelDGRV2 + */ + public function withParcelId($parcelId) + { + $new = clone $this; + $new->parcelId = $parcelId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelDGRV2 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return StatusInfoDGRV2 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param StatusInfoDGRV2 $statusInfo + * @return ParcelDGRV2 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelDGRV2 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDSPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDSPV1.php new file mode 100644 index 00000000..b0edc936 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDSPV1.php @@ -0,0 +1,107 @@ +parcelId; + } + + /** + * @param int $parcelId + * @return ParcelDSPV1 + */ + public function withParcelId($parcelId) + { + $new = clone $this; + $new->parcelId = $parcelId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelDSPV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelDSPV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDSPV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDSPV2.php new file mode 100644 index 00000000..09673226 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelDSPV2.php @@ -0,0 +1,107 @@ +ParcelId; + } + + /** + * @param int $ParcelId + * @return ParcelDSPV2 + */ + public function withParcelId($ParcelId) + { + $new = clone $this; + $new->ParcelId = $ParcelId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->Reference; + } + + /** + * @param string $Reference + * @return ParcelDSPV2 + */ + public function withReference($Reference) + { + $new = clone $this; + $new->Reference = $Reference; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->Waybill; + } + + /** + * @param string $Waybill + * @return ParcelDSPV2 + */ + public function withWaybill($Waybill) + { + $new = clone $this; + $new->Waybill = $Waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV1.php new file mode 100644 index 00000000..6a1d4473 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV1.php @@ -0,0 +1,257 @@ +reference; + } + + /** + * @param string $reference + * @return ParcelOpenUMLFeV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $weight + * @return ParcelOpenUMLFeV1 + */ + public function withWeight($weight) + { + $new = clone $this; + $new->weight = $weight; + + return $new; + } + + /** + * @return string + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param string $sizeX + * @return ParcelOpenUMLFeV1 + */ + public function withSizeX($sizeX) + { + $new = clone $this; + $new->sizeX = $sizeX; + + return $new; + } + + /** + * @return string + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param string $sizeY + * @return ParcelOpenUMLFeV1 + */ + public function withSizeY($sizeY) + { + $new = clone $this; + $new->sizeY = $sizeY; + + return $new; + } + + /** + * @return string + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param string $sizeZ + * @return ParcelOpenUMLFeV1 + */ + public function withSizeZ($sizeZ) + { + $new = clone $this; + $new->sizeZ = $sizeZ; + + return $new; + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @param string $content + * @return ParcelOpenUMLFeV1 + */ + public function withContent($content) + { + $new = clone $this; + $new->content = $content; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData1() + { + return $this->customerData1; + } + + /** + * @param string $customerData1 + * @return ParcelOpenUMLFeV1 + */ + public function withCustomerData1($customerData1) + { + $new = clone $this; + $new->customerData1 = $customerData1; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData2() + { + return $this->customerData2; + } + + /** + * @param string $customerData2 + * @return ParcelOpenUMLFeV1 + */ + public function withCustomerData2($customerData2) + { + $new = clone $this; + $new->customerData2 = $customerData2; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData3() + { + return $this->customerData3; + } + + /** + * @param string $customerData3 + * @return ParcelOpenUMLFeV1 + */ + public function withCustomerData3($customerData3) + { + $new = clone $this; + $new->customerData3 = $customerData3; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV2.php new file mode 100644 index 00000000..f570c094 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV2.php @@ -0,0 +1,282 @@ +reference; + } + + /** + * @param string $reference + * @return ParcelOpenUMLFeV2 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $weight + * @return ParcelOpenUMLFeV2 + */ + public function withWeight($weight) + { + $new = clone $this; + $new->weight = $weight; + + return $new; + } + + /** + * @return string + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param string $sizeX + * @return ParcelOpenUMLFeV2 + */ + public function withSizeX($sizeX) + { + $new = clone $this; + $new->sizeX = $sizeX; + + return $new; + } + + /** + * @return string + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param string $sizeY + * @return ParcelOpenUMLFeV2 + */ + public function withSizeY($sizeY) + { + $new = clone $this; + $new->sizeY = $sizeY; + + return $new; + } + + /** + * @return string + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param string $sizeZ + * @return ParcelOpenUMLFeV2 + */ + public function withSizeZ($sizeZ) + { + $new = clone $this; + $new->sizeZ = $sizeZ; + + return $new; + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @param string $content + * @return ParcelOpenUMLFeV2 + */ + public function withContent($content) + { + $new = clone $this; + $new->content = $content; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData1() + { + return $this->customerData1; + } + + /** + * @param string $customerData1 + * @return ParcelOpenUMLFeV2 + */ + public function withCustomerData1($customerData1) + { + $new = clone $this; + $new->customerData1 = $customerData1; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData2() + { + return $this->customerData2; + } + + /** + * @param string $customerData2 + * @return ParcelOpenUMLFeV2 + */ + public function withCustomerData2($customerData2) + { + $new = clone $this; + $new->customerData2 = $customerData2; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData3() + { + return $this->customerData3; + } + + /** + * @param string $customerData3 + * @return ParcelOpenUMLFeV2 + */ + public function withCustomerData3($customerData3) + { + $new = clone $this; + $new->customerData3 = $customerData3; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelOpenUMLFeV2 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV3.php new file mode 100644 index 00000000..62834370 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV3.php @@ -0,0 +1,282 @@ +reference; + } + + /** + * @param string $reference + * @return ParcelOpenUMLFeV3 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $weight + * @return ParcelOpenUMLFeV3 + */ + public function withWeight($weight) + { + $new = clone $this; + $new->weight = $weight; + + return $new; + } + + /** + * @return string + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param string $sizeX + * @return ParcelOpenUMLFeV3 + */ + public function withSizeX($sizeX) + { + $new = clone $this; + $new->sizeX = $sizeX; + + return $new; + } + + /** + * @return string + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param string $sizeY + * @return ParcelOpenUMLFeV3 + */ + public function withSizeY($sizeY) + { + $new = clone $this; + $new->sizeY = $sizeY; + + return $new; + } + + /** + * @return string + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param string $sizeZ + * @return ParcelOpenUMLFeV3 + */ + public function withSizeZ($sizeZ) + { + $new = clone $this; + $new->sizeZ = $sizeZ; + + return $new; + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @param string $content + * @return ParcelOpenUMLFeV3 + */ + public function withContent($content) + { + $new = clone $this; + $new->content = $content; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData1() + { + return $this->customerData1; + } + + /** + * @param string $customerData1 + * @return ParcelOpenUMLFeV3 + */ + public function withCustomerData1($customerData1) + { + $new = clone $this; + $new->customerData1 = $customerData1; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData2() + { + return $this->customerData2; + } + + /** + * @param string $customerData2 + * @return ParcelOpenUMLFeV3 + */ + public function withCustomerData2($customerData2) + { + $new = clone $this; + $new->customerData2 = $customerData2; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData3() + { + return $this->customerData3; + } + + /** + * @param string $customerData3 + * @return ParcelOpenUMLFeV3 + */ + public function withCustomerData3($customerData3) + { + $new = clone $this; + $new->customerData3 = $customerData3; + + return $new; + } + + /** + * @return string + */ + public function getWeightAdr() + { + return $this->weightAdr; + } + + /** + * @param string $weightAdr + * @return ParcelOpenUMLFeV3 + */ + public function withWeightAdr($weightAdr) + { + $new = clone $this; + $new->weightAdr = $weightAdr; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV4.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV4.php new file mode 100644 index 00000000..901134c2 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelOpenUMLFeV4.php @@ -0,0 +1,307 @@ +reference; + } + + /** + * @param string $reference + * @return ParcelOpenUMLFeV4 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $weight + * @return ParcelOpenUMLFeV4 + */ + public function withWeight($weight) + { + $new = clone $this; + $new->weight = $weight; + + return $new; + } + + /** + * @return string + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param string $sizeX + * @return ParcelOpenUMLFeV4 + */ + public function withSizeX($sizeX) + { + $new = clone $this; + $new->sizeX = $sizeX; + + return $new; + } + + /** + * @return string + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param string $sizeY + * @return ParcelOpenUMLFeV4 + */ + public function withSizeY($sizeY) + { + $new = clone $this; + $new->sizeY = $sizeY; + + return $new; + } + + /** + * @return string + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param string $sizeZ + * @return ParcelOpenUMLFeV4 + */ + public function withSizeZ($sizeZ) + { + $new = clone $this; + $new->sizeZ = $sizeZ; + + return $new; + } + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @param string $content + * @return ParcelOpenUMLFeV4 + */ + public function withContent($content) + { + $new = clone $this; + $new->content = $content; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData1() + { + return $this->customerData1; + } + + /** + * @param string $customerData1 + * @return ParcelOpenUMLFeV4 + */ + public function withCustomerData1($customerData1) + { + $new = clone $this; + $new->customerData1 = $customerData1; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData2() + { + return $this->customerData2; + } + + /** + * @param string $customerData2 + * @return ParcelOpenUMLFeV4 + */ + public function withCustomerData2($customerData2) + { + $new = clone $this; + $new->customerData2 = $customerData2; + + return $new; + } + + /** + * @return string + */ + public function getCustomerData3() + { + return $this->customerData3; + } + + /** + * @param string $customerData3 + * @return ParcelOpenUMLFeV4 + */ + public function withCustomerData3($customerData3) + { + $new = clone $this; + $new->customerData3 = $customerData3; + + return $new; + } + + /** + * @return string + */ + public function getWeightAdr() + { + return $this->weightAdr; + } + + /** + * @param string $weightAdr + * @return ParcelOpenUMLFeV4 + */ + public function withWeightAdr($weightAdr) + { + $new = clone $this; + $new->weightAdr = $weightAdr; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelOpenUMLFeV4 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelPGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelPGRV1.php new file mode 100644 index 00000000..8ae1b652 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelPGRV1.php @@ -0,0 +1,132 @@ +parcelId; + } + + /** + * @param int $parcelId + * @return ParcelPGRV1 + */ + public function withParcelId($parcelId) + { + $new = clone $this; + $new->parcelId = $parcelId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelPGRV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return ParcelPGRV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelPGRV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelPGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelPGRV2.php new file mode 100644 index 00000000..e33074b7 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelPGRV2.php @@ -0,0 +1,157 @@ +Status; + } + + /** + * @param string $Status + * @return ParcelPGRV2 + */ + public function withStatus($Status) + { + $new = clone $this; + $new->Status = $Status; + + return $new; + } + + /** + * @return int + */ + public function getParcelId() + { + return $this->ParcelId; + } + + /** + * @param int $ParcelId + * @return ParcelPGRV2 + */ + public function withParcelId($ParcelId) + { + $new = clone $this; + $new->ParcelId = $ParcelId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->Reference; + } + + /** + * @param string $Reference + * @return ParcelPGRV2 + */ + public function withReference($Reference) + { + $new = clone $this; + $new->Reference = $Reference; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->Waybill; + } + + /** + * @param string $Waybill + * @return ParcelPGRV2 + */ + public function withWaybill($Waybill) + { + $new = clone $this; + $new->Waybill = $Waybill; + + return $new; + } + + /** + * @return ValidationDetails + */ + public function getValidationDetails() + { + return $this->ValidationDetails; + } + + /** + * @param ValidationDetails $ValidationDetails + * @return ParcelPGRV2 + */ + public function withValidationDetails($ValidationDetails) + { + $new = clone $this; + $new->ValidationDetails = $ValidationDetails; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/Parcels.php b/modules/dpdshipping/src/Api/DpdServices/Type/Parcels.php new file mode 100644 index 00000000..8c1ccd72 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/Parcels.php @@ -0,0 +1,57 @@ +Parcel; + } + + /** + * @param ParcelDSPV2 $Parcel + * @return Parcels + */ + public function withParcel($Parcel) + { + $new = clone $this; + $new->Parcel = $Parcel; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendParcelPAV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendParcelPAV1.php new file mode 100644 index 00000000..a4b1cbaf --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendParcelPAV1.php @@ -0,0 +1,132 @@ +parcelId; + } + + /** + * @param int $parcelId + * @return ParcelsAppendParcelPAV1 + */ + public function withParcelId($parcelId) + { + $new = clone $this; + $new->parcelId = $parcelId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelsAppendParcelPAV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return ParcelsAppendParcelPAV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelsAppendParcelPAV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendResponseV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendResponseV1.php new file mode 100644 index 00000000..8f9caf22 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendResponseV1.php @@ -0,0 +1,107 @@ +invalidFields; + } + + /** + * @param InvalidFieldPAV1 $invalidFields + * @return ParcelsAppendResponseV1 + */ + public function withInvalidFields($invalidFields) + { + $new = clone $this; + $new->invalidFields = $invalidFields; + + return $new; + } + + /** + * @return ParcelsAppendParcelPAV1 + */ + public function getParcels() + { + return $this->parcels; + } + + /** + * @param ParcelsAppendParcelPAV1 $parcels + * @return ParcelsAppendResponseV1 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return ParcelsAppendResponseV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendSearchCriteriaPAV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendSearchCriteriaPAV1.php new file mode 100644 index 00000000..abaa1400 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendSearchCriteriaPAV1.php @@ -0,0 +1,107 @@ +packageId; + } + + /** + * @param int $packageId + * @return ParcelsAppendSearchCriteriaPAV1 + */ + public function withPackageId($packageId) + { + $new = clone $this; + $new->packageId = $packageId; + + return $new; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return ParcelsAppendSearchCriteriaPAV1 + */ + public function withReference($reference) + { + $new = clone $this; + $new->reference = $reference; + + return $new; + } + + /** + * @return string + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param string $waybill + * @return ParcelsAppendSearchCriteriaPAV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendV1.php new file mode 100644 index 00000000..d2614a5c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendV1.php @@ -0,0 +1,82 @@ +packagesearchCriteria; + } + + /** + * @param ParcelsAppendSearchCriteriaPAV1 $packagesearchCriteria + * @return ParcelsAppendV1 + */ + public function withPackagesearchCriteria($packagesearchCriteria) + { + $new = clone $this; + $new->packagesearchCriteria = $packagesearchCriteria; + + return $new; + } + + /** + * @return ParcelAppendPAV1 + */ + public function getParcels() + { + return $this->parcels; + } + + /** + * @param ParcelAppendPAV1 $parcels + * @return ParcelsAppendV1 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendV2.php new file mode 100644 index 00000000..dbcea11a --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ParcelsAppendV2.php @@ -0,0 +1,82 @@ +packagesearchCriteria; + } + + /** + * @param ParcelsAppendSearchCriteriaPAV1 $packagesearchCriteria + * @return ParcelsAppendV2 + */ + public function withPackagesearchCriteria($packagesearchCriteria) + { + $new = clone $this; + $new->packagesearchCriteria = $packagesearchCriteria; + + return $new; + } + + /** + * @return ParcelAppendPAV2 + */ + public function getParcels() + { + return $this->parcels; + } + + /** + * @param ParcelAppendPAV2 $parcels + * @return ParcelsAppendV2 + */ + public function withParcels($parcels) + { + $new = clone $this; + $new->parcels = $parcels; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PickupAddressDSPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PickupAddressDSPV1.php new file mode 100644 index 00000000..d4c9e97f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PickupAddressDSPV1.php @@ -0,0 +1,257 @@ +address; + } + + /** + * @param string $address + * @return PickupAddressDSPV1 + */ + public function withAddress($address) + { + $new = clone $this; + $new->address = $address; + + return $new; + } + + /** + * @return string + */ + public function getCity() + { + return $this->city; + } + + /** + * @param string $city + * @return PickupAddressDSPV1 + */ + public function withCity($city) + { + $new = clone $this; + $new->city = $city; + + return $new; + } + + /** + * @return string + */ + public function getCompany() + { + return $this->company; + } + + /** + * @param string $company + * @return PickupAddressDSPV1 + */ + public function withCompany($company) + { + $new = clone $this; + $new->company = $company; + + return $new; + } + + /** + * @return string + */ + public function getCountryCode() + { + return $this->countryCode; + } + + /** + * @param string $countryCode + * @return PickupAddressDSPV1 + */ + public function withCountryCode($countryCode) + { + $new = clone $this; + $new->countryCode = $countryCode; + + return $new; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + * @return PickupAddressDSPV1 + */ + public function withEmail($email) + { + $new = clone $this; + $new->email = $email; + + return $new; + } + + /** + * @return int + */ + public function getFid() + { + return $this->fid; + } + + /** + * @param int $fid + * @return PickupAddressDSPV1 + */ + public function withFid($fid) + { + $new = clone $this; + $new->fid = $fid; + + return $new; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return PickupAddressDSPV1 + */ + public function withName($name) + { + $new = clone $this; + $new->name = $name; + + return $new; + } + + /** + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @param string $phone + * @return PickupAddressDSPV1 + */ + public function withPhone($phone) + { + $new = clone $this; + $new->phone = $phone; + + return $new; + } + + /** + * @return string + */ + public function getPostalCode() + { + return $this->postalCode; + } + + /** + * @param string $postalCode + * @return PickupAddressDSPV1 + */ + public function withPostalCode($postalCode) + { + $new = clone $this; + $new->postalCode = $postalCode; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PickupAddressDSPV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/PickupAddressDSPV2.php new file mode 100644 index 00000000..26b64f99 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PickupAddressDSPV2.php @@ -0,0 +1,257 @@ +Address; + } + + /** + * @param string $Address + * @return PickupAddressDSPV2 + */ + public function withAddress($Address) + { + $new = clone $this; + $new->Address = $Address; + + return $new; + } + + /** + * @return string + */ + public function getCity() + { + return $this->City; + } + + /** + * @param string $City + * @return PickupAddressDSPV2 + */ + public function withCity($City) + { + $new = clone $this; + $new->City = $City; + + return $new; + } + + /** + * @return string + */ + public function getCompany() + { + return $this->Company; + } + + /** + * @param string $Company + * @return PickupAddressDSPV2 + */ + public function withCompany($Company) + { + $new = clone $this; + $new->Company = $Company; + + return $new; + } + + /** + * @return string + */ + public function getCountryCode() + { + return $this->CountryCode; + } + + /** + * @param string $CountryCode + * @return PickupAddressDSPV2 + */ + public function withCountryCode($CountryCode) + { + $new = clone $this; + $new->CountryCode = $CountryCode; + + return $new; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->Email; + } + + /** + * @param string $Email + * @return PickupAddressDSPV2 + */ + public function withEmail($Email) + { + $new = clone $this; + $new->Email = $Email; + + return $new; + } + + /** + * @return int + */ + public function getFid() + { + return $this->Fid; + } + + /** + * @param int $Fid + * @return PickupAddressDSPV2 + */ + public function withFid($Fid) + { + $new = clone $this; + $new->Fid = $Fid; + + return $new; + } + + /** + * @return string + */ + public function getName() + { + return $this->Name; + } + + /** + * @param string $Name + * @return PickupAddressDSPV2 + */ + public function withName($Name) + { + $new = clone $this; + $new->Name = $Name; + + return $new; + } + + /** + * @return string + */ + public function getPhone() + { + return $this->Phone; + } + + /** + * @param string $Phone + * @return PickupAddressDSPV2 + */ + public function withPhone($Phone) + { + $new = clone $this; + $new->Phone = $Phone; + + return $new; + } + + /** + * @return string + */ + public function getPostalCode() + { + return $this->PostalCode; + } + + /** + * @param string $PostalCode + * @return PickupAddressDSPV2 + */ + public function withPostalCode($PostalCode) + { + $new = clone $this; + $new->PostalCode = $PostalCode; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PickupCallSimplifiedDetailsDPPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PickupCallSimplifiedDetailsDPPV1.php new file mode 100644 index 00000000..a7eb298c --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PickupCallSimplifiedDetailsDPPV1.php @@ -0,0 +1,132 @@ +packagesParams; + } + + /** + * @param PickupPackagesParamsDPPV1 $packagesParams + * @return PickupCallSimplifiedDetailsDPPV1 + */ + public function withPackagesParams($packagesParams) + { + $new = clone $this; + $new->packagesParams = $packagesParams; + + return $new; + } + + /** + * @return PickupCustomerDPPV1 + */ + public function getPickupCustomer() + { + return $this->pickupCustomer; + } + + /** + * @param PickupCustomerDPPV1 $pickupCustomer + * @return PickupCallSimplifiedDetailsDPPV1 + */ + public function withPickupCustomer($pickupCustomer) + { + $new = clone $this; + $new->pickupCustomer = $pickupCustomer; + + return $new; + } + + /** + * @return PickupPayerDPPV1 + */ + public function getPickupPayer() + { + return $this->pickupPayer; + } + + /** + * @param PickupPayerDPPV1 $pickupPayer + * @return PickupCallSimplifiedDetailsDPPV1 + */ + public function withPickupPayer($pickupPayer) + { + $new = clone $this; + $new->pickupPayer = $pickupPayer; + + return $new; + } + + /** + * @return PickupSenderDPPV1 + */ + public function getPickupSender() + { + return $this->pickupSender; + } + + /** + * @param PickupSenderDPPV1 $pickupSender + * @return PickupCallSimplifiedDetailsDPPV1 + */ + public function withPickupSender($pickupSender) + { + $new = clone $this; + $new->pickupSender = $pickupSender; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PickupCustomerDPPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PickupCustomerDPPV1.php new file mode 100644 index 00000000..46a83d00 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PickupCustomerDPPV1.php @@ -0,0 +1,107 @@ +customerFullName; + } + + /** + * @param string $customerFullName + * @return PickupCustomerDPPV1 + */ + public function withCustomerFullName($customerFullName) + { + $new = clone $this; + $new->customerFullName = $customerFullName; + + return $new; + } + + /** + * @return string + */ + public function getCustomerName() + { + return $this->customerName; + } + + /** + * @param string $customerName + * @return PickupCustomerDPPV1 + */ + public function withCustomerName($customerName) + { + $new = clone $this; + $new->customerName = $customerName; + + return $new; + } + + /** + * @return string + */ + public function getCustomerPhone() + { + return $this->customerPhone; + } + + /** + * @param string $customerPhone + * @return PickupCustomerDPPV1 + */ + public function withCustomerPhone($customerPhone) + { + $new = clone $this; + $new->customerPhone = $customerPhone; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PickupPackagesParamsDPPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PickupPackagesParamsDPPV1.php new file mode 100644 index 00000000..af210337 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PickupPackagesParamsDPPV1.php @@ -0,0 +1,382 @@ +dox; + } + + /** + * @param bool $dox + * @return PickupPackagesParamsDPPV1 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return int + */ + public function getDoxCount() + { + return $this->doxCount; + } + + /** + * @param int $doxCount + * @return PickupPackagesParamsDPPV1 + */ + public function withDoxCount($doxCount) + { + $new = clone $this; + $new->doxCount = $doxCount; + + return $new; + } + + /** + * @return bool + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param bool $pallet + * @return PickupPackagesParamsDPPV1 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return float + */ + public function getPalletMaxHeight() + { + return $this->palletMaxHeight; + } + + /** + * @param float $palletMaxHeight + * @return PickupPackagesParamsDPPV1 + */ + public function withPalletMaxHeight($palletMaxHeight) + { + $new = clone $this; + $new->palletMaxHeight = $palletMaxHeight; + + return $new; + } + + /** + * @return float + */ + public function getPalletMaxWeight() + { + return $this->palletMaxWeight; + } + + /** + * @param float $palletMaxWeight + * @return PickupPackagesParamsDPPV1 + */ + public function withPalletMaxWeight($palletMaxWeight) + { + $new = clone $this; + $new->palletMaxWeight = $palletMaxWeight; + + return $new; + } + + /** + * @return int + */ + public function getPalletsCount() + { + return $this->palletsCount; + } + + /** + * @param int $palletsCount + * @return PickupPackagesParamsDPPV1 + */ + public function withPalletsCount($palletsCount) + { + $new = clone $this; + $new->palletsCount = $palletsCount; + + return $new; + } + + /** + * @return float + */ + public function getPalletsWeight() + { + return $this->palletsWeight; + } + + /** + * @param float $palletsWeight + * @return PickupPackagesParamsDPPV1 + */ + public function withPalletsWeight($palletsWeight) + { + $new = clone $this; + $new->palletsWeight = $palletsWeight; + + return $new; + } + + /** + * @return float + */ + public function getParcelMaxDepth() + { + return $this->parcelMaxDepth; + } + + /** + * @param float $parcelMaxDepth + * @return PickupPackagesParamsDPPV1 + */ + public function withParcelMaxDepth($parcelMaxDepth) + { + $new = clone $this; + $new->parcelMaxDepth = $parcelMaxDepth; + + return $new; + } + + /** + * @return float + */ + public function getParcelMaxHeight() + { + return $this->parcelMaxHeight; + } + + /** + * @param float $parcelMaxHeight + * @return PickupPackagesParamsDPPV1 + */ + public function withParcelMaxHeight($parcelMaxHeight) + { + $new = clone $this; + $new->parcelMaxHeight = $parcelMaxHeight; + + return $new; + } + + /** + * @return float + */ + public function getParcelMaxWeight() + { + return $this->parcelMaxWeight; + } + + /** + * @param float $parcelMaxWeight + * @return PickupPackagesParamsDPPV1 + */ + public function withParcelMaxWeight($parcelMaxWeight) + { + $new = clone $this; + $new->parcelMaxWeight = $parcelMaxWeight; + + return $new; + } + + /** + * @return float + */ + public function getParcelMaxWidth() + { + return $this->parcelMaxWidth; + } + + /** + * @param float $parcelMaxWidth + * @return PickupPackagesParamsDPPV1 + */ + public function withParcelMaxWidth($parcelMaxWidth) + { + $new = clone $this; + $new->parcelMaxWidth = $parcelMaxWidth; + + return $new; + } + + /** + * @return int + */ + public function getParcelsCount() + { + return $this->parcelsCount; + } + + /** + * @param int $parcelsCount + * @return PickupPackagesParamsDPPV1 + */ + public function withParcelsCount($parcelsCount) + { + $new = clone $this; + $new->parcelsCount = $parcelsCount; + + return $new; + } + + /** + * @return float + */ + public function getParcelsWeight() + { + return $this->parcelsWeight; + } + + /** + * @param float $parcelsWeight + * @return PickupPackagesParamsDPPV1 + */ + public function withParcelsWeight($parcelsWeight) + { + $new = clone $this; + $new->parcelsWeight = $parcelsWeight; + + return $new; + } + + /** + * @return bool + */ + public function getStandardParcel() + { + return $this->standardParcel; + } + + /** + * @param bool $standardParcel + * @return PickupPackagesParamsDPPV1 + */ + public function withStandardParcel($standardParcel) + { + $new = clone $this; + $new->standardParcel = $standardParcel; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PickupPayerDPPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PickupPayerDPPV1.php new file mode 100644 index 00000000..6bd6d78a --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PickupPayerDPPV1.php @@ -0,0 +1,107 @@ +payerCostCenter; + } + + /** + * @param string $payerCostCenter + * @return PickupPayerDPPV1 + */ + public function withPayerCostCenter($payerCostCenter) + { + $new = clone $this; + $new->payerCostCenter = $payerCostCenter; + + return $new; + } + + /** + * @return string + */ + public function getPayerName() + { + return $this->payerName; + } + + /** + * @param string $payerName + * @return PickupPayerDPPV1 + */ + public function withPayerName($payerName) + { + $new = clone $this; + $new->payerName = $payerName; + + return $new; + } + + /** + * @return int + */ + public function getPayerNumber() + { + return $this->payerNumber; + } + + /** + * @param int $payerNumber + * @return PickupPayerDPPV1 + */ + public function withPayerNumber($payerNumber) + { + $new = clone $this; + $new->payerNumber = $payerNumber; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PickupSenderDPPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PickupSenderDPPV1.php new file mode 100644 index 00000000..57e47981 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PickupSenderDPPV1.php @@ -0,0 +1,182 @@ +senderAddress; + } + + /** + * @param string $senderAddress + * @return PickupSenderDPPV1 + */ + public function withSenderAddress($senderAddress) + { + $new = clone $this; + $new->senderAddress = $senderAddress; + + return $new; + } + + /** + * @return string + */ + public function getSenderCity() + { + return $this->senderCity; + } + + /** + * @param string $senderCity + * @return PickupSenderDPPV1 + */ + public function withSenderCity($senderCity) + { + $new = clone $this; + $new->senderCity = $senderCity; + + return $new; + } + + /** + * @return string + */ + public function getSenderFullName() + { + return $this->senderFullName; + } + + /** + * @param string $senderFullName + * @return PickupSenderDPPV1 + */ + public function withSenderFullName($senderFullName) + { + $new = clone $this; + $new->senderFullName = $senderFullName; + + return $new; + } + + /** + * @return string + */ + public function getSenderName() + { + return $this->senderName; + } + + /** + * @param string $senderName + * @return PickupSenderDPPV1 + */ + public function withSenderName($senderName) + { + $new = clone $this; + $new->senderName = $senderName; + + return $new; + } + + /** + * @return string + */ + public function getSenderPhone() + { + return $this->senderPhone; + } + + /** + * @param string $senderPhone + * @return PickupSenderDPPV1 + */ + public function withSenderPhone($senderPhone) + { + $new = clone $this; + $new->senderPhone = $senderPhone; + + return $new; + } + + /** + * @return string + */ + public function getSenderPostalCode() + { + return $this->senderPostalCode; + } + + /** + * @param string $senderPostalCode + * @return PickupSenderDPPV1 + */ + public function withSenderPostalCode($senderPostalCode) + { + $new = clone $this; + $new->senderPostalCode = $senderPostalCode; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PostalCodeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/PostalCodeV1.php new file mode 100644 index 00000000..bd19b5fa --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PostalCodeV1.php @@ -0,0 +1,82 @@ +countryCode; + } + + /** + * @param string $countryCode + * @return PostalCodeV1 + */ + public function withCountryCode($countryCode) + { + $new = clone $this; + $new->countryCode = $countryCode; + + return $new; + } + + /** + * @return string + */ + public function getZipCode() + { + return $this->zipCode; + } + + /** + * @param string $zipCode + * @return PostalCodeV1 + */ + public function withZipCode($zipCode) + { + $new = clone $this; + $new->zipCode = $zipCode; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolDPPV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolDPPV1.php new file mode 100644 index 00000000..615b6916 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolDPPV1.php @@ -0,0 +1,57 @@ +documentId; + } + + /** + * @param string $documentId + * @return ProtocolDPPV1 + */ + public function withDocumentId($documentId) + { + $new = clone $this; + $new->documentId = $documentId; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolDepot.php b/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolDepot.php new file mode 100644 index 00000000..e3a46d79 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolDepot.php @@ -0,0 +1,57 @@ +Number; + } + + /** + * @param string $Number + * @return ProtocolDepot + */ + public function withNumber($Number) + { + $new = clone $this; + $new->Number = $Number; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolPCRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolPCRV1.php new file mode 100644 index 00000000..2a69234e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ProtocolPCRV1.php @@ -0,0 +1,82 @@ +documentId; + } + + /** + * @param string $documentId + * @return ProtocolPCRV1 + */ + public function withDocumentId($documentId) + { + $new = clone $this; + $new->documentId = $documentId; + + return $new; + } + + /** + * @return StatusInfoPCRV1 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param StatusInfoPCRV1 $statusInfo + * @return ProtocolPCRV1 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/PudoReturnReceiver.php b/modules/dpdshipping/src/Api/DpdServices/Type/PudoReturnReceiver.php new file mode 100644 index 00000000..a5164ecc --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/PudoReturnReceiver.php @@ -0,0 +1,257 @@ +address; + } + + /** + * @param string $address + * @return PudoReturnReceiver + */ + public function withAddress($address) + { + $new = clone $this; + $new->address = $address; + + return $new; + } + + /** + * @return string + */ + public function getCity() + { + return $this->city; + } + + /** + * @param string $city + * @return PudoReturnReceiver + */ + public function withCity($city) + { + $new = clone $this; + $new->city = $city; + + return $new; + } + + /** + * @return string + */ + public function getCompany() + { + return $this->company; + } + + /** + * @param string $company + * @return PudoReturnReceiver + */ + public function withCompany($company) + { + $new = clone $this; + $new->company = $company; + + return $new; + } + + /** + * @return string + */ + public function getCountryCode() + { + return $this->countryCode; + } + + /** + * @param string $countryCode + * @return PudoReturnReceiver + */ + public function withCountryCode($countryCode) + { + $new = clone $this; + $new->countryCode = $countryCode; + + return $new; + } + + /** + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * @param string $email + * @return PudoReturnReceiver + */ + public function withEmail($email) + { + $new = clone $this; + $new->email = $email; + + return $new; + } + + /** + * @return int + */ + public function getFid() + { + return $this->fid; + } + + /** + * @param int $fid + * @return PudoReturnReceiver + */ + public function withFid($fid) + { + $new = clone $this; + $new->fid = $fid; + + return $new; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return PudoReturnReceiver + */ + public function withName($name) + { + $new = clone $this; + $new->name = $name; + + return $new; + } + + /** + * @return string + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @param string $phone + * @return PudoReturnReceiver + */ + public function withPhone($phone) + { + $new = clone $this; + $new->phone = $phone; + + return $new; + } + + /** + * @return string + */ + public function getPostalCode() + { + return $this->postalCode; + } + + /** + * @param string $postalCode + * @return PudoReturnReceiver + */ + public function withPostalCode($postalCode) + { + $new = clone $this; + $new->postalCode = $postalCode; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ReturnedWaybillsV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ReturnedWaybillsV1.php new file mode 100644 index 00000000..608be50a --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ReturnedWaybillsV1.php @@ -0,0 +1,57 @@ +waybill; + } + + /** + * @param string $waybill + * @return ReturnedWaybillsV1 + */ + public function withWaybill($waybill) + { + $new = clone $this; + $new->waybill = $waybill; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/SchemaValidationException.php b/modules/dpdshipping/src/Api/DpdServices/Type/SchemaValidationException.php new file mode 100644 index 00000000..b6056cb1 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/SchemaValidationException.php @@ -0,0 +1,57 @@ +message; + } + + /** + * @param string $message + * @return SchemaValidationException + */ + public function withMessage($message) + { + $new = clone $this; + $new->message = $message; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/SenderPlaceV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/SenderPlaceV1.php new file mode 100644 index 00000000..aa349a03 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/SenderPlaceV1.php @@ -0,0 +1,82 @@ +countryCode; + } + + /** + * @param string $countryCode + * @return SenderPlaceV1 + */ + public function withCountryCode($countryCode) + { + $new = clone $this; + $new->countryCode = $countryCode; + + return $new; + } + + /** + * @return string + */ + public function getZipCode() + { + return $this->zipCode; + } + + /** + * @param string $zipCode + * @return SenderPlaceV1 + */ + public function withZipCode($zipCode) + { + $new = clone $this; + $new->zipCode = $zipCode; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCODDedicatedAccountOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCODDedicatedAccountOpenUMLFeV1.php new file mode 100644 index 00000000..9f98980e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCODDedicatedAccountOpenUMLFeV1.php @@ -0,0 +1,107 @@ +accountNumber; + } + + /** + * @param string $accountNumber + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function withAccountNumber($accountNumber) + { + $new = clone $this; + $new->accountNumber = $accountNumber; + + return $new; + } + + /** + * @return string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * @param string $amount + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function withAmount($amount) + { + $new = clone $this; + $new->amount = $amount; + + return $new; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param string $currency + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function withCurrency($currency) + { + $new = clone $this; + $new->currency = $currency; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCODOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCODOpenUMLFeV1.php new file mode 100644 index 00000000..24120997 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCODOpenUMLFeV1.php @@ -0,0 +1,82 @@ +amount; + } + + /** + * @param string $amount + * @return ServiceCODOpenUMLFeV1 + */ + public function withAmount($amount) + { + $new = clone $this; + $new->amount = $amount; + + return $new; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param string $currency + * @return ServiceCODOpenUMLFeV1 + */ + public function withCurrency($currency) + { + $new = clone $this; + $new->currency = $currency; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCUDOpenUMLeFV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCUDOpenUMLeFV1.php new file mode 100644 index 00000000..42972948 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceCUDOpenUMLeFV1.php @@ -0,0 +1,33 @@ +limitDate; + } + + /** + * @param string $limitDate + * @return ServiceDPDFoodOpenUMLFeV2 + */ + public function withLimitDate($limitDate) + { + $new = clone $this; + $new->limitDate = $limitDate; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDPDLqOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDPDLqOpenUMLFeV1.php new file mode 100644 index 00000000..4ce68cc0 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDPDLqOpenUMLFeV1.php @@ -0,0 +1,33 @@ +amount; + } + + /** + * @param string $amount + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function withAmount($amount) + { + $new = clone $this; + $new->amount = $amount; + + return $new; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param string $currency + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function withCurrency($currency) + { + $new = clone $this; + $new->currency = $currency; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDedicatedDeliveryOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDedicatedDeliveryOpenUMLFeV1.php new file mode 100644 index 00000000..db36c9a1 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDedicatedDeliveryOpenUMLFeV1.php @@ -0,0 +1,33 @@ +pudo; + } + + /** + * @param string $pudo + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function withPudo($pudo) + { + $new = clone $this; + $new->pudo = $pudo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDutyOpenUMLeFV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDutyOpenUMLeFV1.php new file mode 100644 index 00000000..22a60cae --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDutyOpenUMLeFV1.php @@ -0,0 +1,82 @@ +amount; + } + + /** + * @param string $amount + * @return ServiceDutyOpenUMLeFV1 + */ + public function withAmount($amount) + { + $new = clone $this; + $new->amount = $amount; + + return $new; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param string $currency + * @return ServiceDutyOpenUMLeFV1 + */ + public function withCurrency($currency) + { + $new = clone $this; + $new->currency = $currency; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDutyOpenUMLeFV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDutyOpenUMLeFV2.php new file mode 100644 index 00000000..8f358284 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceDutyOpenUMLeFV2.php @@ -0,0 +1,82 @@ +amount; + } + + /** + * @param string $amount + * @return ServiceDutyOpenUMLeFV2 + */ + public function withAmount($amount) + { + $new = clone $this; + $new->amount = $amount; + + return $new; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param string $currency + * @return ServiceDutyOpenUMLeFV2 + */ + public function withCurrency($currency) + { + $new = clone $this; + $new->currency = $currency; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceFlagOpenUMLF.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceFlagOpenUMLF.php new file mode 100644 index 00000000..46e54b60 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceFlagOpenUMLF.php @@ -0,0 +1,33 @@ +type; + } + + /** + * @param string $type + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function withType($type) + { + $new = clone $this; + $new->type = $type; + + return $new; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function withValue($value) + { + $new = clone $this; + $new->value = $value; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceInPersOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceInPersOpenUMLFeV1.php new file mode 100644 index 00000000..c2839ef5 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceInPersOpenUMLFeV1.php @@ -0,0 +1,33 @@ +receiver; + } + + /** + * @param string $receiver + * @return ServiceSelfColOpenUMLFeV1 + */ + public function withReceiver($receiver) + { + $new = clone $this; + $new->receiver = $receiver; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServiceTiresExportOpenUMLFeV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceTiresExportOpenUMLFeV1.php new file mode 100644 index 00000000..b06407e0 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServiceTiresExportOpenUMLFeV1.php @@ -0,0 +1,33 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV11 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV11 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function getCodDedicatedAccount() + { + return $this->codDedicatedAccount; + } + + /** + * @param ServiceCODDedicatedAccountOpenUMLFeV1 $codDedicatedAccount + * @return ServicesOpenUMLFeV11 + */ + public function withCodDedicatedAccount($codDedicatedAccount) + { + $new = clone $this; + $new->codDedicatedAccount = $codDedicatedAccount; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV11 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV11 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV11 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServiceDigitalLabelUMLFeV1 + */ + public function getDigitalLabel() + { + return $this->digitalLabel; + } + + /** + * @param ServiceDigitalLabelUMLFeV1 $digitalLabel + * @return ServicesOpenUMLFeV11 + */ + public function withDigitalLabel($digitalLabel) + { + $new = clone $this; + $new->digitalLabel = $digitalLabel; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDocumentsInternational() + { + return $this->documentsInternational; + } + + /** + * @param ServiceFlagOpenUMLF $documentsInternational + * @return ServicesOpenUMLFeV11 + */ + public function withDocumentsInternational($documentsInternational) + { + $new = clone $this; + $new->documentsInternational = $documentsInternational; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV11 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDpdExpress() + { + return $this->dpdExpress; + } + + /** + * @param ServiceFlagOpenUMLF $dpdExpress + * @return ServicesOpenUMLFeV11 + */ + public function withDpdExpress($dpdExpress) + { + $new = clone $this; + $new->dpdExpress = $dpdExpress; + + return $new; + } + + /** + * @return ServiceDPDFoodOpenUMLFeV2 + */ + public function getDpdFood() + { + return $this->dpdFood; + } + + /** + * @param ServiceDPDFoodOpenUMLFeV2 $dpdFood + * @return ServicesOpenUMLFeV11 + */ + public function withDpdFood($dpdFood) + { + $new = clone $this; + $new->dpdFood = $dpdFood; + + return $new; + } + + /** + * @return ServiceDPDLqOpenUMLFeV1 + */ + public function getDpdLQ() + { + return $this->dpdLQ; + } + + /** + * @param ServiceDPDLqOpenUMLFeV1 $dpdLQ + * @return ServicesOpenUMLFeV11 + */ + public function withDpdLQ($dpdLQ) + { + $new = clone $this; + $new->dpdLQ = $dpdLQ; + + return $new; + } + + /** + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function getDpdPickup() + { + return $this->dpdPickup; + } + + /** + * @param ServiceDpdPickupOpenUMLFeV1 $dpdPickup + * @return ServicesOpenUMLFeV11 + */ + public function withDpdPickup($dpdPickup) + { + $new = clone $this; + $new->dpdPickup = $dpdPickup; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV2 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV2 $duty + * @return ServicesOpenUMLFeV11 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV11 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV11 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV11 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV11 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServicePudoToSendUMLFeV1 + */ + public function getPudoToSend() + { + return $this->pudoToSend; + } + + /** + * @param ServicePudoToSendUMLFeV1 $pudoToSend + * @return ServicesOpenUMLFeV11 + */ + public function withPudoToSend($pudoToSend) + { + $new = clone $this; + $new->pudoToSend = $pudoToSend; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV11 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV11 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV11 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV11 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV2.php new file mode 100644 index 00000000..9500c55e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV2.php @@ -0,0 +1,407 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV2 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV2 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV2 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV2 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV2 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV2 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV1 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV1 $duty + * @return ServicesOpenUMLFeV2 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV2 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV2 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV2 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV2 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV2 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV2 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV2 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV2 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV3.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV3.php new file mode 100644 index 00000000..7054dd11 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV3.php @@ -0,0 +1,432 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV3 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV3 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV3 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV3 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV3 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV3 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function getDpdPickup() + { + return $this->dpdPickup; + } + + /** + * @param ServiceDpdPickupOpenUMLFeV1 $dpdPickup + * @return ServicesOpenUMLFeV3 + */ + public function withDpdPickup($dpdPickup) + { + $new = clone $this; + $new->dpdPickup = $dpdPickup; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV1 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV1 $duty + * @return ServicesOpenUMLFeV3 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV3 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV3 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV3 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV3 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV3 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV3 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV3 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV3 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV4.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV4.php new file mode 100644 index 00000000..45c0c0b5 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV4.php @@ -0,0 +1,482 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV4 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV4 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV4 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV4 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV4 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDocumentsInternational() + { + return $this->documentsInternational; + } + + /** + * @param ServiceFlagOpenUMLF $documentsInternational + * @return ServicesOpenUMLFeV4 + */ + public function withDocumentsInternational($documentsInternational) + { + $new = clone $this; + $new->documentsInternational = $documentsInternational; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV4 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDpdExpress() + { + return $this->dpdExpress; + } + + /** + * @param ServiceFlagOpenUMLF $dpdExpress + * @return ServicesOpenUMLFeV4 + */ + public function withDpdExpress($dpdExpress) + { + $new = clone $this; + $new->dpdExpress = $dpdExpress; + + return $new; + } + + /** + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function getDpdPickup() + { + return $this->dpdPickup; + } + + /** + * @param ServiceDpdPickupOpenUMLFeV1 $dpdPickup + * @return ServicesOpenUMLFeV4 + */ + public function withDpdPickup($dpdPickup) + { + $new = clone $this; + $new->dpdPickup = $dpdPickup; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV2 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV2 $duty + * @return ServicesOpenUMLFeV4 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV4 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV4 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV4 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV4 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV4 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV4 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV4 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV4 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV5.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV5.php new file mode 100644 index 00000000..bd756ea5 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV5.php @@ -0,0 +1,507 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV5 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV5 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function getCodDedicatedAccount() + { + return $this->codDedicatedAccount; + } + + /** + * @param ServiceCODDedicatedAccountOpenUMLFeV1 $codDedicatedAccount + * @return ServicesOpenUMLFeV5 + */ + public function withCodDedicatedAccount($codDedicatedAccount) + { + $new = clone $this; + $new->codDedicatedAccount = $codDedicatedAccount; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV5 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV5 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV5 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDocumentsInternational() + { + return $this->documentsInternational; + } + + /** + * @param ServiceFlagOpenUMLF $documentsInternational + * @return ServicesOpenUMLFeV5 + */ + public function withDocumentsInternational($documentsInternational) + { + $new = clone $this; + $new->documentsInternational = $documentsInternational; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV5 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDpdExpress() + { + return $this->dpdExpress; + } + + /** + * @param ServiceFlagOpenUMLF $dpdExpress + * @return ServicesOpenUMLFeV5 + */ + public function withDpdExpress($dpdExpress) + { + $new = clone $this; + $new->dpdExpress = $dpdExpress; + + return $new; + } + + /** + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function getDpdPickup() + { + return $this->dpdPickup; + } + + /** + * @param ServiceDpdPickupOpenUMLFeV1 $dpdPickup + * @return ServicesOpenUMLFeV5 + */ + public function withDpdPickup($dpdPickup) + { + $new = clone $this; + $new->dpdPickup = $dpdPickup; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV2 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV2 $duty + * @return ServicesOpenUMLFeV5 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV5 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV5 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV5 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV5 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV5 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV5 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV5 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV5 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV6.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV6.php new file mode 100644 index 00000000..b9b3d6a8 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV6.php @@ -0,0 +1,532 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV6 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV6 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function getCodDedicatedAccount() + { + return $this->codDedicatedAccount; + } + + /** + * @param ServiceCODDedicatedAccountOpenUMLFeV1 $codDedicatedAccount + * @return ServicesOpenUMLFeV6 + */ + public function withCodDedicatedAccount($codDedicatedAccount) + { + $new = clone $this; + $new->codDedicatedAccount = $codDedicatedAccount; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV6 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV6 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV6 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDocumentsInternational() + { + return $this->documentsInternational; + } + + /** + * @param ServiceFlagOpenUMLF $documentsInternational + * @return ServicesOpenUMLFeV6 + */ + public function withDocumentsInternational($documentsInternational) + { + $new = clone $this; + $new->documentsInternational = $documentsInternational; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV6 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDpdExpress() + { + return $this->dpdExpress; + } + + /** + * @param ServiceFlagOpenUMLF $dpdExpress + * @return ServicesOpenUMLFeV6 + */ + public function withDpdExpress($dpdExpress) + { + $new = clone $this; + $new->dpdExpress = $dpdExpress; + + return $new; + } + + /** + * @return ServiceDPDFoodOpenUMLFeV1 + */ + public function getDpdFood() + { + return $this->dpdFood; + } + + /** + * @param ServiceDPDFoodOpenUMLFeV1 $dpdFood + * @return ServicesOpenUMLFeV6 + */ + public function withDpdFood($dpdFood) + { + $new = clone $this; + $new->dpdFood = $dpdFood; + + return $new; + } + + /** + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function getDpdPickup() + { + return $this->dpdPickup; + } + + /** + * @param ServiceDpdPickupOpenUMLFeV1 $dpdPickup + * @return ServicesOpenUMLFeV6 + */ + public function withDpdPickup($dpdPickup) + { + $new = clone $this; + $new->dpdPickup = $dpdPickup; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV2 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV2 $duty + * @return ServicesOpenUMLFeV6 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV6 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV6 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV6 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV6 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV6 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV6 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV6 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV6 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV8.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV8.php new file mode 100644 index 00000000..81f96b6e --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV8.php @@ -0,0 +1,582 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV8 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV8 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function getCodDedicatedAccount() + { + return $this->codDedicatedAccount; + } + + /** + * @param ServiceCODDedicatedAccountOpenUMLFeV1 $codDedicatedAccount + * @return ServicesOpenUMLFeV8 + */ + public function withCodDedicatedAccount($codDedicatedAccount) + { + $new = clone $this; + $new->codDedicatedAccount = $codDedicatedAccount; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV8 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV8 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV8 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServiceDigitalLabelUMLFeV1 + */ + public function getDigitalLabel() + { + return $this->digitalLabel; + } + + /** + * @param ServiceDigitalLabelUMLFeV1 $digitalLabel + * @return ServicesOpenUMLFeV8 + */ + public function withDigitalLabel($digitalLabel) + { + $new = clone $this; + $new->digitalLabel = $digitalLabel; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDocumentsInternational() + { + return $this->documentsInternational; + } + + /** + * @param ServiceFlagOpenUMLF $documentsInternational + * @return ServicesOpenUMLFeV8 + */ + public function withDocumentsInternational($documentsInternational) + { + $new = clone $this; + $new->documentsInternational = $documentsInternational; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV8 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDpdExpress() + { + return $this->dpdExpress; + } + + /** + * @param ServiceFlagOpenUMLF $dpdExpress + * @return ServicesOpenUMLFeV8 + */ + public function withDpdExpress($dpdExpress) + { + $new = clone $this; + $new->dpdExpress = $dpdExpress; + + return $new; + } + + /** + * @return ServiceDPDFoodOpenUMLFeV1 + */ + public function getDpdFood() + { + return $this->dpdFood; + } + + /** + * @param ServiceDPDFoodOpenUMLFeV1 $dpdFood + * @return ServicesOpenUMLFeV8 + */ + public function withDpdFood($dpdFood) + { + $new = clone $this; + $new->dpdFood = $dpdFood; + + return $new; + } + + /** + * @return ServiceDPDLqOpenUMLFeV1 + */ + public function getDpdLQ() + { + return $this->dpdLQ; + } + + /** + * @param ServiceDPDLqOpenUMLFeV1 $dpdLQ + * @return ServicesOpenUMLFeV8 + */ + public function withDpdLQ($dpdLQ) + { + $new = clone $this; + $new->dpdLQ = $dpdLQ; + + return $new; + } + + /** + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function getDpdPickup() + { + return $this->dpdPickup; + } + + /** + * @param ServiceDpdPickupOpenUMLFeV1 $dpdPickup + * @return ServicesOpenUMLFeV8 + */ + public function withDpdPickup($dpdPickup) + { + $new = clone $this; + $new->dpdPickup = $dpdPickup; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV2 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV2 $duty + * @return ServicesOpenUMLFeV8 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV8 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV8 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV8 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV8 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV8 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV8 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV8 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV8 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV9.php b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV9.php new file mode 100644 index 00000000..ecc91a77 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ServicesOpenUMLFeV9.php @@ -0,0 +1,582 @@ +carryIn; + } + + /** + * @param ServiceCarryInOpenUMLFeV1 $carryIn + * @return ServicesOpenUMLFeV9 + */ + public function withCarryIn($carryIn) + { + $new = clone $this; + $new->carryIn = $carryIn; + + return $new; + } + + /** + * @return ServiceCODOpenUMLFeV1 + */ + public function getCod() + { + return $this->cod; + } + + /** + * @param ServiceCODOpenUMLFeV1 $cod + * @return ServicesOpenUMLFeV9 + */ + public function withCod($cod) + { + $new = clone $this; + $new->cod = $cod; + + return $new; + } + + /** + * @return ServiceCODDedicatedAccountOpenUMLFeV1 + */ + public function getCodDedicatedAccount() + { + return $this->codDedicatedAccount; + } + + /** + * @param ServiceCODDedicatedAccountOpenUMLFeV1 $codDedicatedAccount + * @return ServicesOpenUMLFeV9 + */ + public function withCodDedicatedAccount($codDedicatedAccount) + { + $new = clone $this; + $new->codDedicatedAccount = $codDedicatedAccount; + + return $new; + } + + /** + * @return ServiceCUDOpenUMLeFV1 + */ + public function getCud() + { + return $this->cud; + } + + /** + * @param ServiceCUDOpenUMLeFV1 $cud + * @return ServicesOpenUMLFeV9 + */ + public function withCud($cud) + { + $new = clone $this; + $new->cud = $cud; + + return $new; + } + + /** + * @return ServiceDeclaredValueOpenUMLFeV1 + */ + public function getDeclaredValue() + { + return $this->declaredValue; + } + + /** + * @param ServiceDeclaredValueOpenUMLFeV1 $declaredValue + * @return ServicesOpenUMLFeV9 + */ + public function withDeclaredValue($declaredValue) + { + $new = clone $this; + $new->declaredValue = $declaredValue; + + return $new; + } + + /** + * @return ServiceDedicatedDeliveryOpenUMLFeV1 + */ + public function getDedicatedDelivery() + { + return $this->dedicatedDelivery; + } + + /** + * @param ServiceDedicatedDeliveryOpenUMLFeV1 $dedicatedDelivery + * @return ServicesOpenUMLFeV9 + */ + public function withDedicatedDelivery($dedicatedDelivery) + { + $new = clone $this; + $new->dedicatedDelivery = $dedicatedDelivery; + + return $new; + } + + /** + * @return ServiceDigitalLabelUMLFeV1 + */ + public function getDigitalLabel() + { + return $this->digitalLabel; + } + + /** + * @param ServiceDigitalLabelUMLFeV1 $digitalLabel + * @return ServicesOpenUMLFeV9 + */ + public function withDigitalLabel($digitalLabel) + { + $new = clone $this; + $new->digitalLabel = $digitalLabel; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDocumentsInternational() + { + return $this->documentsInternational; + } + + /** + * @param ServiceFlagOpenUMLF $documentsInternational + * @return ServicesOpenUMLFeV9 + */ + public function withDocumentsInternational($documentsInternational) + { + $new = clone $this; + $new->documentsInternational = $documentsInternational; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getDox() + { + return $this->dox; + } + + /** + * @param ServicePalletOpenUMLFeV1 $dox + * @return ServicesOpenUMLFeV9 + */ + public function withDox($dox) + { + $new = clone $this; + $new->dox = $dox; + + return $new; + } + + /** + * @return ServiceFlagOpenUMLF + */ + public function getDpdExpress() + { + return $this->dpdExpress; + } + + /** + * @param ServiceFlagOpenUMLF $dpdExpress + * @return ServicesOpenUMLFeV9 + */ + public function withDpdExpress($dpdExpress) + { + $new = clone $this; + $new->dpdExpress = $dpdExpress; + + return $new; + } + + /** + * @return ServiceDPDFoodOpenUMLFeV2 + */ + public function getDpdFood() + { + return $this->dpdFood; + } + + /** + * @param ServiceDPDFoodOpenUMLFeV2 $dpdFood + * @return ServicesOpenUMLFeV9 + */ + public function withDpdFood($dpdFood) + { + $new = clone $this; + $new->dpdFood = $dpdFood; + + return $new; + } + + /** + * @return ServiceDPDLqOpenUMLFeV1 + */ + public function getDpdLQ() + { + return $this->dpdLQ; + } + + /** + * @param ServiceDPDLqOpenUMLFeV1 $dpdLQ + * @return ServicesOpenUMLFeV9 + */ + public function withDpdLQ($dpdLQ) + { + $new = clone $this; + $new->dpdLQ = $dpdLQ; + + return $new; + } + + /** + * @return ServiceDpdPickupOpenUMLFeV1 + */ + public function getDpdPickup() + { + return $this->dpdPickup; + } + + /** + * @param ServiceDpdPickupOpenUMLFeV1 $dpdPickup + * @return ServicesOpenUMLFeV9 + */ + public function withDpdPickup($dpdPickup) + { + $new = clone $this; + $new->dpdPickup = $dpdPickup; + + return $new; + } + + /** + * @return ServiceDutyOpenUMLeFV2 + */ + public function getDuty() + { + return $this->duty; + } + + /** + * @param ServiceDutyOpenUMLeFV2 $duty + * @return ServicesOpenUMLFeV9 + */ + public function withDuty($duty) + { + $new = clone $this; + $new->duty = $duty; + + return $new; + } + + /** + * @return ServiceGuaranteeOpenUMLFeV1 + */ + public function getGuarantee() + { + return $this->guarantee; + } + + /** + * @param ServiceGuaranteeOpenUMLFeV1 $guarantee + * @return ServicesOpenUMLFeV9 + */ + public function withGuarantee($guarantee) + { + $new = clone $this; + $new->guarantee = $guarantee; + + return $new; + } + + /** + * @return ServiceInPersOpenUMLFeV1 + */ + public function getInPers() + { + return $this->inPers; + } + + /** + * @param ServiceInPersOpenUMLFeV1 $inPers + * @return ServicesOpenUMLFeV9 + */ + public function withInPers($inPers) + { + $new = clone $this; + $new->inPers = $inPers; + + return $new; + } + + /** + * @return ServicePalletOpenUMLFeV1 + */ + public function getPallet() + { + return $this->pallet; + } + + /** + * @param ServicePalletOpenUMLFeV1 $pallet + * @return ServicesOpenUMLFeV9 + */ + public function withPallet($pallet) + { + $new = clone $this; + $new->pallet = $pallet; + + return $new; + } + + /** + * @return ServicePrivPersOpenUMLFeV1 + */ + public function getPrivPers() + { + return $this->privPers; + } + + /** + * @param ServicePrivPersOpenUMLFeV1 $privPers + * @return ServicesOpenUMLFeV9 + */ + public function withPrivPers($privPers) + { + $new = clone $this; + $new->privPers = $privPers; + + return $new; + } + + /** + * @return ServiceRODOpenUMLFeV1 + */ + public function getRod() + { + return $this->rod; + } + + /** + * @param ServiceRODOpenUMLFeV1 $rod + * @return ServicesOpenUMLFeV9 + */ + public function withRod($rod) + { + $new = clone $this; + $new->rod = $rod; + + return $new; + } + + /** + * @return ServiceSelfColOpenUMLFeV1 + */ + public function getSelfCol() + { + return $this->selfCol; + } + + /** + * @param ServiceSelfColOpenUMLFeV1 $selfCol + * @return ServicesOpenUMLFeV9 + */ + public function withSelfCol($selfCol) + { + $new = clone $this; + $new->selfCol = $selfCol; + + return $new; + } + + /** + * @return ServiceTiresOpenUMLFeV1 + */ + public function getTires() + { + return $this->tires; + } + + /** + * @param ServiceTiresOpenUMLFeV1 $tires + * @return ServicesOpenUMLFeV9 + */ + public function withTires($tires) + { + $new = clone $this; + $new->tires = $tires; + + return $new; + } + + /** + * @return ServiceTiresExportOpenUMLFeV1 + */ + public function getTiresExport() + { + return $this->tiresExport; + } + + /** + * @param ServiceTiresExportOpenUMLFeV1 $tiresExport + * @return ServicesOpenUMLFeV9 + */ + public function withTiresExport($tiresExport) + { + $new = clone $this; + $new->tiresExport = $tiresExport; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/SessionDGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/SessionDGRV1.php new file mode 100644 index 00000000..705db183 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/SessionDGRV1.php @@ -0,0 +1,107 @@ +packages; + } + + /** + * @param PackageDGRV1 $packages + * @return SessionDGRV1 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * @return SessionDGRV1 + */ + public function withSessionId($sessionId) + { + $new = clone $this; + $new->sessionId = $sessionId; + + return $new; + } + + /** + * @return StatusInfoDGRV1 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param StatusInfoDGRV1 $statusInfo + * @return SessionDGRV1 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/SessionDGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/SessionDGRV2.php new file mode 100644 index 00000000..8953756f --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/SessionDGRV2.php @@ -0,0 +1,47 @@ +packages; + } + + /** + * @param PackageDSPV1 $packages + * @return SessionDSPV1 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * @return SessionDSPV1 + */ + public function withSessionId($sessionId) + { + $new = clone $this; + $new->sessionId = $sessionId; + + return $new; + } + + /** + * @return string + */ + public function getSessionType() + { + return $this->sessionType; + } + + /** + * @param string $sessionType + * @return SessionDSPV1 + */ + public function withSessionType($sessionType) + { + $new = clone $this; + $new->sessionType = $sessionType; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/SessionDSPV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/SessionDSPV2.php new file mode 100644 index 00000000..409dd352 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/SessionDSPV2.php @@ -0,0 +1,82 @@ +Packages; + } + + /** + * @param Packages $Packages + * @return SessionDSPV2 + */ + public function withPackages($Packages) + { + $new = clone $this; + $new->Packages = $Packages; + + return $new; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->SessionId; + } + + /** + * @param int $SessionId + * @return SessionDSPV2 + */ + public function withSessionId($SessionId) + { + $new = clone $this; + $new->SessionId = $SessionId; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/SessionPGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/SessionPGRV1.php new file mode 100644 index 00000000..a21f0d38 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/SessionPGRV1.php @@ -0,0 +1,159 @@ +beginTime; + } + + /** + * @param DateTimeInterface $beginTime + * @return SessionPGRV1 + */ + public function withBeginTime($beginTime) + { + $new = clone $this; + $new->beginTime = $beginTime; + + return $new; + } + + /** + * @return DateTimeInterface + */ + public function getEndTime() + { + return $this->endTime; + } + + /** + * @param DateTimeInterface $endTime + * @return SessionPGRV1 + */ + public function withEndTime($endTime) + { + $new = clone $this; + $new->endTime = $endTime; + + return $new; + } + + /** + * @return PackagePGRV1 + */ + public function getPackages() + { + return $this->packages; + } + + /** + * @param PackagePGRV1 $packages + * @return SessionPGRV1 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * @return SessionPGRV1 + */ + public function withSessionId($sessionId) + { + $new = clone $this; + $new->sessionId = $sessionId; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return SessionPGRV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/SessionPGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/SessionPGRV2.php new file mode 100644 index 00000000..71840d54 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/SessionPGRV2.php @@ -0,0 +1,159 @@ +Status; + } + + /** + * @param string $Status + * @return SessionPGRV2 + */ + public function withStatus($Status) + { + $new = clone $this; + $new->Status = $Status; + + return $new; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->SessionId; + } + + /** + * @param int $SessionId + * @return SessionPGRV2 + */ + public function withSessionId($SessionId) + { + $new = clone $this; + $new->SessionId = $SessionId; + + return $new; + } + + /** + * @return DateTimeInterface + */ + public function getBeginTime() + { + return $this->BeginTime; + } + + /** + * @param DateTimeInterface $BeginTime + * @return SessionPGRV2 + */ + public function withBeginTime($BeginTime) + { + $new = clone $this; + $new->BeginTime = $BeginTime; + + return $new; + } + + /** + * @return DateTimeInterface + */ + public function getEndTime() + { + return $this->EndTime; + } + + /** + * @param DateTimeInterface $EndTime + * @return SessionPGRV2 + */ + public function withEndTime($EndTime) + { + $new = clone $this; + $new->EndTime = $EndTime; + + return $new; + } + + /** + * @return Packages + */ + public function getPackages() + { + return $this->Packages; + } + + /** + * @param Packages $Packages + * @return SessionPGRV2 + */ + public function withPackages($Packages) + { + $new = clone $this; + $new->Packages = $Packages; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationResponseV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationResponseV1.php new file mode 100644 index 00000000..a23bb148 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationResponseV1.php @@ -0,0 +1,107 @@ +documentData; + } + + /** + * @param string $documentData + * @return ShipmentDocumentGenerationResponseV1 + */ + public function withDocumentData($documentData) + { + $new = clone $this; + $new->documentData = $documentData; + + return $new; + } + + /** + * @return string + */ + public function getDocumentId() + { + return $this->documentId; + } + + /** + * @param string $documentId + * @return ShipmentDocumentGenerationResponseV1 + */ + public function withDocumentId($documentId) + { + $new = clone $this; + $new->documentId = $documentId; + + return $new; + } + + /** + * @return ShipmentDocumentGenerationSessionV1 + */ + public function getSession() + { + return $this->session; + } + + /** + * @param ShipmentDocumentGenerationSessionV1 $session + * @return ShipmentDocumentGenerationResponseV1 + */ + public function withSession($session) + { + $new = clone $this; + $new->session = $session; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationSessionV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationSessionV1.php new file mode 100644 index 00000000..00e90187 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationSessionV1.php @@ -0,0 +1,107 @@ +packages; + } + + /** + * @param PackageDGRV1 $packages + * @return ShipmentDocumentGenerationSessionV1 + */ + public function withPackages($packages) + { + $new = clone $this; + $new->packages = $packages; + + return $new; + } + + /** + * @return int + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param int $sessionId + * @return ShipmentDocumentGenerationSessionV1 + */ + public function withSessionId($sessionId) + { + $new = clone $this; + $new->sessionId = $sessionId; + + return $new; + } + + /** + * @return ShipmentDocumentGenerationStatusInfoV1 + */ + public function getStatusInfo() + { + return $this->statusInfo; + } + + /** + * @param ShipmentDocumentGenerationStatusInfoV1 $statusInfo + * @return ShipmentDocumentGenerationSessionV1 + */ + public function withStatusInfo($statusInfo) + { + $new = clone $this; + $new->statusInfo = $statusInfo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationStatusInfoV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationStatusInfoV1.php new file mode 100644 index 00000000..7ba94c61 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ShipmentDocumentGenerationStatusInfoV1.php @@ -0,0 +1,82 @@ +description; + } + + /** + * @param string $description + * @return ShipmentDocumentGenerationStatusInfoV1 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return ShipmentDocumentGenerationStatusInfoV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoDGRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoDGRV1.php new file mode 100644 index 00000000..2c475613 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoDGRV1.php @@ -0,0 +1,82 @@ +description; + } + + /** + * @param string $description + * @return StatusInfoDGRV1 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return StatusInfoDGRV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoDGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoDGRV2.php new file mode 100644 index 00000000..296c85c7 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoDGRV2.php @@ -0,0 +1,82 @@ +Description; + } + + /** + * @param string $Description + * @return StatusInfoDGRV2 + */ + public function withDescription($Description) + { + $new = clone $this; + $new->Description = $Description; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->Status; + } + + /** + * @param string $Status + * @return StatusInfoDGRV2 + */ + public function withStatus($Status) + { + $new = clone $this; + $new->Status = $Status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoPCRV1.php b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoPCRV1.php new file mode 100644 index 00000000..bbb9c9b1 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoPCRV1.php @@ -0,0 +1,82 @@ +description; + } + + /** + * @param string $description + * @return StatusInfoPCRV1 + */ + public function withDescription($description) + { + $new = clone $this; + $new->description = $description; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return StatusInfoPCRV1 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoPCRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoPCRV2.php new file mode 100644 index 00000000..a7b97460 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/StatusInfoPCRV2.php @@ -0,0 +1,82 @@ +errorDetails; + } + + /** + * @param ErrorDetailsPCRV2 $errorDetails + * @return StatusInfoPCRV2 + */ + public function withErrorDetails($errorDetails) + { + $new = clone $this; + $new->errorDetails = $errorDetails; + + return $new; + } + + /** + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * @param string $status + * @return StatusInfoPCRV2 + */ + public function withStatus($status) + { + $new = clone $this; + $new->status = $status; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ValidationDetails.php b/modules/dpdshipping/src/Api/DpdServices/Type/ValidationDetails.php new file mode 100644 index 00000000..d24f9fe2 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ValidationDetails.php @@ -0,0 +1,57 @@ +ValidationInfo; + } + + /** + * @param ValidationInfoPGRV2 $ValidationInfo + * @return ValidationDetails + */ + public function withValidationInfo($ValidationInfo) + { + $new = clone $this; + $new->ValidationInfo = $ValidationInfo; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/ValidationInfoPGRV2.php b/modules/dpdshipping/src/Api/DpdServices/Type/ValidationInfoPGRV2.php new file mode 100644 index 00000000..7a486252 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/ValidationInfoPGRV2.php @@ -0,0 +1,132 @@ +ErrorId; + } + + /** + * @param int $ErrorId + * @return ValidationInfoPGRV2 + */ + public function withErrorId($ErrorId) + { + $new = clone $this; + $new->ErrorId = $ErrorId; + + return $new; + } + + /** + * @return string + */ + public function getErrorCode() + { + return $this->ErrorCode; + } + + /** + * @param string $ErrorCode + * @return ValidationInfoPGRV2 + */ + public function withErrorCode($ErrorCode) + { + $new = clone $this; + $new->ErrorCode = $ErrorCode; + + return $new; + } + + /** + * @return string + */ + public function getFieldNames() + { + return $this->FieldNames; + } + + /** + * @param string $FieldNames + * @return ValidationInfoPGRV2 + */ + public function withFieldNames($FieldNames) + { + $new = clone $this; + $new->FieldNames = $FieldNames; + + return $new; + } + + /** + * @return string + */ + public function getInfo() + { + return $this->Info; + } + + /** + * @param string $Info + * @return ValidationInfoPGRV2 + */ + public function withInfo($Info) + { + $new = clone $this; + $new->Info = $Info; + + return $new; + } +} diff --git a/modules/dpdshipping/src/Api/DpdServices/Type/index.php b/modules/dpdshipping/src/Api/DpdServices/Type/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Api/DpdServices/Type/index.php @@ -0,0 +1,33 @@ +commandBus = $commandBus; + $this->quoteGridFactory = $quoteGridFactory; + $this->textFormDataHandler = $textFormDataHandler; + $this->translator = $translator; + } + + public function list(Request $request, AddressFilters $filters): Response + { + $quoteGrid = $this->quoteGridFactory->getGrid($filters); + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/address-list-form.html.twig', [ + 'enableSidebar' => true, + 'layoutTitle' => $this->translator->trans('Shipping history', [], 'Modules.Dpdshipping.Admin'), + 'quoteGrid' => $this->presentGrid($quoteGrid), + 'shopContext' => Shop::getContext() + ]); + } + + public function edit(Request $request): Response + { + $textForm = $this->textFormDataHandler->getForm(); + $textForm->handleRequest($request); + + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $this->textFormDataHandler->save($textForm->getData()); + + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + + return $this->redirectToRoute('dpdshipping_address_form'); + } + + $this->flashErrors($errors); + } + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/address-form.html.twig', [ + 'form' => $textForm->createView(), + 'enableSidebar' => true, + 'layoutTitle' => $this->translator->trans('Shipping history', [], 'Modules.Dpdshipping.Admin'), + 'addressId' => $request->get('addressId'), + 'shopContext' => Shop::getContext() + ]); + } + + public function delete(Request $request): Response + { + $deleteSenderAddress = $this->commandBus->handle(new DeleteSenderAddressCommand($request->get('senderAddressId'))); + if ($deleteSenderAddress) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + } + + return $this->redirectToRoute('dpdshipping_address_form'); + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/DpdShippingCarrierController.php b/modules/dpdshipping/src/Controller/Configuration/DpdShippingCarrierController.php new file mode 100644 index 00000000..7c8a867c --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/DpdShippingCarrierController.php @@ -0,0 +1,80 @@ +queryBus = $queryBus; + $this->textFormDataHandler = $textFormDataHandler; + $this->translator = $translator; + } + + public function index(Request $request): Response + { + $textForm = $this->textFormDataHandler->getForm(); + $textForm->handleRequest($request); + + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $this->textFormDataHandler->save($textForm->getData()); + + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + + return $this->redirectToRoute('dpdshipping_carrier_form'); + } + + $this->flashErrors($errors); + } + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/carrier-form.html.twig', [ + 'form' => $textForm->createView(), + 'dpdCarrierSwipBox' => $this->queryBus->handle(new GetCarrierList(Config::DPD_SWIP_BOX)), + 'dpdCarrierPickup' => $this->queryBus->handle(new GetCarrierList(Config::DPD_PICKUP)), + 'dpdCarrierPickupCod' => $this->queryBus->handle(new GetCarrierList(Config::DPD_PICKUP_COD)), + 'dpdCarrier' => $this->queryBus->handle(new GetCarrierList(Config::DPD_STANDARD)), + 'dpdCarrierCod' => $this->queryBus->handle(new GetCarrierList(Config::DPD_STANDARD_COD)), + 'shopContext' => Shop::getContext() + ]); + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/DpdShippingConfigurationController.php b/modules/dpdshipping/src/Controller/Configuration/DpdShippingConfigurationController.php new file mode 100644 index 00000000..0692f9d9 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/DpdShippingConfigurationController.php @@ -0,0 +1,89 @@ +queryBus = $queryBus; + $this->textFormDataHandler = $textFormDataHandler; + $this->translator = $translator; + } + + public function index(Request $request): Response + { + $form = $this->textFormDataHandler->getForm(); + $form->add('empikDpdApiForStoreDelivery', ChoiceType::class, [ + 'choices' => $this->getChoices(), + 'choice_loader' => null, + 'label' => $this->translator->trans('API account for Empik Store delivery', [], 'Modules.Dpdshipping.AdminConfiguration'), + 'choice_translation_domain' => false, + 'placeholder' => '---', + 'required' => false + ]); + $form->handleRequest($request); + if ($form->isSubmitted() && $form->isValid()) { + $errors = $this->textFormDataHandler->save($form->getData()); + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + return $this->redirectToRoute('dpdshipping_configuration_form'); + } + $this->flashErrors($errors); + } + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/configuration-form.html.twig', [ + 'form' => $form->createView(), + 'shopContext' => Shop::getContext(), + ]); + } + + public function getChoices(): array + { + $connections = $this->queryBus->handle(new GetConnectionList(Shop::getContextListShopID())); + + $choices = []; + foreach ($connections as $connection) { + $choices[$connection->getName() . ', MASTERFID: ' . $connection->getMasterFid()] = (string)$connection->getId(); + } + return $choices; + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/DpdShippingConnectionController.php b/modules/dpdshipping/src/Controller/Configuration/DpdShippingConnectionController.php new file mode 100644 index 00000000..c58c583f --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/DpdShippingConnectionController.php @@ -0,0 +1,103 @@ +commandBus = $commandBus; + $this->quoteGridFactory = $quoteGridFactory; + $this->textFormDataHandler = $textFormDataHandler; + $this->translator = $translator; + } + + public function list(Request $request, ConnectionFilters $filters): Response + { + $quoteGrid = $this->quoteGridFactory->getGrid($filters); + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/connection-list-form.html.twig', [ + 'enableSidebar' => true, + 'layoutTitle' => $this->translator->trans('Shipping history', [], 'Modules.Dpdshipping.Admin'), + 'quoteGrid' => $this->presentGrid($quoteGrid), + 'shopContext' => Shop::getContext() + ]); + } + + public function edit(Request $request): Response + { + $textForm = $this->textFormDataHandler->getForm(); + $textForm->handleRequest($request); + + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $this->textFormDataHandler->save($textForm->getData()); + + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + + return $this->redirectToRoute('dpdshipping_connection_form'); + } + + $this->flashErrors($errors); + } + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/connection-form.html.twig', [ + 'form' => $textForm->createView(), + 'enableSidebar' => true, + 'layoutTitle' => $this->translator->trans('DPD Poland API Connections', [], 'Modules.Dpdshipping.Admin'), + 'connectionId' => $request->get('connectionId'), + 'shopContext' => Shop::getContext(), + 'idShop' => Shop::getContextListShopID() + ]); + } + + public function delete(Request $request): Response + { + $deleteSenderConnection = $this->commandBus->handle(new DeleteConnectionCommand($request->get('connectionId'))); + if ($deleteSenderConnection) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + } + + return $this->redirectToRoute('dpdshipping_connection_form'); + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/DpdShippingOnboardingController.php b/modules/dpdshipping/src/Controller/Configuration/DpdShippingOnboardingController.php new file mode 100644 index 00000000..58135b11 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/DpdShippingOnboardingController.php @@ -0,0 +1,71 @@ +textFormDataHandler = $textFormDataHandler; + $this->translator = $translator; + } + + public function index(Request $request): Response + { + $textForm = $this->textFormDataHandler->getForm(); + $textForm->handleRequest($request); + + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $this->textFormDataHandler->save($textForm->getData()); + + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + + return $this->redirectToRoute('dpdshipping_connection_form'); + } + + $this->flashErrors($errors); + } + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/onboarding-form.html.twig', [ + 'form' => $textForm->createView(), + 'shopContext' => Shop::getContext() + ]); + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/DpdShippingParameterController.php b/modules/dpdshipping/src/Controller/Configuration/DpdShippingParameterController.php new file mode 100644 index 00000000..70d63586 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/DpdShippingParameterController.php @@ -0,0 +1,71 @@ +textFormDataHandler = $textFormDataHandler; + $this->translator = $translator; + } + + public function index(Request $request): Response + { + $textForm = $this->textFormDataHandler->getForm(); + $textForm->handleRequest($request); + + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $this->textFormDataHandler->save($textForm->getData()); + + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + + return $this->redirectToRoute('dpdshipping_parameters_form'); + } + + $this->flashErrors($errors); + } + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/parameters-form.html.twig', [ + 'form' => $textForm->createView(), + 'shopContext' => Shop::getContext() + ]); + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/DpdShippingPickupCourierSettingsController.php b/modules/dpdshipping/src/Controller/Configuration/DpdShippingPickupCourierSettingsController.php new file mode 100644 index 00000000..e0446b09 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/DpdShippingPickupCourierSettingsController.php @@ -0,0 +1,100 @@ +commandBus = $commandBus; + $this->quoteGridFactory = $quoteGridFactory; + $this->textFormDataHandler = $textFormDataHandler; + $this->translator = $translator; + } + + public function list(Request $request, PickupCourierSettingsFilter $filters): Response + { + $quoteGrid = $this->quoteGridFactory->getGrid($filters); + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/pickup-order-settings-list-form.html.twig', [ + 'enableSidebar' => true, + 'layoutTitle' => $this->translator->trans('Pickup order settings', [], 'Modules.Dpdshipping.Admin'), + 'quoteGrid' => $this->presentGrid($quoteGrid), + 'shopContext' => Shop::getContext() + ]); + } + + public function index(Request $request): Response + { + $textForm = $this->textFormDataHandler->getForm(); + $textForm->handleRequest($request); + + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $this->textFormDataHandler->save($textForm->getData()); + + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + + return $this->redirectToRoute('dpdshipping_pickup_courier_settings_list_form'); + } + + $this->flashErrors($errors); + } + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/pickup-courier-settings-form.html.twig', [ + 'form' => $textForm->createView(), + 'pickupCourierId' => $request->get('pickupCourierId'), + 'shopContext' => Shop::getContext() + ]); + } + + public function delete(Request $request): Response + { + $deleteSenderAddress = $this->commandBus->handle(new DeletePickupOrderSettingsAddressCommand($request->get('pickupCourierId'))); + if ($deleteSenderAddress) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + } + + return $this->redirectToRoute('dpdshipping_pickup_courier_settings_list_form'); + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/DpdShippingSpecialPriceController.php b/modules/dpdshipping/src/Controller/Configuration/DpdShippingSpecialPriceController.php new file mode 100644 index 00000000..04b0f3c5 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/DpdShippingSpecialPriceController.php @@ -0,0 +1,175 @@ +textFormDataHandler = $textFormDataHandler; + $this->router = $router; + $this->translator = $translator; + } + + public function index(Request $request): Response + { + $textForm = $this->textFormDataHandler->getForm(); + $textForm->handleRequest($request); + + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $this->textFormDataHandler->save($textForm->getData()); + + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + + return $this->redirectToRoute('dpdshipping_special_price_form'); + } + + $this->flashErrors($errors); + } + + Media::addJsDef([ + 'dpdshipping_special_price_export_ajax_url' => $this->router->generate('dpdshipping_special_price_export_action'), + 'dpdshipping_special_price_import_ajax_url' => $this->router->generate('dpdshipping_special_price_import_action'), + 'dpdshipping_token' => sha1(_COOKIE_KEY_ . 'dpdshipping') + ]); + + return $this->render('@Modules/dpdshipping/views/templates/admin/configuration/special-price-form.html.twig', [ + 'form' => $textForm->createView(), + 'shopContext' => Shop::getContext() + ]); + } + + public function exportAction(Request $request): Response + { + if (!ValidateUserUtil::validateEmployeeSessionDpdShippingToken($request)) + return new JsonResponse(['success' => false, 'data' => 'INVALID TOKEN']); + + $specialPriceList = $this->getQueryBus()->handle(new GetSpecialPriceList()); + $list = []; + foreach ($specialPriceList as $item) { + $array = []; + $array['isoCountry'] = $item->getIsoCountry(); + $array['priceFrom'] = $item->getPriceFrom(); + $array['priceTo'] = $item->getPriceTo(); + $array['weightFrom'] = $item->getWeightFrom(); + $array['weightTo'] = $item->getWeightTo(); + $array['parcelPrice'] = $item->getParcelPrice(); + $array['carrierType'] = $item->getCarrierType(); + $array['codPrice'] = $item->getCodPrice(); + + $list[] = $array; + } + + $csvData = "isoCountry;priceFrom;priceTo;weightFrom;weightTo;parcelPrice;carrierType;codPrice\n"; + foreach ($list as $row) { + $csvData .= implode(';', $row) . "\n"; + } + + $response = new Response($csvData); + $response->headers->set('Content-Type', 'text/csv'); + $response->headers->set('Content-Disposition', 'attachment;filename="export-dpd-ceny-specjalne-prestashop.csv"'); + + return $response; + } + + + public function importAction(Request $request): JsonResponse + { + if (!ValidateUserUtil::validateEmployeeSessionDpdShippingToken($request)) + return new JsonResponse(['success' => false, 'data' => 'INVALID TOKEN']); + + $file = $request->files->get('csvFile'); + + if ($file && $file->isValid()) { + $csvData = file($file->getRealPath()); + $array = []; + foreach ($csvData as $index => $line) { + if ($index === 0) continue; + + $columns = str_getcsv($line, ';'); + + $specialPriceRow = [ + 'isoCountry' => $columns[0] ?? null, + 'priceFrom' => (float)($columns[1] ?? 0), + 'priceTo' => (float)($columns[2] ?? 0), + 'weightFrom' => (float)($columns[3] ?? 0), + 'weightTo' => (float)($columns[4] ?? 0), + 'parcelPrice' => (float)($columns[5] ?? 0), + 'carrierType' => $this->getCarrierType($columns[6] ?? null), + 'codPrice' => (float)($columns[7] ?? 0), + ]; + $array[] = $specialPriceRow; + } + + foreach (Shop::getContextListShopID() as $idShop) { + $this->getCommandBus()->handle(new AddSpecialPriceCommand($array, $idShop)); + } + + $this->addFlash('success', $this->trans('Successful update.', 'Admin.Notifications.Success')); + + return new JsonResponse(['success' => true]); + + } + return new JsonResponse(['success' => false]); + } + + private function getCarrierType($param) + { + if ($param == "1" || $param == "3") + return Config::DPD_STANDARD; + if ($param == "2") + return Config::DPD_STANDARD_COD; + if ($param == "4") + return Config::DPD_PICKUP; + if ($param == "5") + return Config::DPD_PICKUP_COD; + if ($param == "6") + return Config::DPD_SWIP_BOX; + + return $param; + } +} diff --git a/modules/dpdshipping/src/Controller/Configuration/index.php b/modules/dpdshipping/src/Controller/Configuration/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Configuration/index.php @@ -0,0 +1,33 @@ +commandBus = $commandBus; + $this->translator = $translator; + $this->formDataProvider = $formDataProvider; + $this->shippingHistoryController = $shippingHistoryController; + } + + public function index(Request $request) + { + list($successCount, $ids) = $this->generateShippingList($request); + + $this->addFlash( + 'success', + $this->translator->trans( + 'The shipment has been generated success: %successCount% errors: %errors%', + [ + '%successCount%' => $successCount, + '%errors%' => count($ids) - $successCount, + ], + 'Admin.Notifications.Success' + ) + ); + + return $this->redirectToRoute('admin_orders_index'); + } + + /** + * @param Request $request + * @return array + */ + public function generateShippingList(Request $request): array + { + $successCount = 0; + $successIds = []; + $ids = $request->get('order_orders_bulk'); + foreach ($ids as $orderId) { + $order = new Order($orderId); + $dpdCarrier = $this->commandBus->handle(new GetOrderCarrier($order)); + if (!$dpdCarrier) { + continue; + } + $orderData = $this->formDataProvider->getData($orderId); + + + $payerList = $this->commandBus->handle(new GetPayerList(true, $order->id_shop, null)); + + $parcels = [ + 'weight' => '1', + 'weightAdr' => '', + 'content' => '', + 'customerData' => '', + 'sizeX' => '', + 'sizeY' => '', + 'sizeZ' => '', + ]; + + $orderData['payer_number'] = !empty($payerList) ? $payerList[0]->getFid() : null; + $orderData['packages'] = [$parcels]; + + if ($this->isCodPayment($order)) { + $currency_from = new Currency($order->id_currency); + $orderData['service_cod'] = '1'; + $orderData['service_cod_value'] = $order->total_paid_tax_incl; + $orderData['service_cod_currency'] = $currency_from->iso_code; + } + + if (DpdShippingGenerateShippingController::isPickup($dpdCarrier)) { + $orderData['service_dpd_pickup'] = '1'; + $orderData['service_dpd_pickup_value'] = $this->commandBus->handle(new GetOrderPudoCode($order->id_shop, $order->id_cart)); + } + + $generateShippingResult = $this->commandBus->handle(new AddDpdOrderCommand($orderId, $orderData, $dpdCarrier, $order->id_shop, null)); + + if (empty($generateShippingResult['errors'])) { + $successCount = $successCount + 1; + $successIds[] = $orderId; + } + } + + return [$successCount, $ids, $successIds]; + } + + public function isCodPayment($order): bool + { + $paymentMethodsCod = $this->commandBus->handle(new GetConfiguration(Configuration::DPD_COD_PAYMENT_METHODS)); + + return GetCodPaymentModulesHandler::isCodPaymentMethod($paymentMethodsCod, $order->module); + } + + public function generateShippingAndPrintLabels(Request $request) + { + list($successCount, $ids, $successIds) = $this->generateShippingList($request); + + $this->shippingHistoryController->setContainer($this->container); + return $this->shippingHistoryController->printLabelActionAjax(new Request(['order_orders_bulk' => $successIds])); + } +} diff --git a/modules/dpdshipping/src/Controller/Order/DpdShippingGenerateShippingController.php b/modules/dpdshipping/src/Controller/Order/DpdShippingGenerateShippingController.php new file mode 100644 index 00000000..240f3ff4 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Order/DpdShippingGenerateShippingController.php @@ -0,0 +1,311 @@ +textFormDataHandler = $textFormDataHandler; + $this->commandBus = $commandBus; + $this->twig = $twig; + $this->translator = $translator; + } + + public function index($params, Request $request = null) + { + $successMsg = ''; + $errors = []; + + if ($request == null) { + $request = Request::createFromGlobals(); + $orderId = $params['id_order']; + } else { + $orderId = (int)$request->get('orderId'); + } + + $order = new Order($orderId); + + $dpdCarrier = $this->commandBus->handle(new GetOrderCarrier($order)); + + $opts = $this->buildDpdFormOptions($order->id_shop); + $dpdCarrierType = isset($dpdCarrier['dpd_carrier']) ? $dpdCarrier['dpd_carrier']->getType() : ''; + + $orderSource = $this->commandBus->handle(new GetOrderSource($orderId, $order->id_shop)); + + $textForm = $this->textFormDataHandler->getFormFor($orderId, [], [ + 'api_connection_list' => $opts['api_connection_list'], + 'payer_number_list' => $opts['payer_number_list'], + 'default_connection_id' => $opts['default_connection_id'], + 'default_payer_by_conn' => $opts['default_payer_by_conn'], + 'dpd_carrier' => $dpdCarrierType, + 'is_dpd_carrier' => !empty($dpdCarrierType) && substr($dpdCarrierType, 0, 3) === "DPD", + 'dpdPudoFinderUrl' => Config::PICKUP_MAP_BASE_URL, + 'order_currency' => (new Currency($order->id_currency))->iso_code, + 'order_amount' => $order->total_paid_tax_incl, + 'order_pickup_number' => $this->getOrderPickupNumber($orderSource, $orderId, $order), + ]); + + if ($request != null) { + $textForm->handleRequest($request); + } + + if ($textForm->isSubmitted() && $textForm->isValid()) { + + $idConnection = $textForm->getData()['connection_id'] ?? null; + $generateShippingResult = $this->commandBus->handle(new AddDpdOrderCommand($orderId, $textForm->getData(), $dpdCarrier, $order->id_shop, $idConnection)); + + if (empty($generateShippingResult['errors'])) { + $successMsg = $this->translator->trans('The shipment has been generated: %waybills%', ['%waybills%' => $this->getWaybills($generateShippingResult)], 'Admin.Notifications.Success'); + + return $this->twig->render('@Modules/dpdshipping/views/templates/admin/order/generate-shipping-success.html.twig', [ + 'form' => [], + 'successMsg' => $successMsg, + 'errorMsg' => '', + 'isShippingGenerated' => true, + 'showReturnLabel' => $this->isReturnLabel($textForm->getData()), + 'orderId' => $orderId, + 'shippingHistoryId' => $this->getShippingHistoryId($generateShippingResult), + ]); + } else { + $errors = $generateShippingResult['errors']; + } + } + + $result = [ + 'form' => $textForm->createView(), + 'successMsg' => $successMsg, + 'errors' => empty($errors) ? [] : $errors, + 'products' => $this->getProducts($order->getOrderDetailList()), + 'receiver_address_list' => $this->commandBus->handle(new GetReceiverAddressList($order, true)), + 'sender_address_list' => $this->commandBus->handle(new GetOrderSenderAddressList($order->id_shop)), + 'dpd_carrier' => $dpdCarrier['carrier'] ?? '', + 'is_dpd_carrier' => !empty($dpdCarrierType) && substr($dpdCarrierType, 0, 3) === "DPD", + 'dpdPudoFinderUrl' => Config::PICKUP_MAP_BASE_URL, + 'package_group_type' => $this->getValue($this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PACKAGE_GROUPING_WAY, $order->id_shop)), 'single'), + 'is_cod_payment' => $this->isCodPayment($this->commandBus, $order), + 'payment_method' => $this->getPaymentMethodDisplayName($order->module), + 'order_source' => $orderSource, + 'content_source' => $this->getValue($this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_CONTENT, $order->id_shop)), ''), + 'content_source_static' => $this->getValue($this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_CONTENT_STATIC_VALUE, $order->id_shop)), ''), + 'customer_source' => $this->getValue($this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_CUSTOMER_DATA, $order->id_shop)), ''), + 'customer_source_static' => $this->getValue($this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_CUSTOMER_DATA_STATIC_VALUE, $order->id_shop)), ''), + 'order_reference' => $order->reference, + 'order_reference_empik' => $this->commandBus->handle(new GetEmpikOrderReference($order->id, $order->id_shop)), + 'order_id' => $orderId, + 'invoice_number' => $order->invoice_number, + 'default_weight' => $this->getValue($this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_WEIGHT, $order->id_shop)), '0') + ]; + + return $this->twig->render('@Modules/dpdshipping/views/templates/admin/order/generate-shipping.html.twig', $result); + } + + + private function getWaybills($generateShippingResult) + { + $waybills = ''; + foreach ($generateShippingResult as $item) { + $waybills .= implode(', ', $item['waybills']) . ', '; + } + + return rtrim($waybills, ', '); + } + + public static function isPickup($dpdCarrier) + { + if (!isset($dpdCarrier['dpd_carrier'])) { + return false; + } + + return $dpdCarrier['dpd_carrier']->getType() == Config::DPD_PICKUP + || $dpdCarrier['dpd_carrier']->getType() == Config::DPD_PICKUP_COD + || $dpdCarrier['dpd_carrier']->getType() == Config::DPD_SWIP_BOX; + } + + public function isCodPayment($commandBus, Order $order): bool + { + $paymentMethodsCod = $commandBus->handle(new GetConfiguration(Configuration::DPD_COD_PAYMENT_METHODS, $order->id_shop)); + + return GetCodPaymentModulesHandler::isCodPaymentMethod($paymentMethodsCod, $order->module); + } + + private function getPaymentMethodDisplayName($module) + { + if ($module == null) { + return ''; + } + $module = Module::getInstanceByName($module); + + if (!Validate::isLoadedObject($module)) { + return ''; + } + + return $module->displayName; + } + + private function isReturnLabel($form): bool + { + return isset($form['service_return_label']) && $form['service_return_label'] == '1'; + } + + /** + * @param $generateShippingResult + * @return mixed + */ + public function getShippingHistoryId($generateShippingResult) + { + if (is_array($generateShippingResult) && isset($generateShippingResult[0]['shippingHistoryList'][0])) { + return $generateShippingResult[0]['shippingHistoryList'][0]->getId(); + } + + return null; + } + + private function buildDpdFormOptions($idShop): array + { + $connectionConfig = $this->commandBus->handle(new GetConnectionList($idShop)); + $payerList = $this->commandBus->handle(new GetPayerList(true, $idShop, null)); + + $apiConnectionList = []; + $defaultConnectionId = null; + + foreach ($connectionConfig as $c) { + $label = $c->getName() . ", MASTERFID: " . $c->getMasterfid(); + $apiConnectionList[$label] = $c->getId(); + + if ($defaultConnectionId === null && $c->isDefault()) { + $defaultConnectionId = $c->getId(); + } + } + if ($defaultConnectionId === null && !empty($connectionConfig)) { + $defaultConnectionId = $connectionConfig[0]->getId(); + } + + $payerNumberList = []; + $defaultPayerByConn = []; + + foreach ($payerList as $p) { + $connId = (int)$p->getIdConnection(); + if (!isset($payerNumberList[$connId])) { + $payerNumberList[$connId] = []; + } + + $label = $p->getName() . ", FID: " . $p->getFid(); + $payerNumberList[$connId][$label] = $p->getFid(); + + if (!isset($defaultPayerByConn[$connId]) && $p->isDefault()) { + $defaultPayerByConn[$connId] = $p->getFid(); + } + } + + foreach ($payerNumberList as $connId => $choices) { + if (!isset($defaultPayerByConn[$connId])) { + $firstId = reset($choices); // first value (payerId) + if ($firstId !== false) { + $defaultPayerByConn[$connId] = $firstId; + } + } + } + + return [ + 'api_connection_list' => $apiConnectionList, + 'payer_number_list' => $payerNumberList, + 'default_connection_id' => $defaultConnectionId, + 'default_payer_by_conn' => $defaultPayerByConn, + ]; + } + + /** + * @param array $orderDetails + * @return array + */ + public function getProducts(array $orderDetails): array + { + $products = []; + foreach ($orderDetails as $orderDetail) { + $products[] = [ + 'product_id' => $orderDetail['product_id'], + 'product_name' => $orderDetail['product_name'], + 'product_quantity' => $orderDetail['product_quantity'], + 'product_weight' => $orderDetail['product_weight'], + 'product_reference' => $orderDetail['product_reference'], + ]; + } + return $products; + } + + public function getValue($contentSource, $defaultValue): string + { + return $contentSource != null ? $contentSource->getValue() : $defaultValue; + } + + /** + * @param $orderSource + * @param int $orderId + * @param Order $order + * @return mixed + */ + public function getOrderPickupNumber($orderSource, int $orderId, Order $order) + { + $dpdPickupNumber = $this->commandBus->handle(new GetOrderPudoCode($order->id_shop, $order->id_cart)); + if (empty($dpdPickupNumber) && in_array($orderSource, [GetOrderSourceHandler::DELIVERY_EMPIK_STORE, GetOrderSourceHandler::EMPIK])) { + return $this->commandBus->handle(new GetEmpikPickupNumber($orderId, $order->id_shop)); + } + return $dpdPickupNumber; + } +} diff --git a/modules/dpdshipping/src/Controller/Order/DpdShippingReturnLabelController.php b/modules/dpdshipping/src/Controller/Order/DpdShippingReturnLabelController.php new file mode 100644 index 00000000..0b0cb45d --- /dev/null +++ b/modules/dpdshipping/src/Controller/Order/DpdShippingReturnLabelController.php @@ -0,0 +1,94 @@ +commandBus = $commandBus; + $this->twig = $twig; + $this->translator = $translator; + } + + public function index(Request $request): Response + { + $orderId = (int) $request->get('orderId'); + $shippingHistoryId = (int) $request->get('shippingHistoryId'); + + $shipping = $this->commandBus->handle(new GetShipping($shippingHistoryId)); + + $returnLabel = $this->commandBus->handle(new ReturnLabelCommand( + $orderId, + $shipping['parcel']->getWaybill(), + $shipping['shipping']->getIdShop(), + $shipping['shipping']->getIdConnection() ?? null, + $shippingHistoryId, + $shipping['services']->getReturnLabelCompany(), + $shipping['services']->getReturnLabelName(), + $shipping['services']->getReturnLabelStreet(), + $shipping['services']->getReturnLabelPostalcode(), + $shipping['services']->getReturnLabelCity(), + $shipping['services']->getReturnLabelCountryCode(), + $shipping['services']->getReturnLabelEmail(), + $shipping['services']->getReturnLabelPhone() + )); + + if ($returnLabel['status'] == 'OK') { + $fileName = 'return-label-' . sprintf('%04d', rand(0, 1000)) . '-' . date('Y-m-d-H-i-s'); + $fileContent = $returnLabel['data']->documentData ?? "error"; + $response = new Response($fileContent); + $response->headers->set('Content-Type', 'application/pdf'); + $response->headers->set('Content-Disposition', ResponseHeaderBag::DISPOSITION_ATTACHMENT . "; filename=\"$fileName\""); + $response->headers->set('Content-Length', strlen($fileContent)); + + return $response; + } + + return new JsonResponse( + ['status' => 'ERROR', 'message' => implode(' ', $returnLabel['data'])], + 400, + ['Content-Type' => 'application/json'] + ); + } +} diff --git a/modules/dpdshipping/src/Controller/Order/DpdShippingTrackingController.php b/modules/dpdshipping/src/Controller/Order/DpdShippingTrackingController.php new file mode 100644 index 00000000..4a0449b4 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Order/DpdShippingTrackingController.php @@ -0,0 +1,66 @@ +trackingService = $trackingService; + $this->queryBus = $queryBus; + $this->twig = $twig; + $this->translator = $translator; + } + + public function index(Request $request) + { + $checkTrackingOrderView = $this->queryBus->handle(new GetConfiguration(Configuration::CHECK_TRACKING_ORDER_VIEW)); + + if ($checkTrackingOrderView != null && $checkTrackingOrderView->getValue() != '1') { + return $this->translator->trans('To enable tracking for shipments, please visit the DPD Poland configuration page.', [], 'Modules.Dpdshipping.AdminOrder'); + } + + return $this->twig->render('@Modules/dpdshipping/views/templates/admin/order/tracking.html.twig', [ + 'shippingHistory' => $this->trackingService->getTrackingInformation($request->get('orderId')), + ]); + } +} diff --git a/modules/dpdshipping/src/Controller/Order/index.php b/modules/dpdshipping/src/Controller/Order/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Controller/Order/index.php @@ -0,0 +1,33 @@ +queryBus = $queryBus; + $this->commandBus = $commandBus; + $this->quoteGridFactory = $quoteGridFactory; + $this->translator = $translator; + $this->responseBuilder = $responseBuilder; + $this->pickupCourierGridDefinitionFactory = $pickupCourierGridDefinitionFactory; + $this->pickupCourierEditFormDataHandler = $pickupCourierEditFormDataHandler; + } + + public function index(PickupCourierFilters $filters) + { + $quoteGrid = $this->quoteGridFactory->getGrid($filters); + $gridData = $quoteGrid->getData(); + $records = $gridData->getRecords(); + $modifiedRecords = []; + $today = new DateTime(); + $today->setTime(0, 0, 0); + foreach ($records as $record) { + $pickupDate = DateTime::createFromFormat('d-m-Y', $record['pickup_date']); + if ($record['state'] !== 'CANCELLED' && $today > $pickupDate) + $record['state'] = $this->translator->trans('Completed', [], 'Modules.Dpdshipping.PickupCourierGrid'); + else if ($record['state'] === 'CANCELLED') + $record['state'] = $this->translator->trans('Canceled', [], 'Modules.Dpdshipping.PickupCourierGrid'); + else if ($record['state'] === 'OK') + $record['state'] = $this->translator->trans('Ordered', [], 'Modules.Dpdshipping.PickupCourierGrid'); + + $modifiedRecords[] = $record; + } + + $newRecordCollection = new RecordCollection($modifiedRecords); + + $newGridData = new GridData($newRecordCollection, $gridData->getRecordsTotal(), $gridData->getQuery()); + + $quoteGridReflection = new ReflectionClass($quoteGrid); + $dataProperty = $quoteGridReflection->getProperty('data'); + $dataProperty->setAccessible(true); + $dataProperty->setValue($quoteGrid, $newGridData); + + return $this->render( + '@Modules/dpdshipping/views/templates/admin/pickupCourier/pickup-courier-form.html.twig', + [ + 'enableSidebar' => true, + 'layoutTitle' => $this->translator->trans('Shipping history', [], 'Modules.Dpdshipping.Admin'), + 'quoteGrid' => $this->presentGrid($quoteGrid), + 'shopContext' => Shop::getContext() + ] + ); + } + + public function edit(Request $request) + { + $textFormDataHandler = $this->pickupCourierEditFormDataHandler; + $textForm = $textFormDataHandler->getForm(); + $textForm->handleRequest($request); + if ($textForm->isSubmitted() && $textForm->isValid()) { + $errors = $textFormDataHandler->save($textForm->getData()); + if (empty($errors)) { + $this->addFlash('success', $this->translator->trans('Successful update.', [], 'Admin.Notifications.Success')); + return $this->redirectToRoute('dpdshipping_pickup_courier_form'); + } + $this->flashErrors($errors); + } + return $this->render('@Modules/dpdshipping/views/templates/admin/pickupCourier/pickup-courier-edit-form.html.twig', [ + 'form' => $textForm->createView(), + 'shopContext' => Shop::getContext() + ]); + } + + public function searchAction(Request $request) + { + return $this->responseBuilder->buildSearchResponse( + $this->pickupCourierGridDefinitionFactory, + $request, + PickupCourierGridDefinitionFactory::GRID_ID, + 'dpdshipping_pickup_courier_form' + ); + } + + public function getPickupCourierSettingsAjax(Request $request): JsonResponse + { + if (!ValidateUserUtil::validateEmployeeSession($request)) + return new JsonResponse(['success' => false, 'data' => 'INVALID TOKEN']); + + $pickupCourierId = $request->get('pickupOrderSettingsId'); + if ($pickupCourierId == null) + return new JsonResponse(['success' => false]); + + $pickupCourier = $this->queryBus->handle(new GetPickupCourierSettingsList(false, $pickupCourierId)); + + return new JsonResponse(['success' => true, 'data' => [ + 'pickupCourierId' => $pickupCourierId, + 'customerFullName' => $pickupCourier->getCustomerFullName(), + 'customerName' => $pickupCourier->getCustomerName(), + 'customerPhone' => $pickupCourier->getCustomerPhone(), + 'payerNumber' => $pickupCourier->getPayerNumber(), + 'senderAddress' => $pickupCourier->getSenderAddress(), + 'senderCity' => $pickupCourier->getSenderCity(), + 'senderFullName' => $pickupCourier->getSenderFullName(), + 'senderName' => $pickupCourier->getSenderName(), + 'senderPhone' => $pickupCourier->getSenderPhone(), + 'senderPostalCode' => $pickupCourier->getSenderPostalCode(), + 'senderCountryCode' => $pickupCourier->getSenderCountryCode(), + ]]); + } + + public function pickupCourierAjax(Request $request): JsonResponse + { + if (!ValidateUserUtil::validateEmployeeSession($request)) + return new JsonResponse(['success' => false, 'data' => 'INVALID TOKEN']); + + $pickupCourierId = $request->get('pickupOrderSettingsId'); + if ($pickupCourierId == null) + return new JsonResponse(['success' => false]); + + $pickupCourier = $this->commandBus->handle(new AddPickupCourierCommand($request, (int)Context::getContext()->shop->id)); + + if ($pickupCourier['success']) { + $this->addFlash('success', $this->trans('Successful update.', 'Admin.Notifications.Success')); + } + + return new JsonResponse($pickupCourier); + } + + public function deletePickupCourier(Request $request) + { + $pickupCourierId = $request->get('pickupOrderId'); + if ($pickupCourierId == null) { + $this->flashErrors([$this->trans('It is not possible to cancel the collection of a courier shipment', 'Modules.Dpdshipping.Admin')]); + return $this->redirectToRoute('dpdshipping_pickup_courier_form'); + } + + $pickupCourier = $this->commandBus->handle(new CancelPickupCourierCommand($pickupCourierId, (int)Context::getContext()->shop->id)); + + if ($pickupCourier['success']) { + $this->addFlash('success', $this->trans('Successful update.', 'Admin.Notifications.Success')); + } else { + if (!empty($pickupCourier['errors'])) + $this->flashErrors($pickupCourier['errors']); + } + + return $this->redirectToRoute('dpdshipping_pickup_courier_form'); + } + + public function getPickupCourierTimeFramesAjax(Request $request): JsonResponse + { + if (!ValidateUserUtil::validateEmployeeSession($request)) + return new JsonResponse(['success' => false, 'data' => 'INVALID TOKEN']); + + $pickupCourierId = $request->get('pickupOrderSettingsId'); + $countryCode = $request->get('countryCode'); + $postalCode = $request->get('postalCode'); + if ($pickupCourierId == null) + return new JsonResponse(['success' => false]); + + $countryIsoCode = $this->queryBus->handle(new GetCountryIsoCode($countryCode)); + $senderPlace = (new SenderPlaceV1()) + ->withCountryCode($countryIsoCode) + ->withZipCode(str_replace('-', '', $postalCode)); + + $result = $this->queryBus->handle(new GetCourierOrderAvailability($senderPlace, (int)Context::getContext()->shop->id)); + + + return new JsonResponse($result); + } + +} diff --git a/modules/dpdshipping/src/Controller/PickupCourier/index.php b/modules/dpdshipping/src/Controller/PickupCourier/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Controller/PickupCourier/index.php @@ -0,0 +1,33 @@ +redirect('https://tracktrace.dpd.com.pl/parcelDetails?typ=1&p1=' . $shippingNumber); + } +} diff --git a/modules/dpdshipping/src/Controller/ShippingHistory/DpdShippingShippingHistoryController.php b/modules/dpdshipping/src/Controller/ShippingHistory/DpdShippingShippingHistoryController.php new file mode 100644 index 00000000..568a67bd --- /dev/null +++ b/modules/dpdshipping/src/Controller/ShippingHistory/DpdShippingShippingHistoryController.php @@ -0,0 +1,209 @@ +commandBus = $commandBus; + $this->queryBus = $queryBus; + $this->twig = $twig; + $this->translator = $translator; + $this->gridFactory = $gridFactory; + } + + private function renderCompat(string $template, array $params = []): Response + { + if ($this->container && $this->container->has('prestashop.core.twig.template_renderer')) { + $renderer = $this->container->get('prestashop.core.twig.template_renderer'); + $content = $renderer->render($template, $params); + + return new Response($content); + } + if ($this->container && $this->container->has('twig')) { + return parent::render($template, $params); + } + + if ($this->twig instanceof \Twig\Environment) { + $content = $this->twig->render($template, $params); + + return new Response($content); + } + + throw new \LogicException('TwigBundle and renderer not available'); + } + + public function index(ShippingHistoryFilters $filters): Response + { + $quoteGrid = $this->gridFactory->getGrid($filters); + return $this->renderCompat( + '@Modules/dpdshipping/views/templates/admin/shippingHistory/shipping-history-form.html.twig', + [ + 'enableSidebar' => true, + 'layoutTitle' => $this->translator->trans('Shipping history', [], 'Modules.Dpdshipping.Admin'), + 'quoteGrid' => $this->presentGrid($quoteGrid), + ] + ); + } + + public function searchAction(Request $request) + { + $responseBuilder = $this->get('prestashop.bundle.grid.response_builder'); + return $responseBuilder->buildSearchResponse( + $this->get('dpdshipping.grid.definition.factory.shipping.history'), + $request, + ShippingHistoryGridDefinitionFactory::GRID_ID, + 'dpdshipping_shipping_history_form' + ); + } + + public function printLabelActionAjax(Request $request) + { + $sourcePage = 'dpdshipping_shipping_history_form'; + $ids = $request->get('dpdshipping_shipping_history_bulk') ?? [$request->get('shippingHistoryId')]; + if (empty($ids) || $ids[0] == null) { + $ids = $this->getShippingIdsFromOrderBulk($request, $ids); + $sourcePage = 'admin_orders_index'; + } + $labels = $this->commandBus->handle(new GetLabel($ids)); + if (!empty($labels)) { + if (count($labels) > 1) { + return $this->getZip($labels, 'label'); + } else { + return $this->getPdf($labels[0], 'label'); + } + } else { + $errors = [$this->translator->trans('Unable to generate labels', [], 'Modules.Dpdshipping.Admin')]; + $this->flashErrors($errors); + } + return $this->redirectToRoute($sourcePage); + } + + public function printProtocolActionAjax(Request $request) + { + $ids = $request->get('dpdshipping_shipping_history_bulk') ?? [$request->get('shippingHistoryId')]; + $protocols = $this->queryBus->handle(new GetProtocol($ids)); + if ($protocols['status'] == 'OK') { + if (count($protocols['data']) > 1) { + return $this->getZip($protocols['data'], 'protocol'); + } else { + return $this->getPdf($protocols['data'][0], 'protocol'); + } + } else { + $errors = [$this->translator->trans('Unable to generate protocols', [], 'Modules.Dpdshipping.Admin')]; + $this->flashErrors($errors); + } + return $this->redirectToRoute('dpdshipping_shipping_history_form'); + } + + public function deleteAction(Request $request) + { + $ids = $request->get('dpdshipping_shipping_history_bulk') ?? [$request->get('shippingHistoryId')]; + $deleteShipping = $this->commandBus->handle(new DeleteShipping($ids)); + if ($deleteShipping) { + $this->addFlash('success', $this->translator->trans('Success', [], 'Modules.Dpdshipping.Admin')); + } else { + $errors = [$this->translator->trans('Unable to delete shipping', [], 'Modules.Dpdshipping.Admin')]; + $this->flashErrors($errors); + } + return $this->redirectToRoute('dpdshipping_shipping_history_form'); + } + + public function getZip($data, $documentType) + { + $zip = new ZipArchive(); + $zipFileName = $documentType . 's-' . sprintf('%04d', rand(0, 1000)) . '-' . date('Y-m-d-H-i-s') . '.zip'; + if ($zip->open($zipFileName, ZipArchive::CREATE) === true) { + foreach ($data as $index => $response) { + $filename = $documentType . '-' . sprintf('%04d', rand(0, 1000)) . '-' . date('Y-m-d-H-i-s') . '.pdf'; + $pdfData = $response->documentData; + $zip->addFromString($filename, $pdfData); + } + $zip->close(); + $zipContent = Tools::file_get_contents($zipFileName); + $response = new Response($zipContent); + $response->headers->set('Content-Type', 'application/zip'); + $response->headers->set('Content-Disposition', ResponseHeaderBag::DISPOSITION_ATTACHMENT . "; filename=\"$zipFileName\""); + $response->headers->set('Content-Length', (string) strlen($zipContent)); + unlink($zipFileName); + return $response; + } else { + $errors = [$this->translator->trans('Unable to generate protocols', [], 'Modules.Dpdshipping.Admin')]; + $this->flashErrors($errors); + return $this->redirectToRoute('dpdshipping_shipping_history_form'); + } + } + + public function getShippingIdsFromOrderBulk(Request $request, array $ids): array + { + $ids = []; + foreach ($request->get('order_orders_bulk') as $key => $id) { + $shippingIds = $this->queryBus->handle(new GetShippingByOrderId($id)); + if (isset($shippingIds['shipping'])) { + $ids[] = $shippingIds['shipping']->getId(); + } + } + return $ids; + } + + public function getPdf($protocols, $documentType): Response + { + $fileName = $documentType . '-' . sprintf('%04d', rand(0, 1000)) . '-' . date('Y-m-d-H-i-s') . '.pdf'; + $fileContent = $protocols->documentData; + $response = new Response($fileContent); + $response->headers->set('Content-Type', 'application/pdf'); + $response->headers->set('Content-Disposition', ResponseHeaderBag::DISPOSITION_ATTACHMENT . "; filename=\"$fileName\""); + $response->headers->set('Content-Length', (string) strlen($fileContent)); + + return $response; + } +} diff --git a/modules/dpdshipping/src/Controller/ShippingHistory/DpdShippingShippingHistoryDetailController.php b/modules/dpdshipping/src/Controller/ShippingHistory/DpdShippingShippingHistoryDetailController.php new file mode 100644 index 00000000..4d59b979 --- /dev/null +++ b/modules/dpdshipping/src/Controller/ShippingHistory/DpdShippingShippingHistoryDetailController.php @@ -0,0 +1,57 @@ +translator = $translator; + } + + public function index(ShippingHistoryFilters $filters) + { + return $this->render( + '@Modules/dpdshipping/views/templates/admin/shippingHistory/shipping-history-detail-form.html.twig', + [ + 'layoutTitle' => $this->translator->trans('Shipping history', [], 'Modules.Dpdshipping.Admin'), + 'orderId' => \Tools::getValue('orderId'), + 'shopContext' => Shop::getContext() + ] + ); + } +} diff --git a/modules/dpdshipping/src/Controller/ShippingHistory/index.php b/modules/dpdshipping/src/Controller/ShippingHistory/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Controller/ShippingHistory/index.php @@ -0,0 +1,33 @@ +name = $name; + $this->moduleName = $moduleName; + $this->type = $type; + $this->active = $active; + $this->carrier = $carrier; + $this->idShop = $idShop; + } + + public function getName() + { + return $this->name; + } + + public function getModuleName() + { + return $this->moduleName; + } + + public function getType() + { + return $this->type; + } + + public function getActive() + { + return $this->active; + } + + public function getCarrier() + { + return $this->carrier; + } + + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierHandler.php new file mode 100644 index 00000000..d69b0bf9 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierHandler.php @@ -0,0 +1,190 @@ +repository = $repository; + } + + public function handle(AddCarrierCommand $command): bool + { + if (!$command->getActive() && $command->getCarrier() != null) { + return $this->deleteCarrier($command); + } else { + return $this->addCarrier($command); + } + } + + private function deleteCarrier(AddCarrierCommand $command): bool + { + $current = $this->repository->findOneBy(['idCarrier' => $command->getCarrier()->id, 'active' => true]); + + if (isset($current)) { + $carrier = new Carrier($current->getIdCarrier()); + $carrier->deleted = true; + + if (!$carrier->save()) { + return false; + } + + return $this->repository->setInactive($current->getId()); + } + + return true; + } + + private function addCarrier(AddCarrierCommand $command): bool + { + $carrier = new Carrier(); + $carrier->name = $command->getName(); + $carrier->active = 1; + $carrier->deleted = 0; + $carrier->is_free = 0; + $carrier->shipping_handling = 1; + $carrier->shipping_external = 1; + $carrier->shipping_method = 1; + $carrier->max_width = 0; + $carrier->max_height = 0; + $carrier->max_depth = 0; + $carrier->max_weight = 0; + $carrier->grade = 0; + $carrier->is_module = 1; + $carrier->need_range = 1; + $carrier->range_behavior = 1; + $carrier->external_module_name = $command->getModuleName(); + $delay = []; + + foreach (Language::getLanguages(false) as $language) { + $delay[$language['id_lang']] = $command->getName(); + } + + $carrier->delay = $delay; + $carrier->url = Config::DPD_TRACKING_URL; + $originalIdShop = Context::getContext()->shop->id; + $originalContext = Shop::getContext(); + + if (Shop::isFeatureActive() && $originalContext !== Shop::CONTEXT_SHOP) { + Shop::setContext(Shop::CONTEXT_SHOP, $command->getIdShop()); + + if (!$carrier->add()) { + return false; + } + Shop::setContext($originalContext, $originalIdShop); + + } else { + if (!$carrier->add()) { + return false; + } + } + + if (!$this->copyLogo((int)$carrier->id, $command->getType())) { + return false; + } + + $zones = Zone::getZones(); + foreach ($zones as $zone) { + $carrier->addZone((int)$zone['id_zone']); + } + + if (!$range_obj = $carrier->getRangeObject()) { + return false; + } + + $range_obj->id_carrier = (int)$carrier->id; + $range_obj->delimiter1 = 0; + $range_obj->delimiter2 = 1; + + if (!$range_obj->add()) { + return false; + } + + if (!$this->assignCustomerGroupsForCarrier($carrier)) { + return false; + } + + + $this->repository->add($carrier->id, $command->getType(), $carrier->active, $command->getIdShop()); + + if (!DpdCarrierPrestashopConfiguration::setConfig($command->getType(), $carrier->id, $command->getIdShop())) { + return false; + } + + return (int)$carrier->id; + } + + protected static function assignCustomerGroupsForCarrier($carrier): bool + { + $groups = []; + + foreach (Group::getGroups(Context::getContext()->language->id) as $group) { + $groups[] = $group['id_group']; + } + + if (!$carrier->setGroups($groups)) { + return false; + } + + return true; + } + + private function copyLogo(int $carrierId, $type): bool + { + $image = ''; + + if ($type == Config::DPD_STANDARD || $type == Config::DPD_STANDARD_COD) { + $image = '/dpdshipping/views/img/dpd_carrier_logo.png'; + } elseif ($type == Config::DPD_PICKUP || $type == Config::DPD_PICKUP_COD || $type == Config::DPD_SWIP_BOX) { + $image = '/dpdshipping/views/img/dpd_carrier_pickup_logo.png'; + } + + if (!copy(_PS_MODULE_DIR_ . $image, _PS_SHIP_IMG_DIR_ . '/' . $carrierId . '.jpg')) { + return false; + } + + return true; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierPickupCommand.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierPickupCommand.php new file mode 100644 index 00000000..c9f188d3 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierPickupCommand.php @@ -0,0 +1,67 @@ +dpdCarrierId = $dpdCarrierId; + $this->name = $name; + $this->value = $value; + } + + /** + * @return mixed + */ + public function getDpdCarrierId() + { + return $this->dpdCarrierId; + } + + /** + * @return mixed + */ + public function getName() + { + return $this->name; + } + + /** + * @return mixed + */ + public function getValue() + { + return $this->value; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierPickupHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierPickupHandler.php new file mode 100644 index 00000000..acdd303b --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/AddCarrierPickupHandler.php @@ -0,0 +1,49 @@ +repository = $repository; + } + + public function handle(AddCarrierPickupCommand $command): bool + { + return $this->repository->save($command); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/UpdateCarrierActionCommand.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/UpdateCarrierActionCommand.php new file mode 100644 index 00000000..94f10538 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/UpdateCarrierActionCommand.php @@ -0,0 +1,68 @@ +id_carrier = $param['id_carrier']; + } + + if (isset($param['carrier'])) { + $this->newCarrier = $param['carrier']; + } + } + + /** + * @return mixed + */ + public function getNewCarrier() + { + return $this->newCarrier; + } + + /** + * @return mixed + */ + public function getIdCarrier() + { + return $this->id_carrier; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/UpdateCarrierActionHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/UpdateCarrierActionHandler.php new file mode 100644 index 00000000..aa17c120 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/UpdateCarrierActionHandler.php @@ -0,0 +1,55 @@ +repository = $repository; + } + + public function handle(UpdateCarrierActionCommand $command) + { + if ($command->getIdCarrier() == null || $command->getNewCarrier() == null) { + return; + } + + if ($command->getIdCarrier() != $command->getNewCarrier()->id) { + $this->repository->joinCarrier($command->getIdCarrier(), $command->getNewCarrier()->id); + } + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Command/index.php @@ -0,0 +1,33 @@ +commandBus = $commandBus; + $this->queryBus = $queryBus; + } + + public function handleCarrier($carrierType, $carrierName, $dpdSettingsCarrierActive, $idShop) + { + $carrier = $this->queryBus->handle(new GetCarrier($carrierType, $idShop)); + if ($this->needSaveCarrier($carrier, $dpdSettingsCarrierActive)) { + return $this->commandBus->handle(new AddCarrierCommand($carrierName, 'dpdshipping', $carrierType, $dpdSettingsCarrierActive, $carrier, $idShop)); + } + + return true; + } + + /** + * @param $carrier + * @param $dpdCarrierActive + * @return bool + */ + public static function needSaveCarrier($carrier, $dpdCarrierActive): bool + { + if ($carrier === false && $dpdCarrierActive) { + return true; + } + + if ($carrier && !$carrier->active && !$dpdCarrierActive) { + return true; + } + + return $carrier && $carrier->active && !$dpdCarrierActive; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/DpdCarrierPrestashopConfiguration.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/DpdCarrierPrestashopConfiguration.php new file mode 100644 index 00000000..39e428e5 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/DpdCarrierPrestashopConfiguration.php @@ -0,0 +1,66 @@ +id_country); + } catch (Exception $e) { + PrestaShopLogger::addLog('DPDSHIPPING: cannot get country ISO for cart. Set default PL'); + $countryIso = Config::PL_CONST; + } + + $config = DpdCarrierPrestashopConfiguration::getConfig($key); + if (!empty($config)) + return $config . '&query=' . $countryIso; + return $baseUrl . '&query=' . $countryIso; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetAvailableCarrier.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetAvailableCarrier.php new file mode 100644 index 00000000..f17cf13a --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetAvailableCarrier.php @@ -0,0 +1,36 @@ +repository = $repository; + } + + public function handle(GetAvailableCarrier $query) + { + $result = []; + $carrierList = $this->repository->findBy(['active' => 1, 'idShop' => (int)Context::getContext()->shop->id]); + + if (empty($carrierList)) { + return []; + } + + foreach ($carrierList as $carrier) { + $carrierId = $carrier->getIdCarrier(); + + $result[$carrier->getType()] = $carrierId; + } + + return $result; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrier.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrier.php new file mode 100644 index 00000000..40f29cbc --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrier.php @@ -0,0 +1,58 @@ +type = $name; + $this->idShop = $idShop; + } + + public function getType(): string + { + return $this->type; + } + + public function getIdShop(): string + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierHandler.php new file mode 100644 index 00000000..a94903c7 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierHandler.php @@ -0,0 +1,69 @@ +repository = $repository; + } + + public function handle(GetCarrier $query) + { + $carrier = $this->repository->findOneBy(['type' => $query->getType(), 'active' => true, 'idShop' => $query->getIdShop()]); + + if (!isset($carrier)) { + return false; + } + $carrierId = $carrier->getIdCarrier(); + $carrierP = new Carrier($carrierId); + + if ($carrierP->deleted) { + return false; + } + + return (object)[ + 'id' => $carrierP->id, + 'name' => $carrierP->name, + 'active' => $carrierP->active, + 'idShop' => $carrier->getIdShop() + ]; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierList.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierList.php new file mode 100644 index 00000000..5b81b5f4 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierList.php @@ -0,0 +1,47 @@ +type = $name; + } + + public function getType(): string + { + return $this->type; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierListHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierListHandler.php new file mode 100644 index 00000000..2337fd93 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierListHandler.php @@ -0,0 +1,59 @@ +repository = $repository; + $this->queryBus = $queryBus; + } + + public function handle(GetCarrierList $query) + { + $result = []; + foreach (Shop::getContextListShopID() as $shop) { + $result[] = $this->queryBus->handle(new GetCarrier($query->getType(), (int)$shop)); + } + + return $result; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierPickup.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierPickup.php new file mode 100644 index 00000000..0eeaaaac --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierPickup.php @@ -0,0 +1,47 @@ +type = $name; + } + + public function getType(): string + { + return $this->type; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierPickupHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierPickupHandler.php new file mode 100644 index 00000000..7c8afa19 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCarrierPickupHandler.php @@ -0,0 +1,49 @@ +repository = $repository; + } + + public function handle(GetCarrierPickup $query) + { + return $this->repository->findByCarrierType($query->getType()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCodPaymentModules.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCodPaymentModules.php new file mode 100644 index 00000000..842ab583 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCodPaymentModules.php @@ -0,0 +1,47 @@ +type = $name; + } + + public function getType(): string + { + return $this->type; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCodPaymentModulesHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCodPaymentModulesHandler.php new file mode 100644 index 00000000..3a70ef59 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetCodPaymentModulesHandler.php @@ -0,0 +1,161 @@ +dpdshippingConfigurationRepository = $dpdshippingConfigurationRepository; + } + + public function handle(GetCodPaymentModules $query) + { + $paymentMethodsJson = $this->dpdshippingConfigurationRepository->findOneByName($query->getType(), (int)Context::getContext()->shop->id); + + return self::getCodPaymentMethods($paymentMethodsJson); + } + + private static function getShopPaymentMethods() + { + $result = []; + foreach (Module::getPaymentModules() as $payment_module) { + $module = Module::getInstanceByName($payment_module['name']); + + if (!Validate::isLoadedObject($module)) { + continue; + } + + $result[] = [ + 'displayName' => $module->displayName, + 'name' => $payment_module['name'], + 'enable' => false, + ]; + } + + return $result; + } + + public static function isCodPaymentMethod($paymentMethodsJson, $orderPaymentModule): bool + { + if ($paymentMethodsJson == null) { + return false; + } + + $methods = self::getCodPaymentMethods($paymentMethodsJson); + + foreach ($methods as $method) { + if ($method['name'] === $orderPaymentModule && $method['enable'] === true) { + return true; + } + } + + return false; + } + + /** + * @param mixed $paymentMethodsJson + * @param array $result + * @return array + */ + public static function getCodPaymentMethods($paymentMethodsJson): array + { + $shopPaymentMethods = Module::getPaymentModules(); + if (empty($paymentMethodsJson)) { + return self::getShopPaymentMethods(); + } + + $paymentMethodsConfig = json_decode($paymentMethodsJson->getValue(), true); + + $normalizedConfig = self::getNormalizedConfig($paymentMethodsConfig); + + $configByName = self::getName($normalizedConfig); + + foreach ($shopPaymentMethods as $shopPaymentMethod) { + $isEnabled = false; + + if (isset($configByName[$shopPaymentMethod['name']])) { + $isEnabled = $configByName[$shopPaymentMethod['name']]['enable']; + } + + $module = Module::getInstanceByName($shopPaymentMethod['name']); + + if (!Validate::isLoadedObject($module)) { + continue; + } + + $result[] = [ + 'name' => $shopPaymentMethod['name'], + 'displayName' => $module->displayName, + 'enable' => $isEnabled, + ]; + } + + return $result; + } + + /** + * @param $paymentMethodsConfig + * @return array|mixed + */ + private static function getNormalizedConfig($paymentMethodsConfig) + { + if (isset($paymentMethodsConfig[0])) { + $normalizedConfig = $paymentMethodsConfig; + } else { + $normalizedConfig = array_values($paymentMethodsConfig); + } + + return $normalizedConfig; + } + + /** + * @param $normalizedConfig + * @return array + */ + private static function getName($normalizedConfig): array + { + $configByName = []; + foreach ($normalizedConfig as $configMethod) { + $configByName[$configMethod['name']] = $configMethod; + } + + return $configByName; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetOrderCarrier.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetOrderCarrier.php new file mode 100644 index 00000000..c217f5d8 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetOrderCarrier.php @@ -0,0 +1,44 @@ +order = $order; + } + + public function getOrder() + { + return $this->order; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetOrderCarrierHandler.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetOrderCarrierHandler.php new file mode 100644 index 00000000..39ee6ed8 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/GetOrderCarrierHandler.php @@ -0,0 +1,60 @@ +repository = $repository; + } + + public function handle(GetOrderCarrier $query) + { + $carrier = $this->repository->findOneBy(['idCarrier' => $query->getOrder()->id_carrier]); + + if (!isset($carrier)) { + return false; + } + $carrierId = $carrier->getIdCarrier(); + + return [ + 'carrier' => new Carrier($carrierId), + 'dpd_carrier' => $carrier, + ]; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Carrier/Query/index.php @@ -0,0 +1,33 @@ +paramName = null !== $paramName ? $paramName : null; + $this->paramValue = null !== $paramValue ? $paramValue : null; + $this->idShop = $idShop; + } + + public function getParamName() + { + return $this->paramName; + } + + public function getParamValue() + { + return $this->paramValue; + } + + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Configuration/Command/SaveConfigurationHandler.php b/modules/dpdshipping/src/Domain/Configuration/Configuration/Command/SaveConfigurationHandler.php new file mode 100644 index 00000000..5d41fc22 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Configuration/Command/SaveConfigurationHandler.php @@ -0,0 +1,46 @@ +configurationRepository = $configurationRepository; + } + + public function handle(SaveConfigurationCommand $command) + { + $this->configurationRepository->addOrUpdate($command->getParamName(), $command->getParamValue(), $command->getIdShop()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Configuration/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/Configuration/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Configuration/Command/index.php @@ -0,0 +1,33 @@ +paramName = null !== $paramName ? $paramName : null; + $this->idShop = null !== $idShop ? $idShop : (int)Context::getContext()->shop->id; + } + + public function getParamName() + { + return $this->paramName; + } + + public function getIdShop() + { + return $this->idShop; + + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Configuration/Query/GetConfigurationHandler.php b/modules/dpdshipping/src/Domain/Configuration/Configuration/Query/GetConfigurationHandler.php new file mode 100644 index 00000000..418484bd --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Configuration/Query/GetConfigurationHandler.php @@ -0,0 +1,51 @@ +configurationRepository = $configurationRepository; + } + + public function handle(GetConfiguration $query): ?DpdShippingConfiguration + { + return $this->configurationRepository->findOneByName($query->getParamName(), $query->getIdShop()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Configuration/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/Configuration/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Configuration/Query/index.php @@ -0,0 +1,33 @@ + new Parameter(Configuration::DPD_STATUS_INFO_URL, 'https://dpdinfoservices.dpd.com.pl/DPDInfoServicesObjEventsService/DPDInfoServicesObjEvents?wsdl'), + Configuration::NEED_ONBOARDING => new Parameter(Configuration::NEED_ONBOARDING, '1'), + Configuration::LOG_LEVEL => new Parameter(Configuration::LOG_LEVEL, 'info'), + Configuration::CUSTOM_CHECKOUT => new Parameter(Configuration::CUSTOM_CHECKOUT, 'standard'), + Configuration::SEND_MAIL_WHEN_SHIPPING_GENERATED => new Parameter(Configuration::SEND_MAIL_WHEN_SHIPPING_GENERATED, '1'), + Configuration::CHECK_TRACKING_ORDER_VIEW => new Parameter(Configuration::CHECK_TRACKING_ORDER_VIEW, '1'), + Configuration::EMPIK_MODULE_INTEGRATION_ENABLED => new Parameter(Configuration::EMPIK_MODULE_INTEGRATION_ENABLED, '0'), + ]; + } + + public static function getDefaultValue($name): ?string + { + $param = self::getByName($name); + + if (isset($param)) { + return self::getByName($name)->getDefaultValue(); + } + + return null; + } + + public static function getByName($name): ?Parameter + { + return self::getParameters()[$name] ?? null; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Configuration/Repository/Parameter.php b/modules/dpdshipping/src/Domain/Configuration/Configuration/Repository/Parameter.php new file mode 100644 index 00000000..6cf1cfcd --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Configuration/Repository/Parameter.php @@ -0,0 +1,51 @@ +name = $name; + $this->defaultValue = $defaultValue; + } + + public function getName(): string + { + return $this->name; + } + + public function getDefaultValue(): string + { + return $this->defaultValue; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Configuration/Repository/index.php b/modules/dpdshipping/src/Domain/Configuration/Configuration/Repository/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Configuration/Repository/index.php @@ -0,0 +1,33 @@ +id = $id; + } + + public function getId() + { + return $this->id; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Command/DeleteConnectionHandler.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/DeleteConnectionHandler.php new file mode 100644 index 00000000..19ea74ce --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/DeleteConnectionHandler.php @@ -0,0 +1,49 @@ +repository = $repository; + } + + public function handle(DeleteConnectionCommand $command): bool + { + return $this->repository->deleteById($command->getId()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Command/SaveConnectionCommand.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/SaveConnectionCommand.php new file mode 100644 index 00000000..13c91fec --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/SaveConnectionCommand.php @@ -0,0 +1,117 @@ +id = $id; + $this->idShop = $idShop; + $this->name = $name; + $this->login = $login; + $this->password = $password; + $this->masterFid = $masterFid; + $this->environment = $environment; + $this->isDefault = $isDefault; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + + /** + * @return mixed + */ + public function getLogin() + { + return $this->login; + } + + /** + * @return mixed + */ + public function getPassword() + { + return $this->password; + } + + /** + * @return mixed + */ + public function getMasterFid() + { + return $this->masterFid; + } + + /** + * @return mixed + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * @return mixed + */ + public function getName() + { + return $this->name; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @return mixed + */ + public function getIsDefault() + { + return $this->isDefault; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Command/SaveConnectionHandler.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/SaveConnectionHandler.php new file mode 100644 index 00000000..f23d243b --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/SaveConnectionHandler.php @@ -0,0 +1,46 @@ +connectionRepository = $connectionRepository; + } + + public function handle(SaveConnectionCommand $command) + { + return $this->connectionRepository->addOrUpdate($command->getId(), $command->getIdShop(), $command->getName(), $command->getLogin(), $command->getPassword(), $command->getMasterFid(), $command->getEnvironment(), $command->getIsDefault()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Command/index.php @@ -0,0 +1,33 @@ +idShop = $idShop; + $this->connectionId = $connectionId; + } + + public function getIdShop() + { + return $this->idShop; + + } + + /** + * @return mixed|null + */ + public function getConnectionId() + { + return $this->connectionId; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionHandler.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionHandler.php new file mode 100644 index 00000000..e989c545 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionHandler.php @@ -0,0 +1,50 @@ +connectionRepository = $connectionRepository; + } + + public function handle(GetConnection $query): ?DpdShippingConnection + { + return $this->connectionRepository->findOneByIdShop($query->getConnectionId(), $query->getIdShop()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionList.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionList.php new file mode 100644 index 00000000..d275a53c --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionList.php @@ -0,0 +1,47 @@ +idShop = $idShop; + } + + public function getIdShop() + { + return $this->idShop; + + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionListHandler.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionListHandler.php new file mode 100644 index 00000000..0cb2fb73 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/GetConnectionListHandler.php @@ -0,0 +1,50 @@ +connectionRepository = $connectionRepository; + } + + public function handle(GetConnectionList $query): array + { + return $this->connectionRepository->findConnectionList($query->getIdShop()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Connection/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Connection/Query/index.php @@ -0,0 +1,33 @@ +payerList = $payerList; + $this->idShop = $idShop; + $this->connectionId = $connectionId; + } + + public function getPayerList() + { + return $this->payerList; + } + + public function getIdShop() + { + return $this->idShop; + } + + /** + * @return mixed + */ + public function getConnectionId() + { + return $this->connectionId; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Payer/Command/AddPayerHandler.php b/modules/dpdshipping/src/Domain/Configuration/Payer/Command/AddPayerHandler.php new file mode 100644 index 00000000..39c5bdba --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Payer/Command/AddPayerHandler.php @@ -0,0 +1,49 @@ +payerRepository = $payerRepository; + } + + public function handle(AddPayerCommand $command): bool + { + return $this->payerRepository->addOrUpdate($command->getPayerList(), $command->getIdShop(), $command->getConnectionId()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Payer/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/Payer/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Payer/Command/index.php @@ -0,0 +1,33 @@ +idConnection = $idConnection; + } + + /** + * @return mixed + */ + public function getIdConnection() + { + return $this->idConnection; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetDefaultPayerHandler.php b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetDefaultPayerHandler.php new file mode 100644 index 00000000..cd74b288 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetDefaultPayerHandler.php @@ -0,0 +1,50 @@ +payerRepository = $payerRepository; + } + + public function handle(GetDefaultPayer $query): ?DpdshippingPayer + { + return $this->payerRepository->findDefault($query->getIdConnection()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetPayerList.php b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetPayerList.php new file mode 100644 index 00000000..93e3900d --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetPayerList.php @@ -0,0 +1,64 @@ +defaultFirst = $defaultFirst; + $this->idShop = $idShop; + $this->idConnection = $idConnection; + } + + public function isDefaultFirst(): bool + { + return $this->defaultFirst; + } + + public function getIdShop() + { + return $this->idShop; + } + + /** + * @return mixed + */ + public function getIdConnection() + { + return $this->idConnection; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetPayerListHandler.php b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetPayerListHandler.php new file mode 100644 index 00000000..477b7050 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/GetPayerListHandler.php @@ -0,0 +1,49 @@ +payerRepository = $payerRepository; + } + + public function handle(GetPayerList $query) + { + return $this->payerRepository->findAllActive($query->isDefaultFirst(), $query->getIdShop(), $query->getIdConnection()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/Payer/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/Payer/Query/index.php @@ -0,0 +1,33 @@ +request = $request; + $this->operationType = $operationType; + $this->orderNumber = $orderNumber; + $this->checkSum = $checkSum; + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getRequest() + { + return $this->request; + } + + /** + * @return mixed|string + */ + public function getOperationType() + { + return $this->operationType; + } + + public function getOrderNumber() + { + return $this->orderNumber; + } + + /** + * @return mixed|null + */ + public function getCheckSum() + { + return $this->checkSum; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/AddPickupCourierHandler.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/AddPickupCourierHandler.php new file mode 100644 index 00000000..2012b20a --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/AddPickupCourierHandler.php @@ -0,0 +1,158 @@ +repository = $repository; + $this->dpdApiService = $dpdApiService; + $this->router = $router; + $this->queryBus = $queryBus; + } + + /** + * @throws Exception + */ + public function handle(AddPickupCourierCommand $query) + { + $queryParam = $query->getRequest(); + + list($pickupTimeFrom, $pickupTimeTo) = explode('-', $queryParam->get('pickupTime')); + $countryIsoCode = $this->queryBus->handle(new GetCountryIsoCode($this->getQueryValue($queryParam, 'senderCountryCode', ""))); + + $dpdPickupCallParams = (new DpdPickupCallParamsV3()) + ->withOrderNumber($query->getOrderNumber()) + ->withCheckSum($query->getCheckSum()) + ->withOrderType($countryIsoCode == "PL" ? "DOMESTIC" : "INTERNATIONAL") + ->withOperationType($query->getOperationType()) + ->withPickupDate($this->getQueryValue($queryParam, 'pickupDate')) + ->withPickupTimeFrom($pickupTimeFrom ?? null) + ->withPickupTimeTo($pickupTimeTo ?? null) + ->withWaybillsReady(true) + ->withPickupCallSimplifiedDetails( + (new PickupCallSimplifiedDetailsDPPV1()) + ->withPickupCustomer( + (new PickupCustomerDPPV1()) + ->withCustomerFullName($this->getQueryValue($queryParam, 'customerFullName')) + ->withCustomerName($this->getQueryValue($queryParam, 'customerName')) + ->withCustomerPhone($this->getQueryValue($queryParam, 'customerPhone')) + ) + ->withPickupPayer( + (new PickupPayerDPPV1()) + ->withPayerCostCenter($this->getQueryValue($queryParam, 'payerCostCenter')) + ->withPayerName($this->getQueryValue($queryParam, 'payerName')) + ->withPayerNumber($this->getQueryValue($queryParam, 'payerNumber')) + ) + ->withPickupSender( + (new PickupSenderDPPV1()) + ->withSenderAddress($this->getQueryValue($queryParam, 'senderAddress')) + ->withSenderName($this->getQueryValue($queryParam, 'senderName')) + ->withSenderPhone($this->getQueryValue($queryParam, 'senderPhone')) + ->withSenderCity($this->getQueryValue($queryParam, 'senderCity')) + ->withSenderFullName($this->getQueryValue($queryParam, 'senderFullName')) + ->withSenderPostalCode(str_replace('-', '', $this->getQueryValue($queryParam, 'senderPostalCode') ?? ''))) + ->withPackagesParams( + (new PickupPackagesParamsDPPV1()) + ->withDox($this->getQueryValue($queryParam, 'letters', false) && $this->getQueryValue($queryParam, 'lettersCount', 0) > 0) + ->withDoxCount($this->getQueryValue($queryParam, 'letters', false) ? $this->getQueryValue($queryParam, 'lettersCount', 0) : 0) + ->withPallet($this->getQueryValue($queryParam, 'palette', false) && $this->getQueryValue($queryParam, 'paletteCount', 0) > 0) + ->withPalletsCount($this->getQueryValue($queryParam, 'palette', false) ? $this->getQueryValue($queryParam, 'paletteCount', 0) : 0) + ->withPalletMaxHeight($this->getQueryValue($queryParam, 'paletteSizeYMax')) + ->withPalletMaxWeight($this->getQueryValue($queryParam, 'paletteWeightMx')) + ->withPalletsWeight($this->getQueryValue($queryParam, 'paletteWeightSum')) + ->withStandardParcel($this->getQueryValue($queryParam, 'packages', false) && $this->getQueryValue($queryParam, 'packagesCount', 0) > 0) + ->withParcelsCount($this->getQueryValue($queryParam, 'packages', false) ? $this->getQueryValue($queryParam, 'packagesCount', 0) : 0) + ->withParcelsWeight($this->getQueryValue($queryParam, 'packagesWeightSum')) + ->withParcelMaxDepth($this->getQueryValue($queryParam, 'packagesSizeZMax')) + ->withParcelMaxHeight($this->getQueryValue($queryParam, 'packagesSizeYMax')) + ->withParcelMaxWidth($this->getQueryValue($queryParam, 'packagesSizeXMax')) + ->withParcelMaxWeight($this->getQueryValue($queryParam, 'packagesWeightMax')) + )); + + $request = new PackagesPickupCallV4($dpdPickupCallParams, $this->dpdApiService->getAuth($query->getIdShop(), null)); + $result = $this->dpdApiService->getServicesClient($query->getIdShop(), null)->packagesPickupCall($request); + + if ($result != null && $result->return != null && $result->return->statusInfo->status == "OK") { + $this->repository->save($dpdPickupCallParams, $result->return->statusInfo->status, $result->return->orderNumber, $result->return->checkSum, $countryIsoCode); + + $url = $this->router->generate('dpdshipping_pickup_courier_form'); + return ['success' => true, 'data' => array('redirectPath' => $url)]; + } else { + return ['success' => false, 'errors' => $this->getErrorMessages($result)]; + } + } + + private function getQueryValue($queryParam, $field, $defaultValue = null) + { + $val = $queryParam->get($field); + if ($val != null && $val != "") { + return $val; + } + return $defaultValue; + } + + public function getErrorMessages($response): array + { + if (!isset($response) || !isset($response->return)) { + return ['Unknown error']; + } + + return [$response->return->statusInfo->errorDetails->description]; + + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/CancelPickupCourierCommand.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/CancelPickupCourierCommand.php new file mode 100644 index 00000000..e2bb2689 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/CancelPickupCourierCommand.php @@ -0,0 +1,59 @@ +id = $id; + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + + +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/CancelPickupCourierHandler.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/CancelPickupCourierHandler.php new file mode 100644 index 00000000..8a821784 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/CancelPickupCourierHandler.php @@ -0,0 +1,107 @@ +repository = $repository; + $this->dpdApiService = $dpdApiService; + $this->logger = $logger; + $this->translator = $translator; + } + + /** + * @throws \Exception + */ + public function handle(CancelPickupCourierCommand $query) + { + try { + + $pickupCourierEntity = $this->repository->findOneBy(['id' => $query->getId()]); + + $dpdPickupCallParams = (new DpdPickupCallParamsV3()) + ->withOrderNumber($pickupCourierEntity->getOrderNumber()) + ->withCheckSum($pickupCourierEntity->getCheckSum()) + ->withOperationType("CANCEL"); + + $request = new PackagesPickupCallV4($dpdPickupCallParams, $this->dpdApiService->getAuth($query->getIdShop(), null)); + $result = $this->dpdApiService->getServicesClient($query->getIdShop(), null)->packagesPickupCall($request); + + if ($result != null && $result->return != null && $result->return->statusInfo->status == "OK") { + $this->repository->saveStatusCancel($pickupCourierEntity); + return ['success' => true]; + } + return ['success' => false, 'errors' => $this->getErrorMessages($result)]; + + } catch (\Exception $e) { + $this->logger->error('DPDSHIPPING: Error cancel pickup courier:' . $e->getMessage()); + $errorMessage = [$this->translator->trans('It is not possible to cancel the collection of a courier shipment', [], 'Modules.Dpdshipping.Admin')]; + + return ['success' => false, 'errors' => $errorMessage]; + } + } + + public function getErrorMessages($response): array + { + if (!isset($response) || !isset($response->return)) { + return ['Unknown error']; + } + + return [$response->return->statusInfo->errorDetails->description]; + + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Command/index.php @@ -0,0 +1,33 @@ +senderPlace = $senderPlace; + $this->idShop = $idShop; + } + + public function getSenderPlace() + { + return $this->senderPlace; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Query/GetCourierOrderAvailabilityHandler.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Query/GetCourierOrderAvailabilityHandler.php new file mode 100644 index 00000000..01cd0039 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Query/GetCourierOrderAvailabilityHandler.php @@ -0,0 +1,99 @@ +repository = $repository; + $this->dpdApiService = $dpdApiService; + $this->logger = $logger; + } + + /** + * @throws Exception + */ + public function handle(GetCourierOrderAvailability $query) + { + $result = $this->dpdApiService->getServicesClient($query->getIdShop(), null) + ->getCourierOrderAvailability(new GetCourierOrderAvailabilityV1($query->getSenderPlace(), $this->dpdApiService->getAuth($query->getIdShop(), null))); + + if (isset($result->return->ranges)) { + if (is_array($result->return->ranges)) { + return ['success' => true, 'data' => $result->return->ranges]; + } else { + return ['success' => true, 'data' => array( + [ + 'offset' => $result->return->ranges->offset, + 'range' => $result->return->ranges->range + ]) + ]; + } + } else { + return ['success' => false, 'errors' => $this->getErrorMessages($result)]; + } + } + + public function getErrorMessages($response): array + { + if (!isset($response) || !isset($response->return)) { + return ['Unknown error']; + } + return [$response->return->status]; + } + +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourier/Query/index.php @@ -0,0 +1,33 @@ +pickupOrderSettings = $pickupOrderSettings; + $this->idShop = $idShop; + } + + public function getPickupOrderSettings() + { + return $this->pickupOrderSettings; + } + + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/AddPickupOrderSettingsHandler.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/AddPickupOrderSettingsHandler.php new file mode 100644 index 00000000..4444ce91 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/AddPickupOrderSettingsHandler.php @@ -0,0 +1,51 @@ +repository = $repository; + } + + public function handle(AddPickupOrderSettingsCommand $command): bool + { + $this->repository->addOrUpdate($command->getPickupOrderSettings(), $command->getIdShop()); + + return true; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/DeletePickupOrderSettingsAddressCommand.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/DeletePickupOrderSettingsAddressCommand.php new file mode 100644 index 00000000..eb5d9df1 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/DeletePickupOrderSettingsAddressCommand.php @@ -0,0 +1,44 @@ +pickupCourierId = $pickupCourierId; + } + + public function getId() + { + return $this->pickupCourierId; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/DeletePickupOrderSettingsAddressHandler.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/DeletePickupOrderSettingsAddressHandler.php new file mode 100644 index 00000000..72952b92 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/DeletePickupOrderSettingsAddressHandler.php @@ -0,0 +1,51 @@ +repository = $repository; + } + + public function handle(DeletePickupOrderSettingsAddressCommand $command): bool + { + $this->repository->deleteById($command->getId()); + + return true; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Command/index.php @@ -0,0 +1,33 @@ +defaultFirst = $defaultFirst; + $this->pickupCourierId = $pickupCourierId; + } + + /** + * @return mixed + */ + public function getDefaultFirst() + { + return $this->defaultFirst; + } + + public function getPickupCourierId() + { + return $this->pickupCourierId; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Query/GetPickupCourierSettingsListHandler.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Query/GetPickupCourierSettingsListHandler.php new file mode 100644 index 00000000..f29aecc7 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Query/GetPickupCourierSettingsListHandler.php @@ -0,0 +1,53 @@ +repository = $repository; + } + + public function handle(GetPickupCourierSettingsList $query) + { + if ($query->getPickupCourierId() != null) { + return $this->repository->findOneBy(['id' => $query->getPickupCourierId()]); + } + + return $this->repository->findAll(); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/PickupCourierSettings/Query/index.php @@ -0,0 +1,33 @@ +senderAddress = $senderAddress; + $this->idShop = $idShop; + } + + public function getSenderAddress() + { + return $this->senderAddress; + } + + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/AddSenderAddressHandler.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/AddSenderAddressHandler.php new file mode 100644 index 00000000..a955b924 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/AddSenderAddressHandler.php @@ -0,0 +1,51 @@ +repository = $repository; + } + + public function handle(AddSenderAddressCommand $command): bool + { + $this->repository->addOrUpdate($command->getSenderAddress(), $command->getIdShop()); + + return true; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/DeleteSenderAddressCommand.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/DeleteSenderAddressCommand.php new file mode 100644 index 00000000..a47f346a --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/DeleteSenderAddressCommand.php @@ -0,0 +1,44 @@ +senderAddressId = $senderAddressId; + } + + public function getSenderAddressId() + { + return $this->senderAddressId; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/DeleteSenderAddressHandler.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/DeleteSenderAddressHandler.php new file mode 100644 index 00000000..26789a9a --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/DeleteSenderAddressHandler.php @@ -0,0 +1,51 @@ +repository = $repository; + } + + public function handle(DeleteSenderAddressCommand $command): bool + { + $this->repository->deleteById($command->getSenderAddressId()); + + return true; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Command/index.php @@ -0,0 +1,33 @@ +idShop = $idShop; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetDefaultOrderSenderAddressHandler.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetDefaultOrderSenderAddressHandler.php new file mode 100644 index 00000000..e794ae84 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetDefaultOrderSenderAddressHandler.php @@ -0,0 +1,64 @@ +repository = $repository; + } + + public function handle(GetDefaultOrderSenderAddress $query) + { + $item = $this->repository->findDefault($query->getIdShop()); + + if (!isset($item)) { + return []; + } + + return [ + 'company' => $item->getCompany(), + 'name' => $item->getName(), + 'street' => $item->getStreet(), + 'postcode' => $item->getPostalCode(), + 'city' => $item->getCity(), + 'country' => $item->getCountryCode(), + 'phone' => $item->getPhone(), + 'email' => $item->getMail(), + ]; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetOrderSenderAddressList.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetOrderSenderAddressList.php new file mode 100644 index 00000000..6fc6638b --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetOrderSenderAddressList.php @@ -0,0 +1,47 @@ +idShop = $idShop; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetOrderSenderAddressListHandler.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetOrderSenderAddressListHandler.php new file mode 100644 index 00000000..7cf871a5 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetOrderSenderAddressListHandler.php @@ -0,0 +1,66 @@ +repository = $repository; + } + + public function handle(GetOrderSenderAddressList $query) + { + $addresses = $this->repository->findAll($query->getIdShop()); + + $senderAddressList = []; + foreach ($addresses as $item) { + $senderAddressList[] = [ + 'company' => $item->getCompany(), + 'name' => $item->getName(), + 'street' => $item->getStreet(), + 'postcode' => $item->getPostalCode(), + 'city' => $item->getCity(), + 'country' => $item->getCountryCode(), + 'phone' => $item->getPhone(), + 'email' => $item->getMail(), + ]; + } + + return $senderAddressList; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddress.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddress.php new file mode 100644 index 00000000..a99a2179 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddress.php @@ -0,0 +1,44 @@ +senderAddressId = $senderAddressId; + } + + public function getSenderAddressId() + { + return $this->senderAddressId; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressHandler.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressHandler.php new file mode 100644 index 00000000..7720c878 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressHandler.php @@ -0,0 +1,49 @@ +repository = $repository; + } + + public function handle(GetSenderAddress $query) + { + return $this->repository->find($query->getSenderAddressId()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressList.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressList.php new file mode 100644 index 00000000..9d1e28f7 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressList.php @@ -0,0 +1,60 @@ +defaultFirst = $defaultFirst; + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getDefaultFirst() + { + return $this->defaultFirst; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressListHandler.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressListHandler.php new file mode 100644 index 00000000..7c4e3a65 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/GetSenderAddressListHandler.php @@ -0,0 +1,54 @@ +repository = $repository; + } + + public function handle(GetSenderAddressList $query) + { + if ($query->getDefaultFirst()) { + return $this->repository->findBy(['idShop' => $query->getIdShop()], ['isDefault' => 'DESC']); + } + + return $this->repository->findAll(); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SenderAddress/Query/index.php @@ -0,0 +1,33 @@ +specialPrice = $specialPrice; + $this->idShop = $idShop; + } + + public function getSpecialPrice() + { + return $this->specialPrice; + } + + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Command/AddSpecialPriceHandler.php b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Command/AddSpecialPriceHandler.php new file mode 100644 index 00000000..c44cecee --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Command/AddSpecialPriceHandler.php @@ -0,0 +1,51 @@ +repository = $repository; + } + + public function handle(AddSpecialPriceCommand $command): array + { + return $this->repository->save($command->getSpecialPrice(), $command->getIdShop()); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Command/index.php b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Command/index.php @@ -0,0 +1,33 @@ +totalWeight = $totalWeight; + $this->dpdCarrierType = $dpdCarrierType; + $this->cart = $cart; + $this->idCountry = $idCountry; + } + + /** + * @return mixed + */ + public function getTotalWeight() + { + return $this->totalWeight; + } + + /** + * @return mixed + */ + public function getDpdCarrierType() + { + return $this->dpdCarrierType; + } + + /** + * @return mixed + */ + public function getCart() + { + return $this->cart; + } + + public function getIdCountry() + { + return $this->idCountry; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/GetSpecialPriceHandler.php b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/GetSpecialPriceHandler.php new file mode 100644 index 00000000..46516d23 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/GetSpecialPriceHandler.php @@ -0,0 +1,146 @@ +repository = $repository; + } + + public function handle(GetSpecialPrice $query) + { + return $this->getPrice( + $query->getTotalWeight(), + $query->getDpdCarrierType(), + $query->getCart(), + $query->getIdCountry() + ); + } + + public function getPrice($totalWeight, $carrierType, Cart $cart, $idCountry) + { + $cartTotalPrice = $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); + $idCurrencyPln = Currency::getIdByIsoCode(self::PLN, (int) Context::getContext()->shop->id); + $cartCurrency = new Currency($cart->id_currency); + $currencyPLN = new Currency($idCurrencyPln); + $cartTotalPrice = Tools::convertPriceFull($cartTotalPrice, $cartCurrency, $currencyPLN); + + $isoCountry = $this->getIsoCountry($idCountry, $cart); + $price_rules = $this->repository->findPriceRules($isoCountry, $totalWeight, $cartTotalPrice, $carrierType); + + $price_rules = array_filter($price_rules, function ($rule) { + return $rule->getIsoCountry() === '*' || Country::getByIso($rule->getIsoCountry()); + }); + + if (empty($price_rules)) { + return false; + } + + $matchingPriceRule = $this->getMatchingPriceRule($price_rules, $cartTotalPrice, $totalWeight); + + if ($matchingPriceRule == null) { + return false; + } + + $price = $matchingPriceRule->getParcelPrice(); + + if ($carrierType == Config::DPD_STANDARD_COD || $carrierType == Config::DPD_PICKUP_COD) { + $price += $matchingPriceRule->getCodPrice(); + } + + if ($price === false) { + return false; + } + + return Tools::convertPriceFull($price, $currencyPLN, $cartCurrency); + } + + /** + * @param $idCountry + * @param Cart $cart + * @return bool|string + */ + public function getIsoCountry($idCountry, Cart $cart) + { + if ($idCountry) { + $isoCountry = Country::getIsoById($idCountry); + } else { + $address = new Address((int) $cart->id_address_delivery); + $isoCountry = Country::getIsoById($address->id_country); + } + + if (!$isoCountry) { + $isoCountry = self::PLN; + } + + return $isoCountry; + } + + /** + * @param array $price_rules + * @param float $cartTotalPrice + * @param $totalWeight + * @return mixed|null + */ + public function getMatchingPriceRule(array $price_rules, float $cartTotalPrice, $totalWeight) + { + $matchingPriceRule = null; + if (is_array($price_rules)) { + foreach ($price_rules as $price_rule) { + if ($price_rule->getPriceFrom() <= $cartTotalPrice && + $price_rule->getPriceTo() > $cartTotalPrice && + $price_rule->getWeightFrom() <= $totalWeight && + $price_rule->getWeightTo() > $totalWeight + ) { + $matchingPriceRule = $price_rule; + break; + } + } + } + + return $matchingPriceRule; + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/GetSpecialPriceList.php b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/GetSpecialPriceList.php new file mode 100644 index 00000000..bd75f6e6 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/GetSpecialPriceList.php @@ -0,0 +1,36 @@ +repository = $repository; + } + + public function handle(GetSpecialPriceList $query) + { + return $this->repository->findAll(); + } +} diff --git a/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/index.php b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Configuration/SpecialPrice/Query/index.php @@ -0,0 +1,33 @@ +cart = $cart; + $this->id_carrier = $id_carrier; + + $entityManager = $this->getEntityManager(); + $this->specialPriceRepository = $entityManager->getRepository(DpdshippingSpecialPrice::class); + $this->carrierRepository = $entityManager->getRepository(DpdshippingCarrier::class); + } + + /** + * @return bool|float + */ + public function handle() + { + try { + if (!class_exists('SoapClient') || !function_exists('curl_init')) { + return false; + } + + $idCountry = $this->getIdCountry(); + + if (!$this->id_carrier) { + return false; + } + + $currentCarriers = (new GetAvailableCarrierHandler($this->carrierRepository)) + ->handle(new GetAvailableCarrier()); + + $dpdCarrierType = array_search($this->id_carrier, $currentCarriers); + + if ($dpdCarrierType === false) { + return false; + } + + $totalWeight = $this->cart->getTotalWeight(); + + return (new GetSpecialPriceHandler($this->specialPriceRepository)) + ->handle( + new GetSpecialPrice( + $totalWeight, + $dpdCarrierType, + $this->cart, + $idCountry + ) + ); + } catch (Exception $exception) { + return false; + } + } + + /** + * @return bool|int|mixed + */ + public function getIdCountry() + { + $idCountry = (int) Tools::getValue('id_country'); + + if (!$idCountry) { + $country = Address::getCountryAndState((int) $this->cart->id_address_delivery); + $idCountry = is_array($country) ? $country['id_country'] : $country; + + if (!$idCountry) { + $idCountry = Country::getByIso('PL'); + } + } + + return $idCountry; + } + + private function getEntityManager(): EntityManagerInterface + { + // Try controller container (FO/BO) first + $container = null; + if (Context::getContext()->controller && method_exists(Context::getContext()->controller, 'getContainer')) { + $container = Context::getContext()->controller->getContainer(); + } + + if ($container) { + // Try common doctrine service ids across PS versions + if (method_exists($container, 'has') && $container->has('doctrine.orm.entity_manager')) { + $em = $container->get('doctrine.orm.entity_manager'); + if ($em instanceof EntityManagerInterface) { + return $em; + } + } + if (method_exists($container, 'has') && $container->has('doctrine.orm.default_entity_manager')) { + $em = $container->get('doctrine.orm.default_entity_manager'); + if ($em instanceof EntityManagerInterface) { + return $em; + } + } + if (method_exists($container, 'has') && $container->has('doctrine.orm.manager_registry')) { + $registry = $container->get('doctrine.orm.manager_registry'); + if (is_object($registry) && method_exists($registry, 'getManager')) { + $em = $registry->getManager(); + if ($em instanceof EntityManagerInterface) { + return $em; + } + } + } + if (method_exists($container, 'has') && $container->has('doctrine')) { + $doctrine = $container->get('doctrine'); + if (is_object($doctrine) && method_exists($doctrine, 'getManager')) { + $em = $doctrine->getManager(); + if ($em instanceof EntityManagerInterface) { + return $em; + } + } + } + } + + // Legacy fallback for PS <= 8 using SymfonyContainer if available + if (class_exists('\\PrestaShop\\PrestaShop\\Adapter\\SymfonyContainer')) { + $legacyContainer = \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance(); + if ($legacyContainer->has('doctrine.orm.entity_manager')) { + $em = $legacyContainer->get('doctrine.orm.entity_manager'); + if ($em instanceof EntityManagerInterface) { + return $em; + } + } + if ($legacyContainer->has('doctrine.orm.default_entity_manager')) { + $em = $legacyContainer->get('doctrine.orm.default_entity_manager'); + if ($em instanceof EntityManagerInterface) { + return $em; + } + } + if ($legacyContainer->has('doctrine.orm.manager_registry')) { + $registry = $legacyContainer->get('doctrine.orm.manager_registry'); + if (is_object($registry) && method_exists($registry, 'getManager')) { + $em = $registry->getManager(); + if ($em instanceof EntityManagerInterface) { + return $em; + } + } + } + } + + // If everything fails, throw to let caller handle gracefully (caught in handle()) + throw new \RuntimeException('Cannot retrieve Doctrine EntityManager'); + } +} diff --git a/modules/dpdshipping/src/Domain/Legacy/SpecialPrice/index.php b/modules/dpdshipping/src/Domain/Legacy/SpecialPrice/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Legacy/SpecialPrice/index.php @@ -0,0 +1,33 @@ +requestData = $requestData; + $this->idOrder = $idOrder; + $this->dpdCarrier = $dpdCarrier; + $this->idShop = $idShop; + $this->idConnection = $idConnection; + } + + /** + * @return mixed + */ + public function getRequestData() + { + return $this->requestData; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } + + /** + * @return mixed + */ + public function getDpdCarrier() + { + return $this->dpdCarrier; + } + + public function getIdShop() + { + return $this->idShop; + } + + /** + * @return mixed + */ + public function getIdConnection() + { + return $this->idConnection; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Command/AddDpdOrderCommandHandler.php b/modules/dpdshipping/src/Domain/Order/Command/AddDpdOrderCommandHandler.php new file mode 100644 index 00000000..0b0f4477 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Command/AddDpdOrderCommandHandler.php @@ -0,0 +1,425 @@ +dpdApiService = $dpdApiService; + $this->commandBus = $commandBus; + $this->translator = $translator; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(AddDpdOrderCommand $command): array + { + try { + $request = $command->getRequestData(); + $errors = $this->validateConfiguration($request); + + if (!empty($errors)) { + return [ + 'status' => 'ERROR', + 'errors' => $errors, + ]; + } + + $shipping = $this->mapShippingApi($request, $command->getIdShop()); + + $response = $this->dpdApiService + ->getServicesClient($command->getIdShop(), $request['connection_id']) + ->generatePackagesNumbersV9($shipping); + + $result = []; + + if ($response->return->Status == 'OK') { + $packages = $response->return->Packages; + $packageIndex = 0; + + if (is_array($packages)) { + foreach ($packages as $index => $package) { + $result = $this->saveShipping($package->Package, $command, $shipping, $packageIndex, $request, $result); + $packageIndex = $packageIndex + 1; + } + } else { + $result = $this->saveShipping($packages->Package, $command, $shipping, $packageIndex, $request, $result); + } + + return $result; + } + + return [ + 'status' => 'ERROR', + 'errors' => $this->getErrorMessages($response->return), + ]; + } catch (TypeError $e) { + $this->logger->error('DPDSHIPPING: Cannot generate shipping - invalid type: ' . $e->getMessage()); + + return [ + 'status' => 'ERROR', + 'errors' => [$e->getMessage()], + ]; + } catch (Exception $e) { + $this->logger->error('DPDSHIPPING: Cannot generate shipping: ' . $e->getMessage()); + + return [ + 'status' => 'ERROR', + 'errors' => [$e->getMessage()], + ]; + } + } + + public function validateConfiguration(array $request): array + { + $errors = []; + if (empty($request['packages'])) { + $errors[] = $this->translator->trans('Please add packages', [], 'Modules.Dpdshipping.Admin'); + } + foreach ($request['packages'] as $parcel) { + if (!isset($parcel['weight']) || $parcel['weight'] <= 0) { + $errors[] = $this->translator->trans('The package weight must be greater than 0.', [], 'Modules.Dpdshipping.Admin'); + } + } + + if (empty($request['sender_address_company']) && empty($request['sender_address_name'])) { + $errors[] = $this->translator->trans('You must specify at least one of the fields: Sender company, Sender name.', [], 'Modules.Dpdshipping.Admin'); + } + + if (empty($request['receiver_address_company']) && empty($request['receiver_address_name'])) { + $errors[] = $this->translator->trans('You must specify at least one of the fields: Receiver company, Receiver name.', [], 'Modules.Dpdshipping.Admin'); + } + + return $errors; + } + + private function mapShippingApi($request, $idShop): GeneratePackagesNumbersV9 + { + $package = new PackageOpenUMLFeV11(); + $package = $package + ->withSender($this->getSender($request)) + ->withReceiver($this->getReceiver($request)) + ->withParcels($this->getParcels($request)) + ->withRef1($request['ref1']) + ->withRef2($request['ref2']) + ->withRef3('PSMODUL#') + ->withPayerType('THIRD_PARTY') + ->withThirdPartyFID($request['payer_number']) + ->withReference(null) + ->withServices($this->getServices($request)); + + $openUMLFeV11 = (new OpenUMLFeV11()) + ->withPackages([$package]); + + return new GeneratePackagesNumbersV9($openUMLFeV11, 'STOP_ON_FIRST_ERROR', 'PL', $this->dpdApiService->getAuth($idShop, $request['connection_id'])); + } + + private function getSender($request): PackageAddressOpenUMLFeV1 + { + $countryIsoCode = $this->commandBus->handle(new GetCountryIsoCode($request['sender_address_country'] ?? '')); + return (new PackageAddressOpenUMLFeV1()) + ->withCompany($request['sender_address_company'] ?? '') + ->withName($request['sender_address_name'] ?? '') + ->withAddress($request['sender_address_street'] ?? '') + ->withPostalCode(str_replace('-', '', $request['sender_address_postcode'] ?? '')) + ->withCountryCode($countryIsoCode) + ->withCity($request['sender_address_city'] ?? '') + ->withPhone($request['sender_address_phone'] ?? '') + ->withEmail($request['sender_address_email'] ?? ''); + } + + private function getReceiver($request): PackageAddressOpenUMLFeV1 + { + $countryIsoCode = $this->commandBus->handle(new GetCountryIsoCode($request['receiver_address_country'] ?? '')); + + return (new PackageAddressOpenUMLFeV1()) + ->withCompany($request['receiver_address_company'] ?? '') + ->withName($request['receiver_address_name'] ?? '') + ->withAddress($request['receiver_address_street'] ?? '') + ->withPostalCode(str_replace('-', '', $request['receiver_address_postcode'] ?? '')) + ->withCountryCode($countryIsoCode) + ->withCity($request['receiver_address_city'] ?? '') + ->withPhone($request['receiver_address_phone'] ?? '') + ->withEmail($request['receiver_address_email'] ?? ''); + } + + private function getParcels($request): array + { + $result = []; + foreach ($request['packages'] as $parcel) { + $result[] = (new ParcelOpenUMLFeV3()) + ->withWeight((string)($parcel['weight'] ?? '1')) + ->withWeightAdr((string)($parcel['weightAdr'] ?? '')) + ->withContent((string)($parcel['content'])) + ->withCustomerData1((string)($parcel['customerData'])) + ->withSizeX((string)($parcel['sizeX'])) + ->withSizeY((string)($parcel['sizeY'])) + ->withSizeZ((string)($parcel['sizeZ'])); + } + + return $result; + } + + private function getServices($request): ServicesOpenUMLFeV11 + { + $services = new ServicesOpenUMLFeV11(); + + if (isset($request['service_cod']) && $request['service_cod'] == 1) { + $cod = (new ServiceCODOpenUMLFeV1()) + ->withAmount((string)($request['service_cod_value'])) + ->withCurrency($request['service_cod_currency']); + + $services = $services->withCod($cod); + } + + if (isset($request['service_guarantee']) && $request['service_guarantee'] == 1) { + $guarantee = (new ServiceGuaranteeOpenUMLFeV1()) + ->withType($request['service_guarantee_type']) + ->withValue($request['service_guarantee_value']); + + $services = $services->withGuarantee($guarantee); + } + + if (isset($request['service_in_pers']) && $request['service_in_pers'] == 1) { + $services = $services->withInPers(new ServiceInPersOpenUMLFeV1()); + } + + if (isset($request['service_priv_pers']) && $request['service_priv_pers'] == 1) { + $services = $services->withPrivPers(new ServicePrivPersOpenUMLFeV1()); + } + if (isset($request['service_self_con']) && $request['service_self_con'] == 1) { + $services = $services->withSelfCol((new ServiceSelfColOpenUMLFeV1())->withReceiver($request['service_self_con_value'])); + } + + if (isset($request['service_dpd_pickup']) && $request['service_dpd_pickup'] == 1) { + $services = $services->withDpdPickup((new ServiceDpdPickupOpenUMLFeV1())->withPudo($request['service_dpd_pickup_value'])); + } + + if (isset($request['service_rod']) && $request['service_rod'] == 1) { + $services = $services->withRod(new ServiceRODOpenUMLFeV1()); + } + + if (isset($request['service_dox']) && $request['service_dox'] == 1) { + $services = $services->withDox(new ServicePalletOpenUMLFeV1()); + } + + if (isset($request['service_cud']) && $request['service_cud'] == 1) { + $services = $services->withCud(new ServiceCUDOpenUMLeFV1()); + } + + if (isset($request['service_tires']) && $request['service_tires'] == 1) { + if ($request['receiver_address_country'] == 'PL') { + $services = $services->withTires(new ServiceTiresOpenUMLFeV1()); + } else { + $services = $services->withTiresExport(new ServiceTiresExportOpenUMLFeV1()); + } + } + + if (isset($request['service_declared_value']) && $request['service_declared_value'] == 1) { + $declaredValue = (new ServiceDeclaredValueOpenUMLFeV1()) + ->withAmount((string)($request['service_declared_value_value'])) + ->withCurrency($request['service_declared_value_currency']); + + $services = $services->withDeclaredValue($declaredValue); + } + + if (isset($request['service_dpd_express']) && $request['service_dpd_express'] == 1) { + $services = $services->withDpdExpress(new ServiceFlagOpenUMLF()); + } + + if (isset($request['service_dpd_food']) && $request['service_dpd_food'] == 1) { + $date = $request['service_dpd_food_value']; + $services = $services->withDpdFood((new ServiceDPDFoodOpenUMLFeV2())->withLimitDate($date->format('Y-m-d'))); + } + if (isset($request['service_duty']) && $request['service_duty'] == 1) { + $services = $services->withDuty((new ServiceDutyOpenUMLeFV2()) + ->withCurrency($request['service_duty_currency']) + ->withAmount((string)($request['service_duty_value']))); + } + + if (isset($request['service_adr']) && $request['service_adr'] == 1) { + $services = $services->withDpdLQ(new ServiceDPDLqOpenUMLFeV1()); + } + + return $services; + } + + public function getErrorMessages($response): array + { + $errorMessages = []; + + if (!isset($response->Packages)) { + if (isset($response->Status)) { + return [$response->Status]; + } + return []; + } + + + foreach ($response->Packages as $package) { + if ($package->Status !== 'OK' && isset($package->ValidationDetails)) { + if (is_array($package->ValidationDetails->ValidationInfo)) { + foreach ($package->ValidationDetails->ValidationInfo as $validationInfo) { + $errorMessages[] = $validationInfo->Info; + } + } else { + $errorMessages[] = $package->ValidationDetails->ValidationInfo->Info; + } + } + + if (isset($package->Parcels->Parcel)) { + foreach ($package->Parcels as $parcel) { + if ($parcel->Status !== 'OK' && isset($parcel->ValidationDetails->ValidationInfo)) { + if (is_array($parcel->ValidationDetails->ValidationInfo)) { + foreach ($parcel->ValidationDetails->ValidationInfo as $validationInfo) { + $errorMessages[] = $validationInfo->Info; + } + } else { + $errorMessages[] = $parcel->ValidationDetails->ValidationInfo->Info; + } + } + } + } + } + + return $errorMessages; + } + + /** + * @param AddDpdOrderCommand $command + * @param $package + * @param GeneratePackagesNumbersV9 $shipping + * @param $mainWaybill + * @return void + */ + private function callActionsAfterShipment(AddDpdOrderCommand $command, $package, GeneratePackagesNumbersV9 $shipping, $mainWaybill): void + { + try { + $this->commandBus->handle(new AfterShipmentCommand($command->getIdOrder(), $package, $shipping, $command->getDpdCarrier(), $mainWaybill)); + } catch (Exception $e) { + $this->logger->error('DPDSHIPPING: Cannot do actions after generate shipment: ' . $e->getMessage()); + } + } + + private function getReturnLabel($request) + { + if (isset($request['service_return_label']) && $request['service_return_label'] == 1) { + return [ + 'company' => $request['service_return_label_address_company'], + 'name' => $request['service_return_label_address_name'], + 'street' => $request['service_return_label_address_street'], + 'postalCode' => $request['service_return_label_address_postcode'], + 'countryCode' => $request['service_return_label_address_country'], + 'city' => $request['service_return_label_address_city'], + 'phone' => $request['service_return_label_address_phone'], + 'email' => $request['service_return_label_address_email'], + ]; + } + + return null; + } + + /** + * @param $package + * @param AddDpdOrderCommand $command + * @param $shipping + * @param $packageIndex + * @param $request + * @param array $result + * @return array + */ + public function saveShipping($package, AddDpdOrderCommand $command, $shipping, $packageIndex, $request, array $result): array + { + if (is_array($package->Parcels->Parcel)) { + $mainWaybill = $package->Parcels->Parcel[0]->Waybill; + } else { + $mainWaybill = $package->Parcels->Parcel->Waybill; + } + + $result[] = $this->commandBus->handle( + new AddShippingHistoryCommand( + $command->getIdOrder(), + $package, + $shipping, + $packageIndex, + $command->getDpdCarrier(), + $mainWaybill, + $this->getReturnLabel($request), + $command->getIdShop(), + $command->getIdConnection() + )); + $this->callActionsAfterShipment($command, $package, $shipping, $mainWaybill); + + return $result; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Command/AddShippingHistoryCommand.php b/modules/dpdshipping/src/Domain/Order/Command/AddShippingHistoryCommand.php new file mode 100644 index 00000000..947b4edf --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Command/AddShippingHistoryCommand.php @@ -0,0 +1,123 @@ +dpdResponsePackage = $dpdResponsePackage; + $this->shipping = $shipping; + $this->packageIndex = $packageIndex; + $this->idOrder = $idOrder; + $this->dpdCarrier = $dpdCarrier; + $this->mainWaybill = $mainWaybill; + $this->returnLabel = $returnLabel; + $this->idShop = $idShop; + $this->idConnection = $idConnection; + } + + /** + * @return PackageDGRV2 + */ + public function getDpdResponsePackage() + { + return $this->dpdResponsePackage; + } + + public function getShipping() + { + return $this->shipping; + } + + /** + * @return mixed + */ + public function getPackageIndex() + { + return $this->packageIndex; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } + + /** + * @return mixed + */ + public function getDpdCarrier() + { + return $this->dpdCarrier; + } + + /** + * @return mixed + */ + public function getMainWaybill() + { + return $this->mainWaybill; + } + + /** + * @return mixed + */ + public function getReturnLabel() + { + return $this->returnLabel; + } + + public function getIdShop() + { + return $this->idShop; + } + + /** + * @return mixed + */ + public function getIdConnection() + { + return $this->idConnection; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Command/AddShippingHistoryHandler.php b/modules/dpdshipping/src/Domain/Order/Command/AddShippingHistoryHandler.php new file mode 100644 index 00000000..71de3383 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Command/AddShippingHistoryHandler.php @@ -0,0 +1,322 @@ +dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + $this->dpdshippingShippingHistorySenderRepository = $dpdshippingShippingHistorySenderRepository; + $this->dpdshippingShippingHistoryReceiverRepository = $dpdshippingShippingHistoryReceiverRepository; + $this->dpdshippingShippingHistoryParcelRepository = $dpdshippingShippingHistoryParcelRepository; + $this->dpdshippingShippingHistoryServicesRepository = $dpdshippingShippingHistoryServicesRepository; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(AddShippingHistoryCommand $command) + { + $currentShipping = $command->getShipping()->getOpenUMLFeV11()->getPackages()[$command->getPackageIndex()]; + + if ($currentShipping == null) { + return false; + } + + $shippingSender = $this->setShippingHistorySender($currentShipping); + $shippingReceiver = $this->setShippingHistoryReceiver($currentShipping); + $shippingServices = $this->setShippingHistoryServices($currentShipping->getServices(), $command->getReturnLabel()); + + $shippingHistory = $this->setShippingHistory($command, $shippingSender, $shippingReceiver, $shippingServices, $currentShipping); + + $this->setOrderShippingNumber($command); + + return $this->setShippingHistoryParcels($currentShipping, $shippingHistory, $command); + } + + /** + * @param $currentShipping + * @return DpdshippingShippingHistorySender|null + */ + public function setShippingHistorySender($currentShipping): ?DpdshippingShippingHistorySender + { + $sender = $currentShipping->getSender(); + + $shippingSenderEntity = new DpdshippingShippingHistorySender(); + $shippingSenderEntity = $shippingSenderEntity + ->setCompany($sender->getCompany()) + ->setName($sender->getName()) + ->setStreet($sender->getAddress()) + ->setCity($sender->getCity()) + ->setPostalCode($sender->getPostalCode()) + ->setCountryCode($sender->getCountryCode()) + ->setEmail($sender->getEmail()) + ->setPhone($sender->getPhone()); + + return $this->dpdshippingShippingHistorySenderRepository->save($shippingSenderEntity); + } + + /** + * @param $currentShipping + * @return array + */ + public function setShippingHistoryReceiver($currentShipping): ?DpdshippingShippingHistoryReceiver + { + $receiver = $currentShipping->getReceiver(); + $shippingReceiverEntity = new DpdshippingShippingHistoryReceiver(); + $shippingReceiverEntity = $shippingReceiverEntity + ->setCompany($receiver->getCompany()) + ->setName($receiver->getName()) + ->setStreet($receiver->getAddress()) + ->setCity($receiver->getCity()) + ->setPostalCode($receiver->getPostalCode()) + ->setCountryCode($receiver->getCountryCode()) + ->setEmail($receiver->getEmail()) + ->setPhone($receiver->getPhone()); + + return $this->dpdshippingShippingHistoryReceiverRepository->save($shippingReceiverEntity); + } + + /** + * @param ServicesOpenUMLFeV11 $currentShippingServices + * @return DpdshippingShippingHistoryServices|null + */ + public function setShippingHistoryServices($currentShippingServices, $returnLabel): ?DpdshippingShippingHistoryServices + { + $shippingServicesEntity = new DpdshippingShippingHistoryServices(); + + $shippingServicesEntity->setIsCod($currentShippingServices->getCod() != null); + if ($currentShippingServices->getCod() != null) { + $shippingServicesEntity->setIsCod(true); + $shippingServicesEntity->setCodCurrency($currentShippingServices->getCod()->getCurrency()); + $shippingServicesEntity->setCodAmount($currentShippingServices->getCod()->getAmount()); + } + + $shippingServicesEntity->setIsDpdPickup($currentShippingServices->getDpdPickup() != null); + if ($currentShippingServices->getDpdPickup() != null) { + $shippingServicesEntity->setIsDpdPickup(true); + $shippingServicesEntity->setDpdPickupPudo($currentShippingServices->getDpdPickup()->getPudo()); + } + + $shippingServicesEntity->setIsAdr($currentShippingServices->getDpdLQ() != null); + $shippingServicesEntity->setIsCarryIn($currentShippingServices->getCarryIn() != null); + $shippingServicesEntity->setIsCud($currentShippingServices->getCud() != null); + $shippingServicesEntity->setIsDox($currentShippingServices->getDox() != null); + $shippingServicesEntity->setIsDeclaredValue($currentShippingServices->getDeclaredValue() != null); + if ($currentShippingServices->getDeclaredValue() != null) { + $shippingServicesEntity->setDeclaredValueCurrency($currentShippingServices->getDeclaredValue()->getCurrency()); + $shippingServicesEntity->setDeclaredValueAmount($currentShippingServices->getDeclaredValue()->getAmount()); + } + + $shippingServicesEntity->setIsDocumentsInternational($currentShippingServices->getDocumentsInternational() != null); + $shippingServicesEntity->setIsDpdFood($currentShippingServices->getDpdFood() != null); + $shippingServicesEntity->setIsDpdExpress($currentShippingServices->getDpdExpress() != null); + $shippingServicesEntity->setIsDedicatedDelivery($currentShippingServices->getDedicatedDelivery() != null); + $shippingServicesEntity->setIsPallet($currentShippingServices->getPallet() != null); + $shippingServicesEntity->setIsPrivPers($currentShippingServices->getPrivPers() != null); + $shippingServicesEntity->setIsInPers($currentShippingServices->getInPers() != null); + $shippingServicesEntity->setIsGuarantee($currentShippingServices->getGuarantee() != null); + + if ($currentShippingServices->getGuarantee() != null) { + $shippingServicesEntity->setGuaranteeType($currentShippingServices->getGuarantee()->getType()); + $shippingServicesEntity->setGuaranteeValue($currentShippingServices->getGuarantee()->getValue()); + } + + $shippingServicesEntity->setIsTires($currentShippingServices->getTires() != null || $currentShippingServices->getTiresExport() != null); + + $shippingServicesEntity->setIsDuty($currentShippingServices->getDuty() != null); + if ($currentShippingServices->getDuty() != null) { + $shippingServicesEntity->setDutyAmount($currentShippingServices->getDuty()->getAmount()); + $shippingServicesEntity->setDutyCurrency($currentShippingServices->getDuty()->getCurrency()); + } + + $shippingServicesEntity->setIsRod($currentShippingServices->getRod() != null); + + $shippingServicesEntity->setIsSelfCon($currentShippingServices->getSelfCol() != null); + if ($currentShippingServices->getSelfCol() != null) { + $shippingServicesEntity->setSelfConType($currentShippingServices->getSelfCol()->getReceiver()); + } + + $shippingServicesEntity->setIsReturnLabel($returnLabel != null); + if ($returnLabel != null) { + $shippingServicesEntity->setReturnLabelCompany($returnLabel['company']); + $shippingServicesEntity->setReturnLabelName($returnLabel['name']); + $shippingServicesEntity->setReturnLabelStreet($returnLabel['street']); + $shippingServicesEntity->setReturnLabelPostalCode($returnLabel['postalCode']); + $shippingServicesEntity->setReturnLabelCountryCode($returnLabel['countryCode']); + $shippingServicesEntity->setReturnLabelCity($returnLabel['city']); + $shippingServicesEntity->setReturnLabelPhone($returnLabel['phone']); + $shippingServicesEntity->setReturnLabelEmail($returnLabel['email']); + } + + return $this->dpdshippingShippingHistoryServicesRepository->save($shippingServicesEntity); + } + + /** + * @param $currentShipping + * @param DpdshippingShippingHistory|null $shippingHistory + * @param AddShippingHistoryCommand $command + * @return array + */ + public function setShippingHistoryParcels($currentShipping, ?DpdshippingShippingHistory $shippingHistory, AddShippingHistoryCommand $command): array + { + $waybills = []; + $result = []; + + $parcels = $currentShipping->getParcels(); + + foreach ($parcels as $index => $parcel) { + $shippingParcelEntity = new DpdshippingShippingHistoryParcel(); + $shippingParcelEntity->setParcelIndex($index); + $shippingParcelEntity->setWeight((float) number_format((float) $parcel->getWeight(), 2)); + $shippingParcelEntity->setShippingHistory($shippingHistory); + $shippingParcelEntity->setContent($parcel->getContent()); + $shippingParcelEntity->setCustomerData($parcel->getCustomerData1()); + $shippingParcelEntity->setSizeX((float) $parcel->getSizeX()); + $shippingParcelEntity->setSizeY((float) $parcel->getSizeY()); + $shippingParcelEntity->setSizeZ((float) $parcel->getSizeZ()); + $shippingParcelEntity->setWeightAdr((float) $parcel->getWeightAdr()); + $shippingParcelEntity->setIsMainWaybill($index == 0); + + if (is_array($command->getDpdResponsePackage()->Parcels->Parcel)) { + $waybill = $command->getDpdResponsePackage()->Parcels->Parcel[$index]->Waybill; + } else { + $waybill = $command->getDpdResponsePackage()->Parcels->Parcel->Waybill; + } + + $shippingParcelEntity->setWaybill($waybill); + + $this->dpdshippingShippingHistoryParcelRepository->save($shippingParcelEntity); + $waybills[] = $waybill; + } + + $result[] = $shippingHistory; + + return ['shippingHistoryList' => $result, 'waybills' => $waybills]; + } + + /** + * @param AddShippingHistoryCommand $command + * @param DpdshippingShippingHistorySender|null $shippingSender + * @param $shippingReceiver + * @param DpdshippingShippingHistoryServices|null $shippingServices + * @param $currentShipping + * @return DpdshippingShippingHistory|null + */ + public function setShippingHistory(AddShippingHistoryCommand $command, ?DpdshippingShippingHistorySender $shippingSender, $shippingReceiver, ?DpdshippingShippingHistoryServices $shippingServices, $currentShipping): ?DpdshippingShippingHistory + { + $shippingHistoryEntity = new DpdshippingShippingHistory(); + $shippingHistoryEntity->setIdOrder($command->getIdOrder()); + $shippingHistoryEntity->setIdShop($command->getIdShop()); + $shippingHistoryEntity->setIdConnection($command->getIdConnection()); + $shippingHistoryEntity->setSender($shippingSender); + $shippingHistoryEntity->setReceiver($shippingReceiver); + $shippingHistoryEntity->setServices($shippingServices); + $shippingHistoryEntity->setFid($currentShipping->getThirdPartyFID()); + $shippingHistoryEntity->setRef1($currentShipping->getRef1()); + $shippingHistoryEntity->setRef2($currentShipping->getRef2()); + $shippingHistoryEntity->setPayerType($currentShipping->getPayerType()); + $shippingHistoryEntity->setIsDeleted(false); + $shippingHistoryEntity->setIsDelivered(false); + $shippingHistoryEntity->setShippingDate(new DateTime()); + + $dpdCarrier = $command->getDpdCarrier(); + $dpdCarrierType = isset($dpdCarrier['dpd_carrier']) ? $dpdCarrier['dpd_carrier']->getType() : 'OTHER'; + $shippingHistoryEntity->setCarrierName($dpdCarrierType); + $shippingHistoryEntity->setDeliveryZone($currentShipping->getReceiver()->getCountryCode() == 'PL' ? 'DOMESTIC' : 'INTERNATIONAL'); + $shippingHistoryEntity->setDateAdd(new DateTime()); + $shippingHistoryEntity->setDateModify(new DateTime()); + + return $this->dpdshippingShippingHistoryRepository->save($shippingHistoryEntity); + } + + /** + * @param AddShippingHistoryCommand $command + * @return void + * @throws PrestaShopDatabaseException + * @throws PrestaShopException + */ + public function setOrderShippingNumber(AddShippingHistoryCommand $command): void + { + $order = new Order((int) $command->getIdOrder()); + $order_carrier = new OrderCarrier($order->getIdOrderCarrier()); + $order_carrier->tracking_number = $command->getMainWaybill(); + $order_carrier->update(); + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Command/AfterShipmentCommand.php b/modules/dpdshipping/src/Domain/Order/Command/AfterShipmentCommand.php new file mode 100644 index 00000000..10b82246 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Command/AfterShipmentCommand.php @@ -0,0 +1,87 @@ +dpdResponsePackage = $dpdResponsePackage; + $this->shipping = $shipping; + $this->idOrder = $idOrder; + $this->dpdCarrier = $dpdCarrier; + $this->mainWaybill = $mainWaybill; + } + + /** + * @return PackageDGRV2 + */ + public function getDpdResponsePackage() + { + return $this->dpdResponsePackage; + } + + /** + * @return GeneratePackagesNumbersV9 + */ + public function getShipping() + { + return $this->shipping; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } + + /** + * @return mixed + */ + public function getDpdCarrier() + { + return $this->dpdCarrier; + } + + public function getMainWaybill() + { + return $this->mainWaybill; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Command/AfterShipmentHandler.php b/modules/dpdshipping/src/Domain/Order/Command/AfterShipmentHandler.php new file mode 100644 index 00000000..71889002 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Command/AfterShipmentHandler.php @@ -0,0 +1,109 @@ +commandBus = $commandBus; + $this->translator = $translator; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(AfterShipmentCommand $command) + { + $order = new Order((int) $command->getIdOrder()); + $sendEmail = $this->commandBus->handle(new GetConfiguration(Configuration::SEND_MAIL_WHEN_SHIPPING_GENERATED, $order->id_shop)); + + $customer = new Customer($order->id_customer); + $carrier = new Carrier($order->id_carrier); + + Hook::exec('actionAdminOrdersTrackingNumberUpdate', ['order' => $order, 'customer' => $customer, 'carrier' => $carrier]); + + if ($sendEmail != null && $sendEmail->getValue() == '1') { + $templateVars = [ + '{followup}' => str_replace('@', $command->getMainWaybill(), $carrier->url), + '{firstname}' => $customer->firstname, + '{lastname}' => $customer->lastname, + '{id_order}' => $order->id, + '{shipping_number}' => $command->getMainWaybill(), + '{order_name}' => $order->getUniqReference(), + '{meta_products}' => '', + ]; + + if (!@Mail::Send( + $order->id_lang, + 'in_transit', + $this->translator->trans('Package in transit', [], 'Admin.Dpdshipping.Email'), + $templateVars, + $customer->email, + $customer->firstname . ' ' . $customer->lastname, + null, + null, + null, + null, + _PS_MAIL_DIR_, + false, + (int) $order->id_shop + )) { + $this->logger->info('DPDSHIPPING: The email has been sent ' . $command->getMainWaybill()); + } else { + $this->logger->error('DPDSHIPPING: Cannot send email after shimpent' . $command->getMainWaybill()); + } + } + + return true; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Command/index.php b/modules/dpdshipping/src/Domain/Order/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Command/index.php @@ -0,0 +1,33 @@ +country = $country; + } + + /** + * @return mixed + */ + public function getCountry() + { + return $this->country; + } + +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetCountryIsoCodeHandler.php b/modules/dpdshipping/src/Domain/Order/Query/GetCountryIsoCodeHandler.php new file mode 100644 index 00000000..38ec7e81 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetCountryIsoCodeHandler.php @@ -0,0 +1,64 @@ +logger = $logger; + } + + public function handle(GetCountryIsoCode $query): string + { + $countryName = trim($query->getCountry()); + try { + + if (strlen($countryName) == 2) + return strtoupper($countryName); + + $db = \Db::getInstance(); + + $query = 'SELECT `iso_code` FROM `' . _DB_PREFIX_ . 'country_lang` cl + LEFT JOIN `' . _DB_PREFIX_ . 'country` c ON cl.`id_country` = c.`id_country` + WHERE cl.`name` = "' . pSQL($countryName) . '" + OR c.`iso_code` = "' . pSQL($countryName) . '"'; + + return $db->getValue($query); + } catch (Exception $e) { + $this->logger->error('DPDSHIPPING: Cannot get country ISO for:' . $countryName . ' error: ' . $e->getMessage()); + } + + return $countryName; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetDefaultOrderReceiverAddress.php b/modules/dpdshipping/src/Domain/Order/Query/GetDefaultOrderReceiverAddress.php new file mode 100644 index 00000000..cd5c75a1 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetDefaultOrderReceiverAddress.php @@ -0,0 +1,50 @@ +order = $order; + } + + /** + * @return mixed + */ + public function getOrder() + { + return $this->order; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetDefaultOrderReceiverAddressHandler.php b/modules/dpdshipping/src/Domain/Order/Query/GetDefaultOrderReceiverAddressHandler.php new file mode 100644 index 00000000..07c709d2 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetDefaultOrderReceiverAddressHandler.php @@ -0,0 +1,45 @@ +getOrder()->id_customer); + + return $this->getOrderDeliveryAddress($query, $customer); + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetEmpikOrderReference.php b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikOrderReference.php new file mode 100644 index 00000000..37db0314 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikOrderReference.php @@ -0,0 +1,61 @@ +idOrder = $idOrder; + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetEmpikOrderReferenceHandler.php b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikOrderReferenceHandler.php new file mode 100644 index 00000000..e5e20476 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikOrderReferenceHandler.php @@ -0,0 +1,67 @@ +logger = $logger; + $this->commandBus = $commandBus; + } + + public function handle(GetEmpikOrderReference $query): string + { + $idOrder = $query->getIdOrder(); + $empikEnabled = $this->commandBus->handle(new GetConfiguration(Configuration::EMPIK_MODULE_INTEGRATION_ENABLED, $query->getIdShop())); + + if ($empikEnabled != null && $empikEnabled->getValue() != "1") + return ''; + + try { + return Db::getInstance()->getValue( + 'SELECT empik_order_reference + FROM `' . _DB_PREFIX_ . 'empik_orders` + WHERE id_order = ' . $idOrder + ); + } catch (Exception $e) { + // ignore + } + + return ''; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetEmpikPickupNumber.php b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikPickupNumber.php new file mode 100644 index 00000000..52982297 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikPickupNumber.php @@ -0,0 +1,61 @@ +idOrder = $idOrder; + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetEmpikPickupNumberHandler.php b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikPickupNumberHandler.php new file mode 100644 index 00000000..f6e69f0b --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetEmpikPickupNumberHandler.php @@ -0,0 +1,70 @@ +logger = $logger; + $this->commandBus = $commandBus; + } + + public function handle(GetEmpikPickupNumber $query): string + { + $idOrder = $query->getIdOrder(); + $empikEnabled = $this->commandBus->handle(new GetConfiguration(Configuration::EMPIK_MODULE_INTEGRATION_ENABLED, $query->getIdShop())); + + if ($empikEnabled != null && $empikEnabled->getValue() != "1") + return ''; + + try { + $empikPickupPoint = Db::getInstance()->getValue( + 'SELECT empik_pickup_point + FROM `' . _DB_PREFIX_ . 'empik_orders` + WHERE id_order = ' . $idOrder); + + if ($empikPickupPoint === false || $empikPickupPoint === null) { + return ''; + } else { + return $empikPickupPoint; + } + } catch (Exception $e) { + return ''; + } + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetOrderPudoCode.php b/modules/dpdshipping/src/Domain/Order/Query/GetOrderPudoCode.php new file mode 100644 index 00000000..db8f4b94 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetOrderPudoCode.php @@ -0,0 +1,57 @@ +idShop = $idShop; + $this->idCart = $idCart; + } + + /** + * @return mixed + */ + public function getIdCart() + { + return $this->idCart; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetOrderPudoCodeHandler.php b/modules/dpdshipping/src/Domain/Order/Query/GetOrderPudoCodeHandler.php new file mode 100644 index 00000000..5c2e4ede --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetOrderPudoCodeHandler.php @@ -0,0 +1,49 @@ +dpdshippingCartPickupRepository = $dpdshippingCartPickupRepository; + } + + public function handle(GetOrderPudoCode $query): string + { + return $this->dpdshippingCartPickupRepository->getPudoCode($query->getIdShop(), $query->getIdCart()); + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetOrderSource.php b/modules/dpdshipping/src/Domain/Order/Query/GetOrderSource.php new file mode 100644 index 00000000..7d87fbfd --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetOrderSource.php @@ -0,0 +1,61 @@ +idOrder = $idOrder; + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetOrderSourceHandler.php b/modules/dpdshipping/src/Domain/Order/Query/GetOrderSourceHandler.php new file mode 100644 index 00000000..6cd65461 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetOrderSourceHandler.php @@ -0,0 +1,81 @@ +logger = $logger; + $this->commandBus = $commandBus; + } + + public function handle(GetOrderSource $query): string + { + $idOrder = $query->getIdOrder(); + $empikEnabled = $this->commandBus->handle(new GetConfiguration(Configuration::EMPIK_MODULE_INTEGRATION_ENABLED, $query->getIdShop())); + + if ($empikEnabled != null && $empikEnabled->getValue() != "1") + return ''; + + try { + $empikCarrier = Db::getInstance()->getValue( + 'SELECT empik_carrier + FROM `' . _DB_PREFIX_ . 'empik_orders` + WHERE id_order = ' . $idOrder); + + if ($empikCarrier === false || $empikCarrier === null) { + return ''; + } else { + $value = trim(mb_strtolower($empikCarrier)); + + if ($value === mb_strtolower(self::EMPIK_DELIVERY_TO_STORE_CARRIER_NAME)) { + return self::DELIVERY_EMPIK_STORE; + } else { + return self::EMPIK; + } + } + } catch (Exception $e) { + return ''; + } + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressCommon.php b/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressCommon.php new file mode 100644 index 00000000..4146ff89 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressCommon.php @@ -0,0 +1,112 @@ +getOrder()->id_address_delivery); + + return $this->mapToAddress($orderAddress, Country::getIsoById($orderAddress->id_country), $customer); + } + + /** + * @param $item + * @param $countryCode + * @return array + */ + private function mapToAddress($item, $countryCode, $customer): array + { + if (is_array($item)) { + $email = isset($item['other']) && !empty(trim($item['other'])) ? $item['other'] : $customer->email; + } else { + $email = isset($item->other) && !empty(trim($item->other)) ? $item->other : $customer->email; + } + + return [ + 'company' => is_array($item) ? $item['company'] : $item->company, + 'name' => $this->concatenateAndClean($this->getName($item)), + 'street' => $this->concatenateAndClean($this->getAddress($item)), + 'postcode' => is_array($item) ? $item['postcode'] : $item->postcode, + 'city' => is_array($item) ? $item['city'] : $item->city, + 'country' => $countryCode, + 'phone' => (is_array($item) ? $item['phone'] : $item->phone) ?? (is_array($item) ? $item['phone_mobile'] : $item->phone_mobile), + 'email' => $email, + ]; + } + + private function concatenateAndClean(array $items): string + { + $cleanItems = array_filter(array_map('trim', $items), function ($value) { + return !empty($value); + }); + + return implode(' ', $cleanItems); + } + + /** + * @param $item + * @return array + */ + private function getName($item): array + { + return [is_array($item) ? $item['firstname'] : $item->firstname, is_array($item) ? $item['lastname'] : $item->lastname]; + } + + /** + * @param $item + * @return array + */ + private function getAddress($item): array + { + return [is_array($item) ? $item['address1'] : $item->address1, is_array($item) ? $item['address2'] : $item->address2]; + } + + /** + * @param Customer $customer + * @param GetReceiverAddressList $query + * @return array + */ + protected function getAdditionalAddresses(Customer $customer, GetReceiverAddressList $query): array + { + $receiverAddressList = []; + $customerAddresses = $customer->getAddresses($query->getOrder()->id_lang); + foreach ($customerAddresses as $item) { + $countryCode = Country::getIsoById($item['id_country']); + $receiverAddressList[] = $this->mapToAddress($item, $countryCode, $customer); + } + + return $receiverAddressList; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressList.php b/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressList.php new file mode 100644 index 00000000..2af02d9b --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressList.php @@ -0,0 +1,63 @@ +order = $order; + $this->defaultFirst = $defaultFirst; + } + + /** + * @return mixed + */ + public function getDefaultFirst() + { + return $this->defaultFirst; + } + + /** + * @return mixed + */ + public function getOrder() + { + return $this->order; + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressListHandler.php b/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressListHandler.php new file mode 100644 index 00000000..0cbb28b4 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/GetReceiverAddressListHandler.php @@ -0,0 +1,51 @@ +getOrder()->id_customer); + + $receiverAddressList[] = $this->getOrderDeliveryAddress($query, $customer); + $receiverAddressList[] = $this->getAdditionalAddresses($customer, $query); + + return ArrayUtil::flatMultiLevelArray($receiverAddressList); + } +} diff --git a/modules/dpdshipping/src/Domain/Order/Query/index.php b/modules/dpdshipping/src/Domain/Order/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Order/Query/index.php @@ -0,0 +1,33 @@ +orderId = $orderId; + $this->company = $company; + $this->name = $name; + $this->street = $street; + $this->postalCode = $postalCode; + $this->city = $city; + $this->countryCode = $countryCode; + $this->email = $email; + $this->phone = $phone; + $this->shippingHistoryId = $shippingHistoryId; + $this->waybill = $waybill; + $this->idShop = $idShop; + $this->idConnection = $idConnection; + } + + /** + * @return mixed + */ + public function getOrderId() + { + return $this->orderId; + } + + /** + * @return mixed + */ + public function getCompany() + { + return $this->company; + } + + /** + * @return mixed + */ + public function getName() + { + return $this->name; + } + + /** + * @return mixed + */ + public function getStreet() + { + return $this->street; + } + + /** + * @return mixed + */ + public function getPostalCode() + { + return $this->postalCode; + } + + /** + * @return mixed + */ + public function getCity() + { + return $this->city; + } + + /** + * @return mixed + */ + public function getCountryCode() + { + return $this->countryCode; + } + + /** + * @return mixed + */ + public function getEmail() + { + return $this->email; + } + + /** + * @return mixed + */ + public function getPhone() + { + return $this->phone; + } + + /** + * @return mixed + */ + public function getShippingHistoryId() + { + return $this->shippingHistoryId; + } + + /** + * @return mixed + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + + /** + * @return mixed + */ + public function getIdConnection() + { + return $this->idConnection; + } +} diff --git a/modules/dpdshipping/src/Domain/ReturnLabel/Command/ReturnLabelHandler.php b/modules/dpdshipping/src/Domain/ReturnLabel/Command/ReturnLabelHandler.php new file mode 100644 index 00000000..f5dc8d88 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ReturnLabel/Command/ReturnLabelHandler.php @@ -0,0 +1,164 @@ +dpdApiService = $dpdApiService; + $this->dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + $this->commandBus = $commandBus; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(ReturnLabelCommand $command) + { + $this->logger->info('DPDSHIPPING: Generate return label for: ' . $command->getWaybill()); + + $countryIsoCode = $this->commandBus->handle(new GetCountryIsoCode($command->getCountryCode())); + if ($countryIsoCode != Config::PL_CONST) { + $call = $this->dpdApiService + ->getServicesClient($command->getIdShop(), $command->getIdConnection()) + ->generateReturnLabelV1($this->getReturnLabelV1($command, $command->getIdShop(), $command->getIdConnection())); + } else { + $call = $this->dpdApiService + ->getServicesClient($command->getIdShop(), $command->getIdConnection()) + ->generateDomesticReturnLabelV1($this->getDomesticReturnLabelV1($command, $command->getIdShop(), $command->getIdConnection())); + } + + if ($call->return != null && $call->return->session->statusInfo->status == 'OK') { + return [ + 'status' => 'OK', + 'data' => $call->return, + ]; + } + + return [ + 'status' => 'ERROR', + 'data' => $this->getErrorMessages($call->return), + ]; + } + + /** + * @param ReturnLabelCommand $command + * @param string $outputDocPageFormatV1 + * @return GenerateDomesticReturnLabelV1 + */ + public function getDomesticReturnLabelV1(ReturnLabelCommand $command, $idShop, $idConnection): GenerateDomesticReturnLabelV1 + { + $countryIsoCode = $this->commandBus->handle(new GetCountryIsoCode($command->getCountryCode())); + + return new GenerateDomesticReturnLabelV1( + (new ReturnedWaybillsV1()) + ->withWaybill($command->getWaybill()), + (new PudoReturnReceiver()) + ->withCompany($command->getCompany()) + ->withName($command->getName()) + ->withAddress($command->getStreet()) + ->withPostalCode($command->getPostalCode()) + ->withCountryCode($countryIsoCode) + ->withCity($command->getCity()) + ->withEmail($command->getEmail()) + ->withPhone($command->getPhone()), + 'PDF', + 'A4', + 'RETURN', + '', + $this->dpdApiService->getAuth($idShop, $idConnection) + ); + } + + public function getReturnLabelV1(ReturnLabelCommand $command, $idShop, $idConnection): GenerateReturnLabelV1 + { + $countryIsoCode = $this->commandBus->handle(new GetCountryIsoCode($command->getCountryCode())); + + return new GenerateReturnLabelV1( + (new ReturnedWaybillsV1()) + ->withWaybill($command->getWaybill()), + (new PudoReturnReceiver()) + ->withCompany($command->getCompany()) + ->withName($command->getName()) + ->withAddress($command->getStreet()) + ->withPostalCode($command->getPostalCode()) + ->withCountryCode($countryIsoCode) + ->withCity($command->getCity()) + ->withEmail($command->getEmail()) + ->withPhone($command->getPhone()), + 'PDF', + 'A4', + 'RETURN', + '', + $this->dpdApiService->getAuth($idShop, $idConnection) + ); + } + + public function getErrorMessages($response): array + { + if (!isset($response) && $response->session != null) { + return []; + } + + return [$response->session->statusInfo->description]; + } +} diff --git a/modules/dpdshipping/src/Domain/ReturnLabel/Command/index.php b/modules/dpdshipping/src/Domain/ReturnLabel/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ReturnLabel/Command/index.php @@ -0,0 +1,33 @@ +ids = $ids; + } + + /** + * @return array + */ + public function getIds(): array + { + return $this->ids; + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Command/DeleteShippingHandler.php b/modules/dpdshipping/src/Domain/ShippingHistory/Command/DeleteShippingHandler.php new file mode 100644 index 00000000..80f60c44 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Command/DeleteShippingHandler.php @@ -0,0 +1,72 @@ +dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(DeleteShipping $query) + { + if (empty($query->getIds())) { + return false; + } + + try { + $this->dpdshippingShippingHistoryRepository->delete($query->getIds()); + } catch (Exception $ex) { + $this->logger->error('DPDSHIPPING: Cannot delete shipping ' . $ex->getMessage()); + + return false; + } + + return true; + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Command/index.php b/modules/dpdshipping/src/Domain/ShippingHistory/Command/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Command/index.php @@ -0,0 +1,33 @@ +ids = $ids; + } + + /** + * @return array + */ + public function getIds(): array + { + return $this->ids; + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetLabelHandler.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetLabelHandler.php new file mode 100644 index 00000000..fd0313ad --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetLabelHandler.php @@ -0,0 +1,188 @@ +dpdApiService = $dpdApiService; + $this->dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + $this->commandBus = $commandBus; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(GetLabel $query) + { + if (empty($query->getIds())) { + return []; + } + + $result = []; + $shippingHistoryGroupedByDeliveryZone = $this->dpdshippingShippingHistoryRepository + ->getShippingHistoryByIdsGroupByDeliveryZone($query->getIds()); + + $printFormat = $this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PRINT_FORMAT)); + $outputDocPageFormatV1 = $printFormat ? $printFormat->getValue() : 'A4'; + + $labelTypeParam = $this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_LABEL_TYPE)); + $labelType = $labelTypeParam ? $labelTypeParam->getValue() : 'BIC3'; + + foreach ($shippingHistoryGroupedByDeliveryZone as $sessionType => $shippingHistoryList) { + try { + if (empty($shippingHistoryList)) { + continue; + } + + $sender = $shippingHistoryList[0]->getSender(); + $waybills = $this->getWaybills($shippingHistoryList); + $parcels = $this->getParcels($waybills); + $connectionId = $shippingHistoryList[0]->getIdConnection() ?? null; + $shopId = $shippingHistoryList[0]->getIdShop() ?? null; + + $dpdServicesParamsV1 = $this->getDpdServicesParamsV1($sessionType, $parcels, $sender); + + $outputLabelType = $labelType == 'BIC3' ? 'BIC3' : 'EXTENDED'; + $labelVariant = $labelType == 'BIC3' ? '' : $labelType; + + $generateSpedLabelsV4 = new GenerateSpedLabelsV4($dpdServicesParamsV1, 'PDF', $outputDocPageFormatV1, $outputLabelType, $labelVariant, $this->dpdApiService->getAuth($shopId, $connectionId)); + + $call = $this->dpdApiService + ->getServicesClient($shopId, $connectionId) + ->generateSpedLabelsV4($generateSpedLabelsV4); + + if ($call->return->session->statusInfo->status == 'OK') { + $result[] = $call->return; + $this->dpdshippingShippingHistoryRepository->setLabelDate($waybills, new DateTime()); + } + } catch (Exception $ex) { + $this->logger->error('DPDSHIPPING: Cannot generate label ' . $ex->getMessage()); + } + } + + return $result; + } + + /** + * @param $sessionType + * @param array $parcels + * @param $sender + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1($sessionType, array $parcels, $sender): DpdServicesParamsV1 + { + $countryIsoCode = $this->commandBus->handle(new GetCountryIsoCode($sender->getCountryCode())); + + return (new DpdServicesParamsV1()) + ->withSession( + (new SessionDSPV1()) + ->withSessionType($sessionType) + ->withPackages((new PackageDSPV1())->withParcels($parcels)) + ) + ->withPickupAddress( + (new PickupAddressDSPV1()) + ->withCompany($sender->getCompany()) + ->withName($sender->getName()) + ->withAddress($sender->getStreet()) + ->withPostalCode($sender->getPostalCode()) + ->withCity($sender->getCity()) + ->withPhone($sender->getPhone()) + ->withEmail($sender->getEmail()) + ->withCountryCode($countryIsoCode) + ) + ->withPolicy('IGNORE_ERRORS'); + } + + /** + * @param array $waybills + * @return array + */ + public function getParcels(array $waybills): array + { + $parcels = []; + foreach ($waybills as $waybill) { + $parcels[] = (new ParcelDSPV1())->withWaybill($waybill); + } + + return $parcels; + } + + /** + * @param $shippingHistoryList + * @return array + */ + public function getWaybills($shippingHistoryList): array + { + $waybills = []; + foreach ($shippingHistoryList as $shippingHistory) { + foreach ($shippingHistory->getParcels() as $parcel) { + $waybills[] = $parcel->getWaybill(); + } + } + + return $waybills; + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetProtocol.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetProtocol.php new file mode 100644 index 00000000..bb80c3d6 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetProtocol.php @@ -0,0 +1,50 @@ +ids = $ids; + } + + /** + * @return array + */ + public function getIds(): array + { + return $this->ids; + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetProtocolHandler.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetProtocolHandler.php new file mode 100644 index 00000000..dd7f15f6 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetProtocolHandler.php @@ -0,0 +1,219 @@ +dpdApiService = $dpdApiService; + $this->dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + $this->commandBus = $commandBus; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(GetProtocol $query) + { + $status = 'OK'; + + $result = []; + $shippingHistoryGroupedByDeliveryZone = $this->dpdshippingShippingHistoryRepository + ->getShippingHistoryByIdsGroupByDeliveryZone($query->getIds()); + + $groupedHistories = $this->getGroupedBySender($shippingHistoryGroupedByDeliveryZone); + + foreach ($groupedHistories as $sessionType => $groupedBySender) { + foreach ($groupedBySender as $sender => $shippingHistoryList) { + try { + if (empty($shippingHistoryList)) { + continue; + } + + $sender = $shippingHistoryList[0]->getSender(); + $waybills = $this->getWaybills($shippingHistoryList); + $parcels = $this->getParcels($waybills); + $connectionId = $shippingHistoryList[0]->getIdConnection() ?? null; + $shopId = $shippingHistoryList[0]->getIdShop() ?? null; + + $dpdServicesParamsV1 = $this->getDpdServicesParamsV1($sessionType, $parcels, $sender); + $generateProtocolV2 = new GenerateProtocolV2($dpdServicesParamsV1, 'PDF', 'LBL_PRINTER', $this->dpdApiService->getAuth($shopId, $connectionId)); + + $call = $this->dpdApiService + ->getServicesClient($shopId, $connectionId) + ->generateProtocolV2($generateProtocolV2); + + if ($call->return->session->statusInfo->status == 'OK') { + $result[] = $call->return; + $this->dpdshippingShippingHistoryRepository->setProtocolDate($waybills, new DateTime()); + } else { + $status = 'SOME_ERROR'; + } + } catch (Exception $ex) { + $this->logger->error('DPDSHIPPING: Cannot generate label ' . $ex->getMessage()); + $status = 'SOME_ERROR'; + } + } + } + + return ['status' => $status, 'data' => $result]; + } + + /** + * @param array $shippingHistoryGroupedByDeliveryZone + * @return array + */ + public function getGroupedBySender(array $shippingHistoryGroupedByDeliveryZone): array + { + $groupedHistories = []; + foreach ($shippingHistoryGroupedByDeliveryZone as $zone => $histories) { + foreach ($histories as $entry) { + $sender = $this->getSenderKey($entry); + if (!isset($groupedHistories[$zone][$sender])) { + $groupedHistories[$zone][$sender] = []; + } + $groupedHistories[$zone][$sender][] = $entry; + } + } + + return $groupedHistories; + } + + /** + * @param $entry + * @return string + */ + public function getSenderKey($entry): string + { + return + $entry->getSender()->getCompany() . + $entry->getSender()->getName() . + $entry->getSender()->getStreet() . + $entry->getSender()->getPostalCode() . + $entry->getSender()->getCountryCode() . + $entry->getSender()->getCity() . + $entry->getSender()->getPhone() . + $entry->getSender()->getEmail(); + } + + /** + * @param $shippingHistoryList + * @return array + */ + public function getWaybills($shippingHistoryList): array + { + $waybills = []; + foreach ($shippingHistoryList as $shippingHistory) { + foreach ($shippingHistory->getParcels() as $parcel) { + $waybills[] = $parcel->getWaybill(); + } + } + + return $waybills; + } + + /** + * @param array $waybills + * @return array + */ + public function getParcels(array $waybills): array + { + $parcels = []; + foreach ($waybills as $waybill) { + $parcels[] = (new ParcelDSPV1())->withWaybill($waybill); + } + + return $parcels; + } + + /** + * @param $sessionType + * @param array $parcels + * @param $sender + * @return DpdServicesParamsV1 + */ + public function getDpdServicesParamsV1($sessionType, array $parcels, $sender): DpdServicesParamsV1 + { + $countryIsoCode = $this->commandBus->handle(new GetCountryIsoCode($sender->getCountryCode())); + + return (new DpdServicesParamsV1()) + ->withSession( + (new SessionDSPV1()) + ->withSessionType($sessionType) + ->withPackages((new PackageDSPV1())->withParcels($parcels)) + ) + ->withPickupAddress( + (new PickupAddressDSPV1()) + ->withCompany($sender->getCompany()) + ->withName($sender->getName()) + ->withAddress($sender->getStreet()) + ->withPostalCode($sender->getPostalCode()) + ->withCity($sender->getCity()) + ->withPhone($sender->getPhone()) + ->withEmail($sender->getEmail()) + ->withCountryCode($countryIsoCode) + ) + ->withPolicy('STOP_ON_FIRST_ERROR'); + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShipping.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShipping.php new file mode 100644 index 00000000..8f8ca9bf --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShipping.php @@ -0,0 +1,44 @@ +shippingHistoryId = $shippingHistoryId; + } + + public function getShippingHistoryId() + { + return $this->shippingHistoryId; + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingByOrderId.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingByOrderId.php new file mode 100644 index 00000000..a4dc9330 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingByOrderId.php @@ -0,0 +1,44 @@ +orderId = $orderId; + } + + public function getOrderId() + { + return $this->orderId; + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingByOrderIdHandler.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingByOrderIdHandler.php new file mode 100644 index 00000000..32d069d3 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingByOrderIdHandler.php @@ -0,0 +1,60 @@ +dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(GetShippingByOrderId $query) + { + return $this->dpdshippingShippingHistoryRepository->getLastShippingByOrderId($query->getOrderId()); + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingHandler.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingHandler.php new file mode 100644 index 00000000..66cf32b5 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/GetShippingHandler.php @@ -0,0 +1,60 @@ +dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(GetShipping $query) + { + return $this->dpdshippingShippingHistoryRepository->getShippingById($query->getShippingHistoryId()); + } +} diff --git a/modules/dpdshipping/src/Domain/ShippingHistory/Query/index.php b/modules/dpdshipping/src/Domain/ShippingHistory/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/ShippingHistory/Query/index.php @@ -0,0 +1,33 @@ +login = $login; + $this->password = $password; + $this->masterFid = $masterFid; + $this->environment = $environment; + } + + /** + * @return mixed + */ + public function getLogin() + { + return $this->login; + } + + /** + * @return mixed + */ + public function getPassword() + { + return $this->password; + } + + /** + * @return mixed + */ + public function getMasterFid() + { + return $this->masterFid; + } + + /** + * @return mixed + */ + public function getEnvironment() + { + return $this->environment; + } +} diff --git a/modules/dpdshipping/src/Domain/TestConnection/Query/TestDpdConnectionHandler.php b/modules/dpdshipping/src/Domain/TestConnection/Query/TestDpdConnectionHandler.php new file mode 100644 index 00000000..e337443d --- /dev/null +++ b/modules/dpdshipping/src/Domain/TestConnection/Query/TestDpdConnectionHandler.php @@ -0,0 +1,65 @@ +dpdApiService = $dpdApiService; + } + + public function handle(TestDpdConnection $query) + { + try { + $postalCode = (new PostalCodeV1()) + ->withCountryCode('PL') + ->withZipCode('02274'); + + $authData = (new AuthDataV1()) + ->withLogin($query->getLogin()) + ->withPassword($query->getPassword()) + ->withMasterFid($query->getMasterFid()); + + $call = $this->dpdApiService->getServicesClientEnv($query->getEnvironment())->findPostalCodeV1(new FindPostalCodeV1($postalCode, $authData)); + + return $call->return->status == 'OK'; + } catch (Exception $ex) { + return $ex->getMessage(); + } + } +} diff --git a/modules/dpdshipping/src/Domain/TestConnection/Query/index.php b/modules/dpdshipping/src/Domain/TestConnection/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/TestConnection/Query/index.php @@ -0,0 +1,33 @@ +shippingNumber = $shippingNumber; + $this->idShop = $idShop; + $this->idConnection = $idConnection; + } + + public function getShippingNumber() + { + return $this->shippingNumber; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + + /** + * @return mixed + */ + public function getIdConnection() + { + return $this->idConnection; + } +} diff --git a/modules/dpdshipping/src/Domain/Tracking/Query/GetEventsForWaybillHandler.php b/modules/dpdshipping/src/Domain/Tracking/Query/GetEventsForWaybillHandler.php new file mode 100644 index 00000000..1b268017 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Tracking/Query/GetEventsForWaybillHandler.php @@ -0,0 +1,121 @@ +dpdApiService = $dpdApiService; + $this->dpdshippingShippingHistoryRepository = $dpdshippingShippingHistoryRepository; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(GetEventsForWaybill $query): array + { + try { + $shippingNumber = $query->getShippingNumber(); + + if ($shippingNumber == null) { + return []; + } + + $response = $this->dpdApiService + ->getInfoServicesClient() + ->getEventsForWaybillV1( + new GetEventsForWaybillV1( + $shippingNumber, + GetEventsForWaybillHandler::EVENT_SELECT_ALL, + Config::PL_CONST, + $this->dpdApiService->getAuthInfoServices($query->getIdShop(), $query->getIdConnection()) + ) + ); + + $mappedData = []; + + if ($response->return !== null && $response->return->eventsList != null) { + if (is_array($response->return->eventsList)) { + foreach ($response->return->eventsList as $event) { + $eventData = [ + 'state' => $event->description, + 'dateTime' => $event->eventTime, + ]; + $mappedData[] = $eventData; + } + } else { + $eventData = [ + 'state' => $response->return->eventsList->description, + 'dateTime' => $response->return->eventsList->eventTime, + ]; + $mappedData[] = $eventData; + } + } + $this->dpdshippingShippingHistoryRepository->setStatus($shippingNumber, $mappedData); + $shippingResult[] = [ + 'shippingNumber' => $shippingNumber, + 'states' => $mappedData, + ]; + } catch (TypeError $e) { + $this->logger->error('DPDSHIPPING: Cannot get tracking ' . $e->getMessage()); + $shippingResult[] = [ + 'shippingNumber' => $shippingNumber, + 'states' => [], + ]; + } catch (Exception $e) { + $this->logger->error('DPDSHIPPING: Cannot get tracking ' . $e->getMessage()); + $shippingResult[] = [ + 'shippingNumber' => $shippingNumber, + 'states' => [], + ]; + } + + return $shippingResult; + } +} diff --git a/modules/dpdshipping/src/Domain/Tracking/Query/GetShippingListForOrder.php b/modules/dpdshipping/src/Domain/Tracking/Query/GetShippingListForOrder.php new file mode 100644 index 00000000..c703192c --- /dev/null +++ b/modules/dpdshipping/src/Domain/Tracking/Query/GetShippingListForOrder.php @@ -0,0 +1,47 @@ +idOrder = $idOrder; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } +} diff --git a/modules/dpdshipping/src/Domain/Tracking/Query/GetShippingListForOrderHandler.php b/modules/dpdshipping/src/Domain/Tracking/Query/GetShippingListForOrderHandler.php new file mode 100644 index 00000000..7f89c176 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Tracking/Query/GetShippingListForOrderHandler.php @@ -0,0 +1,57 @@ +dpdshippingShippingHistoryParcelRepository = $dpdshippingShippingHistoryParcelRepository; + } + + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + + public function handle(GetShippingListForOrder $getShippingListForOrder): array + { + return $this->dpdshippingShippingHistoryParcelRepository->getWaybillsForOrderId($getShippingListForOrder->getIdOrder()); + } +} diff --git a/modules/dpdshipping/src/Domain/Tracking/Query/index.php b/modules/dpdshipping/src/Domain/Tracking/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Tracking/Query/index.php @@ -0,0 +1,33 @@ +queryBus = $queryBus; + } + + public function getTrackingInformation($orderId): array + { + $shippingNumbers = $this->queryBus->handle(new GetShippingListForOrder($orderId)); + + if (empty($shippingNumbers)) { + return []; + } + + $shippingResult = []; + foreach ($shippingNumbers as $shippingNumber) { + $tracking = $this->queryBus->handle(new GetEventsForWaybill($shippingNumber['waybill'], $shippingNumber['id_shop'], $shippingNumber['id_connection'])); + $shippingResult = array_merge($shippingResult, $tracking); + } + + return $shippingResult; + } +} diff --git a/modules/dpdshipping/src/Domain/Tracking/index.php b/modules/dpdshipping/src/Domain/Tracking/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Domain/Tracking/index.php @@ -0,0 +1,33 @@ +id; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + + return $this; + } + + public function getIdCarrier(): ?int + { + return $this->idCarrier; + } + + public function setIdCarrier(int $idCarrier): self + { + $this->idCarrier = $idCarrier; + + return $this; + } + + public function getType(): ?string + { + return $this->type; + } + + public function setType(string $type): self + { + $this->type = $type; + + return $this; + } + + public function isActive(): ?bool + { + return $this->active; + } + + public function setActive(bool $active): self + { + $this->active = $active; + + return $this; + } + + public function getDateAdd(): ?DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingCarrierPickup.php b/modules/dpdshipping/src/Entity/DpdshippingCarrierPickup.php new file mode 100644 index 00000000..22f74381 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingCarrierPickup.php @@ -0,0 +1,153 @@ +id; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + + return $this; + } + + public function getIdDpdshippingCarrier(): ?int + { + return $this->idDpdshippingCarrier; + } + + public function setIdDpdshippingCarrier(int $idDpdshippingCarrier): self + { + $this->idDpdshippingCarrier = $idDpdshippingCarrier; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + public function getValue(): ?string + { + return $this->value; + } + + public function setValue(string $value): self + { + $this->value = $value; + + return $this; + } + + public function getDateAdd(): ?DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingCartPickup.php b/modules/dpdshipping/src/Entity/DpdshippingCartPickup.php new file mode 100644 index 00000000..c4029693 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingCartPickup.php @@ -0,0 +1,138 @@ +id; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + + return $this; + } + + public function getIdCart(): ?int + { + return $this->idCart; + } + + public function setIdCart(int $idCart): self + { + $this->idCart = $idCart; + + return $this; + } + + public function getPudoCode(): ?string + { + return $this->pudoCode; + } + + public function setPudoCode(string $pudoCode): self + { + $this->pudoCode = $pudoCode; + + return $this; + } + + public function getDateAdd(): ?DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingConfiguration.php b/modules/dpdshipping/src/Entity/DpdshippingConfiguration.php new file mode 100644 index 00000000..3529b81c --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingConfiguration.php @@ -0,0 +1,138 @@ +id; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + public function getValue(): ?string + { + return $this->value; + } + + public function setValue(string $value): self + { + $this->value = $value; + + return $this; + } + + public function getDateAdd(): ?DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingConnection.php b/modules/dpdshipping/src/Entity/DpdshippingConnection.php new file mode 100644 index 00000000..8c9b3860 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingConnection.php @@ -0,0 +1,203 @@ +id; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(?string $name): self + { + $this->name = $name; + + return $this; + } + + public function getLogin(): ?string + { + return $this->login; + } + + public function setLogin(?string $login): self + { + $this->login = $login; + + return $this; + } + + public function getPassword(): ?string + { + return $this->password; + } + + public function setPassword(?string $password): self + { + $this->password = $password; + + return $this; + } + + public function getMasterFid(): ?string + { + return $this->masterFid; + } + + public function setMasterFid(?string $masterFid): self + { + $this->masterFid = $masterFid; + + return $this; + } + + public function getEnvironment(): ?string + { + return $this->environment; + } + + public function setEnvironment(?string $environment): self + { + $this->environment = $environment; + + return $this; + } + + public function isDefault(): bool + { + return (bool) $this->isDefault; + } + + public function setDefault(bool $default): self + { + $this->isDefault = $default; + + return $this; + } + + public function getDateAdd(): ?DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} \ No newline at end of file diff --git a/modules/dpdshipping/src/Entity/DpdshippingPayer.php b/modules/dpdshipping/src/Entity/DpdshippingPayer.php new file mode 100644 index 00000000..928aeddb --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingPayer.php @@ -0,0 +1,169 @@ +id; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + + return $this; + } + public function getIdConnection(): ?int + { + return $this->idConnection; + } + + public function setIdConnection(int $idConnection): self + { + $this->idConnection = $idConnection; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self + { + $this->name = $name; + + return $this; + } + + public function getFid(): ?string + { + return $this->fid; + } + + public function setFid(string $fid): self + { + $this->fid = $fid; + + return $this; + } + + public function isDefault(): ?bool + { + return $this->isDefault; + } + + public function setDefault(bool $default): self + { + $this->isDefault = $default; + + return $this; + } + + public function getDateAdd(): ?DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingPickupCourier.php b/modules/dpdshipping/src/Entity/DpdshippingPickupCourier.php new file mode 100644 index 00000000..c5a44f97 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingPickupCourier.php @@ -0,0 +1,664 @@ +id; + } + + public function getStatus(): ?string + { + return $this->status; + } + + public function setStatus(string $status): self + { + $this->status = $status; + + return $this; + } + + public function getOrderNumber(): ?string + { + return $this->orderNumber; + } + + public function setOrderNumber(?string $orderNumber): self + { + $this->orderNumber = $orderNumber; + + return $this; + } + + public function getChecksum(): ?string + { + return $this->checksum; + } + + public function setChecksum(?string $checksum): self + { + $this->checksum = $checksum; + + return $this; + } + + public function getOperationType(): ?string + { + return $this->operationType; + } + + public function setOperationType(string $operationType): self + { + $this->operationType = $operationType; + + return $this; + } + + public function getOrderType(): ?string + { + return $this->orderType; + } + + public function setOrderType(string $orderType): self + { + $this->orderType = $orderType; + + return $this; + } + + public function getPickupDate(): ?\DateTimeInterface + { + return $this->pickupDate; + } + + public function setPickupDate(\DateTimeInterface $pickupDate): self + { + $this->pickupDate = $pickupDate; + + return $this; + } + + public function getPickupTimeFrom(): ?string + { + return $this->pickupTimeFrom; + } + + public function setPickupTimeFrom(string $pickupTimeFrom): self + { + $this->pickupTimeFrom = $pickupTimeFrom; + + return $this; + } + + public function getPickupTimeTo(): ?string + { + return $this->pickupTimeTo; + } + + public function setPickupTimeTo(string $pickupTimeTo): self + { + $this->pickupTimeTo = $pickupTimeTo; + + return $this; + } + + public function getCustomerFullName(): ?string + { + return $this->customerFullName; + } + + public function setCustomerFullName(?string $customerFullName): self + { + $this->customerFullName = $customerFullName; + + return $this; + } + + public function getCustomerName(): ?string + { + return $this->customerName; + } + + public function setCustomerName(?string $customerName): self + { + $this->customerName = $customerName; + + return $this; + } + + public function getCustomerPhone(): ?string + { + return $this->customerPhone; + } + + public function setCustomerPhone(?string $customerPhone): self + { + $this->customerPhone = $customerPhone; + + return $this; + } + + public function getPayerNumber(): ?int + { + return $this->payerNumber; + } + + public function setPayerNumber(?int $payerNumber): self + { + $this->payerNumber = $payerNumber; + + return $this; + } + + public function getPayerName(): ?string + { + return $this->payerName; + } + + public function setPayerName(?string $payerName): self + { + $this->payerName = $payerName; + + return $this; + } + + public function getSenderAddress(): ?string + { + return $this->senderAddress; + } + + public function setSenderAddress(?string $senderAddress): self + { + $this->senderAddress = $senderAddress; + + return $this; + } + + public function getSenderCity(): ?string + { + return $this->senderCity; + } + + public function setSenderCity(?string $senderCity): self + { + $this->senderCity = $senderCity; + + return $this; + } + + public function getSenderFullName(): ?string + { + return $this->senderFullName; + } + + public function setSenderFullName(?string $senderFullName): self + { + $this->senderFullName = $senderFullName; + + return $this; + } + + public function getSenderName(): ?string + { + return $this->senderName; + } + + public function setSenderName(?string $senderName): self + { + $this->senderName = $senderName; + + return $this; + } + + public function getSenderPhone(): ?string + { + return $this->senderPhone; + } + + public function setSenderPhone(?string $senderPhone): self + { + $this->senderPhone = $senderPhone; + + return $this; + } + + public function getSenderPostalCode(): ?string + { + return $this->senderPostalCode; + } + + public function setSenderPostalCode(?string $senderPostalCode): self + { + $this->senderPostalCode = $senderPostalCode; + + return $this; + } + + public function getSenderCountryCode(): ?string + { + return $this->senderCountryCode; + } + + public function setSenderCountryCode(?string $senderCountryCode): self + { + $this->senderCountryCode = $senderCountryCode; + + return $this; + } + + public function getDox(): ?bool + { + return $this->dox; + } + + public function setDox(bool $dox): self + { + $this->dox = $dox; + + return $this; + } + + public function getDoxCount(): ?int + { + return $this->doxCount; + } + + public function setDoxCount(int $doxCount): self + { + $this->doxCount = $doxCount; + + return $this; + } + + public function getPallet(): ?bool + { + return $this->pallet; + } + + public function setPallet(bool $pallet): self + { + $this->pallet = $pallet; + + return $this; + } + + public function getPalletMaxHeight(): ?string + { + return $this->palletMaxHeight; + } + + public function setPalletMaxHeight(?string $palletMaxHeight): self + { + $this->palletMaxHeight = $palletMaxHeight; + + return $this; + } + + public function getPalletMaxWeight(): ?string + { + return $this->palletMaxWeight; + } + + public function setPalletMaxWeight(?string $palletMaxWeight): self + { + $this->palletMaxWeight = $palletMaxWeight; + + return $this; + } + + public function getPalletsCount(): ?int + { + return $this->palletsCount; + } + + public function setPalletsCount(int $palletsCount): self + { + $this->palletsCount = $palletsCount; + + return $this; + } + + public function getPalletsWeight(): ?string + { + return $this->palletsWeight; + } + + public function setPalletsWeight(?string $palletsWeight): self + { + $this->palletsWeight = $palletsWeight; + + return $this; + } + + public function getStandardParcel(): ?bool + { + return $this->standardParcel; + } + + public function setStandardParcel(bool $standardParcel): self + { + $this->standardParcel = $standardParcel; + + return $this; + } + + public function getParcelMaxDepth(): ?int + { + return $this->parcelMaxDepth; + } + + public function setParcelMaxDepth(?int $parcelMaxDepth): self + { + $this->parcelMaxDepth = $parcelMaxDepth; + + return $this; + } + + public function getParcelMaxHeight(): ?int + { + return $this->parcelMaxHeight; + } + + public function setParcelMaxHeight(?int $parcelMaxHeight): self + { + $this->parcelMaxHeight = $parcelMaxHeight; + + return $this; + } + + public function getParcelMaxWeight(): ?string + { + return $this->parcelMaxWeight; + } + + public function setParcelMaxWeight(?string $parcelMaxWeight): self + { + $this->parcelMaxWeight = $parcelMaxWeight; + + return $this; + } + + public function getParcelMaxWidth(): ?int + { + return $this->parcelMaxWidth; + } + + public function setParcelMaxWidth(?int $parcelMaxWidth): self + { + $this->parcelMaxWidth = $parcelMaxWidth; + + return $this; + } + + public function getParcelsCount(): ?int + { + return $this->parcelsCount; + } + + public function setParcelsCount(int $parcelsCount): self + { + $this->parcelsCount = $parcelsCount; + + return $this; + } + + public function getParcelsWeight(): ?string + { + return $this->parcelsWeight; + } + + public function setParcelsWeight(?string $parcelsWeight): self + { + $this->parcelsWeight = $parcelsWeight; + + return $this; + } + + public function getDateAdd(): ?\DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(\DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?\DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(\DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingPickupCourierSettings.php b/modules/dpdshipping/src/Entity/DpdshippingPickupCourierSettings.php new file mode 100644 index 00000000..9e88d357 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingPickupCourierSettings.php @@ -0,0 +1,282 @@ +id = $id; + return $this; + } + + public function getId(): ?int + { + return $this->id; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + return $this; + } + + public function getCustomerFullName(): ?string + { + return $this->customerFullName; + } + + public function setCustomerFullName(?string $customerFullName): self + { + $this->customerFullName = $customerFullName; + return $this; + } + + public function getCustomerName(): ?string + { + return $this->customerName; + } + + public function setCustomerName(?string $customerName): self + { + $this->customerName = $customerName; + return $this; + } + + public function getCustomerPhone(): ?string + { + return $this->customerPhone; + } + + public function setCustomerPhone(?string $customerPhone): self + { + $this->customerPhone = $customerPhone; + return $this; + } + + public function getPayerNumber(): ?int + { + return $this->payerNumber; + } + + public function setPayerNumber(?int $payerNumber): self + { + $this->payerNumber = $payerNumber; + return $this; + } + + public function getSenderAddress(): ?string + { + return $this->senderAddress; + } + + public function setSenderAddress(?string $senderAddress): self + { + $this->senderAddress = $senderAddress; + return $this; + } + + public function getSenderCity(): ?string + { + return $this->senderCity; + } + + public function setSenderCity(?string $senderCity): self + { + $this->senderCity = $senderCity; + return $this; + } + + public function getSenderFullName(): ?string + { + return $this->senderFullName; + } + + public function setSenderFullName(?string $senderFullName): self + { + $this->senderFullName = $senderFullName; + return $this; + } + + public function getSenderName(): ?string + { + return $this->senderName; + } + + public function setSenderName(?string $senderName): self + { + $this->senderName = $senderName; + return $this; + } + + public function getSenderPhone(): ?string + { + return $this->senderPhone; + } + + public function setSenderPhone(?string $senderPhone): self + { + $this->senderPhone = $senderPhone; + return $this; + } + + public function getSenderPostalCode(): ?string + { + return $this->senderPostalCode; + } + + public function setSenderPostalCode(?string $senderPostalCode): self + { + $this->senderPostalCode = $senderPostalCode; + return $this; + } + + public function getSenderCountryCode(): ?string + { + return $this->senderCountryCode; + } + + public function setSenderCountryCode(?string $senderCountryCode): self + { + $this->senderCountryCode = $senderCountryCode; + return $this; + } + + public function getDateAdd(): ?\DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(\DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + return $this; + } + + public function getDateUpd(): ?\DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(\DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + return $this; + } + +} \ No newline at end of file diff --git a/modules/dpdshipping/src/Entity/DpdshippingSenderAddress.php b/modules/dpdshipping/src/Entity/DpdshippingSenderAddress.php new file mode 100644 index 00000000..3e8b8e4c --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingSenderAddress.php @@ -0,0 +1,279 @@ +id; + } + + public function setId(int $id): self + { + $this->id = $id; + + return $this; + } + + public function getIdShop(): ?int + { + return $this->idShop; + } + + public function setIdShop(int $idShop): self + { + $this->idShop = $idShop; + + return $this; + } + + public function getAlias(): ?string + { + return $this->alias; + } + + public function setAlias(?string $alias): self + { + $this->alias = $alias; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(?string $name): self + { + $this->name = $name; + + return $this; + } + + public function getCompany(): ?string + { + return $this->company; + } + + public function setCompany(?string $company): self + { + $this->company = $company; + + return $this; + } + + public function getStreet(): ?string + { + return $this->street; + } + + public function setStreet(?string $street): self + { + $this->street = $street; + + return $this; + } + + public function getPostalCode(): ?string + { + return $this->postalCode; + } + + public function setPostalCode(?string $postalCode): self + { + $this->postalCode = $postalCode; + + return $this; + } + + public function getCountryCode(): ?string + { + return $this->countryCode; + } + + public function setCountryCode(?string $countryCode): self + { + $this->countryCode = $countryCode; + + return $this; + } + + public function getCity(): ?string + { + return $this->city; + } + + public function setCity(?string $city): self + { + $this->city = $city; + + return $this; + } + + public function getPhone(): ?string + { + return $this->phone; + } + + public function setPhone(?string $phone): self + { + $this->phone = $phone; + + return $this; + } + + public function getMail(): ?string + { + return $this->email; + } + + public function setMail(?string $email): self + { + $this->email = $email; + + return $this; + } + + public function isDefault(): ?bool + { + return $this->isDefault; + } + + public function setIsDefault(?bool $isDefault): self + { + $this->isDefault = $isDefault; + + return $this; + } + + public function getDateAdd(): ?DateTimeInterface + { + return $this->dateAdd; + } + + public function setDateAdd(DateTimeInterface $dateAdd): self + { + $this->dateAdd = $dateAdd; + + return $this; + } + + public function getDateUpd(): ?DateTimeInterface + { + return $this->dateUpd; + } + + public function setDateUpd(DateTimeInterface $dateUpd): self + { + $this->dateUpd = $dateUpd; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingShippingHistory.php b/modules/dpdshipping/src/Entity/DpdshippingShippingHistory.php new file mode 100644 index 00000000..e9e57286 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingShippingHistory.php @@ -0,0 +1,573 @@ +id; + } + + /** + * @return mixed + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param mixed $reference + */ + public function setReference($reference): void + { + $this->reference = $reference; + } + + /** + * @return mixed + */ + public function getSender() + { + return $this->sender; + } + + /** + * @param mixed $sender + */ + public function setSender($sender): void + { + $this->sender = $sender; + } + + /** + * @return mixed + */ + public function getReceiver() + { + return $this->receiver; + } + + /** + * @param mixed $receiver + */ + public function setReceiver($receiver): void + { + $this->receiver = $receiver; + } + + /** + * @return mixed + */ + public function getServices() + { + return $this->services; + } + + /** + * @param mixed $services + */ + public function setServices($services): void + { + $this->services = $services; + } + + /** + * @return mixed + */ + public function getShippingDate() + { + return $this->shippingDate; + } + + /** + * @param mixed $shippingDate + */ + public function setShippingDate($shippingDate): void + { + $this->shippingDate = $shippingDate; + } + + /** + * @return mixed + */ + public function getLabelDate() + { + return $this->labelDate; + } + + /** + * @param mixed $labelDate + */ + public function setLabelDate($labelDate): void + { + $this->labelDate = $labelDate; + } + + /** + * @return mixed + */ + public function getProtocolNumber() + { + return $this->protocolNumber; + } + + /** + * @param mixed $protocolNumber + */ + public function setProtocolNumber($protocolNumber): void + { + $this->protocolNumber = $protocolNumber; + } + + /** + * @return mixed + */ + public function getProtocolDate() + { + return $this->protocolDate; + } + + /** + * @param mixed $protocolDate + */ + public function setProtocolDate($protocolDate): void + { + $this->protocolDate = $protocolDate; + } + + /** + * @return mixed + */ + public function getDeliveryZone() + { + return $this->deliveryZone; + } + + /** + * @param mixed $deliveryZone + */ + public function setDeliveryZone($deliveryZone): void + { + $this->deliveryZone = $deliveryZone; + } + + /** + * @return mixed + */ + public function getFid() + { + return $this->fid; + } + + /** + * @param mixed $fid + */ + public function setFid($fid): void + { + $this->fid = $fid; + } + + /** + * @return mixed + */ + public function getPayerType() + { + return $this->payerType; + } + + /** + * @param mixed $payerType + */ + public function setPayerType($payerType): void + { + $this->payerType = $payerType; + } + + /** + * @return mixed + */ + public function getRef1() + { + return $this->ref1; + } + + /** + * @param mixed $ref1 + */ + public function setRef1($ref1): void + { + $this->ref1 = $ref1; + } + + /** + * @return mixed + */ + public function getRef2() + { + return $this->ref2; + } + + /** + * @param mixed $ref2 + */ + public function setRef2($ref2): void + { + $this->ref2 = $ref2; + } + + /** + * @return mixed + */ + public function getIsDeleted() + { + return $this->isDeleted; + } + + /** + * @param mixed $isDeleted + */ + public function setIsDeleted($isDeleted): void + { + $this->isDeleted = $isDeleted; + } + + /** + * @return mixed + */ + public function getLastStatus() + { + return $this->lastStatus; + } + + /** + * @param mixed $lastStatus + */ + public function setLastStatus($lastStatus): void + { + $this->lastStatus = $lastStatus; + } + + /** + * @return mixed + */ + public function getReturnLabel() + { + return $this->returnLabel; + } + + /** + * @param mixed $returnLabel + */ + public function setReturnLabel($returnLabel): void + { + $this->returnLabel = $returnLabel; + } + + /** + * @return mixed + */ + public function getReturnLabelWaybill() + { + return $this->returnLabelWaybill; + } + + /** + * @param mixed $returnLabelWaybill + */ + public function setReturnLabelWaybill($returnLabelWaybill): void + { + $this->returnLabelWaybill = $returnLabelWaybill; + } + + /** + * @return mixed + */ + public function getIsDelivered() + { + return $this->isDelivered; + } + + /** + * @param mixed $isDelivered + */ + public function setIsDelivered($isDelivered): void + { + $this->isDelivered = $isDelivered; + } + + /** + * @return mixed + */ + public function getDateAdd() + { + return $this->dateAdd; + } + + /** + * @param mixed $dateAdd + */ + public function setDateAdd($dateAdd): void + { + $this->dateAdd = $dateAdd; + } + + /** + * @return mixed + */ + public function getDateModify() + { + return $this->dateModify; + } + + /** + * @param mixed $dateModify + */ + public function setDateModify($dateModify): void + { + $this->dateModify = $dateModify; + } + + /** + * @return mixed + */ + public function getIdOrder() + { + return $this->idOrder; + } + + /** + * @param mixed $idOrder + */ + public function setIdOrder($idOrder): void + { + $this->idOrder = $idOrder; + } + + /** + * @return mixed + */ + public function getCarrierName() + { + return $this->carrierName; + } + + /** + * @param mixed $carrierName + */ + public function setCarrierName($carrierName): void + { + $this->carrierName = $carrierName; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + + /** + * @param mixed $idShop + */ + public function setIdShop($idShop): void + { + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getParcels() + { + return $this->parcels; + } + + /** + * @return mixed + */ + public function getIdConnection() + { + return $this->idConnection; + } + + /** + * @param mixed $idConnection + */ + public function setIdConnection($idConnection): void + { + $this->idConnection = $idConnection; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryParcel.php b/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryParcel.php new file mode 100644 index 00000000..3d28f588 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryParcel.php @@ -0,0 +1,328 @@ +id; + } + + /** + * @return mixed + */ + public function getShippingHistory() + { + return $this->shippingHistory; + } + + /** + * @param mixed $shippingHistory + */ + public function setShippingHistory($shippingHistory): void + { + $this->shippingHistory = $shippingHistory; + } + + /** + * @return mixed + */ + public function getParcelIndex() + { + return $this->parcelIndex; + } + + /** + * @param mixed $index + */ + public function setParcelIndex($parcelIndex): void + { + $this->parcelIndex = $parcelIndex; + } + + /** + * @return mixed + */ + public function getWaybill() + { + return $this->waybill; + } + + /** + * @param mixed $waybill + */ + public function setWaybill($waybill): void + { + $this->waybill = $waybill; + } + + /** + * @return mixed + */ + public function getIsMainWaybill() + { + return $this->isMainWaybill; + } + + /** + * @param mixed $isMainWaybill + */ + public function setIsMainWaybill($isMainWaybill): void + { + $this->isMainWaybill = $isMainWaybill; + } + + /** + * @return mixed + */ + public function getParentWaybill() + { + return $this->parentWaybill; + } + + /** + * @param mixed $parentWaybill + */ + public function setParentWaybill($parentWaybill): void + { + $this->parentWaybill = $parentWaybill; + } + + /** + * @return mixed + */ + public function getReturnLabel() + { + return $this->returnLabel; + } + + /** + * @param mixed $returnLabel + */ + public function setReturnLabel($returnLabel): void + { + $this->returnLabel = $returnLabel; + } + + /** + * @return mixed + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param mixed $weight + */ + public function setWeight($weight): void + { + $this->weight = $weight; + } + + /** + * @return mixed + */ + public function getWeightAdr() + { + return $this->weightAdr; + } + + /** + * @param mixed $weightAdr + */ + public function setWeightAdr($weightAdr): void + { + $this->weightAdr = $weightAdr; + } + + /** + * @return mixed + */ + public function getContent() + { + return $this->content; + } + + /** + * @param mixed $content + */ + public function setContent($content): void + { + $this->content = $content; + } + + /** + * @return mixed + */ + public function getCustomerData() + { + return $this->customerData; + } + + /** + * @param mixed $customerData + */ + public function setCustomerData($customerData): void + { + $this->customerData = $customerData; + } + + /** + * @return mixed + */ + public function getSizeX() + { + return $this->sizeX; + } + + /** + * @param mixed $sizeX + */ + public function setSizeX($sizeX): void + { + $this->sizeX = $sizeX; + } + + /** + * @return mixed + */ + public function getSizeY() + { + return $this->sizeY; + } + + /** + * @param mixed $sizeY + */ + public function setSizeY($sizeY): void + { + $this->sizeY = $sizeY; + } + + /** + * @return mixed + */ + public function getSizeZ() + { + return $this->sizeZ; + } + + /** + * @param mixed $sizeZ + */ + public function setSizeZ($sizeZ): void + { + $this->sizeZ = $sizeZ; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryReceiver.php b/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryReceiver.php new file mode 100644 index 00000000..f17515f6 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryReceiver.php @@ -0,0 +1,203 @@ +id; + } + + public function getAddressId(): ?int + { + return $this->addressId; + } + + public function setAddressId(?int $addressId): self + { + $this->addressId = $addressId; + + return $this; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(?string $name): self + { + $this->name = $name; + + return $this; + } + + public function getCompany(): ?string + { + return $this->company; + } + + public function setCompany(?string $company): self + { + $this->company = $company; + + return $this; + } + + public function getStreet(): ?string + { + return $this->street; + } + + public function setStreet(?string $street): self + { + $this->street = $street; + + return $this; + } + + public function getPostalCode(): ?string + { + return $this->postalCode; + } + + public function setPostalCode(?string $postalCode): self + { + $this->postalCode = $postalCode; + + return $this; + } + + public function getCountryCode(): ?string + { + return $this->countryCode; + } + + public function setCountryCode(?string $countryCode): self + { + $this->countryCode = $countryCode; + + return $this; + } + + public function getCity(): ?string + { + return $this->city; + } + + public function setCity(?string $city): self + { + $this->city = $city; + + return $this; + } + + public function getPhone(): ?string + { + return $this->phone; + } + + public function setPhone(?string $phone): self + { + $this->phone = $phone; + + return $this; + } + + public function getEmail(): ?string + { + return $this->email; + } + + public function setEmail(?string $email): self + { + $this->email = $email; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingShippingHistorySender.php b/modules/dpdshipping/src/Entity/DpdshippingShippingHistorySender.php new file mode 100644 index 00000000..4950b36c --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingShippingHistorySender.php @@ -0,0 +1,186 @@ +id; + } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(?string $name): self + { + $this->name = $name; + + return $this; + } + + public function getCompany(): ?string + { + return $this->company; + } + + public function setCompany(?string $company): self + { + $this->company = $company; + + return $this; + } + + public function getStreet(): ?string + { + return $this->street; + } + + public function setStreet(?string $street): self + { + $this->street = $street; + + return $this; + } + + public function getPostalCode(): ?string + { + return $this->postalCode; + } + + public function setPostalCode(?string $postalCode): self + { + $this->postalCode = $postalCode; + + return $this; + } + + public function getCountryCode(): ?string + { + return $this->countryCode; + } + + public function setCountryCode(?string $countryCode): self + { + $this->countryCode = $countryCode; + + return $this; + } + + public function getCity(): ?string + { + return $this->city; + } + + public function setCity(?string $city): self + { + $this->city = $city; + + return $this; + } + + public function getPhone(): ?string + { + return $this->phone; + } + + public function setPhone(?string $phone): self + { + $this->phone = $phone; + + return $this; + } + + public function getEmail(): ?string + { + return $this->email; + } + + public function setEmail(?string $email): self + { + $this->email = $email; + + return $this; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryServices.php b/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryServices.php new file mode 100644 index 00000000..3ce57b8d --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingShippingHistoryServices.php @@ -0,0 +1,869 @@ +id; + } + + /** + * @return mixed + */ + public function getIsCod() + { + return $this->isCod; + } + + /** + * @param mixed $isCod + */ + public function setIsCod($isCod): void + { + $this->isCod = $isCod; + } + + /** + * @return mixed + */ + public function getCodAmount() + { + return $this->codAmount; + } + + /** + * @param mixed $codAmount + */ + public function setCodAmount($codAmount): void + { + $this->codAmount = $codAmount; + } + + /** + * @return mixed + */ + public function getCodCurrency() + { + return $this->codCurrency; + } + + /** + * @param mixed $codCurrency + */ + public function setCodCurrency($codCurrency): void + { + $this->codCurrency = $codCurrency; + } + + /** + * @return mixed + */ + public function getIsGuarantee() + { + return $this->isGuarantee; + } + + /** + * @param mixed $isGuarantee + */ + public function setIsGuarantee($isGuarantee): void + { + $this->isGuarantee = $isGuarantee; + } + + /** + * @return mixed + */ + public function getGuaranteeType() + { + return $this->guaranteeType; + } + + /** + * @param mixed $guaranteeType + */ + public function setGuaranteeType($guaranteeType): void + { + $this->guaranteeType = $guaranteeType; + } + + /** + * @return mixed + */ + public function getGuaranteeValue() + { + return $this->guaranteeValue; + } + + /** + * @param mixed $guaranteeValue + */ + public function setGuaranteeValue($guaranteeValue): void + { + $this->guaranteeValue = $guaranteeValue; + } + + /** + * @return mixed + */ + public function getIsPallet() + { + return $this->isPallet; + } + + /** + * @param mixed $isPallet + */ + public function setIsPallet($isPallet): void + { + $this->isPallet = $isPallet; + } + + /** + * @return mixed + */ + public function getIsTires() + { + return $this->isTires; + } + + /** + * @param mixed $isTires + */ + public function setIsTires($isTires): void + { + $this->isTires = $isTires; + } + + /** + * @return mixed + */ + public function getIsDeclaredValue() + { + return $this->isDeclaredValue; + } + + /** + * @param mixed $isDeclaredValue + */ + public function setIsDeclaredValue($isDeclaredValue): void + { + $this->isDeclaredValue = $isDeclaredValue; + } + + /** + * @return mixed + */ + public function getDeclaredValueAmount() + { + return $this->declaredValueAmount; + } + + /** + * @param mixed $declaredValueAmount + */ + public function setDeclaredValueAmount($declaredValueAmount): void + { + $this->declaredValueAmount = $declaredValueAmount; + } + + /** + * @return mixed + */ + public function getDeclaredValueCurrency() + { + return $this->declaredValueCurrency; + } + + /** + * @param mixed $declaredValueCurrency + */ + public function setDeclaredValueCurrency($declaredValueCurrency): void + { + $this->declaredValueCurrency = $declaredValueCurrency; + } + + /** + * @return mixed + */ + public function getIsCud() + { + return $this->isCud; + } + + /** + * @param mixed $isCud + */ + public function setIsCud($isCud): void + { + $this->isCud = $isCud; + } + + /** + * @return mixed + */ + public function getIsDox() + { + return $this->isDox; + } + + /** + * @param mixed $isDox + */ + public function setIsDox($isDox): void + { + $this->isDox = $isDox; + } + + /** + * @return mixed + */ + public function getIsDuty() + { + return $this->isDuty; + } + + /** + * @param mixed $isDuty + */ + public function setIsDuty($isDuty): void + { + $this->isDuty = $isDuty; + } + + /** + * @return mixed + */ + public function getDutyAmount() + { + return $this->dutyAmount; + } + + /** + * @param mixed $dutyAmount + */ + public function setDutyAmount($dutyAmount): void + { + $this->dutyAmount = $dutyAmount; + } + + /** + * @return mixed + */ + public function getDutyCurrency() + { + return $this->dutyCurrency; + } + + /** + * @param mixed $dutyCurrency + */ + public function setDutyCurrency($dutyCurrency): void + { + $this->dutyCurrency = $dutyCurrency; + } + + /** + * @return mixed + */ + public function getIsRod() + { + return $this->isRod; + } + + /** + * @param mixed $isRod + */ + public function setIsRod($isRod): void + { + $this->isRod = $isRod; + } + + /** + * @return mixed + */ + public function getIsDedicatedDelivery() + { + return $this->isDedicatedDelivery; + } + + /** + * @param mixed $isDedicatedDelivery + */ + public function setIsDedicatedDelivery($isDedicatedDelivery): void + { + $this->isDedicatedDelivery = $isDedicatedDelivery; + } + + /** + * @return mixed + */ + public function getIsDpdExpress() + { + return $this->isDpdExpress; + } + + /** + * @param mixed $isDpdExpress + */ + public function setIsDpdExpress($isDpdExpress): void + { + $this->isDpdExpress = $isDpdExpress; + } + + /** + * @return mixed + */ + public function getIsDpdFood() + { + return $this->isDpdFood; + } + + /** + * @param mixed $isDpdFood + */ + public function setIsDpdFood($isDpdFood): void + { + $this->isDpdFood = $isDpdFood; + } + + /** + * @return mixed + */ + public function getIsCarryIn() + { + return $this->isCarryIn; + } + + /** + * @param mixed $isCarryIn + */ + public function setIsCarryIn($isCarryIn): void + { + $this->isCarryIn = $isCarryIn; + } + + /** + * @return mixed + */ + public function getIsDpdPickup() + { + return $this->isDpdPickup; + } + + /** + * @param mixed $isDpdPickup + */ + public function setIsDpdPickup($isDpdPickup): void + { + $this->isDpdPickup = $isDpdPickup; + } + + /** + * @return mixed + */ + public function getDpdPickupPudo() + { + return $this->dpdPickupPudo; + } + + /** + * @param mixed $dpdPickupPudo + */ + public function setDpdPickupPudo($dpdPickupPudo): void + { + $this->dpdPickupPudo = $dpdPickupPudo; + } + + /** + * @return mixed + */ + public function getIsInPers() + { + return $this->isInPers; + } + + /** + * @param mixed $isInPers + */ + public function setIsInPers($isInPers): void + { + $this->isInPers = $isInPers; + } + + /** + * @return mixed + */ + public function getIsPrivPers() + { + return $this->isPrivPers; + } + + /** + * @param mixed $isPrivPers + */ + public function setIsPrivPers($isPrivPers): void + { + $this->isPrivPers = $isPrivPers; + } + + /** + * @return mixed + */ + public function getIsSelfCon() + { + return $this->isSelfCon; + } + + /** + * @param mixed $isSelfCon + */ + public function setIsSelfCon($isSelfCon): void + { + $this->isSelfCon = $isSelfCon; + } + + /** + * @return mixed + */ + public function getSelfConType() + { + return $this->selfConType; + } + + /** + * @param mixed $selfConType + */ + public function setSelfConType($selfConType): void + { + $this->selfConType = $selfConType; + } + + /** + * @return mixed + */ + public function getIsDocumentsInternational() + { + return $this->isDocumentsInternational; + } + + /** + * @param mixed $isDocumentsInternational + */ + public function setIsDocumentsInternational($isDocumentsInternational): void + { + $this->isDocumentsInternational = $isDocumentsInternational; + } + + /** + * @return mixed + */ + public function getIsAdr() + { + return $this->isAdr; + } + + /** + * @param mixed $isAdr + */ + public function setIsAdr($isAdr): void + { + $this->isAdr = $isAdr; + } + + /** + * @return mixed + */ + public function getDpdFoodLimitDate() + { + return $this->dpdFoodLimitDate; + } + + /** + * @param mixed $dpdFoodLimitDate + */ + public function setDpdFoodLimitDate($dpdFoodLimitDate): void + { + $this->dpdFoodLimitDate = $dpdFoodLimitDate; + } + + /** + * @return mixed + */ + public function getIsReturnLabel() + { + return $this->isReturnLabel; + } + + /** + * @param mixed $isReturnLabel + */ + public function setIsReturnLabel($isReturnLabel): void + { + $this->isReturnLabel = $isReturnLabel; + } + + /** + * @return mixed + */ + public function getReturnLabelCompany() + { + return $this->returnLabelCompany; + } + + /** + * @param mixed $returnLabelCompany + */ + public function setReturnLabelCompany($returnLabelCompany): void + { + $this->returnLabelCompany = $returnLabelCompany; + } + + /** + * @return mixed + */ + public function getReturnLabelName() + { + return $this->returnLabelName; + } + + /** + * @param mixed $returnLabelName + */ + public function setReturnLabelName($returnLabelName): void + { + $this->returnLabelName = $returnLabelName; + } + + /** + * @return mixed + */ + public function getReturnLabelStreet() + { + return $this->returnLabelStreet; + } + + /** + * @param mixed $returnLabelStreet + */ + public function setReturnLabelStreet($returnLabelStreet): void + { + $this->returnLabelStreet = $returnLabelStreet; + } + + /** + * @return mixed + */ + public function getReturnLabelCity() + { + return $this->returnLabelCity; + } + + /** + * @param mixed $returnLabelCity + */ + public function setReturnLabelCity($returnLabelCity): void + { + $this->returnLabelCity = $returnLabelCity; + } + + /** + * @return mixed + */ + public function getReturnLabelPostalCode() + { + return $this->returnLabelPostalCode; + } + + /** + * @param mixed $returnLabelPostalCode + */ + public function setReturnLabelPostalCode($returnLabelPostalCode): void + { + $this->returnLabelPostalCode = $returnLabelPostalCode; + } + + /** + * @return mixed + */ + public function getReturnLabelCountryCode() + { + return $this->returnLabelCountryCode; + } + + /** + * @param mixed $returnLabelCountryCode + */ + public function setReturnLabelCountryCode($returnLabelCountryCode): void + { + $this->returnLabelCountryCode = $returnLabelCountryCode; + } + + /** + * @return mixed + */ + public function getReturnLabelPhone() + { + return $this->returnLabelPhone; + } + + /** + * @param mixed $returnLabelPhone + */ + public function setReturnLabelPhone($returnLabelPhone): void + { + $this->returnLabelPhone = $returnLabelPhone; + } + + /** + * @return mixed + */ + public function getReturnLabelEmail() + { + return $this->returnLabelEmail; + } + + /** + * @param mixed $returnLabelEmail + */ + public function setReturnLabelEmail($returnLabelEmail): void + { + $this->returnLabelEmail = $returnLabelEmail; + } +} diff --git a/modules/dpdshipping/src/Entity/DpdshippingSpecialPrice.php b/modules/dpdshipping/src/Entity/DpdshippingSpecialPrice.php new file mode 100644 index 00000000..0a4e1405 --- /dev/null +++ b/modules/dpdshipping/src/Entity/DpdshippingSpecialPrice.php @@ -0,0 +1,292 @@ +id; + } + + /** + * @param mixed $id + */ + public function setId($id): void + { + $this->id = $id; + } + + /** + * @return mixed + */ + public function getIdShop() + { + return $this->idShop; + } + + /** + * @param mixed $idShop + */ + public function setIdShop($idShop): void + { + $this->idShop = $idShop; + } + + /** + * @return mixed + */ + public function getIsoCountry() + { + return $this->isoCountry; + } + + /** + * @param mixed $isoCountry + */ + public function setIsoCountry($isoCountry): void + { + $this->isoCountry = $isoCountry; + } + + /** + * @return mixed + */ + public function getPriceFrom() + { + return $this->priceFrom; + } + + /** + * @param mixed $priceFrom + */ + public function setPriceFrom($priceFrom): void + { + $this->priceFrom = $priceFrom; + } + + /** + * @return mixed + */ + public function getWeightFrom() + { + return $this->weightFrom; + } + + /** + * @param mixed $weightFrom + */ + public function setWeightFrom($weightFrom): void + { + $this->weightFrom = $weightFrom; + } + + /** + * @return mixed + */ + public function getPriceTo() + { + return $this->priceTo; + } + + /** + * @param mixed $priceTo + */ + public function setPriceTo($priceTo): void + { + $this->priceTo = $priceTo; + } + + /** + * @return mixed + */ + public function getWeightTo() + { + return $this->weightTo; + } + + /** + * @param mixed $weightTo + */ + public function setWeightTo($weightTo): void + { + $this->weightTo = $weightTo; + } + + /** + * @return mixed + */ + public function getParcelPrice() + { + return $this->parcelPrice; + } + + /** + * @param mixed $parcelPrice + */ + public function setParcelPrice($parcelPrice): void + { + $this->parcelPrice = $parcelPrice; + } + + /** + * @return mixed + */ + public function getCodPrice() + { + return $this->codPrice; + } + + /** + * @param mixed $codPrice + */ + public function setCodPrice($codPrice): void + { + $this->codPrice = $codPrice; + } + + /** + * @return mixed + */ + public function getDateAdd() + { + return $this->dateAdd; + } + + /** + * @param mixed $dateAdd + */ + public function setDateAdd($dateAdd): void + { + $this->dateAdd = $dateAdd; + } + + /** + * @return mixed + */ + public function getDateUpd() + { + return $this->dateUpd; + } + + /** + * @param mixed $dateUpd + */ + public function setDateUpd($dateUpd): void + { + $this->dateUpd = $dateUpd; + } + + /** + * @return mixed + */ + public function getCarrierType() + { + return $this->carrierType; + } + + /** + * @param mixed $carrierType + */ + public function setCarrierType($carrierType): void + { + $this->carrierType = $carrierType; + } +} diff --git a/modules/dpdshipping/src/Form/CommonFormDataProvider.php b/modules/dpdshipping/src/Form/CommonFormDataProvider.php new file mode 100644 index 00000000..2085aba8 --- /dev/null +++ b/modules/dpdshipping/src/Form/CommonFormDataProvider.php @@ -0,0 +1,77 @@ +queryBus = $queryBus; + $this->commandBus = $commandBus; + } + + protected function saveConfiguration($param, $value, $idShop = null): void + { + if ($idShop == null) + $idShop = (int)Context::getContext()->shop->id; + + $this->commandBus->handle(new SaveConfigurationCommand($param, $value ?? '', $idShop)); + } + + protected function loadField($fieldName, $configurationParamName): array + { + $return = []; + $param = ConfigurationRepository::getByName($configurationParamName); + if (!isset($param)) { + $dbValue = $this->queryBus->handle(new GetConfiguration($configurationParamName)); + if (isset($dbValue)) { + $return[$fieldName] = $dbValue->getValue(); + } + + return $return; + } + $currentValue = $this->queryBus->handle(new GetConfiguration($param->getName())); + + if (isset($currentValue)) { + $return[$fieldName] = $currentValue->getValue(); + } else { + $return[$fieldName] = $param->getDefaultValue(); + } + + return $return; + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Address/DpdShippingAddressFormDataProvider.php b/modules/dpdshipping/src/Form/Configuration/Address/DpdShippingAddressFormDataProvider.php new file mode 100644 index 00000000..49d9eff4 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Address/DpdShippingAddressFormDataProvider.php @@ -0,0 +1,97 @@ +queryBus->handle(new GetSenderAddress($senderAddressId)); + if (!isset($senderAddress)) { + return []; + } + + return [ + 'senderAddressId' => $senderAddressId, + 'alias' => $senderAddress->getAlias(), + 'company' => $senderAddress->getCompany(), + 'name' => $senderAddress->getName(), + 'street' => $senderAddress->getStreet(), + 'city' => $senderAddress->getCity(), + 'country' => $senderAddress->getCountryCode(), + 'postcode' => $senderAddress->getPostalCode(), + 'mail' => $senderAddress->getMail(), + 'phone' => $senderAddress->getPhone(), + 'isDefault' => $senderAddress->isDefault() ?? false, + ]; + } + + public function setData(array $data): array + { + $entity = new DpdshippingSenderAddress(); + if (isset($data['senderAddressId'])) { + $entity + ->setId((int)$data['senderAddressId']); + } + $entity + ->setAlias($data['alias']) + ->setCompany($data['company']) + ->setName($data['name']) + ->setStreet($data['street']) + ->setCity($data['city']) + ->setCountryCode($data['country']) + ->setPostalCode($data['postcode']) + ->setMail($data['mail']) + ->setPhone($data['phone']) + ->setIsDefault($data['isDefault'] ?? false); + + foreach (Shop::getContextListShopID() as $idShop) { + $this->queryBus->handle(new AddSenderAddressCommand($entity, $idShop)); + } + + return []; + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Address/DpdShippingAddressType.php b/modules/dpdshipping/src/Form/Configuration/Address/DpdShippingAddressType.php new file mode 100644 index 00000000..978564fb --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Address/DpdShippingAddressType.php @@ -0,0 +1,77 @@ +add('senderAddressId', HiddenType::class, []) + ->add('alias', TextType::class, [ + 'label' => $this->trans('Alias', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('company', TextType::class, [ + 'label' => $this->trans('Company', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('name', TextType::class, [ + 'label' => $this->trans('Name', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('street', TextType::class, [ + 'label' => $this->trans('Street', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('postcode', TextType::class, [ + 'label' => $this->trans('Postcode', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('city', TextType::class, [ + 'label' => $this->trans('City', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('country', TextType::class, [ + 'label' => $this->trans('Country', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('mail', TextType::class, [ + 'label' => $this->trans('Mail', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('phone', TextType::class, [ + 'label' => $this->trans('Phone', 'Modules.Dpdshipping.AdminAddress'), + ]) + ->add('isDefault', CheckboxType::class, [ + 'label' => $this->trans('Default', 'Modules.Dpdshipping.AdminAddress'), + 'required' => false, + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Address/index.php b/modules/dpdshipping/src/Form/Configuration/Address/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Address/index.php @@ -0,0 +1,33 @@ +add('displayName', TextType::class, [ + 'required' => true, + 'label' => false, + ]) + ->add('enable', CheckboxType::class, [ + 'required' => false, + 'label' => false, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => null, + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Carrier/DpdShippingCarrierFormDataProvider.php b/modules/dpdshipping/src/Form/Configuration/Carrier/DpdShippingCarrierFormDataProvider.php new file mode 100644 index 00000000..dedff532 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Carrier/DpdShippingCarrierFormDataProvider.php @@ -0,0 +1,346 @@ +dpdCarrier = $dpdCarrier; + $this->translator = $translator; + $this->queryBus = $queryBus; + $this->commandBus = $commandBus; + } + + public function getData(): array + { + $return = []; + $idShop = (int)Context::getContext()->shop->id; + $standardCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_STANDARD, $idShop)); + $return['dpdPolandCarrierStandard'] = isset($standardCarrier) && $standardCarrier !== false; + + $standardCodCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_STANDARD_COD, $idShop)); + $return['dpdPolandCarrierStandardCod'] = isset($standardCodCarrier) && $standardCodCarrier !== false; + + $swipBoxCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_SWIP_BOX, $idShop)); + $return['dpdPolandCarrierSwipBox'] = isset($swipBoxCarrier) && $swipBoxCarrier !== false; + + $swipBoxCarrierFilter = $this->queryBus->handle(new GetCarrierPickup(Config::DPD_SWIP_BOX)); + + $return['dpdPolandCarrierSwipBoxFilterOpenLate'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterOpenLate'); + $return['dpdPolandCarrierSwipBoxFilterOpenSaturdays'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterOpenSaturdays'); + $return['dpdPolandCarrierSwipBoxFilterOpenSundays'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterOpenSundays'); + $return['dpdPolandCarrierSwipBoxFilterDisabledFriendly'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterDisabledFriendly'); + $return['dpdPolandCarrierSwipBoxFilterParking'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterParking'); + $return['dpdPolandCarrierSwipBoxFilterDirectDelivery'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterDirectDelivery'); + $return['dpdPolandCarrierSwipBoxFilterDirectDeliveryCod'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterDirectDeliveryCod'); + $return['dpdPolandCarrierSwipBoxFilterDropoffOnline'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterDropoffOnline'); + $return['dpdPolandCarrierSwipBoxFilterDropoffOffline'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterDropoffOffline'); + $return['dpdPolandCarrierSwipBoxFilterSwapParcel'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterSwapParcel'); + $return['dpdPolandCarrierSwipBoxFilterFresh'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterFresh'); + $return['dpdPolandCarrierSwipBoxFilterCardPayment'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterCardPayment'); + $return['dpdPolandCarrierSwipBoxFilterFittingRoom'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterFittingRoom'); + $return['dpdPolandCarrierSwipBoxFilterRod'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterRod'); + $return['dpdPolandCarrierSwipBoxFilterLQ'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterLQ'); + $return['dpdPolandCarrierSwipBoxFilterDigitalLabel'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterDigitalLabel'); + $return['dpdPolandCarrierSwipBoxFilterSwipBox'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterSwipBox'); + $return['dpdPolandCarrierSwipBoxFilterPointsWithServices'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterPointsWithServices'); + $return['dpdPolandCarrierSwipBoxFilterHideFilters'] = $this->getPickupFilterValue($swipBoxCarrierFilter, 'dpdPolandCarrierSwipBoxFilterHideFilters'); + + $pickupCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_PICKUP, $idShop)); + $return['dpdPolandCarrierPickup'] = isset($pickupCarrier) && $pickupCarrier !== false; + + $pickupCodCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_PICKUP_COD, $idShop)); + $return['dpdPolandCarrierPickupCOD'] = isset($pickupCodCarrier) && $pickupCodCarrier !== false; + + $pickupCarrierFilter = $this->queryBus->handle(new GetCarrierPickup(Config::DPD_PICKUP)); + + $return['dpdPolandCarrierPickupFilterOpenLate'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterOpenLate'); + $return['dpdPolandCarrierPickupFilterOpenSaturdays'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterOpenSaturdays'); + $return['dpdPolandCarrierPickupFilterOpenSundays'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterOpenSundays'); + $return['dpdPolandCarrierPickupFilterDisabledFriendly'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterDisabledFriendly'); + $return['dpdPolandCarrierPickupFilterParking'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterParking'); + $return['dpdPolandCarrierPickupFilterDirectDelivery'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterDirectDelivery'); + $return['dpdPolandCarrierPickupFilterDirectDeliveryCod'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterDirectDeliveryCod'); + $return['dpdPolandCarrierPickupFilterDropoffOnline'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterDropoffOnline'); + $return['dpdPolandCarrierPickupFilterDropoffOffline'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterDropoffOffline'); + $return['dpdPolandCarrierPickupFilterSwapParcel'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterSwapParcel'); + $return['dpdPolandCarrierPickupFilterFresh'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterFresh'); + $return['dpdPolandCarrierPickupFilterCardPayment'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterCardPayment'); + $return['dpdPolandCarrierPickupFilterFittingRoom'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterFittingRoom'); + $return['dpdPolandCarrierPickupFilterRod'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterRod'); + $return['dpdPolandCarrierPickupFilterLQ'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterLQ'); + $return['dpdPolandCarrierPickupFilterDigitalLabel'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterDigitalLabel'); + $return['dpdPolandCarrierPickupFilterSwipBox'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterSwipBox'); + $return['dpdPolandCarrierPickupFilterPointsWithServices'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterPointsWithServices'); + $return['dpdPolandCarrierPickupFilterHideFilters'] = $this->getPickupFilterValue($pickupCarrierFilter, 'dpdPolandCarrierPickupFilterHideFilters'); + + $pickupCarrierCodFilter = $this->queryBus->handle(new GetCarrierPickup(Config::DPD_PICKUP_COD)); + + $return['dpdPolandCarrierPickupCODFilterOpenLate'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterOpenLate'); + $return['dpdPolandCarrierPickupCODFilterOpenSaturdays'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterOpenSaturdays'); + $return['dpdPolandCarrierPickupCODFilterOpenSundays'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterOpenSundays'); + $return['dpdPolandCarrierPickupCODFilterDisabledFriendly'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterDisabledFriendly'); + $return['dpdPolandCarrierPickupCODFilterParking'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterParking'); + $return['dpdPolandCarrierPickupCODFilterDirectDelivery'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterDirectDelivery'); + $return['dpdPolandCarrierPickupCODFilterDirectDeliveryCod'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterDirectDeliveryCod'); + $return['dpdPolandCarrierPickupCODFilterDropoffOnline'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterDropoffOnline'); + $return['dpdPolandCarrierPickupCODFilterDropoffOffline'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterDropoffOffline'); + $return['dpdPolandCarrierPickupCODFilterSwapParcel'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterSwapParcel'); + $return['dpdPolandCarrierPickupCODFilterFresh'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterFresh'); + $return['dpdPolandCarrierPickupCODFilterCardPayment'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterCardPayment'); + $return['dpdPolandCarrierPickupCODFilterFittingRoom'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterFittingRoom'); + $return['dpdPolandCarrierPickupCODFilterRod'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterRod'); + $return['dpdPolandCarrierPickupCODFilterLQ'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterLQ'); + $return['dpdPolandCarrierPickupCODFilterDigitalLabel'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterDigitalLabel'); + $return['dpdPolandCarrierPickupCODFilterSwipBox'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterSwipBox'); + $return['dpdPolandCarrierPickupCODFilterPointsWithServices'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterPointsWithServices'); + $return['dpdPolandCarrierPickupCODFilterHideFilters'] = $this->getPickupFilterValue($pickupCarrierCodFilter, 'dpdPolandCarrierPickupCODFilterHideFilters'); + + $return['dpdCarrierCodPaymentMethods'] = $this->queryBus->handle(new GetCodPaymentModules(Configuration::DPD_COD_PAYMENT_METHODS)) ?? Module::getPaymentModules(); + + return $return; + } + + public function setData(array $data): array + { + $idShop = (int)Context::getContext()->shop->id; + + $this->dpdCarrier->handleCarrier(Config::DPD_SWIP_BOX, $this->translator->trans('DPD Poland - Swip Box', [], 'Modules.Dpdshipping.Carrier'), $data['dpdPolandCarrierSwipBox'], $idShop); + + $this->dpdCarrier->handleCarrier(Config::DPD_PICKUP, $this->translator->trans('DPD Poland - Pickup', [], 'Modules.Dpdshipping.Carrier'), $data['dpdPolandCarrierPickup'], $idShop); + $this->dpdCarrier->handleCarrier(Config::DPD_PICKUP_COD, $this->translator->trans('DPD Poland - Pickup COD', [], 'Modules.Dpdshipping.Carrier'), $data['dpdPolandCarrierPickupCOD'], $idShop); + + $this->dpdCarrier->handleCarrier(Config::DPD_STANDARD, $this->translator->trans('DPD Poland', [], 'Modules.Dpdshipping.Carrier'), $data['dpdPolandCarrierStandard'], $idShop); + $this->dpdCarrier->handleCarrier(Config::DPD_STANDARD_COD, $this->translator->trans('DPD Poland - COD', [], 'Modules.Dpdshipping.Carrier'), $data['dpdPolandCarrierStandardCod'], $idShop); + + $this->saveSwipBoxFilters($data, $idShop); + $this->savePickupFilters($data, $idShop); + $this->savePickupCodFilters($data, $idShop); + + if (isset($data['dpdCarrierCodPaymentMethods'])) { + $this->saveConfiguration(Configuration::DPD_COD_PAYMENT_METHODS, json_encode($data['dpdCarrierCodPaymentMethods'], $idShop)); + } + + return []; + } + + /** + * @param array $data + * @return void + */ + public function saveSwipBoxFilters(array $data, $idShop): void + { + $swipBoxFilters = [ + 'dpdPolandCarrierSwipBoxFilterOpenLate' => $data['dpdPolandCarrierSwipBoxFilterOpenLate'], + 'dpdPolandCarrierSwipBoxFilterOpenSaturdays' => $data['dpdPolandCarrierSwipBoxFilterOpenSaturdays'], + 'dpdPolandCarrierSwipBoxFilterOpenSundays' => $data['dpdPolandCarrierSwipBoxFilterOpenSundays'], + 'dpdPolandCarrierSwipBoxFilterDisabledFriendly' => $data['dpdPolandCarrierSwipBoxFilterDisabledFriendly'], + 'dpdPolandCarrierSwipBoxFilterParking' => $data['dpdPolandCarrierSwipBoxFilterParking'], + 'dpdPolandCarrierSwipBoxFilterDirectDelivery' => $data['dpdPolandCarrierSwipBoxFilterDirectDelivery'], + 'dpdPolandCarrierSwipBoxFilterDirectDeliveryCod' => $data['dpdPolandCarrierSwipBoxFilterDirectDeliveryCod'], + 'dpdPolandCarrierSwipBoxFilterDropoffOnline' => $data['dpdPolandCarrierSwipBoxFilterDropoffOnline'], + 'dpdPolandCarrierSwipBoxFilterDropoffOffline' => $data['dpdPolandCarrierSwipBoxFilterDropoffOffline'], + 'dpdPolandCarrierSwipBoxFilterSwapParcel' => $data['dpdPolandCarrierSwipBoxFilterSwapParcel'], + 'dpdPolandCarrierSwipBoxFilterFresh' => $data['dpdPolandCarrierSwipBoxFilterFresh'], + 'dpdPolandCarrierSwipBoxFilterFittingRoom' => $data['dpdPolandCarrierSwipBoxFilterFittingRoom'], + 'dpdPolandCarrierSwipBoxFilterCardPayment' => $data['dpdPolandCarrierSwipBoxFilterCardPayment'], + 'dpdPolandCarrierSwipBoxFilterRod' => $data['dpdPolandCarrierSwipBoxFilterRod'], + 'dpdPolandCarrierSwipBoxFilterLQ' => $data['dpdPolandCarrierSwipBoxFilterLQ'], + 'dpdPolandCarrierSwipBoxFilterDigitalLabel' => $data['dpdPolandCarrierSwipBoxFilterDigitalLabel'], + 'dpdPolandCarrierSwipBoxFilterSwipBox' => true, + 'dpdPolandCarrierSwipBoxFilterPointsWithServices' => $data['dpdPolandCarrierSwipBoxFilterPointsWithServices'], + 'dpdPolandCarrierSwipBoxFilterHideFilters' => true, + ]; + $carrier = $this->queryBus->handle(new GetCarrier(Config::DPD_SWIP_BOX, $idShop)); + if ($carrier !== false) { + $filters = []; + foreach ($swipBoxFilters as $key => $value) { + $this->commandBus->handle(new AddCarrierPickupCommand($carrier->id, $key, $value)); + if ($value == 1) { + $urlFilter = $this->translateToUrlFilter($key); + if (!empty($urlFilter)) { + $filters[] = $urlFilter; + } + } + } + $pudoMapUrl = Config::PICKUP_MAP_BASE_URL . '&' . implode('&', $filters); + DpdCarrierPrestashopConfiguration::setConfig(Config::DPD_SWIP_BOX_MAP_URL_WITH_FILTERS, $pudoMapUrl, $idShop); + } + } + /** + * @param array $data + * @return void + */ + public function savePickupFilters(array $data, $idShop): void + { + $pickupFilters = [ + 'dpdPolandCarrierPickupFilterOpenLate' => $data['dpdPolandCarrierPickupFilterOpenLate'], + 'dpdPolandCarrierPickupFilterOpenSaturdays' => $data['dpdPolandCarrierPickupFilterOpenSaturdays'], + 'dpdPolandCarrierPickupFilterOpenSundays' => $data['dpdPolandCarrierPickupFilterOpenSundays'], + 'dpdPolandCarrierPickupFilterDisabledFriendly' => $data['dpdPolandCarrierPickupFilterDisabledFriendly'], + 'dpdPolandCarrierPickupFilterParking' => $data['dpdPolandCarrierPickupFilterParking'], + 'dpdPolandCarrierPickupFilterDirectDelivery' => $data['dpdPolandCarrierPickupFilterDirectDelivery'], + 'dpdPolandCarrierPickupFilterDirectDeliveryCod' => $data['dpdPolandCarrierPickupFilterDirectDeliveryCod'], + 'dpdPolandCarrierPickupFilterDropoffOnline' => $data['dpdPolandCarrierPickupFilterDropoffOnline'], + 'dpdPolandCarrierPickupFilterDropoffOffline' => $data['dpdPolandCarrierPickupFilterDropoffOffline'], + 'dpdPolandCarrierPickupFilterSwapParcel' => $data['dpdPolandCarrierPickupFilterSwapParcel'], + 'dpdPolandCarrierPickupFilterFresh' => $data['dpdPolandCarrierPickupFilterFresh'], + 'dpdPolandCarrierPickupFilterFittingRoom' => $data['dpdPolandCarrierPickupFilterFittingRoom'], + 'dpdPolandCarrierPickupFilterCardPayment' => $data['dpdPolandCarrierPickupFilterCardPayment'], + 'dpdPolandCarrierPickupFilterRod' => $data['dpdPolandCarrierPickupFilterRod'], + 'dpdPolandCarrierPickupFilterLQ' => $data['dpdPolandCarrierPickupFilterLQ'], + 'dpdPolandCarrierPickupFilterDigitalLabel' => $data['dpdPolandCarrierPickupFilterDigitalLabel'], + 'dpdPolandCarrierPickupFilterSwipBox' => $data['dpdPolandCarrierPickupFilterSwipBox'], + 'dpdPolandCarrierPickupFilterPointsWithServices' => $data['dpdPolandCarrierPickupFilterPointsWithServices'], + 'dpdPolandCarrierPickupFilterHideFilters' => false, + ]; + $carrier = $this->queryBus->handle(new GetCarrier(Config::DPD_PICKUP, $idShop)); + if ($carrier !== false) { + $filters = []; + foreach ($pickupFilters as $key => $value) { + $this->commandBus->handle(new AddCarrierPickupCommand($carrier->id, $key, $value)); + if ($value == 1) { + $urlFilter = $this->translateToUrlFilter($key); + if (!empty($urlFilter)) { + $filters[] = $urlFilter; + } + } + } + $pudoMapUrl = Config::PICKUP_MAP_BASE_URL . '&' . implode('&', $filters); + DpdCarrierPrestashopConfiguration::setConfig(Config::DPD_PICKUP_MAP_URL_WITH_FILTERS, $pudoMapUrl, $idShop); + } + } + + /** + * @param array $data + * @return void + */ + public function savePickupCodFilters(array $data, $idShop): void + { + $pickupFilters = [ + 'dpdPolandCarrierPickupCODFilterOpenLate' => $data['dpdPolandCarrierPickupCODFilterOpenLate'], + 'dpdPolandCarrierPickupCODFilterOpenSaturdays' => $data['dpdPolandCarrierPickupCODFilterOpenSaturdays'], + 'dpdPolandCarrierPickupCODFilterOpenSundays' => $data['dpdPolandCarrierPickupCODFilterOpenSundays'], + 'dpdPolandCarrierPickupCODFilterDisabledFriendly' => $data['dpdPolandCarrierPickupCODFilterDisabledFriendly'], + 'dpdPolandCarrierPickupCODFilterParking' => $data['dpdPolandCarrierPickupCODFilterParking'], + 'dpdPolandCarrierPickupCODFilterDirectDelivery' => $data['dpdPolandCarrierPickupCODFilterDirectDelivery'], + 'dpdPolandCarrierPickupCODFilterDirectDeliveryCod' => true, + 'dpdPolandCarrierPickupCODFilterDropoffOnline' => $data['dpdPolandCarrierPickupCODFilterDropoffOnline'], + 'dpdPolandCarrierPickupCODFilterDropoffOffline' => $data['dpdPolandCarrierPickupCODFilterDropoffOffline'], + 'dpdPolandCarrierPickupCODFilterSwapParcel' => $data['dpdPolandCarrierPickupCODFilterSwapParcel'], + 'dpdPolandCarrierPickupCODFilterFresh' => $data['dpdPolandCarrierPickupCODFilterFresh'], + 'dpdPolandCarrierPickupCODFilterFittingRoom' => $data['dpdPolandCarrierPickupCODFilterFittingRoom'], + 'dpdPolandCarrierPickupCODFilterCardPayment' => $data['dpdPolandCarrierPickupCODFilterCardPayment'], + 'dpdPolandCarrierPickupCODFilterRod' => $data['dpdPolandCarrierPickupCODFilterRod'], + 'dpdPolandCarrierPickupCODFilterLQ' => $data['dpdPolandCarrierPickupCODFilterLQ'], + 'dpdPolandCarrierPickupCODFilterDigitalLabel' => $data['dpdPolandCarrierPickupCODFilterDigitalLabel'], + 'dpdPolandCarrierPickupCODFilterSwipBox' => $data['dpdPolandCarrierPickupCODFilterSwipBox'], + 'dpdPolandCarrierPickupCODFilterPointsWithServices' => $data['dpdPolandCarrierPickupCODFilterPointsWithServices'], + 'dpdPolandCarrierPickupCODFilterHideFilters' => false, + ]; + + $carrier = $this->queryBus->handle(new GetCarrier(Config::DPD_PICKUP_COD, $idShop)); + if ($carrier !== false) { + $filters = []; + foreach ($pickupFilters as $key => $value) { + $this->commandBus->handle(new AddCarrierPickupCommand($carrier->id, $key, $value)); + if ($value == 1) { + $urlFilter = $this->translateToUrlFilter($key); + if (!empty($urlFilter)) { + $filters[] = $urlFilter; + } + } + } + $pudoMapUrl = Config::PICKUP_MAP_BASE_URL . '&' . implode('&', $filters); + DpdCarrierPrestashopConfiguration::setConfig(Config::DPD_PICKUP_COD_MAP_URL_WITH_FILTERS, $pudoMapUrl, $idShop); + } + } + + private function getPickupFilterValue($filterArray, $filterName): bool + { + foreach ($filterArray as $object) { + if ($object->getName() === $filterName) { + return (bool)$object->getValue(); + } + } + + return false; + } + + private function translateToUrlFilter(string $key) + { + $search = str_replace(['dpdPolandCarrierPickupCOD', 'dpdPolandCarrierPickup', 'dpdPolandCarrierSwipBox'], ['', ''], $key); + + $pickupFilters = [ + 'FilterOpenLate' => 'open_late', + 'FilterOpenSaturdays' => 'open_saturdays', + 'FilterOpenSundays' => 'open_sundays', + 'FilterDisabledFriendly' => 'disabled_friendly', + 'FilterParking' => 'parking', + 'FilterDirectDelivery' => 'direct_delivery', + 'FilterDirectDeliveryCod' => 'direct_delivery_cod', + 'FilterDropoffOnline' => 'dropoff_online', + 'FilterDropoffOffline' => 'dropoff_offline', + 'FilterSwapParcel' => 'swap_parcel', + 'FilterFresh' => 'd_fresh', + 'FilterFittingRoom' => 'fitting_room', + 'FilterCardPayment' => 'card_payment', + 'FilterRod' => 'rod', + 'FilterLQ' => 'dpd_lq', + 'FilterDigitalLabel' => 'digital_label', + 'FilterSwipBox' => 'swip_box', + 'FilterPointsWithServices' => 'points_with_services', + 'FilterHideFilters' => 'hideFilters', + ]; + + return $pickupFilters[$search] . '=1' ?? ''; + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Carrier/DpdShippingCarrierType.php b/modules/dpdshipping/src/Form/Configuration/Carrier/DpdShippingCarrierType.php new file mode 100644 index 00000000..50819416 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Carrier/DpdShippingCarrierType.php @@ -0,0 +1,304 @@ +add('dpdPolandCarrierStandard', CheckboxType::class, [ + 'label' => $this->trans('DPD Poland', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierStandardCod', CheckboxType::class, [ + 'label' => $this->trans('DPD Poland COD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBox', CheckboxType::class, [ + 'label' => $this->trans('DPD Poland Swip Box', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterOpenLate', CheckboxType::class, [ + 'label' => $this->trans('Open late', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterOpenSaturdays', CheckboxType::class, [ + 'label' => $this->trans('Open Saturdays', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterOpenSundays', CheckboxType::class, [ + 'label' => $this->trans('Open Sundays', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterDisabledFriendly', CheckboxType::class, [ + 'label' => $this->trans('Disabled friendly', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterParking', CheckboxType::class, [ + 'label' => $this->trans('Parking', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterDirectDelivery', CheckboxType::class, [ + 'label' => $this->trans('Direct delivery', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterDirectDeliveryCod', CheckboxType::class, [ + 'label' => $this->trans('Direct delivery COD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterDropoffOnline', CheckboxType::class, [ + 'label' => $this->trans('Dropoff online', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterDropoffOffline', CheckboxType::class, [ + 'label' => $this->trans('Dropoff offline', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterSwapParcel', CheckboxType::class, [ + 'label' => $this->trans('Swap parcel', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterFresh', CheckboxType::class, [ + 'label' => $this->trans('Fresh', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterFittingRoom', CheckboxType::class, [ + 'label' => $this->trans('Fitting room', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterCardPayment', CheckboxType::class, [ + 'label' => $this->trans('Card payment', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterRod', CheckboxType::class, [ + 'label' => $this->trans('ROD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterLQ', CheckboxType::class, [ + 'label' => $this->trans('LQ', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterDigitalLabel', CheckboxType::class, [ + 'label' => $this->trans('Digital label', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierSwipBoxFilterSwipBox', CheckboxType::class, [ + 'label' => $this->trans('Swip box', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + 'data' => true, + 'attr' => ['disabled' => 'disabled'], + ]) + ->add('dpdPolandCarrierSwipBoxFilterPointsWithServices', CheckboxType::class, [ + 'label' => $this->trans('Points with services', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) +// ->add('dpdPolandCarrierSwipBoxFilterHideFilters', CheckboxType::class, [ +// 'label' => $this->trans('Hide filters', 'Modules.Dpdshipping.AdminCarrier'), +// 'required' => false, +// ]) + ->add('dpdPolandCarrierPickup', CheckboxType::class, [ + 'label' => $this->trans('DPD Poland Pickup', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterOpenLate', CheckboxType::class, [ + 'label' => $this->trans('Open late', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterOpenSaturdays', CheckboxType::class, [ + 'label' => $this->trans('Open Saturdays', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterOpenSundays', CheckboxType::class, [ + 'label' => $this->trans('Open Sundays', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterDisabledFriendly', CheckboxType::class, [ + 'label' => $this->trans('Disabled friendly', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterParking', CheckboxType::class, [ + 'label' => $this->trans('Parking', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterDirectDelivery', CheckboxType::class, [ + 'label' => $this->trans('Direct delivery', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterDirectDeliveryCod', CheckboxType::class, [ + 'label' => $this->trans('Direct delivery COD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterDropoffOnline', CheckboxType::class, [ + 'label' => $this->trans('Dropoff online', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterDropoffOffline', CheckboxType::class, [ + 'label' => $this->trans('Dropoff offline', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterSwapParcel', CheckboxType::class, [ + 'label' => $this->trans('Swap parcel', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterFresh', CheckboxType::class, [ + 'label' => $this->trans('Fresh', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterFittingRoom', CheckboxType::class, [ + 'label' => $this->trans('Fitting room', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterCardPayment', CheckboxType::class, [ + 'label' => $this->trans('Card payment', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterRod', CheckboxType::class, [ + 'label' => $this->trans('ROD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterLQ', CheckboxType::class, [ + 'label' => $this->trans('LQ', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterDigitalLabel', CheckboxType::class, [ + 'label' => $this->trans('Digital label', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterSwipBox', CheckboxType::class, [ + 'label' => $this->trans('Swip box', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupFilterPointsWithServices', CheckboxType::class, [ + 'label' => $this->trans('Points with services', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) +// ->add('dpdPolandCarrierPickupFilterHideFilters', CheckboxType::class, [ +// 'label' => $this->trans('Hide filters', 'Modules.Dpdshipping.AdminCarrier'), +// 'required' => false, +// ]) + ->add('dpdPolandCarrierPickupCOD', CheckboxType::class, [ + 'label' => $this->trans('DPD Poland Pickup COD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterOpenLate', CheckboxType::class, [ + 'label' => $this->trans('Open late', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterOpenSaturdays', CheckboxType::class, [ + 'label' => $this->trans('Open Saturdays', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterOpenSundays', CheckboxType::class, [ + 'label' => $this->trans('Open Sundays', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterDisabledFriendly', CheckboxType::class, [ + 'label' => $this->trans('Disabled friendly', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterParking', CheckboxType::class, [ + 'label' => $this->trans('Parking', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterDirectDelivery', CheckboxType::class, [ + 'label' => $this->trans('Direct delivery', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterDirectDeliveryCod', CheckboxType::class, [ + 'label' => $this->trans('Direct delivery COD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + 'data' => true, + 'attr' => ['disabled' => 'disabled'], + ]) + ->add('dpdPolandCarrierPickupCODFilterDropoffOnline', CheckboxType::class, [ + 'label' => $this->trans('Dropoff online', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterDropoffOffline', CheckboxType::class, [ + 'label' => $this->trans('Dropoff offline', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterSwapParcel', CheckboxType::class, [ + 'label' => $this->trans('Swap parcel', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterFresh', CheckboxType::class, [ + 'label' => $this->trans('Fresh', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterFittingRoom', CheckboxType::class, [ + 'label' => $this->trans('Fitting room', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterCardPayment', CheckboxType::class, [ + 'label' => $this->trans('Card payment', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterRod', CheckboxType::class, [ + 'label' => $this->trans('ROD', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterLQ', CheckboxType::class, [ + 'label' => $this->trans('LQ', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterDigitalLabel', CheckboxType::class, [ + 'label' => $this->trans('Digital label', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterSwipBox', CheckboxType::class, [ + 'label' => $this->trans('Swip box', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) + ->add('dpdPolandCarrierPickupCODFilterPointsWithServices', CheckboxType::class, [ + 'label' => $this->trans('Points with services', 'Modules.Dpdshipping.AdminCarrier'), + 'required' => false, + ]) +// ->add('dpdPolandCarrierPickupCODFilterHideFilters', CheckboxType::class, [ +// 'label' => $this->trans('Hide filters', 'Modules.Dpdshipping.AdminCarrier'), +// 'required' => false +// ]) + ->add('dpdCarrierCodPaymentMethods', CollectionType::class, [ + 'entry_type' => CodPaymentMethodType::class, + 'entry_options' => ['label' => false], + 'allow_add' => false, + 'allow_delete' => false, + 'prototype' => true, + 'prototype_name' => '__payment_cod_prototype__', + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Carrier/index.php b/modules/dpdshipping/src/Form/Configuration/Carrier/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Carrier/index.php @@ -0,0 +1,33 @@ +loadField('logLevel', Configuration::LOG_LEVEL), + $this->loadField('customCheckout', Configuration::CUSTOM_CHECKOUT), + $this->loadField('sendMailWhenShippingGenerated', Configuration::SEND_MAIL_WHEN_SHIPPING_GENERATED), + $this->loadField('checkTrackingOrderView', Configuration::CHECK_TRACKING_ORDER_VIEW), + $this->loadField('empikModuleIntegrationEnabled', Configuration::EMPIK_MODULE_INTEGRATION_ENABLED), + $this->loadField('empikDpdApiForStoreDelivery', Configuration::EMPIK_DPD_API_FOR_STORE_DELIVERY), + ]; + + return ArrayUtil::flatArray($return); + } + + public function setData(array $data): array + { + foreach (Shop::getContextListShopID() as $idShop) { + $this->saveConfiguration(Configuration::LOG_LEVEL, $data['logLevel'] ?? ConfigurationRepository::getDefaultValue(Configuration::LOG_LEVEL), $idShop); + $customCheckout = $data['customCheckout'] ?? ConfigurationRepository::getDefaultValue(Configuration::CUSTOM_CHECKOUT); + $this->saveConfiguration(Configuration::CUSTOM_CHECKOUT, $customCheckout, $idShop); + DpdCarrierPrestashopConfiguration::setConfig(Configuration::CUSTOM_CHECKOUT, $customCheckout, $idShop); + + $this->saveConfiguration(Configuration::SEND_MAIL_WHEN_SHIPPING_GENERATED, $data['sendMailWhenShippingGenerated'] ?? ConfigurationRepository::getDefaultValue(Configuration::SEND_MAIL_WHEN_SHIPPING_GENERATED), $idShop); + $this->saveConfiguration(Configuration::CHECK_TRACKING_ORDER_VIEW, $data['checkTrackingOrderView'] ?? ConfigurationRepository::getDefaultValue(Configuration::CHECK_TRACKING_ORDER_VIEW), $idShop); + $this->saveConfiguration(Configuration::EMPIK_MODULE_INTEGRATION_ENABLED, $data['empikModuleIntegrationEnabled'] ?? ConfigurationRepository::getDefaultValue(Configuration::CHECK_TRACKING_ORDER_VIEW), $idShop); + + $this->saveConfiguration(Configuration::EMPIK_DPD_API_FOR_STORE_DELIVERY, $data['empikDpdApiForStoreDelivery'], $idShop); + } + return []; + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Configuration/DpdShippingConfigurationType.php b/modules/dpdshipping/src/Form/Configuration/Configuration/DpdShippingConfigurationType.php new file mode 100644 index 00000000..c55ef026 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Configuration/DpdShippingConfigurationType.php @@ -0,0 +1,91 @@ +add('logLevel', ChoiceType::class, [ + 'choices' => [ + $this->trans('ERROR', 'Modules.Dpdshipping.AdminConfiguration') => 'error', + $this->trans('INFO', 'Modules.Dpdshipping.AdminConfiguration') => 'info', + $this->trans('DEBUG', 'Modules.Dpdshipping.AdminConfiguration') => 'debug', + ], + 'label' => $this->trans('Log level', 'Modules.Dpdshipping.AdminConfiguration'), + ]) + ->add('customCheckout', ChoiceType::class, [ + 'choices' => [ + $this->trans('Standard Prestashop Checkout', 'Modules.Dpdshipping.AdminConfiguration') => 'standard', + $this->trans('Supercheckout', 'Modules.Dpdshipping.AdminConfiguration') => Configuration::CUSTOM_CHECKOUT_SUPERCHECKOUT, + $this->trans('Easycheckout', 'Modules.Dpdshipping.AdminConfiguration') => Configuration::CUSTOM_CHECKOUT_EASYCHECKOUT, + $this->trans('One Page Checkout - PrestaTeam - Prestashop 1.7', 'Modules.Dpdshipping.AdminConfiguration') => Configuration::CUSTOM_CHECKOUT_OPC_PRESTATEAM_1_7, + $this->trans('One Page Checkout - PrestaTeam - Prestashop 8', 'Modules.Dpdshipping.AdminConfiguration') => Configuration::CUSTOM_CHECKOUT_OPC_PRESTATEAM_8, + $this->trans('The Checkout - PrestaSmart', 'Modules.Dpdshipping.AdminConfiguration') => Configuration::CUSTOM_CHECKOUT_THECHECKOUT_PRESTASMART, + $this->trans('One Page Checkout - PrestaSmart', 'Modules.Dpdshipping.AdminConfiguration') => Configuration::CUSTOM_CHECKOUT_OPC_PRESTASMART, + + ], + 'label' => $this->trans('Custom checkout', 'Modules.Dpdshipping.AdminConfiguration'), + ]) + ->add('sendMailWhenShippingGenerated', ChoiceType::class, [ + 'choices' => [ + $this->trans('Yes', 'Modules.Dpdshipping.AdminConfiguration') => '1', + $this->trans('No', 'Modules.Dpdshipping.AdminConfiguration') => '0', + ], + 'label' => $this->trans('Send mail when shipping is generated', 'Modules.Dpdshipping.AdminConfiguration'), + ]) + ->add('checkTrackingOrderView', ChoiceType::class, [ + 'choices' => [ + $this->trans('Yes', 'Modules.Dpdshipping.AdminConfiguration') => '1', + $this->trans('No', 'Modules.Dpdshipping.AdminConfiguration') => '0', + ], + 'label' => $this->trans('Check shipment tracking on the order view page', 'Modules.Dpdshipping.AdminConfiguration'), + ]) + ->add('empikModuleIntegrationEnabled', ChoiceType::class, [ + 'choices' => [ + $this->trans('Yes', 'Modules.Dpdshipping.AdminConfiguration') => '1', + $this->trans('No', 'Modules.Dpdshipping.AdminConfiguration') => '0', + ], + 'label' => $this->trans('Integration with Empik marketplace', 'Modules.Dpdshipping.AdminConfiguration'), + ]) + ->add('empikDpdApiForStoreDelivery', ChoiceType::class, [ + 'choices' => [], //Override by DpdShippingConfigurationController + 'label' => $this->trans('API account for Empik Store delivery', 'Modules.Dpdshipping.AdminConfiguration'), + 'required' => false, + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Configuration/index.php b/modules/dpdshipping/src/Form/Configuration/Configuration/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Configuration/index.php @@ -0,0 +1,33 @@ + null, + 'name' => "DPD API", + 'payerList' => [], + 'idShop' => $idShop + ]; + } + + $connectionConfig = $this->queryBus->handle(new GetConnection($idShop, $connectionId)); + + if(empty($connectionConfig)) + Tools::redirectAdmin($this->generateRouteUrl('dpdshipping_connection_form')); + + $return[] = [ + 'id' => $connectionId, + 'idShop' => $idShop, + 'login' => $connectionConfig->getLogin(), + 'masterfid' => $connectionConfig->getMasterfid(), + 'environment' => $connectionConfig->getEnvironment(), + 'isDefault' => $connectionConfig->isDefault(), + 'name' => $connectionConfig->getName(), + ]; + + $return[] = ['payerList' => $this->queryBus->handle(new GetPayerList(false, $idShop, $connectionConfig->getId())) ?? []]; + + return ArrayUtil::flatArray($return); + } + + public function setData(array $data): array + { + $errors = []; + + $testConnection = $this->queryBus->handle(new TestDpdConnection($data['login'], $data['password'], $data['masterfid'], $data['environment'])); + + if ($testConnection !== true) { + $errors[] = $testConnection; + + return $errors; + } + + $phpEncryption = new PhpEncryption(_NEW_COOKIE_KEY_); + + foreach ($data['idShop'] as $idShop) { + $connectionConfigId = $data['id']; + if (!empty($connectionConfigId)) { + $connectionConfig = $this->queryBus->handle(new GetConnection(null, $connectionConfigId)); + + if (empty($connectionConfig) || $connectionConfig->getIdShop() != $idShop) + continue; + } + + $connectionId = $this->queryBus->handle(new SaveConnectionCommand($connectionConfigId, $idShop, $data['name'], $data['login'], $phpEncryption->encrypt($data['password']), $data['masterfid'], $data['environment'], $data['isDefault'])); + + $this->commandBus->handle(new AddPayerCommand($data['payerList'], $idShop, $connectionId)); + } + + return $errors; + } + + private function generateRouteUrl(string $routeName): string + { + $context = Context::getContext(); + if ($context && $context->controller && method_exists($context->controller, 'getContainer')) { + $container = $context->controller->getContainer(); + if ($container && $container->has('router')) { + $router = $container->get('router'); + try { + return $router->generate($routeName); + } catch (\Throwable $e) { + // fallback below + } + } + } + + return $context->link->getAdminLink('AdminModules', true, [], ['route' => $routeName]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Connection/DpdShippingConnectionType.php b/modules/dpdshipping/src/Form/Configuration/Connection/DpdShippingConnectionType.php new file mode 100644 index 00000000..01c56684 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Connection/DpdShippingConnectionType.php @@ -0,0 +1,81 @@ +add('id', HiddenType::class, []) + ->add('name', TextType::class, [ + 'label' => $this->trans('Name', 'Modules.Dpdshipping.AdminConnection'), + ]) + ->add('login', TextType::class, [ + 'label' => $this->trans('Login', 'Modules.Dpdshipping.AdminConnection'), + ]) + ->add('password', PasswordType::class, [ + 'label' => $this->trans('Password', 'Modules.Dpdshipping.AdminConnection'), + ]) + ->add('masterfid', TextType::class, [ + 'label' => $this->trans('Master FID', 'Modules.Dpdshipping.AdminConnection'), + ]) + ->add('environment', ChoiceType::class, [ + 'choices' => [ + $this->trans('DPD Poland Production', 'Modules.Dpdshipping.AdminOnboarding') => Config::DPD_API_URL_LIVE, + $this->trans('DPD Poland DEMO', 'Modules.Dpdshipping.AdminOnboarding') => Config::DPD_API_URL_DEMO, + ], + 'label' => $this->trans('Environment', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('isDefault', CheckboxType::class, [ + 'label' => $this->trans('Default', 'Modules.Dpdshipping.AdminOnboarding'), + 'required' => false, + ]) + ->add('payerList', CollectionType::class, [ + 'entry_type' => PayerType::class, + 'entry_options' => ['label' => false], + 'allow_add' => true, + 'allow_delete' => true, + 'prototype' => true, + 'prototype_name' => '__payer_prototype__', + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Connection/PayerType.php b/modules/dpdshipping/src/Form/Configuration/Connection/PayerType.php new file mode 100644 index 00000000..b22460ca --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Connection/PayerType.php @@ -0,0 +1,62 @@ +add('fid', IntegerType::class, [ + 'required' => true, + ]) + ->add('name', TextType::class, [ + 'required' => true, + ]) + ->add('default', CheckboxType::class, [ + 'required' => false, + 'label' => false, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => DpdshippingPayer::class, + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Connection/index.php b/modules/dpdshipping/src/Form/Configuration/Connection/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Connection/index.php @@ -0,0 +1,33 @@ +dpdCarrier = $dpdCarrier; + } + + public function getData(): array + { + $idShop = (int)Context::getContext()->shop->id; + $connectionConfig = $this->queryBus->handle(new GetConnection($idShop, null)); + + if(!isset($connectionConfig) && $connectionConfig != null) { + $return[] = [ + 'login' => $connectionConfig->getLogin(), + 'masterfid' => $connectionConfig->getMasterfid(), + 'environment' => $connectionConfig->getEnvironment(), + ]; + + $defaultPayer = $this->queryBus->handle(new GetDefaultPayer($connectionConfig->getId())); + if (isset($defaultPayer)) { + $return[] = ['defaultFidNumber' => $defaultPayer->getFid()]; + } + } + + $senderAddress = $this->getSenderAddress($idShop); + + if (isset($senderAddress)) { + $return[] = [ + 'senderAddressId' => $senderAddress->getId(), + 'alias' => $senderAddress->getAlias(), + 'company' => $senderAddress->getCompany(), + 'name' => $senderAddress->getName(), + 'street' => $senderAddress->getStreet(), + 'city' => $senderAddress->getCity(), + 'country' => $senderAddress->getCountryCode(), + 'postcode' => $senderAddress->getPostalCode(), + 'mail' => $senderAddress->getMail(), + 'phone' => $senderAddress->getPhone(), + ]; + } + + $swipBoxCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_SWIP_BOX, $idShop)); + $pickupCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_PICKUP, $idShop)); + $pickupCodCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_PICKUP_COD, $idShop)); + $standardCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_STANDARD, $idShop)); + $standardCodCarrier = $this->queryBus->handle(new GetCarrier(Config::DPD_STANDARD_COD, $idShop)); + + $return[] = [ + 'carrierDpdPolandSwipBox' => isset($swipBoxCarrier) && $swipBoxCarrier !== false, + 'carrierDpdPolandPickup' => isset($pickupCarrier) && $pickupCarrier !== false, + 'carrierDpdPolandPickupCod' => isset($pickupCodCarrier) && $pickupCodCarrier !== false, + 'carrierDpdPoland' => isset($standardCarrier) && $standardCarrier !== false, + 'carrierDpdPolandCod' => isset($standardCodCarrier) && $standardCodCarrier !== false, + ]; + + return ArrayUtil::flatArray($return); + } + + public function setData(array $data): array + { + $errors = []; + + $testConnection = $this->queryBus->handle(new TestDpdConnection($data['login'], $data['password'], $data['masterfid'], $data['environment'])); + + if ($testConnection !== true) { + $errors[] = $testConnection; + + return $errors; + } + + $phpEncryption = new PhpEncryption(_NEW_COOKIE_KEY_); + foreach (Shop::getContextListShopID() as $idShop) { + $payer = new DpdshippingPayer(); + $payer + ->setName('FID') + ->setFid((string)$data['defaultFidNumber']) + ->setDefault(true); + $connectionId = $this->queryBus->handle(new SaveConnectionCommand(null, $idShop, "DPD API", $data['login'], $phpEncryption->encrypt($data['password']), $data['masterfid'], $data['environment'], true)); + $this->commandBus->handle(new AddPayerCommand([$payer], $idShop, $connectionId)); + + $this->saveConfiguration(Configuration::DEFAULT_PARAM_WEIGHT, 1.0, $idShop); + + $this->setSenderAddress($data, $idShop); + $this->dpdCarrier->handleCarrier(Config::DPD_SWIP_BOX, 'DPD Poland - Swip Box', $data['carrierDpdPolandSwipBox'], $idShop); + $this->dpdCarrier->handleCarrier(Config::DPD_PICKUP, 'DPD Poland - Pickup', $data['carrierDpdPolandPickup'], $idShop); + $this->dpdCarrier->handleCarrier(Config::DPD_PICKUP_COD, 'DPD Poland - Pickup COD', $data['carrierDpdPolandPickupCod'], $idShop); + + $this->dpdCarrier->handleCarrier(Config::DPD_STANDARD, 'DPD Poland', $data['carrierDpdPoland'], $idShop); + $this->dpdCarrier->handleCarrier(Config::DPD_STANDARD_COD, 'DPD Poland - COD', $data['carrierDpdPolandCod'], $idShop); + + $this->saveConfiguration(Configuration::NEED_ONBOARDING, '0', $idShop); + } + + return $errors; + } + + private function getSenderAddress($idShop): ?DpdshippingSenderAddress + { + $senderAddressList = $this->queryBus->handle(new GetSenderAddressList(true, $idShop)); + if (isset($senderAddressList) && count($senderAddressList) > 0 && $senderAddressList[0]->isDefault()) { + return $senderAddressList[0]; + } + + return null; + } + + private function setSenderAddress(array $data, int $idShop) + { + $entity = new DpdshippingSenderAddress(); + $entity + ->setIdShop($idShop) + ->setAlias($data['alias']) + ->setCompany($data['company']) + ->setName($data['name']) + ->setStreet($data['street']) + ->setCity($data['city']) + ->setCountryCode($data['country']) + ->setPostalCode($data['postcode']) + ->setMail($data['mail']) + ->setPhone($data['phone']) + ->setIsDefault(true); + + $this->queryBus->handle(new AddSenderAddressCommand($entity, $idShop)); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Onboarding/DpdShippingOnboardingType.php b/modules/dpdshipping/src/Form/Configuration/Onboarding/DpdShippingOnboardingType.php new file mode 100644 index 00000000..8c499ba7 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Onboarding/DpdShippingOnboardingType.php @@ -0,0 +1,116 @@ +add('login', TextType::class, [ + 'label' => $this->trans('Login', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('password', PasswordType::class, [ + 'label' => $this->trans('Password', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('masterfid', TextType::class, [ + 'label' => $this->trans('Master FID', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('defaultFidNumber', IntegerType::class, [ + 'label' => $this->trans('Default FID', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('environment', ChoiceType::class, [ + 'choices' => [ + $this->trans('DPD Poland Production', 'Modules.Dpdshipping.AdminOnboarding') => Config::DPD_API_URL_LIVE, + $this->trans('DPD Poland DEMO', 'Modules.Dpdshipping.AdminOnboarding') => Config::DPD_API_URL_DEMO, + ], + 'label' => $this->trans('Environment', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('carrierDpdPolandSwipBox', CheckboxType::class, [ + 'label' => $this->trans('Carrier DPD Poland Swip Box', 'Modules.Dpdshipping.AdminOnboarding'), + 'required' => false, + ]) + ->add('carrierDpdPolandPickup', CheckboxType::class, [ + 'label' => $this->trans('Carrier DPD Poland Pickup', 'Modules.Dpdshipping.AdminOnboarding'), + 'required' => false, + ]) + ->add('carrierDpdPolandPickupCod', CheckboxType::class, [ + 'label' => $this->trans('Carrier DPD Poland Pickup COD', 'Modules.Dpdshipping.AdminOnboarding'), + 'required' => false, + ]) + ->add('carrierDpdPoland', CheckboxType::class, [ + 'label' => $this->trans('Carrier DPD Poland', 'Modules.Dpdshipping.AdminOnboarding'), + 'required' => false, + ]) + ->add('carrierDpdPolandCod', CheckboxType::class, [ + 'label' => $this->trans('Carrier DPD Poland COD', 'Modules.Dpdshipping.AdminOnboarding'), + 'required' => false, + ]) + ->add('senderAddressId', HiddenType::class, []) + ->add('alias', TextType::class, [ + 'label' => $this->trans('Alias', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('company', TextType::class, [ + 'label' => $this->trans('Company', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('name', TextType::class, [ + 'label' => $this->trans('Name', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('street', TextType::class, [ + 'label' => $this->trans('Street', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('postcode', TextType::class, [ + 'label' => $this->trans('Postcode', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('city', TextType::class, [ + 'label' => $this->trans('City', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('country', TextType::class, [ + 'label' => $this->trans('Country', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('mail', TextType::class, [ + 'label' => $this->trans('Mail', 'Modules.Dpdshipping.AdminOnboarding'), + ]) + ->add('phone', TextType::class, [ + 'label' => $this->trans('Phone', 'Modules.Dpdshipping.AdminOnboarding'), + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Onboarding/index.php b/modules/dpdshipping/src/Form/Configuration/Onboarding/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Onboarding/index.php @@ -0,0 +1,33 @@ +loadField('ref1', Configuration::DEFAULT_PARAM_REF1), + $this->loadField('ref1StaticValue', Configuration::DEFAULT_PARAM_REF1_STATIC_VALUE), + $this->loadField('ref2', Configuration::DEFAULT_PARAM_REF2), + $this->loadField('ref2StaticValue', Configuration::DEFAULT_PARAM_REF2_STATIC_VALUE), + $this->loadField('customerData', Configuration::DEFAULT_PARAM_CUSTOMER_DATA), + $this->loadField('customerDataStaticValue', Configuration::DEFAULT_PARAM_CUSTOMER_DATA_STATIC_VALUE), + $this->loadField('content', Configuration::DEFAULT_PARAM_CONTENT), + $this->loadField('contentStaticValue', Configuration::DEFAULT_PARAM_CONTENT_STATIC_VALUE), + $this->loadField('weight', Configuration::DEFAULT_PARAM_WEIGHT), + $this->loadField('printFormat', Configuration::DEFAULT_PRINT_FORMAT), + $this->loadField('labelType', Configuration::DEFAULT_LABEL_TYPE), + $this->loadField('package_group_type', Configuration::DEFAULT_PACKAGE_GROUPING_WAY), + ]; + + return ArrayUtil::flatArray($return); + } + + public function setData(array $data): array + { + foreach (Shop::getContextListShopID() as $idShop) { + $this->saveConfiguration(Configuration::DEFAULT_PARAM_REF1, $data['ref1'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_REF1_STATIC_VALUE, $data['ref1StaticValue'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_REF2, $data['ref2'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_REF2_STATIC_VALUE, $data['ref2StaticValue'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_CUSTOMER_DATA, $data['customerData'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_CUSTOMER_DATA_STATIC_VALUE, $data['customerDataStaticValue'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_CONTENT, $data['content'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_CONTENT_STATIC_VALUE, $data['contentStaticValue'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PARAM_WEIGHT, (float)$data['weight'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PRINT_FORMAT, $data['printFormat'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_LABEL_TYPE, $data['labelType'], $idShop); + $this->saveConfiguration(Configuration::DEFAULT_PACKAGE_GROUPING_WAY, $data['package_group_type'] ?? 'single', $idShop); + } + return []; + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Parameter/DpdShippingParameterType.php b/modules/dpdshipping/src/Form/Configuration/Parameter/DpdShippingParameterType.php new file mode 100644 index 00000000..0faa4817 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Parameter/DpdShippingParameterType.php @@ -0,0 +1,152 @@ +add('ref1', ChoiceType::class, [ + 'choices' => [ + $this->trans('Order number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER, + $this->trans('Order number Empik', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER_EMPIK, + $this->trans('Order ID', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_ID, + $this->trans('Invoice number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::INVOICE_NUMBER, + $this->trans('Static value', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE, + $this->trans('Static value for Empik orders', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE_ONLY_FOR_EMPIK, + ], + 'label' => $this->trans('Ref 1', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'select-with-static-value'], + ]) + ->add('ref1StaticValue', TextType::class, [ + 'label' => $this->trans('Ref 1 - static value', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'input-static-value d-none'], + ]) + ->add('ref2', ChoiceType::class, [ + 'choices' => [ + $this->trans('Order number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER, + $this->trans('Order number Empik', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER_EMPIK, + $this->trans('Order ID', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_ID, + $this->trans('Invoice number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::INVOICE_NUMBER, + $this->trans('Static value', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE, + $this->trans('Static value for Empik orders', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE_ONLY_FOR_EMPIK, + ], + 'label' => $this->trans('Ref 2', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'select-with-static-value'], + + ]) + ->add('ref2StaticValue', TextType::class, [ + 'label' => $this->trans('Ref 2 - static value', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'input-static-value d-none'], + ]) + ->add('customerData', ChoiceType::class, [ + 'choices' => [ + $this->trans('Order number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER, + $this->trans('Order number Empik', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER_EMPIK, + $this->trans('Order ID', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_ID, + $this->trans('Invoice number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::INVOICE_NUMBER, + $this->trans('Product index', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::PRODUCT_INDEX, + $this->trans('Product name', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::PRODUCT_NAME, + $this->trans('Static value', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE, + $this->trans('Static value for Empik orders', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE_ONLY_FOR_EMPIK, + ], + 'label' => $this->trans('Customer data', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'select-with-static-value'], + + ]) + ->add('customerDataStaticValue', TextType::class, [ + 'label' => $this->trans('Customer data - static value', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'input-static-value d-none'], + ]) + ->add('content', ChoiceType::class, [ + 'choices' => [ + $this->trans('Order number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER, + $this->trans('Order number Empik', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_NUMBER_EMPIK, + $this->trans('Order ID', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::ORDER_ID, + $this->trans('Invoice number', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::INVOICE_NUMBER, + $this->trans('Product index', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::PRODUCT_INDEX, + $this->trans('Product name', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::PRODUCT_NAME, + $this->trans('Static value', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE, + $this->trans('Static value for Empik orders', 'Modules.Dpdshipping.AdminParameter') => AdditionalFields::STATIC_VALUE_ONLY_FOR_EMPIK, + ], + 'label' => $this->trans('Content', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'select-with-static-value'], + + ]) + ->add('contentStaticValue', TextType::class, [ + 'label' => $this->trans('Content - static value', 'Modules.Dpdshipping.AdminParameter'), + 'required' => false, + 'attr' => ['class' => 'input-static-value d-none'], + ]) + ->add('package_group_type', ChoiceType::class, [ + 'choices' => [ + $this->trans('Single shipping', 'Modules.Dpdshipping.AdminParameter') => 'single', + $this->trans('Shipping for products group', 'Modules.Dpdshipping.AdminParameter') => 'group', + $this->trans('Shipping for each product', 'Modules.Dpdshipping.AdminParameter') => 'package', + ], + 'label' => $this->trans('Method of Package Grouping', 'Modules.Dpdshipping.AdminParameter'), + 'required' => true, + ]) + ->add('weight', NumberType::class, [ + 'label' => $this->trans('Weight [kg]', 'Modules.Dpdshipping.AdminParameter'), + ]) + ->add('printFormat', ChoiceType::class, [ + 'choices' => [ + $this->trans('A4', 'Modules.Dpdshipping.AdminParameter') => 'A4', + $this->trans('Label', 'Modules.Dpdshipping.AdminParameter') => 'LBL_PRINTER', + ], + 'label' => $this->trans('Print format', 'Modules.Dpdshipping.AdminParameter'), + ]) + ->add('labelType', ChoiceType::class, [ + 'choices' => [ + $this->trans('Standard label', 'Modules.Dpdshipping.AdminParameter') => 'BIC3', + $this->trans('RUCH label', 'Modules.Dpdshipping.AdminParameter') => 'RUCH', + $this->trans('APOLLO label', 'Modules.Dpdshipping.AdminParameter') => 'APOLLO', + ], + 'label' => $this->trans('Label type', 'Modules.Dpdshipping.AdminParameter'), + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/Parameter/index.php b/modules/dpdshipping/src/Form/Configuration/Parameter/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/Parameter/index.php @@ -0,0 +1,33 @@ +queryBus->handle(new GetPickupCourierSettingsList(false, $pickupCourierId ?: "0")); + + if (!isset($pickupCourier) || $pickupCourier == null) { + return []; + } + + return [ + 'pickupCourierId' => $pickupCourierId, + 'customer_full_name' => $pickupCourier->getCustomerFullName(), + 'customer_name' => $pickupCourier->getCustomerName(), + 'customer_phone' => $pickupCourier->getCustomerPhone(), + 'payer_number' => $pickupCourier->getPayerNumber(), + 'sender_address' => $pickupCourier->getSenderAddress(), + 'sender_city' => $pickupCourier->getSenderCity(), + 'sender_full_name' => $pickupCourier->getSenderFullName(), + 'sender_name' => $pickupCourier->getSenderName(), + 'sender_phone' => $pickupCourier->getSenderPhone(), + 'sender_postal_code' => $pickupCourier->getSenderPostalCode(), + 'sender_country_code' => $pickupCourier->getSenderCountryCode(), + ]; + } + + public function setData(array $data): array + { + $entity = new DpdshippingPickupCourierSettings(); + if (isset($data['pickupCourierId'])) { + $entity + ->setId((int)$data['pickupCourierId']); + } + $entity + ->setCustomerName($data['customer_name']) + ->setCustomerFullName($data['customer_full_name']) + ->setCustomerPhone($data['customer_phone']) + ->setPayerNumber($data['payer_number']) + ->setSenderFullName($data['sender_full_name']) + ->setSenderName($data['sender_name']) + ->setSenderAddress($data['sender_address']) + ->setSenderCity($data['sender_city']) + ->setSenderPhone($data['sender_phone']) + ->setSenderPostalCode($data['sender_postal_code']) + ->setSenderCountryCode($data['sender_country_code']); + + foreach (Shop::getContextListShopID() as $idShop) { + $this->queryBus->handle(new AddPickupOrderSettingsCommand($entity, $idShop)); + } + return []; + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/PickupCourierSettings/DpdShippingPickupCourierSettingsType.php b/modules/dpdshipping/src/Form/Configuration/PickupCourierSettings/DpdShippingPickupCourierSettingsType.php new file mode 100644 index 00000000..3998ce11 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/PickupCourierSettings/DpdShippingPickupCourierSettingsType.php @@ -0,0 +1,80 @@ +add('customer_full_name', TextType::class, [ + 'label' => $this->trans('Customer company', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('customer_name', TextType::class, [ + 'label' => $this->trans('Customer Name', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('customer_phone', TextType::class, [ + 'label' => $this->trans('Customer Phone number', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('payer_number', IntegerType::class, [ + 'label' => $this->trans('Payer number', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('sender_full_name', TextType::class, [ + 'label' => $this->trans('Sender company', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('sender_name', TextType::class, [ + 'label' => $this->trans('Sender name', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('sender_address', TextType::class, [ + 'label' => $this->trans('Sender address', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('sender_city', TextType::class, [ + 'label' => $this->trans('Sender city', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('sender_phone', TextType::class, [ + 'label' => $this->trans('Sender phone', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('sender_postal_code', TextType::class, [ + 'label' => $this->trans('Sender postal code', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('sender_country_code', TextType::class, [ + 'label' => $this->trans('Sender country code', 'Modules.Dpdshipping.AdminPickupCourier'), + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/PickupCourierSettings/index.php b/modules/dpdshipping/src/Form/Configuration/PickupCourierSettings/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/PickupCourierSettings/index.php @@ -0,0 +1,33 @@ +loadField('specialPrice', Configuration::SPECIAL_PRICE_ENABLED), + ]; + + $result = ArrayUtil::flatArray($return); + $result['specialPrice'] = boolval($result['specialPrice'] ?? '0'); + $result['specialPriceList'] = $this->getSpecialPriceList(); + + return $result; + } + + public function setData(array $data): array + { + $shops = Shop::getContextListShopID(); + + foreach ($shops as $idShop) { + $idGroupShop = Shop::getGroupFromShop($idShop); + + $this->saveConfiguration(Configuration::SPECIAL_PRICE_ENABLED, $data['specialPrice'], (int)$idShop); + ConfigurationPrestashop::updateValue(Configuration::SPECIAL_PRICE_ENABLED, $data['specialPrice'], false, (int)$idGroupShop, (int)$idShop); + + if ($idShop === (int)Context::getContext()->shop->id) + $result = $this->commandBus->handle(new AddSpecialPriceCommand($data['specialPriceList'], $idShop)); + else + $this->commandBus->handle(new AddSpecialPriceCommand($data['specialPriceList'], $idShop)); + + } + return $result ?? []; + } + + /** + * @return array + */ + public function getSpecialPriceList(): array + { + $specialPriceList = $this->queryBus->handle(new GetSpecialPriceList()); + $specialPriceListResult = []; + foreach ($specialPriceList as $item) { + $array = []; + $array['isoCountry'] = $item->getIsoCountry(); + $array['priceFrom'] = $item->getPriceFrom(); + $array['priceTo'] = $item->getPriceTo(); + $array['weightFrom'] = $item->getWeightFrom(); + $array['weightTo'] = $item->getWeightTo(); + $array['parcelPrice'] = $item->getParcelPrice(); + $array['codPrice'] = $item->getCodPrice(); + $array['carrierType'] = $item->getCarrierType(); + + $specialPriceListResult[] = $array; + } + if (!empty($specialPriceListResult)) { + return $specialPriceListResult; + } else { + $emptyRow = []; + $emptyRow[] = [ + 'isoCountry' => 'PL', + 'priceFrom' => 0, + 'priceTo' => 999, + 'weightFrom' => 0, + 'weightTo' => 999, + 'parcelPrice' => null, + 'codPrice' => null, + 'carrierType' => Config::DPD_STANDARD, + ]; + + return $emptyRow; + } + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/SpecialPrice/DpdShippingSpecialPriceType.php b/modules/dpdshipping/src/Form/Configuration/SpecialPrice/DpdShippingSpecialPriceType.php new file mode 100644 index 00000000..192f0543 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/SpecialPrice/DpdShippingSpecialPriceType.php @@ -0,0 +1,56 @@ +add('specialPrice', CheckboxType::class, [ + 'label' => $this->trans('Special price enabled', 'Modules.Dpdshipping.AdminSpecialPrice'), + 'required' => false, + ]) + ->add('specialPriceList', CollectionType::class, [ + 'entry_type' => SpecialPriceType::class, + 'entry_options' => ['label' => false], + 'allow_add' => true, + 'allow_delete' => true, + 'prototype' => true, + 'prototype_name' => '__special_price_prototype__', + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/SpecialPrice/SpecialPriceType.php b/modules/dpdshipping/src/Form/Configuration/SpecialPrice/SpecialPriceType.php new file mode 100644 index 00000000..f16574e9 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/SpecialPrice/SpecialPriceType.php @@ -0,0 +1,89 @@ +add('isoCountry', TextType::class, [ + 'required' => true, + ]) + ->add('priceFrom', NumberType::class, [ + 'required' => true, + ]) + ->add('priceTo', NumberType::class, [ + 'required' => true, + ]) + ->add('weightFrom', NumberType::class, [ + 'required' => true, + ]) + ->add('weightTo', NumberType::class, [ + 'required' => true, + ]) + ->add('parcelPrice', NumberType::class, [ + 'required' => true, + ]) + ->add('codPrice', NumberType::class, [ + 'required' => false, + ]) + ->add('carrierType', ChoiceType::class, [ + 'choices' => [ + $this->trans('DPD Poland', 'Modules.Dpdshipping.Carrier') => Config::DPD_STANDARD, + $this->trans('DPD Poland COD', 'Modules.Dpdshipping.Carrier') => Config::DPD_STANDARD_COD, + $this->trans('DPD Poland - Pickup', 'Modules.Dpdshipping.Carrier') => Config::DPD_PICKUP, + $this->trans('DPD Poland - Pickup COD', 'Modules.Dpdshipping.Carrier') => Config::DPD_PICKUP_COD, + $this->trans('DPD Poland - Swip Box', 'Modules.Dpdshipping.Carrier') => Config::DPD_SWIP_BOX, + ], + 'required' => true, + 'label' => 'deliveryMethod', + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => null, + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Configuration/SpecialPrice/index.php b/modules/dpdshipping/src/Form/Configuration/SpecialPrice/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Configuration/SpecialPrice/index.php @@ -0,0 +1,33 @@ +queryBus->handle(new GetDefaultOrderSenderAddress($order->id_shop)); + $receiverAddress = $this->queryBus->handle(new GetDefaultOrderReceiverAddress($order)); + + $ref1Source = $this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_REF1, $order->id_shop)); + $ref1SourceStatic = $this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_REF1_STATIC_VALUE, $order->id_shop)); + + $ref2Source = $this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_REF2, $order->id_shop)); + $ref2SourceStatic = $this->commandBus->handle(new GetConfiguration(Configuration::DEFAULT_PARAM_REF2_STATIC_VALUE, $order->id_shop)); + + $connectionIdOption = $this->getConnectionIdOption($order); + + return [ + 'sender_address_company' => $senderAddress['company'] ?? '', + 'sender_address_name' => $senderAddress['name'] ?? '', + 'sender_address_street' => $senderAddress['street'] ?? '', + 'sender_address_city' => $senderAddress['city'] ?? '', + 'sender_address_postcode' => $senderAddress['postcode'] ?? '', + 'sender_address_country' => $senderAddress['country'] ?? '', + 'sender_address_phone' => $senderAddress['phone'] ?? '', + 'sender_address_email' => $senderAddress['email'] ?? '', + + 'receiver_address_company' => $receiverAddress['company'] ?? '', + 'receiver_address_name' => $receiverAddress['name'] ?? '', + 'receiver_address_street' => $receiverAddress['street'] ?? '', + 'receiver_address_city' => $receiverAddress['city'] ?? '', + 'receiver_address_postcode' => $receiverAddress['postcode'] ?? '', + 'receiver_address_country' => $receiverAddress['country'] ?? '', + 'receiver_address_phone' => $receiverAddress['phone'] ?? '', + 'receiver_address_email' => $receiverAddress['email'] ?? '', + 'packages' => [[]], + 'ref1' => self::getDynamicData($order, $ref1Source, $ref1SourceStatic), + 'ref2' => self::getDynamicData($order, $ref2Source, $ref2SourceStatic), + 'connection_id' => $connectionIdOption != null ? $connectionIdOption->getValue() : null + ]; + } + + public function getDefaultData() + { + } + + public function getDynamicData($order, $dataSource, $dataSourceStatic): string + { + if ($dataSource == null) { + return ''; + } + + if ($dataSource->getValue() == AdditionalFields::STATIC_VALUE) { + return $dataSourceStatic != null ? $dataSourceStatic->getValue() : ''; + } elseif ($dataSource->getValue() == AdditionalFields::ORDER_NUMBER) { + return $order->reference; + } elseif ($dataSource->getValue() == AdditionalFields::ORDER_ID) { + return (string)$order->id; + } elseif ($dataSource->getValue() == AdditionalFields::INVOICE_NUMBER) { + return (string)$order->invoice_number; + } elseif ($dataSource->getValue() == AdditionalFields::STATIC_VALUE_ONLY_FOR_EMPIK && $this->commandBus->handle(new GetEmpikOrderReference($order->id, $order->id_shop)) != '') { + return $dataSourceStatic != null ? $dataSourceStatic->getValue() : ''; + } elseif ($dataSource->getValue() == AdditionalFields::ORDER_NUMBER_EMPIK) { + return $this->commandBus->handle(new GetEmpikOrderReference($order->id, $order->id_shop)); + } + + return ''; + } + + /** + * @param $empikEnabled + * @param Order $order + * @return null + */ + public function getConnectionIdOption(Order $order) + { + $empikEnabled = $this->commandBus->handle(new GetConfiguration(Configuration::EMPIK_MODULE_INTEGRATION_ENABLED, $order->id_shop)); + + if ($empikEnabled != null && $empikEnabled->getValue() == "1") { + $orderSource = $this->commandBus->handle(new GetOrderSource($order->id, $order->id_shop)); + if ($orderSource == GetOrderSourceHandler::DELIVERY_EMPIK_STORE) { + return $this->commandBus->handle(new GetConfiguration(Configuration::EMPIK_DPD_API_FOR_STORE_DELIVERY, $order->id_shop)); + } + } + return null; + } +} diff --git a/modules/dpdshipping/src/Form/Order/GenerateShipping/DpdShippingGenerateShippingType.php b/modules/dpdshipping/src/Form/Order/GenerateShipping/DpdShippingGenerateShippingType.php new file mode 100644 index 00000000..862c9271 --- /dev/null +++ b/modules/dpdshipping/src/Form/Order/GenerateShipping/DpdShippingGenerateShippingType.php @@ -0,0 +1,553 @@ + $labelToFid) { + foreach ($labelToFid as $label => $fid) { + $payerAllChoices[$label] = (string) $fid; + } + } + + $firstConnectionId = !empty($connectionChoices) ? array_values($connectionChoices)[0] : null; + + $data = $builder->getData(); + + $builder +// SENDER + ->add('sender_address_company', TextType::class, [ + 'label' => $this->trans('Company name:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter company...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) + ->add('sender_address_name', TextType::class, [ + 'label' => $this->trans('Name:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter name...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) + ->add('sender_address_street', TextType::class, [ + 'label' => $this->trans('Street:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter street...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('sender_address_postcode', TextType::class, [ + 'label' => $this->trans('Postcode:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter postcode...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('sender_address_city', TextType::class, [ + 'label' => $this->trans('City:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter city...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('sender_address_country', TextType::class, [ + 'label' => $this->trans('Country:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter country...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('sender_address_phone', TextType::class, [ + 'label' => $this->trans('Phone:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter phone...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) + ->add('sender_address_email', TextType::class, [ + 'label' => $this->trans('Email:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter email...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) +// Receiver + ->add('receiver_address_company', TextType::class, [ + 'label' => $this->trans('Receiver company name:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter company...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) + ->add('receiver_address_name', TextType::class, [ + 'label' => $this->trans('Receiver name:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter name...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) + ->add('receiver_address_street', TextType::class, [ + 'label' => $this->trans('Receiver street:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter street...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('receiver_address_postcode', TextType::class, [ + 'label' => $this->trans('Receiver postcode:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter postcode...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('receiver_address_city', TextType::class, [ + 'label' => $this->trans('Receiver city:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter city...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('receiver_address_country', TextType::class, [ + 'label' => $this->trans('Receiver country:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter country...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => true, + ]) + ->add('receiver_address_phone', TextType::class, [ + 'label' => $this->trans('Receiver phone:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter phone...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) + ->add('receiver_address_email', TextType::class, [ + 'label' => $this->trans('Receiver email:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control', 'placeholder' => $this->trans('Enter email...', 'Modules.Dpdshipping.AdminOrder')], + 'required' => false, + ]) +// API Connection + ->add('connection_id', ChoiceType::class, [ + 'choices' => $connectionChoices, + 'placeholder' => $this->trans('Select connection', 'Modules.Dpdshipping.AdminConnection'), + 'required' => true, + 'label' => false, + 'data' => is_array($data) && isset($data['connection_id']) + ? $data['connection_id'] + : $firstConnectionId, + 'attr' => [ + 'class' => 'form-control js-dpd-connection', + 'data-payers' => json_encode($payersByConnection, JSON_UNESCAPED_UNICODE), + ], + ]) +// PAYER + ->add('payer_number', ChoiceType::class, [ + 'choices' => $payerAllChoices, // JS will fill + 'placeholder' => $this->trans('Select payer', 'Modules.Dpdshipping.AdminConnection'), + 'required' => true, + 'label' => false, + 'attr' => [ + 'class' => 'form-control js-dpd-payer', + ], + ]) +//ADDITIONAL FIELDS + ->add('ref1', TextType::class, [ + 'label' => $this->trans('Ref1:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('ref2', TextType::class, [ + 'label' => $this->trans('Ref2:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) +// SERVICES + ->add('service_guarantee', CheckboxType::class, [ + 'label' => $this->trans('Service guarantee', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_guarantee_type', ChoiceType::class, [ + 'choices' => [ + '09:30' => 'TIME0930', + '12:00' => 'TIME1200', + $this->trans('DPD on hour', 'Modules.Dpdshipping.AdminOrder') => 'TIMEFIXED', + $this->trans('Saturday', 'Modules.Dpdshipping.AdminOrder') => 'SATURDAY', + $this->trans('DPD NEXTDAY', 'Modules.Dpdshipping.AdminOrder') => 'DPDNEXTDAY', + $this->trans('DPD TODAY', 'Modules.Dpdshipping.AdminOrder') => 'DPDTODAY', + $this->trans('Guarantee international ', 'Modules.Dpdshipping.AdminOrder') => 'INTER', + $this->trans('B2C', 'Modules.Dpdshipping.AdminOrder') => 'B2C', + ], + 'required' => false, + 'label' => false, + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => true, + 'required' => false, + ], + ]) + ->add('service_guarantee_value', TextType::class, [ + 'label' => false, + 'attr' => [ + 'class' => '', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('HH:MM', 'Modules.Dpdshipping.AdminOrder'), + 'required' => false, + ], + 'required' => false, + 'constraints' => [ + new Assert\Regex([ + 'pattern' => '/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/', + 'message' => 'Please enter a valid time in the format XX:XX.', + ]), + ], + ]) + ->add('service_in_pers', CheckboxType::class, [ + 'label' => $this->trans('Service in pers', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_priv_pers', CheckboxType::class, [ + 'label' => $this->trans('Service priv pers', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_cod', CheckboxType::class, [ + 'label' => $this->trans('Service COD', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + 'data' => $this->isCod($options['dpd_carrier']), + ]) + ->add('service_cod_value', NumberType::class, [ + 'label' => false, + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => !$this->isCod($options['dpd_carrier']), + 'min' => 0, + 'placeholder' => $this->trans('Enter value...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + 'data' => $options['order_amount'], + + ]) + ->add('service_cod_currency', ChoiceType::class, [ + 'choices' => $options['currencies'], + 'label' => false, + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => !$this->isCod($options['dpd_carrier']), + ], + 'required' => false, + 'data' => $options['order_currency'] ?? 'PLN', + ]) + ->add('service_self_con', CheckboxType::class, [ + 'label' => $this->trans('Service self con', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_self_con_value', ChoiceType::class, [ + 'choices' => [ + $this->trans('Company', 'Modules.Dpdshipping.AdminOrder') => 'COMP', + $this->trans('Private', 'Modules.Dpdshipping.AdminOrder') => 'PRIV', + ], + 'label' => false, + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + ], + 'required' => false, + ]) + ->add('service_dpd_pickup', CheckboxType::class, [ + 'label' => $this->trans('Service DPD Pickup', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + 'data' => $this->isPickup($options['dpd_carrier']), + ]) + ->add('service_dpd_pickup_value', TextType::class, [ + 'label' => false, + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => !$this->isPickup($options['dpd_carrier']), + ], + 'required' => false, + 'data' => $options['order_pickup_number'], + ]) + ->add('service_dpd_pickup_map', ButtonType::class, [ + 'label' => $this->trans('Open map', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control btn-sm btn-secondary dpdshipping-pudo-change-map-btn', + 'data-attribute' => true, + 'data-hidden' => !$this->isPickup($options['dpd_carrier']), + ], + ]) + ->add('service_rod', CheckboxType::class, [ + 'label' => $this->trans('Service rod', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_dox', CheckboxType::class, [ + 'label' => $this->trans('Service dox', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_cud', CheckboxType::class, [ + 'label' => $this->trans('Service cud', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_tires', CheckboxType::class, [ + 'label' => $this->trans('Service Tires', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_declared_value', CheckboxType::class, [ + 'label' => $this->trans('Service Declared value', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_declared_value_value', NumberType::class, [ + 'label' => false, + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => true, + 'min' => 0, + 'placeholder' => $this->trans('Enter value...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + 'data' => $options['order_amount'], + ]) + ->add('service_declared_value_currency', ChoiceType::class, [ + 'choices' => $options['currencies'], + 'label' => false, + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => true, + ], + 'required' => false, + 'data' => $options['order_currency'] ?? 'PLN', + ]) + ->add('service_dpd_express', CheckboxType::class, [ + 'label' => $this->trans('Service DPD Express', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_dpd_food', CheckboxType::class, [ + 'label' => $this->trans('Service DPD Food', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_dpd_food_value', DateType::class, [ + 'label' => false, + 'widget' => 'single_text', + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => true, + 'min' => (new DateTime('+2 days'))->format('Y-m-d')], + 'required' => false, + ]) + ->add('service_duty', CheckboxType::class, [ + 'label' => $this->trans('Service duty', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_duty_value', NumberType::class, [ + 'label' => false, + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => true, + 'min' => 0, + ], + 'required' => false, + 'data' => $options['order_amount'], + ]) + ->add('service_duty_currency', ChoiceType::class, [ + 'choices' => $options['currencies'], + 'label' => false, + 'attr' => [ + 'class' => 'form-control ', + 'data-attribute' => true, + 'data-hidden' => true, + ], + 'required' => false, + 'data' => $options['order_currency'] ?? 'PLN', + ]) + ->add('service_adr', CheckboxType::class, [ + 'label' => $this->trans('Service ADR', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) + ->add('service_return_label', CheckboxType::class, [ + 'label' => $this->trans('Service return label', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => ['class' => 'form-control'], + 'required' => false, + ]) +// RETURN LABEL + ->add('service_return_label_address_company', TextType::class, [ + 'label' => $this->trans('Company name:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter company...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) + ->add('service_return_label_address_name', TextType::class, [ + 'label' => $this->trans('Name:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter name...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) + ->add('service_return_label_address_street', TextType::class, [ + 'label' => $this->trans('Street:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter street...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) + ->add('service_return_label_address_city', TextType::class, [ + 'label' => $this->trans('City:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter city...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) + ->add('service_return_label_address_postcode', TextType::class, [ + 'label' => $this->trans('Postcode:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter postcode...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) + ->add('service_return_label_address_country', TextType::class, [ + 'label' => $this->trans('Country:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter country...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) + ->add('service_return_label_address_phone', TextType::class, [ + 'label' => $this->trans('Phone:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter phone...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) + ->add('service_return_label_address_email', TextType::class, [ + 'label' => $this->trans('Email:', 'Modules.Dpdshipping.AdminOrder'), + 'attr' => [ + 'class' => 'form-control', + 'data-attribute' => true, + 'data-hidden' => true, + 'placeholder' => $this->trans('Enter email...', 'Modules.Dpdshipping.AdminOrder'), + ], + 'required' => false, + ]) +// packages + + ->add('packages', CollectionType::class, [ + 'entry_type' => PackageType::class, + 'entry_options' => ['label' => false], + 'allow_add' => true, + 'allow_delete' => true, + 'prototype' => true, + 'prototype_name' => '__package_dpd_prototype__', + ]); + + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'api_connection_list' => '', + 'default_connection_id' => '', + 'default_payer_by_conn' => '', + 'payer_number_list' => '', + 'dpd_carrier' => '', + 'currencies' => Currency::getDpdCurrencies(), + 'order_amount' => '', + 'order_pickup_number' => '', + 'order_currency' => '', + 'is_dpd_carrier' => 'false', + 'dpdPudoFinderUrl' => '', + 'constraints' => [ + new AtLeastOne([ + 'fields' => ['sender_address_company', 'sender_address_name'], + ]), + new AtLeastOne([ + 'fields' => ['receiver_address_company', 'receiver_address_name'], + ]), + ], + ]); + } + + /** + * @param $dpd_carrier + * @return bool + */ + public function isPickup($dpd_carrier): bool + { + return $dpd_carrier == Config::DPD_PICKUP || $dpd_carrier == Config::DPD_PICKUP_COD || $dpd_carrier == Config::DPD_SWIP_BOX; + } + + /** + * @param $dpd_carrier + * @return bool + */ + public function isCod($dpd_carrier): bool + { + return $dpd_carrier == Config::DPD_STANDARD_COD || $dpd_carrier == Config::DPD_PICKUP_COD; + } +} diff --git a/modules/dpdshipping/src/Form/Order/GenerateShipping/PackageType.php b/modules/dpdshipping/src/Form/Order/GenerateShipping/PackageType.php new file mode 100644 index 00000000..4461223a --- /dev/null +++ b/modules/dpdshipping/src/Form/Order/GenerateShipping/PackageType.php @@ -0,0 +1,71 @@ +add('weight', NumberType::class, [ + 'required' => true, + ]) + ->add('weightAdr', NumberType::class, [ + 'required' => false, + ]) + ->add('customerData', TextType::class, [ + 'required' => false, + ]) + ->add('content', TextType::class, [ + 'required' => false, + ]) + ->add('sizeX', NumberType::class, [ + 'required' => false, + ]) + ->add('sizeY', NumberType::class, [ + 'required' => false, + ]) + ->add('sizeZ', NumberType::class, [ + 'required' => false, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => null, + ]); + } +} diff --git a/modules/dpdshipping/src/Form/Order/GenerateShipping/index.php b/modules/dpdshipping/src/Form/Order/GenerateShipping/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/Order/GenerateShipping/index.php @@ -0,0 +1,33 @@ +queryBus->handle(new GetPickupCourierSettingsList(true)); + + $result = []; + foreach ($senderAddresses as $senderAddress) { + $label = implode(' ', [ + $senderAddress->getCustomerFullName(), + $senderAddress->getCustomerName(), + $senderAddress->getCustomerPhone(), + $senderAddress->getPayerNumber(), + $senderAddress->getSenderAddress(), + $senderAddress->getSenderCity(), + $senderAddress->getSenderFullName(), + $senderAddress->getSenderName(), + $senderAddress->getSenderPhone(), + $senderAddress->getSenderPostalCode(), + $senderAddress->getSenderCountryCode(), + + ]); + $result[$label] = $senderAddress->getId(); + } + + return $result; + } + + public function setData(array $data): array + { + return []; + } +} diff --git a/modules/dpdshipping/src/Form/PickupCourier/DpdShippingPickupCourierEditType.php b/modules/dpdshipping/src/Form/PickupCourier/DpdShippingPickupCourierEditType.php new file mode 100644 index 00000000..6abd4268 --- /dev/null +++ b/modules/dpdshipping/src/Form/PickupCourier/DpdShippingPickupCourierEditType.php @@ -0,0 +1,178 @@ +formDataProvider = $formDataProvider; + } + + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('dpdshipping_pickup_courier_sender_address', ChoiceType::class, [ + 'label' => $this->trans('Sender address', 'Modules.Dpdshipping.AdminPickupCourier'), + 'attr' => ['class' => 'mb-3'], + 'choices' => $this->formDataProvider->getSenderAddress(), + 'required' => false, + ]) + ->add('customer_company', TextType::class, [ + 'label' => $this->trans('Company name', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('customer_name', TextType::class, [ + 'label' => $this->trans('Name', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('customer_phone', TextType::class, [ + 'label' => $this->trans('Phone number', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('pickup_date', DatePickerType::class, [ + 'label' => $this->trans('Pickup date', 'Modules.Dpdshipping.AdminPickupCourier'), + ]) + ->add('pickup_time', ChoiceType::class, [ + 'label' => $this->trans('Pickup date', 'Modules.Dpdshipping.AdminPickupCourier'), + 'choices' => [], + 'required' => false, + ]) + ->add('letters', CheckboxType::class, [ + 'label' => $this->trans('Letters', 'Modules.Dpdshipping.AdminPickupCourier'), + 'attr' => ['class' => 'mb-3'], + 'required' => false, + ]) + ->add('letters_count', IntegerType::class, [ + 'label' => $this->trans('Letters', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('packages', CheckboxType::class, [ + 'label' => $this->trans('Packages', 'Modules.Dpdshipping.AdminPickupCourier'), + 'attr' => ['class' => 'mt-3 mb-3'], + 'required' => false, + ]) + ->add('packages_count', IntegerType::class, [ + 'label' => $this->trans('Packages', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('packages_weight_sum', IntegerType::class, [ + 'label' => $this->trans('Weight sum [kg]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('packages_weight_max', IntegerType::class, [ + 'label' => $this->trans('Weight max [kg]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('packages_size_x_max', IntegerType::class, [ + 'label' => $this->trans('Size X max [cm]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('packages_size_y_max', IntegerType::class, [ + 'label' => $this->trans('Size Y max [cm]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('packages_size_z_max', IntegerType::class, [ + 'label' => $this->trans('Size Z max [cm]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('palette', CheckboxType::class, [ + 'label' => $this->trans('Palette', 'Modules.Dpdshipping.AdminPickupCourier'), + 'attr' => ['class' => 'mt-3 mb-3'], + 'required' => false, + ]) + ->add('palette_count', IntegerType::class, [ + 'label' => $this->trans('Palette', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('palette_weight_sum', IntegerType::class, [ + 'label' => $this->trans('Weight sum [kg]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('palette_weight_max', IntegerType::class, [ + 'label' => $this->trans('Weight max [kg]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]) + ->add('palette_size_y_max', IntegerType::class, [ + 'label' => $this->trans('Size Y max [cm]', 'Modules.Dpdshipping.AdminPickupCourier'), + 'required' => false, + 'attr' => [ + 'min' => 0, + ] + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'sender_address' => [], + ]); + } +} diff --git a/modules/dpdshipping/src/Form/PickupCourier/index.php b/modules/dpdshipping/src/Form/PickupCourier/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Form/PickupCourier/index.php @@ -0,0 +1,33 @@ + 100, + 'offset' => 0, + 'orderBy' => 'id', + 'sortOrder' => 'desc', + 'filters' => [], + ]; + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/Address/Definition/Factory/AddressGridDefinitionFactory.php b/modules/dpdshipping/src/Grid/Configuration/Address/Definition/Factory/AddressGridDefinitionFactory.php new file mode 100644 index 00000000..9702396b --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/Address/Definition/Factory/AddressGridDefinitionFactory.php @@ -0,0 +1,167 @@ +trans('Sender addresses', [], 'Modules.Dpdshipping.AdminAddress'); + } + + protected function getColumns() + { + return (new ColumnCollection()) + ->add( + (DataColumnFactory::create('id_shop')) + ->setName($this->trans('Shop', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'id_shop', + ]) + ) + ->add( + (DataColumnFactory::create('alias')) + ->setName($this->trans('Alias', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'alias', + ]) + ) + ->add( + (DataColumnFactory::create('company')) + ->setName($this->trans('Company', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'company', + ]) + ) + ->add( + (DataColumnFactory::create('name')) + ->setName($this->trans('Name', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'name', + ]) + ) + ->add( + (DataColumnFactory::create('street')) + ->setName($this->trans('Street', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'street', + ]) + ) + ->add( + (DataColumnFactory::create('postal_code')) + ->setName($this->trans('Postcode', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'postal_code', + ]) + ) + ->add( + (DataColumnFactory::create('city')) + ->setName($this->trans('City', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'city', + ]) + ) + ->add( + (DataColumnFactory::create('country_code')) + ->setName($this->trans('Country', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'country_code', + ]) + ) + ->add( + (DataColumnFactory::create('email')) + ->setName($this->trans('Mail', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'email', + ]) + ) + ->add( + (DataColumnFactory::create('phone')) + ->setName($this->trans('Phone', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'phone', + ]) + ) + ->add( + (DataColumnFactory::create('is_default')) + ->setName($this->trans('Default', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'field' => 'is_default', + ]) + ) + ->add( + (new ActionColumn('actions')) + ->setName($this->trans('Actions', [], 'Modules.Dpdshipping.AdminAddress')) + ->setOptions([ + 'actions' => (new RowActionCollection()) + ->add((new SubmitRowAction('edit')) + ->setName($this->trans('Edit', [], 'Modules.Dpdshipping.AdminAddress')) + ->setIcon('edit') + ->setOptions([ + 'method' => 'POST', + 'route' => 'dpdshipping_address_edit_form', + 'route_param_name' => 'senderAddressId', + 'route_param_field' => 'id', + ])) + ->add((new SubmitRowAction('delete')) + ->setName($this->trans('Delete', [], 'Modules.Dpdshipping.AdminAddress')) + ->setIcon('delete') + ->setOptions([ + 'method' => 'DELETE', + 'route' => 'dpdshipping_address_delete_form', + 'route_param_name' => 'senderAddressId', + 'route_param_field' => 'id', + 'modal_options' => new ModalOptions([ + 'title' => $this->trans('Remove selected row?', [], 'Modules.Dpdshipping.AdminAddress'), + 'confirm_button_label' => $this->trans('Delete', [], 'Modules.Dpdshipping.AdminAddress'), + 'confirm_button_class' => 'btn-secondary', + 'close_button_label' => $this->trans('Close', [], 'Modules.Dpdshipping.AdminAddress'), + ]), + ])), + ]) + ); + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/Address/Definition/Factory/index.php b/modules/dpdshipping/src/Grid/Configuration/Address/Definition/Factory/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/Address/Definition/Factory/index.php @@ -0,0 +1,33 @@ +searchCriteriaApplicator = $searchCriteriaApplicator; + $this->contextLanguageId = $contextLanguageId; + $this->contextShopId = $contextShopId; + $this->isStockSharingBetweenShopGroupEnabled = $isStockSharingBetweenShopGroupEnabled; + $this->contextShopGroupId = $contextShopGroupId; + $this->filterApplicator = $filterApplicator; + } + + public function getSearchQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb + ->select('id, id_shop, alias, company, name, street, city, postal_code, country_code, phone, email, is_default'); + + return $qb; + } + + private function getQueryBuilder(array $filterValues): QueryBuilder + { + $qb = $this->connection + ->createQueryBuilder() + ->from($this->dbPrefix . 'dpdshipping_sender_address', 'sa'); + + $sqlFilters = new SqlFilters(); + $sqlFilters + ->addFilter( + 'id', + 'sa.`id`', + SqlFilters::WHERE_STRICT + ); + + $this->filterApplicator->apply($qb, $sqlFilters, $filterValues); + + $qb->andWhere('sa.`id_shop` IN (' . implode(', ', Shop::getContextListShopID()) . ')'); + + return $qb; + } + + public function getCountQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb->select('COUNT(sa.`id`)'); + + return $qb; + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/Address/Query/index.php b/modules/dpdshipping/src/Grid/Configuration/Address/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/Address/Query/index.php @@ -0,0 +1,33 @@ + 100, + 'offset' => 0, + 'orderBy' => 'id', + 'sortOrder' => 'desc', + 'filters' => [], + ]; + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/Connection/Definition/Factory/ConnectionGridDefinitionFactory.php b/modules/dpdshipping/src/Grid/Configuration/Connection/Definition/Factory/ConnectionGridDefinitionFactory.php new file mode 100644 index 00000000..8a84763c --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/Connection/Definition/Factory/ConnectionGridDefinitionFactory.php @@ -0,0 +1,133 @@ +trans('DPD Poland API Connection', [], 'Modules.Dpdshipping.AdminConnection'); + } + + protected function getColumns() + { + return (new ColumnCollection()) + ->add( + (DataColumnFactory::create('id_shop')) + ->setName($this->trans('Shop', [], 'Modules.Dpdshipping.AdminConnection')) + ->setOptions([ + 'field' => 'id_shop', + ]) + ) + ->add( + (DataColumnFactory::create('name')) + ->setName($this->trans('Name', [], 'Modules.Dpdshipping.AdminConnection')) + ->setOptions([ + 'field' => 'name', + ]) + ) + ->add( + (DataColumnFactory::create('login')) + ->setName($this->trans('Login', [], 'Modules.Dpdshipping.AdminConnection')) + ->setOptions([ + 'field' => 'login', + ]) + ) + ->add( + (DataColumnFactory::create('master_fid')) + ->setName($this->trans('Masterfid', [], 'Modules.Dpdshipping.AdminConnection')) + ->setOptions([ + 'field' => 'master_fid' + ]) + ) + ->add( + (DataColumnFactory::create('environment')) + ->setName($this->trans('Environment', [], 'Modules.Dpdshipping.AdminConnection')) + ->setOptions([ + 'field' => 'environment' + ]) + ) + ->add( + (DataColumnFactory::create('is_default')) + ->setName($this->trans('Default', [], 'Modules.Dpdshipping.AdminConnection')) + ->setOptions([ + 'field' => 'is_default', + ]) + ) + ->add( + (new ActionColumn('actions')) + ->setName($this->trans('Actions', [], 'Modules.Dpdshipping.AdminConnection')) + ->setOptions([ + 'actions' => (new RowActionCollection()) + ->add((new SubmitRowAction('edit')) + ->setName($this->trans('Edit', [], 'Modules.Dpdshipping.AdminConnection')) + ->setIcon('edit') + ->setOptions([ + 'method' => 'POST', + 'route' => 'dpdshipping_connection_edit_form', + 'route_param_name' => 'connectionId', + 'route_param_field' => 'id', + ])) + ->add((new SubmitRowAction('delete')) + ->setName($this->trans('Delete', [], 'Modules.Dpdshipping.AdminConnection')) + ->setIcon('delete') + ->setOptions([ + 'method' => 'DELETE', + 'route' => 'dpdshipping_connection_delete_form', + 'route_param_name' => 'connectionId', + 'route_param_field' => 'id', + 'modal_options' => new ModalOptions([ + 'title' => $this->trans('Remove selected row?', [], 'Modules.Dpdshipping.AdminConnection'), + 'confirm_button_label' => $this->trans('Delete', [], 'Modules.Dpdshipping.AdminConnection'), + 'confirm_button_class' => 'btn-secondary', + 'close_button_label' => $this->trans('Close', [], 'Modules.Dpdshipping.AdminConnection'), + ]), + ])), + ]) + ); + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/Connection/Definition/Factory/index.php b/modules/dpdshipping/src/Grid/Configuration/Connection/Definition/Factory/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/Connection/Definition/Factory/index.php @@ -0,0 +1,33 @@ +searchCriteriaApplicator = $searchCriteriaApplicator; + $this->contextLanguageId = $contextLanguageId; + $this->contextShopId = $contextShopId; + $this->isStockSharingBetweenShopGroupEnabled = $isStockSharingBetweenShopGroupEnabled; + $this->contextShopGroupId = $contextShopGroupId; + $this->filterApplicator = $filterApplicator; + } + + public function getSearchQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb + ->select('id, id_shop, name, login, master_fid, environment, is_default'); + + return $qb; + } + + private function getQueryBuilder(array $filterValues): QueryBuilder + { + $qb = $this->connection + ->createQueryBuilder() + ->from($this->dbPrefix . 'dpdshipping_connection', 'sa'); + + $sqlFilters = new SqlFilters(); + $sqlFilters + ->addFilter( + 'id', + 'sa.`id`', + SqlFilters::WHERE_STRICT + ); + + $this->filterApplicator->apply($qb, $sqlFilters, $filterValues); + + $qb->andWhere('sa.`id_shop` IN (' . implode(', ', Shop::getContextListShopID()) . ')'); + + return $qb; + } + + public function getCountQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb->select('COUNT(sa.`id`)'); + + return $qb; + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/Connection/Query/index.php b/modules/dpdshipping/src/Grid/Configuration/Connection/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/Connection/Query/index.php @@ -0,0 +1,33 @@ +trans('Pickup order settings', [], 'Modules.Dpdshipping.AdminPickupCourierSettings'); + } + + protected function getColumns() + { + return (new ColumnCollection()) + ->add( + (DataColumnFactory::create('id_shop')) + ->setName($this->trans('Shop', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'id_shop', + ]) + ) + ->add( + (DataColumnFactory::create('customer_full_name')) + ->setName($this->trans('Customer company', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'customer_full_name', + ]) + ) + ->add( + (DataColumnFactory::create('customer_name')) + ->setName($this->trans('Customer name', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'customer_name', + ]) + ) + ->add( + (DataColumnFactory::create('customer_phone')) + ->setName($this->trans('Customer phone', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'customer_phone', + ]) + ) + + ->add( + (DataColumnFactory::create('payer_number')) + ->setName($this->trans('Payer number ', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'payer_number', + ]) + ) + ->add( + (DataColumnFactory::create('sender_full_name')) + ->setName($this->trans('Sender company', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'sender_full_name', + ]) + ) + ->add( + (DataColumnFactory::create('sender_name')) + ->setName($this->trans('Sender name', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'sender_name', + ]) + ) + ->add( + (DataColumnFactory::create('sender_address')) + ->setName($this->trans('Sender address', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'field' => 'sender_address', + ]) + ) + ->add( + (new ActionColumn('actions')) + ->setName($this->trans('Actions', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setOptions([ + 'actions' => (new RowActionCollection()) + ->add((new SubmitRowAction('edit')) + ->setName($this->trans('Edit', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setIcon('edit') + ->setOptions([ + 'method' => 'POST', + 'route' => 'dpdshipping_pickup_courier_settings_form', + 'route_param_name' => 'pickupCourierId', + 'route_param_field' => 'id', + ])) + ->add((new SubmitRowAction('delete')) + ->setName($this->trans('Delete', [], 'Modules.Dpdshipping.AdminPickupCourierSettings')) + ->setIcon('delete') + ->setOptions([ + 'method' => 'DELETE', + 'route' => 'dpdshipping_pickup_courier_settings_delete_form', + 'route_param_name' => 'pickupCourierId', + 'route_param_field' => 'id', + 'modal_options' => new ModalOptions([ + 'title' => $this->trans('Remove selected row?', [], 'Modules.Dpdshipping.AdminPickupCourierSettings'), + 'confirm_button_label' => $this->trans('Delete', [], 'Modules.Dpdshipping.AdminPickupCourierSettings'), + 'confirm_button_class' => 'btn-secondary', + 'close_button_label' => $this->trans('Close', [], 'Modules.Dpdshipping.AdminPickupCourierSettings'), + ]), + ])), + ]) + ); + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Definition/Factory/index.php b/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Definition/Factory/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Definition/Factory/index.php @@ -0,0 +1,33 @@ + 100, + 'offset' => 0, + 'orderBy' => 'id', + 'sortOrder' => 'desc', + 'filters' => [], + ]; + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Query/PickupCourierSettingsQueryBuilder.php b/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Query/PickupCourierSettingsQueryBuilder.php new file mode 100644 index 00000000..dfc30c38 --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Query/PickupCourierSettingsQueryBuilder.php @@ -0,0 +1,147 @@ +searchCriteriaApplicator = $searchCriteriaApplicator; + $this->contextLanguageId = $contextLanguageId; + $this->contextShopId = $contextShopId; + $this->isStockSharingBetweenShopGroupEnabled = $isStockSharingBetweenShopGroupEnabled; + $this->contextShopGroupId = $contextShopGroupId; + $this->filterApplicator = $filterApplicator; + } + + public function getSearchQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb + ->select('pcs.`id` as id') + ->addSelect('pcs.`id_shop` as id_shop') + ->addSelect('pcs.`customer_full_name` as customer_full_name') + ->addSelect('pcs.`customer_name` as customer_name') + ->addSelect('pcs.`customer_phone` as customer_phone') + ->addSelect('pcs.`payer_number` as payer_number') + ->addSelect('pcs.`sender_address` as sender_address') + ->addSelect('pcs.`sender_city` as sender_city') + ->addSelect('pcs.`sender_full_name` as sender_full_name') + ->addSelect('pcs.`sender_name` as sender_name') + ->addSelect('pcs.`sender_phone` as sender_phone') + ->addSelect('pcs.`sender_postal_code` as sender_postal_code') + ->addSelect('pcs.`sender_country_code` as sender_country_code') + ; +// $this->searchCriteriaApplicator +// ->applyPagination($searchCriteria, $qb); + return $qb; + } + + private function getQueryBuilder(array $filterValues): QueryBuilder + { + $qb = $this->connection + ->createQueryBuilder() + ->from($this->dbPrefix . PickupCourierSettingsGridDefinitionFactory::GRID_ID, 'pcs'); + + $sqlFilters = new SqlFilters(); + $sqlFilters + ->addFilter( + 'id', + 'pcs.`id`', + SqlFilters::WHERE_STRICT + ); + + $this->filterApplicator->apply($qb, $sqlFilters, $filterValues); + $qb->andWhere('pcs.`id_shop` IN (' . implode(', ', Shop::getContextListShopID()) . ')'); + return $qb; + } + + public function getCountQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb->select('COUNT(pcs.`id`)'); + + return $qb; + } +} diff --git a/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Query/index.php b/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/Configuration/PickupCourierSettings/Query/index.php @@ -0,0 +1,33 @@ +=')) { + // PrestaShop 8 or higher + return new \PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\DataColumn($columnName); + } else { + // PrestaShop 1.7 + return new \PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn($columnName); + } + } +} diff --git a/modules/dpdshipping/src/Grid/HtmlColumnFactory.php b/modules/dpdshipping/src/Grid/HtmlColumnFactory.php new file mode 100644 index 00000000..2eb17841 --- /dev/null +++ b/modules/dpdshipping/src/Grid/HtmlColumnFactory.php @@ -0,0 +1,45 @@ +=')) { + // PrestaShop 8 or higher + return new \PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\HtmlColumn($columnName); + } else { + // PrestaShop 1.7 + return new \PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn($columnName); + } + } +} diff --git a/modules/dpdshipping/src/Grid/PickupCourier/Definition/Factory/PickupCourierGridDefinitionFactory.php b/modules/dpdshipping/src/Grid/PickupCourier/Definition/Factory/PickupCourierGridDefinitionFactory.php new file mode 100644 index 00000000..9546c35f --- /dev/null +++ b/modules/dpdshipping/src/Grid/PickupCourier/Definition/Factory/PickupCourierGridDefinitionFactory.php @@ -0,0 +1,251 @@ +trans('Pickup Courier', [], 'Modules.Dpdshipping.AdminPickupCourier'); + } + + protected function getColumns() + { + return (new ColumnCollection()) + ->add( + (HtmlColumnFactory::create('state')) + ->setName($this->trans('State', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'state', + ]) + ) + ->add( + (HtmlColumnFactory::create('order_number')) + ->setName($this->trans('Order number', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'order_number', + ]) + ) + ->add( + (HtmlColumnFactory::create('sender_address')) + ->setName($this->trans('Sender address', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'sender_address', + ]) + ) + ->add( + (DataColumnFactory::create('letter')) + ->setName($this->trans('Letter', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'letter', + ]) + ) + ->add( + (DataColumnFactory::create('packages')) + ->setName($this->trans('Packages', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'packages', + ]) + ) + ->add( + (HtmlColumnFactory::create('palette')) + ->setName($this->trans('Palette', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'palette', + ]) + ) + ->add( + (DataColumnFactory::create('pickup_time')) + ->setName($this->trans('Pickup time', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'pickup_time', + ]) + ) + ->add( + (DataColumnFactory::create('pickup_date')) + ->setName($this->trans('Pickup date', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'field' => 'pickup_date', + ]) + ) + ->add( + (new ActionColumn('actions')) + ->setName($this->trans('Actions', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setOptions([ + 'actions' => (new RowActionCollection()) + ->add((new SubmitRowAction('delete')) + ->setName($this->trans('Reject', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setIcon('delete') + ->setOptions([ + 'method' => 'DELETE', + 'route' => 'dpdshipping_pickup_courier_delete_pickup_courier', + 'route_param_name' => 'pickupOrderId', + 'route_param_field' => 'id', + 'modal_options' => new ModalOptions([ + 'title' => $this->trans('Cancel selected pickup courier?', [], 'Modules.Dpdshipping.AdminPickupCourier'), + 'confirm_button_label' => $this->trans('Cancel', [], 'Modules.Dpdshipping.AdminPickupCourier'), + 'confirm_button_class' => 'btn-secondary', + 'close_button_label' => $this->trans('Close', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ]), + ])), + ]) + ); + } + + /** + * {@inheritdoc} + */ + protected function getFilters() + { + return (new FilterCollection()) + ->add( + (new Filter('state', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('State', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ], + ]) + ->setAssociatedColumn('state') + ) + ->add( + (new Filter('order_number', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Order number', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ], + ]) + ->setAssociatedColumn('order_number') + ) + ->add( + (new Filter('sender_address', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Sender address', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ], + ]) + ->setAssociatedColumn('sender_address') + ) + ->add( + (new Filter('letter', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Letter', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ], + ]) + ->setAssociatedColumn('letter') + ) + ->add( + (new Filter('packages', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Packages', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ], + ]) + ->setAssociatedColumn('packages') + ) + ->add( + (new Filter('palette', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Palette', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ], + ]) + ->setAssociatedColumn('palette') + ) + ->add( + (new Filter('pickup_time', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('HH:MM', [], 'Modules.Dpdshipping.AdminPickupCourier'), + ], + ]) + ->setAssociatedColumn('pickup_time') + ) + ->add( + (new Filter('pickup_date', DateRangeType::class)) + ->setTypeOptions([ + 'required' => false, + ]) + ->setAssociatedColumn('pickup_date') + ) + ->add( + (new Filter('actions', SearchAndResetType::class)) + ->setTypeOptions([ + 'reset_route' => 'admin_common_reset_search_by_filter_id', + 'reset_route_params' => [ + 'filterId' => self::GRID_ID, + ], + 'redirect_route' => 'dpdshipping_pickup_courier_form', + ]) + ->setAssociatedColumn('actions') + ); + } + + protected function getGridActions() + { + return (new GridActionCollection()) + ->add( + (new SimpleGridAction('common_refresh_list')) + ->setName($this->trans('Refresh list', [], 'Modules.Dpdshipping.AdminPickupCourier')) + ->setIcon('refresh') + ); + } +} diff --git a/modules/dpdshipping/src/Grid/PickupCourier/Definition/Factory/index.php b/modules/dpdshipping/src/Grid/PickupCourier/Definition/Factory/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/PickupCourier/Definition/Factory/index.php @@ -0,0 +1,33 @@ + 30, + 'offset' => 0, + 'orderBy' => 'id', + 'sortOrder' => 'desc', + 'filters' => [], + ]; + } +} diff --git a/modules/dpdshipping/src/Grid/PickupCourier/Query/PickupCourierQueryBuilder.php b/modules/dpdshipping/src/Grid/PickupCourier/Query/PickupCourierQueryBuilder.php new file mode 100644 index 00000000..94a7560c --- /dev/null +++ b/modules/dpdshipping/src/Grid/PickupCourier/Query/PickupCourierQueryBuilder.php @@ -0,0 +1,234 @@ +searchCriteriaApplicator = $searchCriteriaApplicator; + $this->contextLanguageId = $contextLanguageId; + $this->contextShopId = $contextShopId; + $this->isStockSharingBetweenShopGroupEnabled = $isStockSharingBetweenShopGroupEnabled; + $this->contextShopGroupId = $contextShopGroupId; + $this->filterApplicator = $filterApplicator; + $this->configuration = $configuration; + } + + public function getSearchQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb + ->select('pc.`id` as id') + ->addSelect('pc.`status` as state') + ->addSelect('pc.`order_number` as order_number') + ->addSelect($this->getSenderAddress() . ' AS sender_address') + ->addSelect('pc.`operation_type` as type') + ->addSelect('pc.`dox_count` as letter') + ->addSelect('pc.`parcels_count` as packages') + ->addSelect('pc.`pallets_count` as palette') + ->addSelect($this->getPickupTime() . 'as pickup_time') + ->addSelect('DATE_FORMAT(pc.`pickup_date`, "%d-%m-%Y") as pickup_date'); + + $this->searchCriteriaApplicator + ->applyPagination($searchCriteria, $qb) + ->applySorting($searchCriteria, $qb); + + return $qb; + } + + private function getQueryBuilder(array $filterValues): QueryBuilder + { + $qb = $this->connection + ->createQueryBuilder() + ->from($this->dbPrefix . PickupCourierGridDefinitionFactory::GRID_ID, 'pc'); + + $sqlFilters = new SqlFilters(); + $sqlFilters + ->addFilter( + 'id', + 'pc.`id`', + SqlFilters::WHERE_STRICT + ); + + $this->filterApplicator->apply($qb, $sqlFilters, $filterValues); + + foreach ($filterValues as $filterName => $filter) { + switch ($filterName) { + case 'pickup_date': + if (isset($filter['from']) && isset($filter['to'])) { + $start = (new DateTime($filter['from']))->setTime(0, 0, 0)->format('Y-m-d H:i:s'); + $end = (new DateTime($filter['to']))->setTime(23, 59, 59)->format('Y-m-d H:i:s'); + + $qb->andWhere('pc.`pickup_date` BETWEEN :pickup_date_start AND :pickup_date_end'); + $qb->setParameter('pickup_date_start', $start); + $qb->setParameter('pickup_date_end', $end); + } + break; + case 'sender_address': + $qb->andWhere($this->getSenderAddress() . ' LIKE :sender_address'); + $qb->setParameter('sender_address', '%' . $filter . '%'); + break; + case 'state': + $qb->andWhere('pc.`status` LIKE :state'); + $qb->setParameter('state', '%' . $filter . '%'); + break; + case 'order_number': + $qb->andWhere('pc.`order_number` LIKE :order_number'); + $qb->setParameter('order_number', '%' . $filter . '%'); + break; + case 'type': + $qb->andWhere('pc.`operation_type` LIKE :type'); + $qb->setParameter('type', '%' . $filter . '%'); + break; + case 'letter': + $qb->andWhere('pc.`dox_count` LIKE :letter'); + $qb->setParameter('letter', '%' . $filter . '%'); + break; + case 'packages': + $qb->andWhere('pc.`parcels_count` LIKE :packages'); + $qb->setParameter('packages', '%' . $filter . '%'); + break; + case 'palette': + $qb->andWhere('pc.`parcels_count` LIKE :palette'); + $qb->setParameter('palette', '%' . $filter . '%'); + break; + case 'pickup_time': + $qb->andWhere($this->getPickupTime().' LIKE :pickup_time'); + $qb->setParameter('pickup_time', '%' . $filter . '%'); + break; + default: + break; + } + } + + return $qb; + } + + private function getCustomerAddress() + { + return 'CONCAT( + COALESCE(pc . `customer_full_name`,"") ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `customer_name`,""), ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `customer_phone`,"") + )'; + } + + private function getSenderAddress() + { + return 'CONCAT( + COALESCE(pc . `sender_name`,""), ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `sender_full_name`,""), ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `sender_address`,""), ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `sender_postal_code`,""), ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `sender_city`,""), ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `sender_country_code`,""), ' . ShippingHistoryQueryBuilder::getTextSeparator() . ', + COALESCE(pc . `sender_phone`,"") + )'; + } + + public function getCountQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb->select('COUNT(pc.`id`)'); + + return $qb; + } + + private function getPickupTime() + { + return 'CONCAT( + pc . `pickup_time_from`, " - " , + pc . `pickup_time_to` + )'; + } +} diff --git a/modules/dpdshipping/src/Grid/PickupCourier/Query/index.php b/modules/dpdshipping/src/Grid/PickupCourier/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/PickupCourier/Query/index.php @@ -0,0 +1,33 @@ +trans('Shippings', [], 'Modules.Dpdshipping.AdminShippingHistory'); + } + + protected function getColumns() + { + return (new ColumnCollection()) + ->add( + (new BulkActionColumn('bulk')) + ->setOptions([ + 'bulk_field' => 'id', + ]) + ) + ->add( + (new LinkColumn('id_order')) + ->setName($this->trans('Order number', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'id_order', + 'route' => 'admin_orders_view', + 'route_param_name' => 'orderId', + 'route_param_field' => 'id_order', + ]) + ) + ->add( + (new LinkColumn('shipping_number')) + ->setName($this->trans('Shipping number', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'shipping_number', + 'route' => 'dpdshipping_external_dpd_tracking', + 'route_param_name' => 'shippingNumber', + 'route_param_field' => 'shipping_number', + 'target' => '_blank', + ]) + ) + ->add( + (HtmlColumnFactory::create('sender_address')) + ->setName($this->trans('Sender address', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'sender_address', + ]) + ) + ->add( + (HtmlColumnFactory::create('receiver_address')) + ->setName($this->trans('Receiver address', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'receiver_address', + ]) + ) + ->add( + (DataColumnFactory::create('carrier_name')) + ->setName($this->trans('Carrier', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'carrier_name', + ]) + ) + ->add( + (DataColumnFactory::create('ref1')) + ->setName($this->trans('Ref 1', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'ref1', + ]) + ) + ->add( + (DataColumnFactory::create('ref2')) + ->setName($this->trans('Ref 2', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'ref2', + ]) + ) + ->add( + (HtmlColumnFactory::create('services')) + ->setName($this->trans('Services', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'services', + ]) + ) + ->add( + (DataColumnFactory::create('label_datetime')) + ->setName($this->trans('Label Datetime', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'label_datetime', + ]) + ) + ->add( + (DataColumnFactory::create('protocol_datetime')) + ->setName($this->trans('Protocol Datetime', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'protocol_datetime', + ]) + ) + ->add( + (new BooleanColumn('is_delivered')) + ->setName($this->trans('Delivered', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'is_delivered', + 'true_name' => $this->trans('Yes', [], 'Modules.Dpdshipping.AdminShippingHistory'), + 'false_name' => $this->trans('No', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ]) + ) + ->add( + (DataColumnFactory::create('shipping_date')) + ->setName($this->trans('Shipping date', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'field' => 'shipping_date', + ]) + ) + ->add( + (new ActionColumn('actions')) + ->setName($this->trans('Actions', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'actions' => (new RowActionCollection()) + ->add((new SubmitRowAction('delete')) + ->setName($this->trans('Delete', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setIcon('delete') + ->setOptions([ + 'method' => 'DELETE', + 'route' => 'dpdshipping_shipping_history_delete_form', + 'route_param_name' => 'shippingHistoryId', + 'route_param_field' => 'id', + 'modal_options' => new ModalOptions([ + 'title' => $this->trans('Remove selected row?', [], 'Modules.Dpdshipping.AdminShippingHistory'), + 'confirm_button_label' => $this->trans('Delete', [], 'Modules.Dpdshipping.AdminShippingHistory'), + 'confirm_button_class' => 'btn-secondary', + 'close_button_label' => $this->trans('Close', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ]), + ])) + ->add((new SubmitRowAction('printprotocol')) + ->setName($this->trans('Print protocol', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setIcon('print') + ->setOptions([ + 'method' => 'POST', + 'route' => 'dpdshipping_shipping_history_print_protocols_form', + 'route_param_name' => 'shippingHistoryId', + 'route_param_field' => 'id', + ])) + ->add((new SubmitRowAction('print')) + ->setName($this->trans('Print label', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setIcon('print') + ->setOptions([ + 'method' => 'POST', + 'route' => 'dpdshipping_shipping_history_print_labels_form', + 'route_param_name' => 'shippingHistoryId', + 'route_param_field' => 'id', + ])), + + ]) + ); + } + + /** + * {@inheritdoc} + */ + protected function getFilters() + { + return (new FilterCollection()) + ->add( + (new Filter('id_order', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('ID Order', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('id_order') + ) + ->add( + (new Filter('shipping_number', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Shipping number', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('shipping_number') + ) + ->add( + (new Filter('sender_address', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Sender address', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('sender_address') + ) + ->add( + (new Filter('receiver_address', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Receiver address', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('receiver_address') + ) + ->add( + (new Filter('carrier_name', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Carrier', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('carrier_name') + ) + ->add( + (new Filter('ref1', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Ref 1', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('ref1') + ) + ->add( + (new Filter('ref2', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Ref 2', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('ref2') + ) + ->add( + (new Filter('services', TextType::class)) + ->setTypeOptions([ + 'required' => false, + 'attr' => [ + 'placeholder' => $this->trans('Services', [], 'Modules.Dpdshipping.AdminShippingHistory'), + ], + ]) + ->setAssociatedColumn('services') + ) + ->add( + (new Filter('label_datetime', DateRangeType::class)) + ->setTypeOptions([ + 'required' => false, + ]) + ->setAssociatedColumn('label_datetime') + ) + ->add( + (new Filter('protocol_datetime', DateRangeType::class)) + ->setTypeOptions([ + 'required' => false, + ]) + ->setAssociatedColumn('protocol_datetime') + ) + ->add( + (new Filter('is_delivered', YesAndNoChoiceType::class)) + ->setAssociatedColumn('is_delivered') + ) + ->add( + (new Filter('shipping_date', DateRangeType::class)) + ->setTypeOptions([ + 'required' => false, + ]) + ->setAssociatedColumn('shipping_date') + ) + ->add( + (new Filter('actions', SearchAndResetType::class)) + ->setTypeOptions([ + 'reset_route' => 'admin_common_reset_search_by_filter_id', + 'reset_route_params' => [ + 'filterId' => self::GRID_ID, + ], + 'redirect_route' => 'dpdshipping_shipping_history_search_form', + ]) + ->setAssociatedColumn('actions') + ); + } + + protected function getGridActions() + { + return (new GridActionCollection()) + ->add( + (new SimpleGridAction('common_refresh_list')) + ->setName($this->trans('Refresh list', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setIcon('refresh') + ); + } + + protected function getBulkActions() + { + return (new BulkActionCollection()) + ->add( + (new SubmitBulkAction('print_labels')) + ->setName($this->trans('Print labels', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'submit_route' => 'dpdshipping_shipping_history_print_labels_form', + ]) + ) + ->add( + (new SubmitBulkAction('print_protocols')) + ->setName($this->trans('Print protocols', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'submit_route' => 'dpdshipping_shipping_history_print_protocols_form', + ]) + ) + ->add( + (new SubmitBulkAction('delete_shipping_history_list')) + ->setName($this->trans('Delete', [], 'Modules.Dpdshipping.AdminShippingHistory')) + ->setOptions([ + 'submit_route' => 'dpdshipping_shipping_history_delete_form', + 'submit_method' => 'POST', + ]) + ); + } +} diff --git a/modules/dpdshipping/src/Grid/ShippingHistory/Definition/Factory/index.php b/modules/dpdshipping/src/Grid/ShippingHistory/Definition/Factory/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/ShippingHistory/Definition/Factory/index.php @@ -0,0 +1,33 @@ +searchCriteriaApplicator = $searchCriteriaApplicator; + $this->contextLanguageId = $contextLanguageId; + $this->contextShopId = $contextShopId; + $this->isStockSharingBetweenShopGroupEnabled = $isStockSharingBetweenShopGroupEnabled; + $this->contextShopGroupId = $contextShopGroupId; + $this->filterApplicator = $filterApplicator; + $this->configuration = $configuration; + } + + public function getSearchQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb + ->select('dsh.`id_order` as id_order') + ->addSelect('dsh.`id` as id') + ->addSelect('COALESCE(dshp.`waybill`,"EMPTY") as shipping_number') + ->addSelect($this->getSenderAddress() . ' AS sender_address') + ->addSelect($this->getReceiverAddress() . ' AS receiver_address') + ->addSelect($this->getServices() . ' AS services') + ->addSelect('dsh.`ref1` as ref1') + ->addSelect('dsh.`ref2` as ref2') + ->addSelect('dsh.`carrier_name` as carrier_name') + ->addSelect('dsh.`label_date` as label_datetime') + ->addSelect('dsh.`is_delivered` as is_delivered') + ->addSelect('dsh.`protocol_date` as protocol_datetime') + ->addSelect('dsh.`shipping_date` as shipping_date'); + + $this->searchCriteriaApplicator + ->applyPagination($searchCriteria, $qb) + ->applySorting($searchCriteria, $qb); + + return $qb; + } + + private function getQueryBuilder(array $filterValues): QueryBuilder + { + $qb = $this->connection + ->createQueryBuilder() + ->from($this->dbPrefix . ShippingHistoryGridDefinitionFactory::GRID_ID, 'dsh') + ->leftJoin('dsh', $this->dbPrefix . 'dpdshipping_shipping_history_parcel', 'dshp', 'dsh.id = dshp.shipping_history_id AND dshp.is_main_waybill = 1') + ->leftJoin('dsh', $this->dbPrefix . 'dpdshipping_shipping_history_sender', 'dshs', 'dshs.id = dsh.shipping_history_sender_id') + ->leftJoin('dsh', $this->dbPrefix . 'dpdshipping_shipping_history_receiver', 'dshr', 'dshr.id = dsh.shipping_history_receiver_id') + ->leftJoin('dsh', $this->dbPrefix . 'dpdshipping_shipping_history_services', 'dshsv', 'dshsv.id = dsh.shipping_history_services_id'); + $sqlFilters = new SqlFilters(); + $sqlFilters + ->addFilter( + 'id', + 'dsh.`id`', + SqlFilters::WHERE_STRICT + ); + + $this->filterApplicator->apply($qb, $sqlFilters, $filterValues); + $qb->andWhere('dsh.`id_shop` IN (' . implode(', ', Shop::getContextListShopID()) . ')'); + + foreach ($filterValues as $filterName => $filter) { + switch ($filterName) { + case 'ref1': + $qb->andWhere('dsh.`ref1` LIKE :ref1'); + $qb->setParameter('ref1', '%' . $filter . '%'); + break; + case 'ref2': + $qb->andWhere('dsh.`ref2` LIKE :ref2'); + $qb->setParameter('ref2', '%' . $filter . '%'); + break; + case 'is_delivered': + $qb->andWhere('dsh.`is_delivered` = :is_delivered'); + $qb->setParameter('is_delivered', $filter); + break; + case 'id_order': + $qb->andWhere('dsh.`id_order` = :id_order'); + $qb->setParameter('id_order', $filter); + break; + case 'id': + $qb->andWhere('dsh.`id` = :id'); + $qb->setParameter('id', $filter); + break; + case 'shipping_number': + $qb->andWhere('dshp.`waybill` LIKE :shipping_number'); + $qb->setParameter('shipping_number', '%' . $filter . '%'); + break; + case 'carrier_name': + $qb->andWhere('dsh.`carrier_name` LIKE :carrier_name'); + $qb->setParameter('carrier_name', '%' . $filter . '%'); + break; + case 'label_datetime': + if (isset($filter['from']) && isset($filter['to'])) { + $start = (new DateTime($filter['from']))->setTime(0, 0, 0)->format('Y-m-d H:i:s'); + $end = (new DateTime($filter['to']))->setTime(23, 59, 59)->format('Y-m-d H:i:s'); + + $qb->andWhere('dsh.`label_date` BETWEEN :label_start AND :label_end'); + $qb->setParameter('label_start', $start); + $qb->setParameter('label_end', $end); + } + break; + case 'protocol_datetime': + if (isset($filter['from']) && isset($filter['to'])) { + $start = (new DateTime($filter['from']))->setTime(0, 0, 0)->format('Y-m-d H:i:s'); + $end = (new DateTime($filter['to']))->setTime(23, 59, 59)->format('Y-m-d H:i:s'); + + $qb->andWhere('dsh.`protocol_date` BETWEEN :protocol_start AND :protocol_end'); + $qb->setParameter('protocol_start', $start); + $qb->setParameter('protocol_end', $end); + } + break; + case 'shipping_date': + if (isset($filter['from']) && isset($filter['to'])) { + $start = (new DateTime($filter['from']))->setTime(0, 0, 0)->format('Y-m-d H:i:s'); + $end = (new DateTime($filter['to']))->setTime(23, 59, 59)->format('Y-m-d H:i:s'); + + $qb->andWhere('dsh.`shipping_date` BETWEEN :shipping_start AND :shipping_end'); + $qb->setParameter('shipping_start', $start); + $qb->setParameter('shipping_end', $end); + } + break; + case 'sender_address': + $qb->andWhere($this->getSenderAddress() . ' LIKE :sender_address'); + $qb->setParameter('sender_address', '%' . $filter . '%'); + break; + case 'receiver_address': + $qb->andWhere($this->getReceiverAddress() . ' LIKE :receiver_address'); + $qb->setParameter('receiver_address', '%' . $filter . '%'); + break; + case 'services': + $qb->andWhere($this->getServices() . ' LIKE :services'); + $qb->setParameter('services', '%' . $filter . '%'); + break; + default: + break; + } + } + + return $qb; + } + + public function getCountQueryBuilder(SearchCriteriaInterface $searchCriteria): QueryBuilder + { + $qb = $this->getQueryBuilder($searchCriteria->getFilters()); + $qb->select('COUNT(dsh.`id`)'); + + return $qb; + } + + private function getSenderAddress() + { + return 'CONCAT( + COALESCE(dshs . `company`,""), ' . self::getTextSeparator() . ', + COALESCE(dshs . `name`,""), ' . self::getTextSeparator() . ', + COALESCE(dshs . `street`,""), ' . self::getTextSeparator() . ', + COALESCE(dshs . `postal_code`,""), " ", COALESCE(dshs.`city`,""), " ",COALESCE(dshs.`country_code`,""),' . self::getTextSeparator() . ', + COALESCE(dshs . `phone`,""), ' . self::getTextSeparator() . ', + COALESCE(dshs . `email`,"") + )'; + } + + public static function getTextSeparator(): string + { + if (version_compare(_PS_VERSION_, '8.1.0', '>=')) { + return '"
"'; + } else { + return '" "'; + } + } + + private function getReceiverAddress() + { + return 'CONCAT( + COALESCE(dshr . `company`,""), ' . self::getTextSeparator() . ', + COALESCE(dshr . `name`,""), ' . self::getTextSeparator() . ', + COALESCE(dshr . `street`,""), ' . self::getTextSeparator() . ', + COALESCE(dshr . `postal_code`,""), " ", COALESCE(dshr.`city`,""), " ",COALESCE(dshr.`country_code`,""),' . self::getTextSeparator() . ', + COALESCE(dshr . `phone`,""), ' . self::getTextSeparator() . ', + COALESCE(dshr . `email`,"") + )'; + } + + private function getServices() + { + return "TRIM(TRAILING ', ' FROM CONCAT( + IF(is_adr = 1, 'ADR " . self::getTextSeparator() . "', ''), + IF(is_cod = 1, CONCAT('COD: ', dshsv.`cod_amount`, ' ', dshsv.`cod_currency`, " . self::getTextSeparator() . "), ''), + IF(is_guarantee = 1, 'Guarantee" . self::getTextSeparator() . "', ''), + IF(is_pallet = 1, 'Pallet" . self::getTextSeparator() . "', ''), + IF(is_tires = 1, 'Tires" . self::getTextSeparator() . "', ''), + IF(is_declared_value = 1, CONCAT('Declared Value: ', dshsv.`declared_value_amount`, ' ', dshsv.`declared_value_currency`, " . self::getTextSeparator() . "), ''), + IF(is_cud = 1, 'CUD" . self::getTextSeparator() . "', ''), + IF(is_dox = 1, 'DOX" . self::getTextSeparator() . "', ''), + IF(is_duty = 1, 'Duty" . self::getTextSeparator() . "', ''), + IF(is_rod = 1, 'ROD" . self::getTextSeparator() . "', ''), + IF(is_dedicated_delivery = 1, 'Dedicated Delivery" . self::getTextSeparator() . "', ''), + IF(is_dpd_express = 1, 'DPD Express" . self::getTextSeparator() . "', ''), + IF(is_dpd_food = 1, 'DPD Food" . self::getTextSeparator() . "', ''), + IF(is_carry_in = 1, 'Carry In" . self::getTextSeparator() . "', ''), + IF(is_dpd_pickup = 1, CONCAT('DPD Pickup: ', dshsv.`dpd_pickup_pudo`, " . self::getTextSeparator() . "), ''), + IF(is_in_pers = 1, 'In Pers" . self::getTextSeparator() . "', ''), + IF(is_priv_pers = 1, 'Priv Pers" . self::getTextSeparator() . " ', ''), + IF(is_self_con = 1, 'Self Con" . self::getTextSeparator() . " ', ''), + IF(is_documents_international = 1, 'Documents International" . self::getTextSeparator() . " ', ''), + IF(is_adr = 1, 'ADR" . self::getTextSeparator() . " ', '') + ))"; + } +} diff --git a/modules/dpdshipping/src/Grid/ShippingHistory/Query/index.php b/modules/dpdshipping/src/Grid/ShippingHistory/Query/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/ShippingHistory/Query/index.php @@ -0,0 +1,33 @@ + 30, + 'offset' => 0, + 'orderBy' => 'id', + 'sortOrder' => 'desc', + 'filters' => [], + ]; + } +} diff --git a/modules/dpdshipping/src/Grid/ShippingHistory/index.php b/modules/dpdshipping/src/Grid/ShippingHistory/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Grid/ShippingHistory/index.php @@ -0,0 +1,33 @@ +hookName = $hookName; + $this->form = $form; + } + + /** + * @return string + */ + public function getForm(): string + { + return $this->form; + } + + /** + * @return string + */ + public function getHookName(): string + { + return $this->hookName; + } +} diff --git a/modules/dpdshipping/src/Hook/Hook.php b/modules/dpdshipping/src/Hook/Hook.php new file mode 100644 index 00000000..a70f9fd3 --- /dev/null +++ b/modules/dpdshipping/src/Hook/Hook.php @@ -0,0 +1,41 @@ +repository = $repository; + } + + public function renderView($hookName, array $params, $controller) + { + $hook = $this->repository->getHook($hookName); + if ($hookName == Hook::$DISPLAY_ADMIN_ORDER_MAIN) { + + return $controller->index($params, $params['request']); + } elseif ($hookName == Hook::$DISPLAY_ADMIN_ORDER_TAB_CONTENT) {; + + if (!isset($params['request']) && !isset($params['id_order'])) { + return ''; + } + + return $controller->index($params['request'] ?? new Request(['orderId' => $params['id_order']])); + } + + return $controller->render(self::MODULES_DPDSHIPPING_VIEWS_TEMPLATES_ADMIN . $hook->getForm(), []); + } + +} diff --git a/modules/dpdshipping/src/Hook/HookRepository.php b/modules/dpdshipping/src/Hook/HookRepository.php new file mode 100644 index 00000000..8b16bd5a --- /dev/null +++ b/modules/dpdshipping/src/Hook/HookRepository.php @@ -0,0 +1,58 @@ +hooks = [ + Hook::$DISPLAY_ADMIN_ORDER_TAB_LINK => new DisplayHook(Hook::$DISPLAY_ADMIN_ORDER_TAB_LINK, 'order/tracking-link.html.twig'), + Hook::$DISPLAY_ADMIN_ORDER_TAB_CONTENT => new DisplayHook(Hook::$DISPLAY_ADMIN_ORDER_TAB_CONTENT, ''), + Hook::$DISPLAY_ADMIN_ORDER_MAIN => new DisplayHook(Hook::$DISPLAY_ADMIN_ORDER_MAIN, ''), + Hook::$DISPLAY_CARRIER_EXTRA_CONTENT => new DisplayHook(Hook::$DISPLAY_CARRIER_EXTRA_CONTENT, 'views/templates/hook/carrier-extra-content-pudo.tpl'), + Hook::$ACTION_FRONT_CONTROLLER_SET_MEDIA => new DisplayHook(Hook::$ACTION_FRONT_CONTROLLER_SET_MEDIA, ''), + Hook::$DISPLAY_BACKOFFICE_HEADER => new DisplayHook(Hook::$DISPLAY_BACKOFFICE_HEADER, ''), + Hook::$ACTION_ORDER_GRID_DEFINITION_MODIFIER => new DisplayHook(Hook::$ACTION_ORDER_GRID_DEFINITION_MODIFIER, ''), + Hook::$ACTION_CARRIER_UPDATE => new DisplayHook(Hook::$ACTION_CARRIER_UPDATE, ''), + ]; + } + + public function getHooks(): array + { + return array_keys($this->hooks); + } + + public function getHook($hookName): DisplayHook + { + return $this->hooks[$hookName]; + } +} diff --git a/modules/dpdshipping/src/Hook/index.php b/modules/dpdshipping/src/Hook/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Hook/index.php @@ -0,0 +1,33 @@ + 'AdminDpdShippingShippingHistoryForm', + 'visible' => true, + 'name' => $name, + 'parent_class_name' => 'AdminParentShipping', + ], + ]; + } +} diff --git a/modules/dpdshipping/src/Install/DatabaseInstaller.php b/modules/dpdshipping/src/Install/DatabaseInstaller.php new file mode 100644 index 00000000..6c66d73f --- /dev/null +++ b/modules/dpdshipping/src/Install/DatabaseInstaller.php @@ -0,0 +1,422 @@ +connection = $connection; + } + + private function executeSql(string $sql): void + { + if (method_exists($this->connection, 'executeStatement')) { + $this->connection->executeStatement($sql); + return; + } + if (method_exists($this->connection, 'executeQuery')) { + $this->connection->executeQuery($sql); + return; + } + if (method_exists($this->connection, 'execute')) { + $result = $this->connection->execute($sql); + if ($result === false) { + throw new \RuntimeException('SQL execution failed for: ' . $sql); + } + return; + } + if ($this->connection instanceof PDO) { + $res = $this->connection->exec($sql); + if ($res === false) { + $errorInfo = $this->connection->errorInfo(); + throw new \RuntimeException('PDO exec failed: ' . json_encode($errorInfo)); + } + return; + } + throw new \RuntimeException('Unsupported DB connection type in DatabaseInstaller'); + } + + public function createTables(): array + { + $errors = []; + $sqlQueries = self::getSqlQueries(); + foreach ($sqlQueries as $query) { + if (empty($query)) { + continue; + } + try { + $this->executeSql($query); + } catch (\Throwable $e) { + $errors[] = [ + 'key' => $e->getMessage(), + 'parameters' => [], + 'domain' => 'Admin.Modules.Dpdshipping', + ]; + } + } + return $errors; + } + + public function dropTables(): array + { + $errors = []; + foreach ($this->tableNames as $tableName) { + $sql = 'DROP TABLE IF EXISTS ' . _DB_PREFIX_ . $tableName; + try { + $this->executeSql($sql); + } catch (\Throwable $e) { + $errors[] = [ + 'key' => $e->getMessage(), + 'parameters' => [], + 'domain' => 'Admin.Modules.Dpdshipping', + ]; + } + } + return $errors; + } + + private static function getTableDefinitions(): array + { + return [ + 'dpdshipping_cart_pickup' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'id_cart int(11) NOT NULL', + 'pudo_code varchar(100) NOT NULL', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_configuration' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'name varchar(100) NOT NULL', + 'value varchar(8000) NOT NULL', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_payer' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'id_connection int(11) NULL', + 'name varchar(100) NOT NULL', + 'fid varchar(30) NOT NULL', + 'is_default tinyint(1) NOT NULL DEFAULT 0', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_sender_address' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'alias varchar(255) NULL', + 'company varchar(255) NULL', + 'name varchar(255) NULL', + 'street varchar(255) NULL', + 'city varchar(255) NULL', + 'postal_code varchar(255) NULL', + 'country_code varchar(255) NULL', + 'phone varchar(255) NULL', + 'email varchar(255) NULL', + 'is_default tinyint(1) NOT NULL DEFAULT 0', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_carrier' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'id_carrier int(11) NOT NULL', + 'type varchar(255) NOT NULL', + 'active tinyint(1) NOT NULL DEFAULT 0', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_carrier_pickup' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'id_dpdshipping_carrier int(11) NOT NULL', + 'name varchar(255) NOT NULL', + 'value tinyint(1) NOT NULL DEFAULT 0', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_pickup_courier' => [ + 'id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'status VARCHAR(100) NOT NULL', + 'order_number VARCHAR(100) NULL', + 'checksum VARCHAR(255) NULL', + 'operation_type VARCHAR(50) NOT NULL', + 'order_type VARCHAR(50) NOT NULL', + 'pickup_date datetime NOT NULL', + 'pickup_time_from VARCHAR(50) NOT NULL', + 'pickup_time_to VARCHAR(50) NOT NULL', + 'customer_full_name VARCHAR(100) NULL', + 'customer_name VARCHAR(100) NULL', + 'customer_phone VARCHAR(100) NULL', + 'payer_number INT NULL', + 'payer_name VARCHAR(100) NULL', + 'sender_address VARCHAR(255) NULL', + 'sender_city VARCHAR(100) NULL', + 'sender_full_name VARCHAR(255) NULL', + 'sender_name VARCHAR(255) NULL', + 'sender_phone VARCHAR(100) NULL', + 'sender_postal_code VARCHAR(50) NULL', + 'sender_country_code VARCHAR(10) NULL', + 'dox tinyint(1) NOT NULL DEFAULT 0', + 'dox_count INT NOT NULL DEFAULT 0', + 'pallet tinyint(1) NOT NULL DEFAULT 0', + 'pallet_max_height DECIMAL(14, 2) NULL', + 'pallet_max_weight DECIMAL(14, 2) NULL', + 'pallets_count INT NOT NULL DEFAULT 0', + 'pallets_weight DECIMAL(14, 2) NULL', + 'standard_parcel tinyint(1) NOT NULL DEFAULT 0', + 'parcel_max_depth INT NULL', + 'parcel_max_height INT NULL', + 'parcel_max_weight DECIMAL(14, 2) NULL', + 'parcel_max_width INT NULL', + 'parcels_count INT NOT NULL DEFAULT 0', + 'parcels_weight DECIMAL(14, 2) NULL', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP' + ], + 'dpdshipping_pickup_courier_settings' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'customer_full_name VARCHAR(100) NULL', + 'customer_name VARCHAR(100) NULL', + 'customer_phone VARCHAR(100) NULL', + 'payer_number INT NULL', + 'sender_address VARCHAR(255) NULL', + 'sender_city VARCHAR(100) NULL', + 'sender_full_name VARCHAR(255) NULL', + 'sender_name VARCHAR(255) NULL', + 'sender_phone VARCHAR(100) NULL', + 'sender_postal_code VARCHAR(50) NULL', + 'sender_country_code VARCHAR(10) NULL', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_special_price' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'iso_country varchar(255) NOT NULL', + 'price_from decimal(20,6) NOT NULL', + 'price_to decimal(20,6) NOT NULL', + 'weight_from decimal(20,6) NOT NULL', + 'weight_to decimal(20,6) NOT NULL', + 'parcel_price float NOT NULL', + 'cod_price varchar(255) NOT NULL', + 'carrier_type varchar(50) NOT NULL', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)' + ], + 'dpdshipping_shipping_history_sender' => [ + 'id int NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'name varchar(255) NULL', + 'company varchar(255) NULL', + 'street varchar(255) NULL', + 'postal_code varchar(255) NULL', + 'country_code varchar(255) NULL', + 'city varchar(255) NULL', + 'phone varchar(255) NULL', + 'email varchar(255) NULL' + ], + 'dpdshipping_shipping_history_receiver' => [ + 'id int NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'address_id int NULL', + 'name varchar(255) NULL', + 'company varchar(255) NULL', + 'street varchar(255) NULL', + 'postal_code varchar(255) NULL', + 'country_code varchar(255) NULL', + 'city varchar(255) NULL', + 'phone varchar(255) NULL', + 'email varchar(255) NULL' + ], + 'dpdshipping_shipping_history_services' => [ + 'id int NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'is_cod bit NOT NULL default 0', + 'cod_amount decimal(14, 2) NULL', + 'cod_currency varchar(10) NULL', + 'is_guarantee bit NOT NULL default 0', + 'guarantee_type varchar(50) NULL', + 'guarantee_value varchar(50) NULL', + 'is_pallet bit NOT NULL default 0', + 'is_tires bit NOT NULL default 0', + 'is_declared_value bit NOT NULL default 0', + 'declared_value_amount decimal(14, 2) NULL', + 'declared_value_currency varchar(10) NULL', + 'is_cud bit NOT NULL default 0', + 'is_dox bit NOT NULL default 0', + 'is_duty bit NOT NULL default 0', + 'duty_amount decimal(14, 2) NULL', + 'duty_currency varchar(10) NULL', + 'is_rod bit NOT NULL default 0', + 'is_dedicated_delivery bit NOT NULL default 0', + 'is_dpd_express bit NOT NULL default 0', + 'is_dpd_food bit NOT NULL default 0', + 'is_carry_in bit NOT NULL default 0', + 'is_dpd_pickup bit NOT NULL default 0', + 'dpd_pickup_pudo varchar(200) NULL', + 'is_in_pers bit NOT NULL default 0', + 'is_priv_pers bit NOT NULL default 0', + 'is_self_con bit NOT NULL default 0', + 'self_con_type varchar(200) NULL', + 'is_documents_international bit NOT NULL default 0', + 'is_adr bit NOT NULL default 0', + 'dpd_food_limit_date varchar(20) NULL', + 'is_return_label bit NOT NULL default 0', + 'return_label_name varchar(255) NULL', + 'return_label_company varchar(255) NULL', + 'return_label_street varchar(255) NULL', + 'return_label_postal_code varchar(255) NULL', + 'return_label_country_code varchar(255) NULL', + 'return_label_city varchar(255) NULL', + 'return_label_phone varchar(255) NULL', + 'return_label_email varchar(255) NULL' + ], + 'dpdshipping_shipping_history' => [ + 'id int NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'id_order int NOT NULL', + 'id_shop int NOT NULL', + 'id_connection int(11) NULL', + 'reference varchar(255) NULL', + 'shipping_history_sender_id int NULL', + 'shipping_history_receiver_id int NULL', + 'shipping_history_services_id int NULL', + 'carrier_name varchar(255) NULL', + 'shipping_date datetime NULL', + 'label_date datetime NULL', + 'protocol_number varchar(255) NULL', + 'protocol_date datetime NULL', + 'delivery_zone varchar(255) NULL', + 'fid int NULL', + 'payer_type varchar(255) NULL', + 'ref1 varchar(255) NULL', + 'ref2 varchar(255) NULL', + 'is_deleted bit NOT NULL default 0', + 'last_status varchar(255) NULL', + 'return_label datetime NULL', + 'return_label_waybill varchar(255) NULL', + 'is_delivered bit NOT NULL default 0', + 'date_add datetime NOT NULL default CURRENT_TIMESTAMP', + 'date_modify datetime NOT NULL default CURRENT_TIMESTAMP' + ], + 'dpdshipping_shipping_history_parcel' => [ + 'id int NOT NULL AUTO_INCREMENT PRIMARY KEY', + 'shipping_history_id int NULL', + 'parcel_index int NOT NULL', + 'waybill varchar(255) NULL', + 'is_main_waybill bit NOT NULL default 0', + 'parent_waybill varchar(255) NULL', + 'return_label varchar(255) NULL', + 'weight decimal(14, 2) NOT NULL', + 'weight_adr decimal(14, 2) NULL', + 'content varchar(500) NULL', + 'customer_data varchar(500) NULL', + 'size_x decimal(14, 2) NULL', + 'size_y decimal(14, 2) NULL', + 'size_z decimal(14, 2) NULL' + ], + 'dpdshipping_connection' => [ + 'id int(11) NOT NULL AUTO_INCREMENT', + 'id_shop int(11) NOT NULL', + 'name varchar(255) NULL', + 'login varchar(255) NULL', + 'password varchar(255) NULL', + 'master_fid varchar(255) NULL', + 'environment varchar(255) NULL', + 'is_default tinyint(1) NOT NULL DEFAULT 0', + 'date_add datetime DEFAULT CURRENT_TIMESTAMP', + 'date_upd datetime DEFAULT CURRENT_TIMESTAMP', + 'PRIMARY KEY (id)', + ], + ]; + } + + private static function buildCreateTableQuery(string $table, array $columns): string + { + return "CREATE TABLE IF NOT EXISTS `" . _DB_PREFIX_ . "$table` (\n " . implode(",\n ", $columns) . "\n)" . self::ENGINE . ";"; + } + + public static function getSqlQueries(): array + { + $sqlQueries = []; + foreach (self::getTableDefinitions() as $table => $columns) { + $sqlQueries[] = self::buildCreateTableQuery($table, $columns); + } + $sqlQueries[] = + 'INSERT INTO `' . _DB_PREFIX_ . 'dpdshipping_configuration` (`id_shop`, `name`, `value`) ' + . 'VALUES (' . (int)Context::getContext()->shop->id . ', "' . Configuration::NEED_ONBOARDING . '", "1") ' + . 'ON DUPLICATE KEY UPDATE `id_shop` = VALUES(`id_shop`), `name` = VALUES(`name`)'; + return $sqlQueries; + } + + public static function getDpdshippingConnectionCreateTable(): string + { + $columns = self::getTableDefinitions()['dpdshipping_connection'] ?? []; + return self::buildCreateTableQuery('dpdshipping_connection', $columns); + } + +} diff --git a/modules/dpdshipping/src/Install/Installer.php b/modules/dpdshipping/src/Install/Installer.php new file mode 100644 index 00000000..27054302 --- /dev/null +++ b/modules/dpdshipping/src/Install/Installer.php @@ -0,0 +1,71 @@ +hookRepository = $hookRepository; + $this->dbInstaller = new DatabaseInstaller($connection); + } + + public function install(Module $module): bool + { + if (!$this->registerHooks($module)) { + return false; + } + + if (!empty($this->dbInstaller->createTables())) { + return false; + } + + return true; + } + + private function registerHooks(Module $module): bool + { + $hooks = $this->hookRepository->getHooks(); + + return $module->registerHook($hooks); + } + + public function uninstall(): bool + { + return empty($this->dbInstaller->dropTables()); + } +} diff --git a/modules/dpdshipping/src/Install/InstallerFactory.php b/modules/dpdshipping/src/Install/InstallerFactory.php new file mode 100644 index 00000000..12ea67a9 --- /dev/null +++ b/modules/dpdshipping/src/Install/InstallerFactory.php @@ -0,0 +1,39 @@ +logger = $logger; + } + + public function save(AddCarrierPickupCommand $command): bool + { + //DELETE CURRENT + $this->logger->info('DPDSHIPPING: Add new carrier pickup'); + + $param = $this->findOneBy(['name' => $command->getName()]); + if (!isset($param)) { + $entity = new DpdshippingCarrierPickup(); + $entity + ->setIdShop((int) Context::getContext()->shop->id) + ->setIdDpdshippingCarrier($command->getDpdCarrierId()) + ->setName($command->getName()) + ->setValue($command->getValue()) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($entity); + } else { + $param + ->setIdDpdshippingCarrier($command->getDpdCarrierId()) + ->setValue($command->getValue()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($param); + } + + $this->_em->flush(); + + return true; + } + + public function findByCarrierType(string $type) + { + $query = $this->_em->createQuery( + 'SELECT cp + FROM DpdShipping\Entity\DpdshippingCarrierPickup cp + LEFT JOIN DpdShipping\Entity\DpdshippingCarrier c WITH cp.idDpdshippingCarrier = c.idCarrier + WHERE c.type = :type AND c.idShop IN (:idShop)' + ); + + $query->setParameter('type', $type); + $query->setParameter('idShop', Shop::getContextListShopID()); + + return $query->getResult(); + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingCarrierRepository.php b/modules/dpdshipping/src/Repository/DpdshippingCarrierRepository.php new file mode 100644 index 00000000..eebcb58a --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingCarrierRepository.php @@ -0,0 +1,126 @@ +logger = $logger; + } + + public function findAll(): array + { + return $this->findBy(['idShop' => (int)Context::getContext()->shop->id]); + } + + public function add($idCarrier, $type, $active, int $idShop) + { + $this->logger->info("DPDSHIPPING: Add new carrier id: $idCarrier, type: $type"); + + $newEntity = new DpdshippingCarrier(); + $newEntity + ->setIdShop($idShop) + ->setIdCarrier($idCarrier) + ->setActive($active) + ->setType($type) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($newEntity); + + $this->_em->flush(); + + if ($newEntity->getId() && $active) { + $this->setOtherCarrierAsInactive($newEntity->getId(), $type, $idShop); + } + } + + private function setOtherCarrierAsInactive(int $id, $type, int $idShop) + { + $currentList = $this->findBy( + [ + 'idShop' => $idShop, + 'type' => $type, + ] + ); + + foreach ($currentList as $item) { + if ($item->getId() != $id) { + $item->setActive(false); + } + + $this->_em->persist($item); + } + $this->_em->flush(); + } + + public function setInactive($id): bool + { + $current = $this->findOneBy(['id' => $id]); + + if (isset($current)) { + $current->setActive(false); + } else { + return false; + } + + $this->_em->persist($current); + $this->_em->flush(); + + return true; + } + + public function joinCarrier($currentId, $newId) + { + $current = $this->findOneBy(['idCarrier' => $currentId]); + + if (isset($current)) { + $this->add($newId, $current->getType(), true, $current->getIdShop()); + + if ($current->getType() == Config::DPD_PICKUP) { + DpdCarrierPrestashopConfiguration::setConfig(Config::DPD_PICKUP, $newId, $current->getIdShop()); + } elseif ($current->getType() == Config::DPD_PICKUP_COD) { + DpdCarrierPrestashopConfiguration::setConfig(Config::DPD_PICKUP_COD, $newId, $current->getIdShop()); + } elseif ($current->getType() == Config::DPD_SWIP_BOX) { + DpdCarrierPrestashopConfiguration::setConfig(Config::DPD_SWIP_BOX, $newId, $current->getIdShop()); + } + } + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingCartPickupRepository.php b/modules/dpdshipping/src/Repository/DpdshippingCartPickupRepository.php new file mode 100644 index 00000000..d03108be --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingCartPickupRepository.php @@ -0,0 +1,53 @@ +logger = $logger; + } + + public function getPudoCode($idShop, $idCart) + { + $result = $this->findOneBy(['idShop' => $idShop, 'idCart' => $idCart], ['dateAdd' => 'DESC']); + + if (isset($result)) { + return $result->getPudoCode(); + } + + return ''; + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingConfigurationRepository.php b/modules/dpdshipping/src/Repository/DpdshippingConfigurationRepository.php new file mode 100644 index 00000000..e388b9c9 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingConfigurationRepository.php @@ -0,0 +1,67 @@ +findOneByName($name, $idShop); + if (!isset($param)) { + $entity = new DpdshippingConfiguration(); + $entity + ->setIdShop($idShop) + ->setName($name) + ->setValue($value) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($entity); + } else { + $param->setValue($value); + $param->setDateUpd(new DateTime()); + + $this->_em->persist($param); + } + + $this->_em->flush(); + + return true; + } + + public function findOneByName(string $name, int $idShop): ?DpdshippingConfiguration + { + return $this->findOneBy(['name' => $name, 'idShop' => $idShop]); + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingConnectionRepository.php b/modules/dpdshipping/src/Repository/DpdshippingConnectionRepository.php new file mode 100644 index 00000000..a43c7c86 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingConnectionRepository.php @@ -0,0 +1,165 @@ +logger = $logger; + } + + public function findOneByIdShop($idConnection, $idShop) + { + $criteria = []; + + if ($idShop !== null) { + $criteria['idShop'] = $idShop; + } + + if ($idConnection !== null) { + $criteria['id'] = $idConnection; + } + + if (empty($criteria)) { + $criteria['idShop'] = (int) Context::getContext()->shop->id; + } + + return $this->findOneBy($criteria, ['isDefault' => 'DESC']); + } + + public function addOrUpdate($id, $idShop, $name, $login, $password, $masterFid, $environment, $isDefault) + { + $em = $this->_em; + $conn = $em->getConnection(); + + $conn->beginTransaction(); + try { + $entity = $this->findOneBy(['id' => $id]); + + $now = new DateTime(); + + if (!$entity) { + $entity = new DpdshippingConnection(); + $entity + ->setIdShop($idShop) + ->setName($name) + ->setLogin($login) + ->setPassword($password) + ->setMasterFid($masterFid) + ->setEnvironment($environment) + ->setDefault((bool)$isDefault) + ->setDateAdd($now) + ->setDateUpd($now); + + $em->persist($entity); + $em->flush(); + $currentId = $entity->getId(); + } else { + $entity + ->setIdShop($idShop) + ->setName($name) + ->setLogin($login) + ->setPassword($password) + ->setMasterFid($masterFid) + ->setEnvironment($environment) + ->setDefault((bool)$isDefault) + ->setDateUpd($now); + + $em->persist($entity); + $em->flush(); + $currentId = (int)$id; + } + + if ($isDefault) { + $em->createQueryBuilder() + ->update(DpdshippingConnection::class, 'c') + ->set('c.isDefault', ':false') + ->where('c.idShop = :idShop') + ->andWhere('c.id != :id') + ->setParameter('false', false) + ->setParameter('idShop', $idShop) + ->setParameter('id', $currentId) + ->getQuery() + ->execute(); + } + + $conn->commit(); + return $currentId; + + } catch (Throwable $e) { + $conn->rollBack(); + throw $e; + } + } + + public function deleteById($id): bool + { + $entity = $this->findOneBy(['id' => $id]); + + if (!$entity) { + return false; + } + + $payers = $this->_em->getRepository(DpdshippingPayer::class) + ->findBy(['idConnection' => $id]); + + foreach ($payers as $payer) { + $this->_em->remove($payer); + } + + $this->_em->remove($entity); + + $this->_em->flush(); + + return true; + } + + public function findConnectionList($idShop): array + { + return $this->createQueryBuilder('c') + ->where('c.idShop in ( :idShop)') + ->setParameter('idShop', $idShop) + ->orderBy('c.isDefault', 'DESC') + ->addOrderBy('c.id', 'ASC') + ->getQuery() + ->getResult(); + } + +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingPayerRepository.php b/modules/dpdshipping/src/Repository/DpdshippingPayerRepository.php new file mode 100644 index 00000000..2b744a8e --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingPayerRepository.php @@ -0,0 +1,110 @@ +logger = $logger; + } + + public function addOrUpdate(array $payerList, $idShop, $connectionId): bool + { + $toDelete = []; + + $currentList = $this->findAllActive(false, $idShop, $connectionId); + + foreach ($currentList as $item) { + $toDelete[] = $item; + } + + foreach ($toDelete as $item) { + $recordToDelete = $this->find($item); + $this->getEntityManager()->remove($recordToDelete); + } + $this->_em->flush(); + + $defaultSet = false; + foreach ($payerList as $payer) { + $isDefault = false; + if ($payer->isDefault() && !$defaultSet) { + $isDefault = true; + $defaultSet = true; + } + + $newEntity = new DpdshippingPayer(); + $newEntity + ->setIdShop($idShop) + ->setIdConnection($connectionId) + ->setName($payer->getName()) + ->setFid((string)$payer->getFid()) + ->setDefault($isDefault) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($newEntity); + } + + $this->_em->flush(); + + return true; + } + + public function findAllActive(bool $defaultFirst, $idShop, $idConnection): array + { + $criteria = []; + + if ($idShop !== null) { + $criteria['idShop'] = $idShop; + } + + if ($idConnection !== null) { + $criteria['idConnection'] = $idConnection; + } + + $orderBy = $defaultFirst ? ['isDefault' => 'DESC'] : []; + + return $this->findBy($criteria, $orderBy); + } + + public function findDefault($idConnection): ?DpdshippingPayer + { + return $this->findOneBy(['idShop' => (int)Context::getContext()->shop->id, 'isDefault' => true, 'idConnection' => $idConnection]); + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingPickupCourierRepository.php b/modules/dpdshipping/src/Repository/DpdshippingPickupCourierRepository.php new file mode 100644 index 00000000..ac1247a7 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingPickupCourierRepository.php @@ -0,0 +1,112 @@ +logger = $logger; + } + + public function save(DpdPickupCallParamsV3 $dpdPickupCallParams, string $status, string $orderNumber, string $checkSum, string $countryCode): bool + { + $customer = $dpdPickupCallParams->getPickupCallSimplifiedDetails()->getPickupCustomer(); + $payer = $dpdPickupCallParams->getPickupCallSimplifiedDetails()->getPickupPayer(); + $sender = $dpdPickupCallParams->getPickupCallSimplifiedDetails()->getPickupSender(); + $params = $dpdPickupCallParams->getPickupCallSimplifiedDetails()->getPackagesParams(); + + $entity = (new DpdshippingPickupCourier()) + ->setStatus($status) + ->setOrderNumber($orderNumber) + ->setChecksum($checkSum) + ->setOperationType($dpdPickupCallParams->getOperationType()) + ->setOrderType($dpdPickupCallParams->getOrderType()) + ->setPickupDate(new DateTime($dpdPickupCallParams->getPickupDate())) + ->setPickupTimeFrom($dpdPickupCallParams->getPickupTimeFrom() ?? "") + ->setPickupTimeTo($dpdPickupCallParams->getPickupTimeTo() ?? "") + ->setCustomerFullName($customer->getCustomerFullName()) + ->setCustomerName($customer->getCustomerName()) + ->setCustomerPhone($customer->getCustomerPhone()) + ->setPayerNumber($payer->getPayerNumber()) + ->setPayerName($payer->getPayerName()) + ->setSenderAddress($sender->getSenderAddress()) + ->setSenderCity($sender->getSenderCity()) + ->setSenderFullName($sender->getSenderFullName()) + ->setSenderName($sender->getSenderName()) + ->setSenderPhone($sender->getSenderPhone()) + ->setSenderPostalCode($sender->getSenderPostalCode()) + ->setSenderCountryCode($countryCode) + ->setDox($params->getDox() === true || $params->getDox() == "true" || $params->getDox() == "1") + ->setDoxCount($params->getDoxCount() ?? 0) + ->setPallet($params->getPallet() === true || $params->getPallet() == "true" || $params->getPallet() == "1") + ->setPalletMaxHeight($params->getPalletMaxHeight() ?? 0) + ->setPalletMaxWeight($params->getPalletMaxWeight() ?? 0) + ->setPalletsCount($params->getPalletsCount() ?? 0) + ->setPalletsWeight($params->getPalletsWeight() ?? 0) + ->setStandardParcel($params->getStandardParcel() === true || $params->getStandardParcel() == "true" || $params->getStandardParcel() == "1") + ->setParcelMaxDepth($params->getParcelMaxDepth() ?? 0) + ->setParcelMaxHeight($params->getParcelMaxHeight() ?? 0) + ->setParcelMaxWeight($params->getParcelMaxWeight() ?? 0) + ->setParcelMaxWidth($params->getParcelMaxWidth() ?? 0) + ->setParcelsCount($params->getParcelsCount() ?? 0) + ->setParcelsWeight($params->getParcelsWeight() ?? 0) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($entity); + $this->logger->info('DPDSHIPPING: Added courier pickup:' . json_encode($entity)); + + $this->_em->flush(); + + return true; + } + + public function saveStatusCancel($pickupCourierEntity) + { + $pickupCourierEntity->setStatus("CANCELLED"); + $pickupCourierEntity->setDateUpd(new DateTime()); + + $this->_em->persist($pickupCourierEntity); + $this->logger->info('DPDSHIPPING: Cancelled courier pickup:' . json_encode($pickupCourierEntity)); + + $this->_em->flush(); + } + +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingPickupCourierSettingsRepository.php b/modules/dpdshipping/src/Repository/DpdshippingPickupCourierSettingsRepository.php new file mode 100644 index 00000000..4ab2029f --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingPickupCourierSettingsRepository.php @@ -0,0 +1,112 @@ +logger = $logger; + } + + public function findAll(): array + { + return $this->findBy(['idShop' => Shop::getContextListShopID()]); + } + + public function deleteById($id) + { + $entity = $this->findOneBy(['id' => $id]); + + if (!isset($entity)) { + return false; + } + + $this->_em->remove($entity); + $this->_em->flush(); + + return true; + + } + + public function addOrUpdate($pickupOrderSettings, $idShop) + { + $entity = $pickupOrderSettings != null ? $this->findOneBy(['id' => $pickupOrderSettings->getId()]) : null; + + if (!isset($entity)) { + $newEntity = new DpdshippingPickupCourierSettings(); + $newEntity + ->setIdShop($idShop) + ->setCustomerName($pickupOrderSettings->getCustomerName()) + ->setCustomerFullName($pickupOrderSettings->getCustomerFullName()) + ->setCustomerPhone($pickupOrderSettings->getCustomerPhone()) + ->setSenderFullName($pickupOrderSettings->getSenderFullName()) + ->setPayerNumber($pickupOrderSettings->getPayerNumber()) + ->setSenderName($pickupOrderSettings->getSenderName()) + ->setSenderAddress($pickupOrderSettings->getSenderAddress()) + ->setSenderCity($pickupOrderSettings->getSenderCity()) + ->setSenderPhone($pickupOrderSettings->getSenderPhone()) + ->setSenderPostalCode($pickupOrderSettings->getSenderPostalCode()) + ->setSenderCountryCode($pickupOrderSettings->getSenderCountryCode()) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($newEntity); + } else { + $entity + ->setCustomerName($pickupOrderSettings->getCustomerName()) + ->setCustomerFullName($pickupOrderSettings->getCustomerFullName()) + ->setCustomerPhone($pickupOrderSettings->getCustomerPhone()) + ->setSenderFullName($pickupOrderSettings->getSenderFullName()) + ->setPayerNumber($pickupOrderSettings->getPayerNumber()) + ->setSenderName($pickupOrderSettings->getSenderName()) + ->setSenderAddress($pickupOrderSettings->getSenderAddress()) + ->setSenderCity($pickupOrderSettings->getSenderCity()) + ->setSenderPhone($pickupOrderSettings->getSenderPhone()) + ->setSenderPostalCode($pickupOrderSettings->getSenderPostalCode()) + ->setSenderCountryCode($pickupOrderSettings->getSenderCountryCode()) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($entity); + } + + $this->_em->flush(); + } + +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingSenderAddressRepository.php b/modules/dpdshipping/src/Repository/DpdshippingSenderAddressRepository.php new file mode 100644 index 00000000..95c8b22e --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingSenderAddressRepository.php @@ -0,0 +1,125 @@ +findBy(['idShop' => $idShop], ['isDefault' => 'DESC']); + + return $this->findBy(['idShop' => Shop::getContextListShopID()], ['isDefault' => 'DESC']); + } + + public function addOrUpdate($senderAddress, int $idShop) + { + $entity = $senderAddress != null ? $this->findOneBy(['id' => $senderAddress->getId()]) : null; + + if (!isset($entity)) { + if ($senderAddress->isDefault()) { + $this->setDefaultToZero($idShop); + } + $newEntity = new DpdshippingSenderAddress(); + $newEntity + ->setIdShop($idShop) + ->setAlias($senderAddress->getAlias()) + ->setCompany($senderAddress->getCompany()) + ->setName($senderAddress->getName()) + ->setStreet($senderAddress->getStreet()) + ->setCity($senderAddress->getCity()) + ->setCountryCode($senderAddress->getCountryCode()) + ->setPostalCode($senderAddress->getPostalCode()) + ->setMail($senderAddress->getMail()) + ->setPhone($senderAddress->getPhone()) + ->setIsDefault($senderAddress->isDefault()) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($newEntity); + } else { + if ($senderAddress->isDefault()) { + $this->setDefaultToZero($entity->getIdShop()); + } + $entity + ->setAlias($senderAddress->getAlias()) + ->setCompany($senderAddress->getCompany()) + ->setName($senderAddress->getName()) + ->setStreet($senderAddress->getStreet()) + ->setCity($senderAddress->getCity()) + ->setCountryCode($senderAddress->getCountryCode()) + ->setPostalCode($senderAddress->getPostalCode()) + ->setMail($senderAddress->getMail()) + ->setPhone($senderAddress->getPhone()) + ->setIsDefault($senderAddress->isDefault()) + ->setDateAdd(new DateTime()) + ->setDateUpd(new DateTime()); + + $this->_em->persist($entity); + } + + $this->_em->flush(); + } + + public function deleteById($id) + { + $entity = $this->findOneBy(['id' => $id]); + + if (!isset($entity)) { + return false; + } + + $this->_em->remove($entity); + $this->_em->flush(); + + return true; + } + + private function setDefaultToZero($idShop) + { + $entities = $this->findAll($idShop); + + foreach ($entities as $entity) { + $entity->setIsDefault(false); + } + + $this->_em->flush(); + } + + public function findDefault($idShop) + { + return $this->findOneBy(['idShop' => $idShop, 'isDefault' => true]); + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryParcelRepository.php b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryParcelRepository.php new file mode 100644 index 00000000..4fd62046 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryParcelRepository.php @@ -0,0 +1,57 @@ +_em->persist($entity); + $this->_em->flush(); + + return $entity; + } + + public function getWaybillsForOrderId($orderId): array + { + $query = $this->_em->createQuery( + 'SELECT shp.waybill, sh.idShop as id_shop, sh.idConnection as id_connection + FROM DpdShipping\Entity\DpdshippingShippingHistoryParcel shp + LEFT JOIN shp.shippingHistory sh + WHERE sh.idOrder = :idOrder AND shp.isMainWaybill = true' + ); + + $query->setParameter('idOrder', $orderId); + + return $query->getResult(); + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryReceiverRepository.php b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryReceiverRepository.php new file mode 100644 index 00000000..d33b5b04 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryReceiverRepository.php @@ -0,0 +1,43 @@ +_em->persist($entity); + $this->_em->flush(); + + return $entity; + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryRepository.php b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryRepository.php new file mode 100644 index 00000000..eecbffa5 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryRepository.php @@ -0,0 +1,220 @@ +_em->persist($entity); + $this->_em->flush(); + + return $entity; + } + + public function setStatus($shippingNumber, array $mappedData) + { + if (empty($mappedData)) { + return; + } + + $shippingHistoryEntity = $this->_em->getRepository(DpdshippingShippingHistoryParcel::class)->findOneBy(['waybill' => $shippingNumber]); + + if (isset($shippingHistoryEntity)) { + $entity = $this->findOneBy(['id' => $shippingHistoryEntity->getShippingHistory()->getId()]); + + $entity->setLastStatus($mappedData[0]['state']); + $isDelivered = false; + + foreach ($mappedData as $shipment) { + if (isset($shipment['state']) && strpos($shipment['state'], 'Przesyłka doręczona') !== false) { + $isDelivered = true; + break; + } + } + $entity->setIsDelivered($isDelivered); + + $this->_em->persist($entity); + $this->_em->flush(); + } + } + + public function getShippingHistoryByIdsGroupByDeliveryZone(array $ids) + { + $qb = $this->createQueryBuilder('sh'); + $qb->select('sh', 'shp', 'shs') + ->leftJoin('sh.parcels', 'shp') + ->join('sh.sender', 'shs') + ->where($qb->expr()->in('sh.id', $ids)); + + $result = $qb->getQuery()->getResult(); + + $groupedResults = [ + 'DOMESTIC' => [], + 'INTERNATIONAL' => [], + ]; + + foreach ($result as $order) { + $zone = $order->getDeliveryZone(); + if (!array_key_exists($zone, $groupedResults)) { + $groupedResults[$zone] = []; + } + $groupedResults[$zone][] = $order; + } + + return $groupedResults; + } + + public function setLabelDate(array $waybills, DateTime $labelDate) + { + $qb = $this->createQueryBuilder('sh'); + $qb->select('sh', 'shp') + ->leftJoin('sh.parcels', 'shp', 'WITH', 'shp.isMainWaybill = 1') + ->where($qb->expr()->in('shp.waybill', $waybills)); + + $result = $qb->getQuery()->getResult(); + + foreach ($result as $order) { + $order->setLabelDate($labelDate); + $this->_em->persist($order); + } + + $this->_em->flush(); + } + + public function setProtocolDate(array $waybills, DateTime $protocolDate) + { + $qb = $this->createQueryBuilder('sh'); + $qb->select('sh', 'shp') + ->leftJoin('sh.parcels', 'shp', 'WITH', 'shp.isMainWaybill = 1') + ->where($qb->expr()->in('shp.waybill', $waybills)); + + $result = $qb->getQuery()->getResult(); + + foreach ($result as $order) { + $order->setProtocolDate($protocolDate); + $this->_em->persist($order); + } + + $this->_em->flush(); + } + + public function getShippingById($shippingHistoryId): array + { + $query = $this->_em->createQuery( + 'SELECT sh, shp, shs + FROM DpdShipping\Entity\DpdshippingShippingHistoryParcel shp + LEFT JOIN DpdShipping\Entity\DpdshippingShippingHistory sh WITH sh.id = shp.shippingHistory + LEFT JOIN DpdShipping\Entity\DpdshippingShippingHistoryServices shs WITH sh.services = shs.id + WHERE sh.id = :shippingHistoryId and shp.isMainWaybill = true' + ); + + $query->setParameter('shippingHistoryId', $shippingHistoryId); + $query->setMaxResults(1); + + $result = $query->getResult(); + + if (empty($result)) { + return []; + } + + return [ + 'parcel' => $result[0], + 'shipping' => $result[1], + 'services' => $result[2], + ]; + } + + public function getLastShippingByOrderId($orderId) + { + $query = $this->_em->createQuery( + 'SELECT sh, shp, shs + FROM DpdShipping\Entity\DpdshippingShippingHistoryParcel shp + LEFT JOIN DpdShipping\Entity\DpdshippingShippingHistory sh WITH sh.id = shp.shippingHistory + LEFT JOIN DpdShipping\Entity\DpdshippingShippingHistoryServices shs WITH sh.services = shs.id + WHERE sh.idOrder = :orderId and shp.isMainWaybill = true + ORDER BY sh.id DESC' + ); + + $query->setParameter('orderId', $orderId); + $query->setMaxResults(1); + + $result = $query->getResult(); + + if (empty($result)) { + return []; + } + + return [ + 'parcel' => $result[0], + 'shipping' => $result[1], + 'services' => $result[2], + ]; + } + + public function delete($ids) + { + foreach ($ids as $id) { + $shippingHistory = $this->find($id); + + if ($shippingHistory) { + $shippingHistoryParcels = $this->_em->getRepository(DpdshippingShippingHistoryParcel::class)->findBy(['shippingHistory' => $shippingHistory]); + $shippingHistoryReceiver = $shippingHistory->getReceiver(); + $shippingHistorySender = $shippingHistory->getSender(); + $shippingHistoryServices = $shippingHistory->getServices(); + + foreach ($shippingHistoryParcels as $parcel) { + $this->_em->remove($parcel); + } + + if ($shippingHistoryReceiver) { + $this->_em->remove($shippingHistoryReceiver); + } + + if ($shippingHistorySender) { + $this->_em->remove($shippingHistorySender); + } + + if ($shippingHistoryServices) { + $this->_em->remove($shippingHistoryServices); + } + $this->_em->remove($shippingHistory); + + $this->_em->flush(); + } + } + + return true; + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingShippingHistorySenderRepository.php b/modules/dpdshipping/src/Repository/DpdshippingShippingHistorySenderRepository.php new file mode 100644 index 00000000..e980b0f5 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingShippingHistorySenderRepository.php @@ -0,0 +1,43 @@ +_em->persist($entity); + $this->_em->flush(); + + return $entity; + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryServicesRepository.php b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryServicesRepository.php new file mode 100644 index 00000000..6f114c99 --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingShippingHistoryServicesRepository.php @@ -0,0 +1,43 @@ +_em->persist($entity); + $this->_em->flush(); + + return $entity; + } +} diff --git a/modules/dpdshipping/src/Repository/DpdshippingSpecialPriceRepository.php b/modules/dpdshipping/src/Repository/DpdshippingSpecialPriceRepository.php new file mode 100644 index 00000000..92c2fd0b --- /dev/null +++ b/modules/dpdshipping/src/Repository/DpdshippingSpecialPriceRepository.php @@ -0,0 +1,110 @@ +logger = $logger; + } + + public function findAll(): array + { + return $this->findBy(['idShop' => (int) Context::getContext()->shop->id]); + } + + public function save($specialPriceList, $idShop): array + { + $toDelete = $this->findBy(['idShop' => $idShop]); + + foreach ($toDelete as $item) { + $recordToDelete = $this->find($item); + $this->getEntityManager()->remove($recordToDelete); + $this->logger->info('DPDSHIPPING: Delete specialPrice: ' . $item->getId()); + } + + $this->_em->flush(); + + foreach ($specialPriceList as $item) { + $entity = new DpdshippingSpecialPrice(); + + $entity->setIdShop($idShop); + $entity->setIsoCountry($item['isoCountry']); + $entity->setPriceFrom($item['priceFrom']); + $entity->setPriceTo($item['priceTo']); + $entity->setWeightFrom($item['weightFrom']); + $entity->setWeightTo($item['weightTo']); + $entity->setParcelPrice($item['parcelPrice']); + $entity->setCodPrice($item['codPrice'] ?? 0); + $entity->setCarrierType($item['carrierType']); + $entity->setDateAdd(new DateTime()); + $entity->setDateUpd(new DateTime()); + + $this->_em->persist($entity); + $this->logger->info('DPDSHIPPING: Add new special price for:' . $entity->getIsoCountry()); + } + $this->_em->flush(); + + return []; + } + + public function findPriceRules($isoCountry, $total_weight, $cart_total_price, $carrierType) + { + $query = $this->_em->createQuery( + "SELECT sp + FROM DpdShipping\Entity\DpdshippingSpecialPrice sp + WHERE (sp.isoCountry = :isoCountry OR sp.isoCountry = '*') + AND + ( + (sp.weightFrom <= :totalWeight AND sp.weightTo >= :totalWeight) + OR + (sp.priceFrom <= :cartTotalPrice AND sp.priceTo >= :cartTotalPrice) + ) + AND sp.carrierType = :carrierType + AND sp.idShop = :idShop" + ); + + $query->setParameter('isoCountry', $isoCountry); + $query->setParameter('totalWeight', (float) $total_weight); + $query->setParameter('cartTotalPrice', (float) $cart_total_price); + $query->setParameter('carrierType', $carrierType); + $query->setParameter('idShop', (int) Context::getContext()->shop->id); + + return $query->getResult(); + } +} diff --git a/modules/dpdshipping/src/Repository/index.php b/modules/dpdshipping/src/Repository/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Repository/index.php @@ -0,0 +1,33 @@ +controller) { + return; + } + $options = ['position' => 'bottom', 'priority' => $priority]; + if ($withServer) { + $options['server'] = 'remote'; + } + $context->controller->registerJavascript($handle, $module->getPathUri() . $relativePath, $options); + } + + private static function addCss($module, $context, string $handle, string $relativePath, int $priority = 50, string $media = 'all', bool $withServer = true): void + { + if (!$context || !$context->controller) { + return; + } + $options = ['media' => $media, 'priority' => $priority]; + if ($withServer) { + $options['server'] = 'remote'; + } + $context->controller->registerStylesheet($handle, $module->getPathUri() . $relativePath, $options); + } + + public static function register($module, $context): void + { + if (!$context || !isset($context->controller) || !$context->controller) { + return; + } + + self::addJs($module, $context, 'dpdshipping-common-js', 'views/js/dpdshipping-common.js', 100, false); + self::addCss($module, $context, 'dpdshipping-common-css', 'views/css/dpdshipping-common.css'); + + $custom_cart = DpdCarrierPrestashopConfiguration::getConfig(ConfigurationAlias::CUSTOM_CHECKOUT); + $custom_cart_array = [ + ConfigurationAlias::CUSTOM_CHECKOUT_SUPERCHECKOUT, + ConfigurationAlias::CUSTOM_CHECKOUT_EASYCHECKOUT, + ConfigurationAlias::CUSTOM_CHECKOUT_OPC_PRESTASMART, + ConfigurationAlias::CUSTOM_CHECKOUT_THECHECKOUT_PRESTASMART, + ConfigurationAlias::CUSTOM_CHECKOUT_OPC_PRESTATEAM_8, + ConfigurationAlias::CUSTOM_CHECKOUT_OPC_PRESTATEAM_1_7, + ]; + + if (in_array($custom_cart, $custom_cart_array, true)) { + self::addCss($module, $context, 'dpdshipping-pudo-customcheckout-css', 'views/css/dpdshipping-pudo-customcheckout.css'); + + switch ($custom_cart) { + case ConfigurationAlias::CUSTOM_CHECKOUT_SUPERCHECKOUT: + self::addJs($module, $context, 'dpdshipping-pudo-supercheckout-js', 'views/js/dpdshipping-pudo-supercheckout.js'); + break; + case ConfigurationAlias::CUSTOM_CHECKOUT_EASYCHECKOUT: + self::addJs($module, $context, 'dpdshipping-pudo-easycheckout-js', 'views/js/dpdshipping-pudo-easycheckout.js'); + break; + case ConfigurationAlias::CUSTOM_CHECKOUT_OPC_PRESTASMART: + self::addJs($module, $context, 'dpdshipping-pudo-opcprestasmart-js', 'views/js/dpdshipping-pudo-opc-prestasmart.js'); + break; + case ConfigurationAlias::CUSTOM_CHECKOUT_OPC_PRESTATEAM_8: + self::addJs($module, $context, 'dpdshipping-pudo-opcprestateam8-js', 'views/js/dpdshipping-pudo-opc-prestateam-8.js'); + break; + case ConfigurationAlias::CUSTOM_CHECKOUT_OPC_PRESTATEAM_1_7: + self::addJs($module, $context, 'dpdshipping-pudo-opcprestateam17-js', 'views/js/dpdshipping-pudo-opc-prestateam-1.7.js'); + break; + case ConfigurationAlias::CUSTOM_CHECKOUT_THECHECKOUT_PRESTASMART: + self::addJs($module, $context, 'dpdshipping-pudo-thecheckout-prestasmart-js', 'views/js/dpdshipping-pudo-thecheckout-prestasmart.js'); + break; + } + } else { + self::addJs($module, $context, 'dpdshipping-pudo-default-js', 'views/js/dpdshipping-pudo-default.js'); + self::addCss($module, $context, 'dpdshipping-pudo-default-css', 'views/css/dpdshipping-pudo-default.css'); + } + + self::addJs($module, $context, 'dpdshipping_pudo_iframe_js', 'views/js/dpdshipping-pudo-iframe.js?ver=1.0.6'); + self::addJs($module, $context, 'dpdshipping_pudo_cod_iframe_js', 'views/js/dpdshipping-pudo-cod-iframe.js?ver=1.0.6'); + self::addJs($module, $context, 'dpdshipping_pudo_swipbox_iframe_js', 'views/js/dpdshipping-pudo-swipbox-iframe.js?ver=1.0.6'); + } +} diff --git a/modules/dpdshipping/src/Support/BackOfficeHeader.php b/modules/dpdshipping/src/Support/BackOfficeHeader.php new file mode 100644 index 00000000..916a7697 --- /dev/null +++ b/modules/dpdshipping/src/Support/BackOfficeHeader.php @@ -0,0 +1,55 @@ +controller || !$context->link) { + return; + } + + $translator = \Context::getContext()->getTranslator(); + + $controller = \Tools::getValue('controller'); + $context->controller->addJS($module->getPathUri() . 'views/js/dpdshipping-ajax.js?' . time()); + + if ($controller === 'AdminOrders') { + $ajaxUrl = $context->link->getAdminLink('AdminModules', true, [], [ + 'route' => 'dpdshipping_generate_shipping_bulk_action', + ]); + + \Media::addJsDef([ + 'dpdshipping_bulk_generate_shipping' => $ajaxUrl, + 'dpdshipping_translations' => [ + 'dpdshipping_return_label_success_text' => $translator->trans('The return label has been generated.', [], 'Modules.Dpdshipping.ReturnLabel'), + 'dpdshipping_return_label_error_text' => $translator->trans('The return label cannot be generated.', [], 'Modules.Dpdshipping.ReturnLabel'), + 'dpdshipping_label_success_text' => $translator->trans('The label has been generated.', [], 'Modules.Dpdshipping.ReturnLabel'), + 'dpdshipping_label_error_text' => $translator->trans('The label cannot be generated.', [], 'Modules.Dpdshipping.ReturnLabel'), + ], + ]); + } else { + \Media::addJsDef([ + 'dpdshipping_pickup_courier_ajax_url' => RouterHelper::generateRouteUrl($module, 'dpdshipping_pickup_courier_get_pickup_courier_settings_ajax'), + 'dpdshipping_pickup_courier_get_pickup_time_frames_ajax_url' => RouterHelper::generateRouteUrl($module, 'dpdshipping_pickup_courier_get_pickup_courier_time_frames_ajax'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_url' => RouterHelper::generateRouteUrl($module, 'dpdshipping_pickup_courier_pickup_courier_ajax'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_customer' => $translator->trans('Please complete the customer details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_sender' => $translator->trans('Please complete the sender details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_payer' => $translator->trans('Please complete the payer details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_pickup_date_time' => $translator->trans('Please complete pickup date and time range details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_parcel' => $translator->trans('Please complete parcels details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_letters' => $translator->trans('Please complete letters details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_packages' => $translator->trans('Please complete all packages details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_ajax_empty_palette' => $translator->trans('Please complete all palette details.', [], 'Modules.Dpdshipping.PickupCourier'), + 'dpdshipping_pickup_courier_pickup_courier_empty_configuration' => $translator->trans('Please complete the configuration in the module settings before ordering a courier', [], 'Modules.Dpdshipping.PickupCourier') + ]); + } + + \Media::addJsDef([ + 'dpdshipping_token' => sha1(_COOKIE_KEY_ . 'dpdshipping') + ]); + } +} diff --git a/modules/dpdshipping/src/Support/ContainerHelper.php b/modules/dpdshipping/src/Support/ContainerHelper.php new file mode 100644 index 00000000..163c1017 --- /dev/null +++ b/modules/dpdshipping/src/Support/ContainerHelper.php @@ -0,0 +1,77 @@ +get($serviceId); + } catch (\Throwable $e) { + } + } + + if (class_exists('\\PrestaShop\\PrestaShop\\Adapter\\SymfonyContainer')) { + try { + $container = \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance(); + if ($container && $container->has($serviceId)) { + return $container->get($serviceId); + } + } catch (\Throwable $e) { + } + } + + return null; + } + + public static function getQueryBus(Module $module) + { + return self::getFromContainer($module, 'prestashop.core.query_bus'); + } + + public static function getCommandBus(Module $module) + { + return self::getFromContainer($module, 'prestashop.core.command_bus'); + } + + public static function getDatabaseConnectionForInstaller(Module $module) + { + $conn = self::getFromContainer($module, 'database_connection'); + if ($conn) { + return $conn; + } + $conn = self::getFromContainer($module, 'doctrine.dbal.default_connection'); + if ($conn) { + return $conn; + } + + if (class_exists('\\Db')) { + try { + $db = \Db::getInstance(); + if ($db) { + return $db; + } + } catch (\Throwable $e) { + } + } + + try { + if (defined('_DB_SERVER_') && defined('_DB_NAME_') && defined('_DB_USER_')) { + $charset = 'utf8'; + $dsn = 'mysql:host=' . _DB_SERVER_ . ';dbname=' . _DB_NAME_ . ';charset=' . $charset; + $pdo = new \PDO($dsn, _DB_USER_, defined('_DB_PASSWD_') ? _DB_PASSWD_ : '', [ + \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, + \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC, + ]); + return $pdo; + } + } catch (\Throwable $e) { + } + + return null; + } +} diff --git a/modules/dpdshipping/src/Support/GridActions.php b/modules/dpdshipping/src/Support/GridActions.php new file mode 100644 index 00000000..6c75a45c --- /dev/null +++ b/modules/dpdshipping/src/Support/GridActions.php @@ -0,0 +1,47 @@ +getBulkActions(); + if (!$bulk || !method_exists($bulk, 'add')) { + return; + } + + $translator = \Context::getContext()->getTranslator(); + + $bulk->add( + (new \PrestaShop\PrestaShop\Core\Grid\Action\Bulk\Type\SubmitBulkAction('dpdshipping_generate_shipping_bulk_action')) + ->setName($translator->trans('DPD Poland - generate shipping', [], 'Modules.Dpdshipping.Bulk')) + ->setOptions([ + 'submit_route' => 'dpdshipping_generate_shipping_bulk_action', + 'submit_method' => 'POST', + ]) + ); + + $bulk->add( + (new \PrestaShop\PrestaShop\Core\Grid\Action\Bulk\Type\SubmitBulkAction('dpdshipping_generate_labels_bulk_action')) + ->setName($translator->trans('DPD Poland - generate labels', [], 'Modules.Dpdshipping.Bulk')) + ->setOptions([ + 'submit_route' => 'dpdshipping_shipping_history_print_labels_form', + 'submit_method' => 'POST', + ]) + ); + + $bulk->add( + (new \PrestaShop\PrestaShop\Core\Grid\Action\Bulk\Type\SubmitBulkAction('dpdshipping_generate_shipping_and_labels_bulk_action')) + ->setName($translator->trans('DPD Poland - generate shipping and labels', [], 'Modules.Dpdshipping.Bulk')) + ->setOptions([ + 'submit_route' => 'dpdshipping_generate_shipping_and_labels_bulk_action', + 'submit_method' => 'POST', + ]) + ); + } +} diff --git a/modules/dpdshipping/src/Support/RouterHelper.php b/modules/dpdshipping/src/Support/RouterHelper.php new file mode 100644 index 00000000..0ed9b889 --- /dev/null +++ b/modules/dpdshipping/src/Support/RouterHelper.php @@ -0,0 +1,78 @@ +context ?? null; + if ($context && isset($context->controller) && method_exists($context->controller, 'getContainer')) { + $container = $context->controller->getContainer(); + if ($container && $container->has('router')) { + return $container->get('router'); + } + } + + if (method_exists($module, 'get')) { + try { + $router = $module->get('router'); + if ($router) { + return $router; + } + } catch (\Throwable $e) { + // ignore + } + } + + if (class_exists('\\PrestaShop\\PrestaShop\\Adapter\\SymfonyContainer')) { + try { + return \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()->get('router'); + } catch (\Throwable $e) { + // ignore and fallback + } + } + + $link = $context ? $context->link : null; + $shim = new class($link) { + private $link; + + public function __construct($link) + { + $this->link = $link; + } + + public function generate($routeName, array $params = []) + { + if (!$this->link) { + return ''; + } + return $this->link->getAdminLink('AdminModules', true, [], array_merge(['route' => $routeName], $params)); + } + }; + + return $shim; + } + + public static function generateRouteUrl($module, string $routeName, array $params = []): string + { + try { + $router = self::getRouterCompatible($module); + if (is_object($router) && method_exists($router, 'generate')) { + $url = $router->generate($routeName, $params); + if (is_string($url) && $url !== '') { + return $url; + } + } + } catch (\Throwable $e) { + // ignore and fallback below + } + + $context = $module->context ?? null; + if ($context && $context->link) { + return $context->link->getAdminLink('AdminModules', true, [], array_merge(['route' => $routeName], $params)); + } + + return ''; + } +} diff --git a/modules/dpdshipping/src/Util/ArrayUtil.php b/modules/dpdshipping/src/Util/ArrayUtil.php new file mode 100644 index 00000000..56ef3ad7 --- /dev/null +++ b/modules/dpdshipping/src/Util/ArrayUtil.php @@ -0,0 +1,56 @@ + 'PLN', + 'EUR' => 'EUR', + 'USD' => 'USD', + 'CHF' => 'CHF', + 'SEK' => 'SEK', + 'NOK' => 'NOK', + 'CZK' => 'CZK', + 'RON' => 'RON', + 'HUF' => 'HUF', + 'HRK' => 'HRK', + 'BGN' => 'BGN', + 'DKK' => 'DKK', + 'GBP' => 'GBP', + 'RSD' => 'RSD', + 'RUB' => 'RUB', + 'TRY' => 'TRY', + ]; + } +} diff --git a/modules/dpdshipping/src/Util/ValidateUserUtil.php b/modules/dpdshipping/src/Util/ValidateUserUtil.php new file mode 100644 index 00000000..37606ede --- /dev/null +++ b/modules/dpdshipping/src/Util/ValidateUserUtil.php @@ -0,0 +1,66 @@ +get('token'); + + if (empty($token)) + return false; + + if ($token != sha1(_COOKIE_KEY_ . 'dpdshipping')) + return false; + + + return true; + + } + + public static function validateEmployeeSessionDpdShippingToken(Request $request): bool + { + $token = $request->get('dpdshipping_token'); + + if (empty($token)) + return false; + + if ($token != sha1(_COOKIE_KEY_ . 'dpdshipping')) + return false; + + + return true; + + } +} \ No newline at end of file diff --git a/modules/dpdshipping/src/Util/index.php b/modules/dpdshipping/src/Util/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Util/index.php @@ -0,0 +1,33 @@ +fields as $field) { + if (!empty($value[$field])) { + $isEmpty = false; + break; + } + } + + if ($isEmpty) { + $this->context->buildViolation($constraint->message) + ->setParameter('{{ fields }}', implode(', ', $constraint->fields)) + ->addViolation(); + } + } +} diff --git a/modules/dpdshipping/src/Validator/Constraints/index.php b/modules/dpdshipping/src/Validator/Constraints/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/src/Validator/Constraints/index.php @@ -0,0 +1,33 @@ + + + + + + DPD Poland sp. z o. o. shipping module + DPD Poland sp. z o. o. Moduł Wysyłkowy + Line: + + + DPD Poland shipping + Wysyłki DPD Polska + Line: + + + Pickup order settings + Zamów kuriera + Line: + + + Shipping history + Historia wysyłek + Line: + + + DPD Poland API Connections + Konta API DPD Polska + Line: + + + Unable to generate labels + Błąd generowania etykiety. + Line: + + + Unable to generate protocols + Błąd generowania protokołu. + Line: + + + Success + Operacja wykonana pomyślnie. + Line: + + + Unable to delete shipping + Nie można usunąć przesyłki. + Line: + + + It is not possible to cancel the collection of a courier shipment + Anulowanie zlecenia nie powiodło się. + Line: + + + Please add packages + Proszę dodać paczki. + Line: + + + The package weight must be greater than 0. + Waga paczki musi być większa niż 0. + Line: + + + You must specify at least one of the fields: Sender company, Sender name. + Należy podać przynajmniej jedno z pól: Firma nadawcy, Nazwa nadawcy. + Line: + + + You must specify at least one of the fields: Receiver company, Receiver name. + Należy podać przynajmniej jedno z pól: Firma odbiorcy, Nazwa odbiorcy. + Line: + + + You are editing settings for multiple shops contexts. These settings will be applied to other contexts and may override current values. + Edytujesz ustawienia dla wielu sklepów. Wprowadzone zmiany zostaną zastosowane do wszystkich wybranych sklepów, co może nadpisać ich obecne ustawienia. Aby zmodyfikować ustawienia tylko jednego sklepu, wybierz go z listy. + Line: + + + Shipping details + Szczegóły wysyłki + Line: + + + Order + Zamówienie + Line: + + + Sender Address + Adres Nadawcy + Line: + + + Company + Firma + Line: + + + Sender Name + Nazwa + Line: + + + Address + Address + Line: + + + Phone + Telefon + Line: + + + Receiver Address + Adres Odbiorcy + Line: + + + Services + Usługi + Line: + + + Additional Fields + Pola dodatkowe + Line: + + + Reference 1 + Ref 1 + Line: + + + Reference 2 + Ref 2 + Line: + + + Payer + Płatnik + Line: + + + Payer FID + Numer FID + Line: + + + Tracking + Śledzenie przesyłek + Line: + + + Date and time + Data i czas + Line: + + + State + Status + Line: + + + Content + Zawartosć + Line: + + + Customer data + Uwagi + Line: + + + Size X + Szerokość [cm] + Line: + + + Size Y + Wysokość [cm] + Line: + + + Size Z + Głębokość [cm] + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminAddress.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminAddress.pl-PL.xlf new file mode 100644 index 00000000..5be5d326 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminAddress.pl-PL.xlf @@ -0,0 +1,117 @@ + + + + + + Alias + Alias + Line: + + + Company + Firma + Line: + + + Name + Nazwa + Line: + + + Street + Ulica + Line: + + + Postcode + Kod pocztowy + Line: + + + City + Miejscowość + Line: + + + Country + Kraj + Line: + + + Mail + Mail + Line: + + + Phone + Telefon + Line: + + + Default + Domyślny + Line: + + + Sender addresses + Adresy nadawcy + Line: + + + Shop + Sklep + Line: + + + Actions + Akcje + Line: + + + Edit + Edytuj + Line: + + + Delete + Usuń + Line: + + + Remove selected row? + Czy chcesz usunąć zaznaczony wiersz? + Line: + + + Close + Zamknij + Line: + + + Address + Adresy nadawcy + Line: + + + Save + Zapisz + Line: + + + Add new sender address + Dodaj nowy adres + Line: + + + Add new API connection + Dodaj nowe konto + Line: + + + Add + Dodaj + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminCarrier.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminCarrier.pl-PL.xlf new file mode 100644 index 00000000..3a3ae993 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminCarrier.pl-PL.xlf @@ -0,0 +1,192 @@ + + + + + + DPD Poland + DPD Polska + Line: + + + DPD Poland COD + DPD Polska - pobranie + Line: + + + DPD Poland Swip Box + DPD Polska - Automaty paczkowe + Line: + + + Open late + Otwarte do późna + Line: + + + Open Saturdays + Otwarty w sobotę + Line: + + + Open Sundays + Otwarty w niedziele + Line: + + + Disabled friendly + Ułatwienia dla osób niepełnosprawnych + Line: + + + Parking + Parking + Line: + + + Direct delivery + Bezpośrednia dostawa + Line: + + + Direct delivery COD + Odbiór za pobraniem + Line: + + + Dropoff online + Odbiór online + Line: + + + Dropoff offline + Nadanie za gotówkę + Line: + + + Swap parcel + Zamień paczkę + Line: + + + Fresh + DPD Food + Line: + + + Fitting room + Przymierzalnia + Line: + + + Card payment + Płatność kartą + Line: + + + ROD + ROD + Line: + + + LQ + Materiały niebezpieczne + Line: + + + Digital label + Nadanie bez etykiety + Line: + + + Swip box + Automaty paczkowe + Line: + + + Points with services + Punkty z obsługą + Line: + + + DPD Poland Pickup + DPD Polska - Odbiór w punkcie Pickup + Line: + + + DPD Poland Pickup COD + DPD Polska - Odbiór w punkcie Pickup - pobranie + Line: + + + Carriers + Przewoźnicy + Line: + + + Select an available shipping method for the Create Prestashop carrier. You can manage carriers on the standard prestashop page. + Wybierz dostępne metody wysyłki dla przewoźników Prestashop. Możesz zarządzać przewoźnikami po naciśnięciu przycisku "konfiguruj" + Line: + + + Select a single shop context to manage carriers. + Wybierz jeden sklep z listy, aby zarządzać przewoźnikami. + Line: + + + Available shipping methods + Dostępne metody dostawy + Line: + + + Id + Numer + Line: + + + Id Shop + Id sklepu + Line: + + + Name + Nazwa + Line: + + + Visible + Widoczność + Line: + + + Actions + Akcje + Line: + + + Configure + Konfiguruj + Line: + + + Filters for SwipBox map + Filtry Automaty paczkowe + Line: + + + Filters for Pickup map + Filtry mapy odbioru + Line: + + + COD payment methods + Metody płatności dla przesyłki za pobraniem (COD) + Line: + + + Save + Zapisz + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminConfiguration.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminConfiguration.pl-PL.xlf new file mode 100644 index 00000000..4da2fcd4 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminConfiguration.pl-PL.xlf @@ -0,0 +1,107 @@ + + + + + + ERROR + ERROR + Line: + + + INFO + INFO + Line: + + + DEBUG + DEBUG + Line: + + + Log level + Poziom logowania + Line: + + + Standard Prestashop Checkout + Domyślny koszyk Prestashop + Line: + + + Supercheckout + Supercheckout + Line: + + + Easycheckout + Easycheckout + Line: + + + One Page Checkout - PrestaTeam - Prestashop 1.7 + One Page Checkout - PrestaTeam - Prestashop 1.7 + Line: + + + One Page Checkout - PrestaTeam - Prestashop 8 + One Page Checkout - PrestaTeam - Prestashop 8 + Line: + + + The Checkout - PrestaSmart + The Checkout - PrestaSmart + Line: + + + One Page Checkout - PrestaSmart + One Page Checkout - PrestaSmart + Line: + + + Custom checkout + Niestandardowy koszyk + Line: + + + Yes + Tak + Line: + + + No + Nie + Line: + + + Send mail when shipping is generated + Wyślij mail po wygenerowaniu wysyłki + Line: + + + Check shipment tracking on the order view page + Sprawdź śledzenie przesyłki na stronie widoku zamówienia + Line: + + + Integration with Empik marketplace + Integracja z Empik + Line: + + + API account for Empik Store delivery + Konto API DPD Polska dla Empik + Line: + + + Configuration + Konfiguracja + Line: + + + Save + Zapisz + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminConnection.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminConnection.pl-PL.xlf new file mode 100644 index 00000000..0a6d9e5c --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminConnection.pl-PL.xlf @@ -0,0 +1,112 @@ + + + + + + Select connection + Wybierz konto API + Line: + + + Select payer + Wybierz płatnika + Line: + + + Name + Nazwa + Line: + + + Login + Login + Line: + + + Password + Hasło + Line: + + + Master FID + Numer płatnika (MASTERFID) + Line: + + + DPD Poland API Connection + Konto API DPD Polska + Line: + + + Shop + Sklep + Line: + + + Masterfid + MasterFID + Line: + + + Environment + Środowisko + Line: + + + Default + Domyślny + Line: + + + Actions + Akcje + Line: + + + Edit + Edytuj + Line: + + + Delete + Usuń + Line: + + + Remove selected row? + Czy chcesz usunąć zaznaczone wiersze? + Line: + + + Close + Zamknij + Line: + + + Connection with DPD Poland + Połączenie z API DPD Polska + Line: + + + Payer data + Dane płatnika + Line: + + + FID number + Nazwa płatnika + Line: + + + FID name + Numer płatnika (FID) + Line: + + + Save + Zapisz + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminNav.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminNav.pl-PL.xlf new file mode 100644 index 00000000..41d14863 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminNav.pl-PL.xlf @@ -0,0 +1,67 @@ + + + + + + DPD Poland + DPD Polska + Line: + + + Shipping history + Historia wysyłek + Line: + + + Pickup courier + Zamów kuriera + Line: + + + Configuration + Konfiguracja + Line: + + + Connection with DPD Poland + Połączenie z API DPD Polska + Line: + + + Sender addresses + Adresy nadawcy + Line: + + + Carriers + Przewoźnicy + Line: + + + Special prices + Ceny specjalne + Line: + + + Default parameters + Parametry domyślne + Line: + + + Settings + Ustawienia + Line: + + + Pickup courier settings + Zamów kuriera + Line: + + + Onboarding + Pierwsze uruchomienie + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminOnboarding.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminOnboarding.pl-PL.xlf new file mode 100644 index 00000000..04122ce4 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminOnboarding.pl-PL.xlf @@ -0,0 +1,157 @@ + + + + + + DPD Poland Production + DPD Polska - środowisko Produkcyjne + Line: + + + DPD Poland DEMO + DPD Polska - środowisko DEMO + Line: + + + Environment + Środowisko + Line: + + + Default + Domyślny + Line: + + + Login + Login + Line: + + + Password + Hasło + Line: + + + Master FID + Master FID + Line: + + + Default FID + Domyślny numer FID + Line: + + + Carrier DPD Poland Swip Box + DPD Polska - Automaty paczkowe + Line: + + + Carrier DPD Poland Pickup + DPD Polska - Odbiór w punkcie + Line: + + + Carrier DPD Poland Pickup COD + DPD Polska - Odbiór w punkcie - pobranie + Line: + + + Carrier DPD Poland + DPD Polska + Line: + + + Carrier DPD Poland COD + DPD Polska - pobranie + Line: + + + Alias + Alias + Line: + + + Company + Firma + Line: + + + Name + Nazwa + Line: + + + Street + Ulica + Line: + + + Postcode + Kod pocztowy + Line: + + + City + Miasto + Line: + + + Country + Kraj + Line: + + + Mail + Mail + Line: + + + Phone + Telefon + Line: + + + Onboarding + Pierwsze uruchomienie + Line: + + + DPD Poland API connections + Połączenie z API DPD Polska + Line: + + + Configure DPD Poland API connection + Konfiguruj połączenie z API DPD Polska + Line: + + + Carriers + Przewoźnicy + Line: + + + Select available shipping method. + Wybierz dostępne metody wysyłki + Line: + + + Sender address + Adres Nadawcy + Line: + + + Configure default Sender address + Konfiguruj domyślny adres nadawcy + Line: + + + Save + Zapisz + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminOrder.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminOrder.pl-PL.xlf new file mode 100644 index 00000000..34529397 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminOrder.pl-PL.xlf @@ -0,0 +1,496 @@ + + + + + + Company name: + Firma: + Line: + + + Enter company... + Wpisz firmę... + Line: + + + Name: + Nazwa: + Line: + + + Enter name... + Wpisz imię i nazwisko... + Line: + + + Street: + Ulica: + Line: + + + Enter street... + Wpisz ulicę... + Line: + + + Postcode: + Kod pocztowy: + Line: + + + Enter postcode... + Wpisz kod pocztowy... + Line: + + + City: + Miejscowość: + Line: + + + Enter city... + Wpisz miejscowość: + Line: + + + Country: + Kraj: + Line: + + + Enter country... + Wpisz kod kraju np. PL... + Line: + + + Phone: + Numer telefonu: + Line: + + + Enter phone... + Wpisz numer telefonu... + Line: + + + Email: + Email: + Line: + + + Enter email... + Wpisz adres email... + Line: + + + Receiver company name: + Firma: + Line: + + + Receiver name: + Nazwa: + Line: + + + Receiver street: + Ulica: + Line: + + + Receiver postcode: + Kod pocztowy: + Line: + + + Receiver city: + Miejscowość: + Line: + + + Receiver country: + Kraj: + Line: + + + Receiver phone: + Numer telefonu: + Line: + + + Receiver email: + Email: + Line: + + + Ref1: + Ref1: + Line: + + + Ref2: + Ref2: + Line: + + + Service guarantee + Doręczenia gwarantowane + Line: + + + DPD on hour + Doręczenie na godzinę + Line: + + + Saturday + Sobota + Line: + + + DPD NEXTDAY + DPD Nextday + Line: + + + DPD TODAY + DPD Today + Line: + + + Guarantee international + Gwarant międzynarodowy + Line: + + + B2C + B2C + Line: + + + HH:MM + HH:MM + Line: + + + Service in pers + Doręczenie do rąk własnych + Line: + + + Service priv pers + Doręczenie na adres prywatny + Line: + + + Service COD + Pobranie COD + Line: + + + Enter value... + Wpisz wartość... + Line: + + + Service self con + Odbiór własny + Line: + + + Company + Firma + Line: + + + Private + Prywatny + Line: + + + Service DPD Pickup + Punkt odbioru DPD Pickup + Line: + + + Open map + Wybierz + Line: + + + Service rod + Dokumenty zwrotne + Line: + + + Service dox + DOX + Line: + + + Service cud + Przesyłka zwrotna + Line: + + + Service Tires + Opony + Line: + + + Service Declared value + Dodatkowa ochrona ubezpieczeniowa + Line: + + + Service DPD Express + DPD Express + Line: + + + Service DPD Food + DPD FOOD + Line: + + + Service duty + Odprawa celna + Line: + + + Service ADR + LQ + Line: + + + Service return label + Etykieta zwrotna + Line: + + + To enable tracking for shipments, please visit the DPD Poland configuration page. + Aby włączyć śledzenie przesyłek, odwiedź stronę konfiguracyjną modułu DPD Polska. + Line: + + + No shipments + Brak przesyłek + Line: + + + No data + Brak danych + Line: + + + Date and time + Data i czas + Line: + + + State + Status + Line: + + + DPD Poland generate shipping + DPD Polska - generuj wysyłkę + Line: + + + New shipping + Nowa wysyłka + Line: + + + Print label + Drukuj etykietę + Line: + + + Print return label + Drukuj etykietę zwrotną + Line: + + + Carrier: + Metoda dostawy: + Line: + + + The shipping method is different from DPD Poland, but you can still send it with DPD! + Sposób wysyłki różni się od DPD Polska, ale nadal możesz wysłać go za pomocą DPD! + Line: + + + Payment: + Płatność: + Line: + + + Source: + Źródło: + Line: + + + Delivery to the EMPIK store + Dostawa do Salonu Empik + Line: + + + EMPIK marketplace + Empik + Line: + + + The selected payment method is COD. You should check the COD service! + Wybraną metodą płatności zamówienia jest COD. Powinieneś sprawdzić usługę COD! + Line: + + + Sender address + Adres Nadawcy + Line: + + + Receiver address + Adres Odbiorcy + Line: + + + Services + Usługi + Line: + + + Single Shipping + Jedna wysyłka + Line: + + + Shipping for products group + Wysyłka dla każdego produktu + Line: + + + Shipping for each product + Przesyłka dla każdego produktu + Line: + + + Custom + Niestandardowy + Line: + + + Weight [kg] + Waga [kg] + Line: + + + Weight ADR [kg] + Waga ADR [kg] + Line: + + + Content + Zawartość + Line: + + + Customer Data + Uwagi + Line: + + + Size X [cm] + Długość [cm] + Line: + + + Size Y [cm] + Wysokość [cm] + Line: + + + Size Z [cm] + Głębokość [cm] + Line: + + + Add row + Dodaj + Line: + + + Warning! You are generating a shipment to Empik without the DPD Pickup Point service. + Uwaga! Generujesz wysyłkę do Empik bez usługi Punkt odbioru DPD Pickup. + Line: + + + Save + Zapisz + Line: + + + DPD Poland custom shipping + DPD Polska wysyłka niestandardowa + Line: + + + Packages + Przesyłki + Line: + + + Change + Zmień + Line: + + + Product + Produkt + Line: + + + Package + Przesyłka + Line: + + + Summary + Podsumowanie + Line: + + + Package number + Numer wysyłki + Line: + + + Customer data + Uwagi + Line: + + + Products weight + Waga produktów + Line: + + + Close + Zamknij + Line: + + + DPD Shipping history + DPD Polska - Historia wysyłek + Line: + + + Generate shipping + Generuj wysyłkę + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminParameter.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminParameter.pl-PL.xlf new file mode 100644 index 00000000..4d61735d --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminParameter.pl-PL.xlf @@ -0,0 +1,157 @@ + + + + + + Order number + Numer zamówienia + Line: + + + Order number Empik + Numer zamówienia Empik + Line: + + + Order ID + ID zamówienia + Line: + + + Invoice number + Numer faktury + Line: + + + Static value + stała wartość pola + Line: + + + Static value for Empik orders + Wartość stała dla zamówień Empik + Line: + + + Ref 1 + Ref 1 + Line: + + + Ref 1 - static value + Ref 1 - stała wartość pola + Line: + + + Ref 2 + Ref 2 + Line: + + + Ref 2 - static value + Ref 2 - stała wartość pola + Line: + + + Product index + Indeks produktu + Line: + + + Product name + Nazwa produktu + Line: + + + Customer data + Uwagi + Line: + + + Customer data - static value + Uwagi - stała wartość pola + Line: + + + Content + Zawartość + Line: + + + Content - static value + Zawartość - stała wartość pola + Line: + + + Single shipping + Jedna wysyłka + Line: + + + Shipping for products group + Przesyłka dla grupy produktów + Line: + + + Shipping for each product + Przesyłka dla każdego produktu + Line: + + + Method of Package Grouping + Metoda grupowania przesyłek + Line: + + + Weight [kg] + Waga [kg] + Line: + + + A4 + A4 + Line: + + + Label + Etykieciarka + Line: + + + Print format + Format wydruku + Line: + + + Standard label + Etykieta standardowa + Line: + + + RUCH label + Etykieta RUCH + Line: + + + APOLLO label + Etykieta APOLLO + Line: + + + Label type + Typ etykiety + Line: + + + Default parameters + Parametry domyślne + Line: + + + Save + Zapisz + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminPickupCourier.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminPickupCourier.pl-PL.xlf new file mode 100644 index 00000000..4c1639db --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminPickupCourier.pl-PL.xlf @@ -0,0 +1,227 @@ + + + + + + Customer company + Firma Klienta + Line: + + + Customer Name + Imię i nazwisko Klienta + Line: + + + Customer Phone number + Numer telefonu Klienta + Line: + + + Payer number + Numer płatnika (FID) + Line: + + + Sender company + Firma Nadawcy + Line: + + + Sender name + Imię i nazwisko Nadawcy + Line: + + + Sender address + Adres Nadawcy + Line: + + + Sender city + Miejscowość Nadawcy + Line: + + + Sender phone + Numer telefonu Nadawcy + Line: + + + Sender postal code + Kod pocztowy Nadawcy + Line: + + + Sender country code + Kod kraju Nadawcy + Line: + + + Company name + Firma + Line: + + + Name + Nazwa + Line: + + + Phone number + Telefon + Line: + + + Pickup date + Data odbioru + Line: + + + Letters + Koperty + Line: + + + Packages + Paczki + Line: + + + Weight sum [kg] + Suma wag [kg] + Line: + + + Weight max [kg] + Maksymalna waga [kg] + Line: + + + Size X max [cm] + Maksymalna szerokość [cm] + Line: + + + Size Y max [cm] + Maksymalna wysokość [cm] + Line: + + + Size Z max [cm] + Maksymalna głębokość [cm] + Line: + + + Palette + Palety + Line: + + + Pickup Courier + Zamów kuriera + Line: + + + State + Status + Line: + + + Order number + Numer zamówienia + Line: + + + Letter + Koperty + Line: + + + Pickup time + Czas odbioru + Line: + + + Actions + Akcje + Line: + + + Reject + Anuluj + Line: + + + Cancel selected pickup courier? + Czy na pewno chcesz usunąć zlecenie? + Line: + + + Cancel + Anuluj zamówienie + Line: + + + Close + Zamknij + Line: + + + HH:MM + HH:MM + Line: + + + Refresh list + Odśwież listę + Line: + + + Pickup courier settings + Zamów kuriera + Line: + + + Save + Zapisz + Line: + + + Pickup courier + Zamów kuriera + Line: + + + Payer number: + Numer płatnika: + Line: + + + Pickup date and time + Data i czas odbioru + Line: + + + Get pickup time frames + Pobierz dostępne godziny podjazdu dla wskazanej daty + Line: + + + Date available until + Zlecenie zamówienia możliwe do: + Line: + + + on + dnia + Line: + + + Shipping + Wysyłka + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminPickupCourierSettings.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminPickupCourierSettings.pl-PL.xlf new file mode 100644 index 00000000..7ba1f6ee --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminPickupCourierSettings.pl-PL.xlf @@ -0,0 +1,77 @@ + + + + + + Pickup order settings + Zamów kuriera + Line: + + + Shop + Sklep + Line: + + + Customer company + Firma Klienta + Line: + + + Customer name + Imię i nazwisko Klienta + Line: + + + Customer phone + Numer telefonu Klienta + Line: + + + Payer number + Numer płatnika (FID) + Line: + + + Sender company + Firma Nadawcy + Line: + + + Sender name + Imię i nazwisko Nadawcy + Line: + + + Sender address + Adres Nadawcy + Line: + + + Actions + Akcje + Line: + + + Edit + Edytuj + Line: + + + Delete + Usuń + Line: + + + Remove selected row? + Usunąć zaznaczony wiersz? + Line: + + + Close + Zamknij + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminShippingHistory.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminShippingHistory.pl-PL.xlf new file mode 100644 index 00000000..8fe4946a --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminShippingHistory.pl-PL.xlf @@ -0,0 +1,132 @@ + + + + + + Shippings + Wysyłki + Line: + + + Order number + Nr zamówienia + Line: + + + Shipping number + Numer wysyłki + Line: + + + Sender address + Adres Nadawcy + Line: + + + Receiver address + Adres Odbiorcy + Line: + + + Carrier + Przewoźnicy + Line: + + + Ref 1 + Ref 1 + Line: + + + Ref 2 + Ref 2 + Line: + + + Services + Usługi + Line: + + + Label Datetime + Data wygenerowania etykiety + Line: + + + Protocol Datetime + Data wygenerowania protokołu + Line: + + + Delivered + Dostarczono + Line: + + + Yes + Tak + Line: + + + No + Nie + Line: + + + Shipping date + Data wysyłki + Line: + + + Actions + Akcje + Line: + + + Delete + Usuń + Line: + + + Remove selected row? + Czy chcesz usunąć zaznaczone rekordy? + Line: + + + Close + Zamknij + Line: + + + Print protocol + Drukuj protokół + Line: + + + Print label + Drukuj etykietę + Line: + + + ID Order + Nr zamówienia + Line: + + + Refresh list + Odśwież listę + Line: + + + Print labels + Drukuj etykiety + Line: + + + Print protocols + Drukuj protokoły + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminSpecialPrice.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminSpecialPrice.pl-PL.xlf new file mode 100644 index 00000000..c8eb556a --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingAdminSpecialPrice.pl-PL.xlf @@ -0,0 +1,117 @@ + + + + + + Special price enabled + Włącz cennik specjalny + Line: + + + Special prices + Ceny specjalne + Line: + + + from + z + Line: + + + Country + Kraj + Line: + + + Cart price from (PLN) + Cena koszyka od (PLN) + Line: + + + Cart price up to (PLN) + Cena koszyka do (PLN) + Line: + + + Package weight from (kg) + Waga paczki od (kg) + Line: + + + Package weight up to (kg) + Waga paczki do (kg) + Line: + + + Price per package (PLN) + Cena za paczkę (PLN) + Line: + + + Delivery method + Sposób dostawy + Line: + + + Price for COD service (PLN) + Cena za usługę COD (PLN) + Line: + + + Action + Akcje + Line: + + + Save + Zapisz + Line: + + + Special price configuration + Konfiguracja cen specjalnych + Line: + + + Export Data + Exportuj + Line: + + + Click the button below to export your special price configuration data as a CSV file. + Kliknij przycisk poniżej, aby wyeksportować dane konfiguracji cen specjalnych jako plik CSV. + Line: + + + Export to CSV + Export do CSV + Line: + + + Import Data + Importuj + Line: + + + Choose a CSV file to upload and update your special price configuration data. + Wybierz plik CSV, aby przesłać i zaktualizować dane konfiguracji cen specjalnych. + Line: + + + Choose File + Wybierz plik + Line: + + + No file chosen + Nie wybrano pliku + Line: + + + Import CSV + Import z CSV + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingBulk.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingBulk.pl-PL.xlf new file mode 100644 index 00000000..3cf8331c --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingBulk.pl-PL.xlf @@ -0,0 +1,22 @@ + + + + + + DPD Poland - generate shipping + DPD Polska - generuj przesyłki + Line: + + + DPD Poland - generate labels + DPD Polska - generuj etykiety dla wygenerowanych przesyłek + Line: + + + DPD Poland - generate shipping and labels + DPD Polska - generuj przesyłki i etykiety + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingButton.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingButton.pl-PL.xlf new file mode 100644 index 00000000..016bc813 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingButton.pl-PL.xlf @@ -0,0 +1,12 @@ + + + + + + Add row + Dodaj + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingCarrier.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingCarrier.pl-PL.xlf new file mode 100644 index 00000000..3a1d54e3 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingCarrier.pl-PL.xlf @@ -0,0 +1,32 @@ + + + + + + DPD Poland - Swip Box + DPD Polska - Automaty paczkowe + Line: + + + DPD Poland - Pickup + DPD Polska - Odbiór w Punkcie Pickup + Line: + + + DPD Poland - Pickup COD + DPD Polska - Odbiór w Punkcie Pickup za pobraniem + Line: + + + DPD Poland + Kurier DPD Polska + Line: + + + DPD Poland - COD + Kurier DPD Polska - pobranie + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingCheckout.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingCheckout.pl-PL.xlf new file mode 100644 index 00000000..4a851b14 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingCheckout.pl-PL.xlf @@ -0,0 +1,42 @@ + + + + + + Error occured. Please try again + Wystąpił błąd. Proszę spróbuj ponownie. + Line: + + + DPD pickup point: + Punkt odbioru DPD Pickup: + Line: + + + Select from map + Wybierz z mapy + Line: + + + Selected DPD pickup point: + Wybrany punkt odbioru DPD Pickup: + Line: + + + Change + Zmień punkt odbioru + Line: + + + Close + Zamknij + Line: + + + Selected point does not provide the cod service + Wybrany punkt nie świadczy usługi pobrania + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingDpdshipping.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingDpdshipping.pl-PL.xlf new file mode 100644 index 00000000..a0801f03 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingDpdshipping.pl-PL.xlf @@ -0,0 +1,17 @@ + + + + + + 09:30 + 09:30 + Line: + + + 12:00 + 12:00 + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingPickupCourier.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingPickupCourier.pl-PL.xlf new file mode 100644 index 00000000..de63df47 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingPickupCourier.pl-PL.xlf @@ -0,0 +1,52 @@ + + + + + + Please complete the customer details. + Proszę uzupełnić szczegóły Zleceniodawcy. + Line: + + + Please complete the sender details. + Proszę uzupełnić szczegóły nadawcy w konfiguracji modułu. + Line: + + + Please complete the payer details. + Proszę uzupełnić szczegóły płatnika w konfiguracji modułu. + Line: + + + Please complete pickup date and time range details. + Proszę uzupełnić datę i zakres czasu podjazdu. + Line: + + + Please complete parcels details. + Proszę wybrać rodzaj przesyłki. + Line: + + + Please complete letters details. + Proszę uzupełnić wszystkie szczegóły listu. + Line: + + + Please complete all packages details. + Proszę uzupełnić wszystkie szczegóły paczki. + Line: + + + Please complete all palette details. + Proszę uzupełnić wszystkie szczegóły palety. + Line: + + + Please complete the configuration in the module settings before ordering a courier + Zamów kuriera]]> + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingPickupCourierGrid.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingPickupCourierGrid.pl-PL.xlf new file mode 100644 index 00000000..8caf930e --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingPickupCourierGrid.pl-PL.xlf @@ -0,0 +1,22 @@ + + + + + + Completed + Zrealizowane + Line: + + + Canceled + Anulowane + Line: + + + Ordered + Oczekuje na odbiór + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingReturnLabel.pl-PL.xlf b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingReturnLabel.pl-PL.xlf new file mode 100644 index 00000000..058cc878 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/ModulesDpdshippingReturnLabel.pl-PL.xlf @@ -0,0 +1,27 @@ + + + + + + The return label has been generated. + Etykieta zwrotna została wygenerowana. + Line: + + + The return label cannot be generated. + Nie można wygenerować etykiety zwrotnej. + Line: + + + The label has been generated. + Etykieta została wygenerowana. + Line: + + + The label cannot be generated. + Nie można wygenerować etykiety. + Line: + + + + diff --git a/modules/dpdshipping/translations/pl-PL/index.php b/modules/dpdshipping/translations/pl-PL/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/translations/pl-PL/index.php @@ -0,0 +1,33 @@ +execute( + 'ALTER TABLE ' . _DB_PREFIX_ . 'dpdshipping_shipping_history_parcel MODIFY COLUMN content VARCHAR(500) NULL'); + + $alterCustomerData = Db::getInstance()->execute( + 'ALTER TABLE ' . _DB_PREFIX_ . 'dpdshipping_shipping_history_parcel MODIFY COLUMN customer_data VARCHAR(500) NULL'); + + return $alterContent && $alterCustomerData; +} diff --git a/modules/dpdshipping/upgrade/Upgrade-1.6.0.php b/modules/dpdshipping/upgrade/Upgrade-1.6.0.php new file mode 100644 index 00000000..7fae8fc3 --- /dev/null +++ b/modules/dpdshipping/upgrade/Upgrade-1.6.0.php @@ -0,0 +1,40 @@ +execute(DatabaseInstaller::getDpdshippingConnectionCreateTable()); + + $alterPayer = $db->execute( + 'ALTER TABLE ' . _DB_PREFIX_ . 'dpdshipping_payer ADD COLUMN id_connection int(11) NULL AFTER id_shop;'); + + return $createConnectionTable && $alterPayer; +} \ No newline at end of file diff --git a/modules/dpdshipping/upgrade/Upgrade-1.6.3.php b/modules/dpdshipping/upgrade/Upgrade-1.6.3.php new file mode 100644 index 00000000..7593bc0b --- /dev/null +++ b/modules/dpdshipping/upgrade/Upgrade-1.6.3.php @@ -0,0 +1,77 @@ +execute($q)) { + if (strpos($db->getMsgError(), 'Duplicate') === false + && strpos($db->getMsgError(), 'already exists') === false) { + return false; + } + } + } + + return true; +} + diff --git a/modules/dpdshipping/upgrade/Upgrade-1.6.5.php b/modules/dpdshipping/upgrade/Upgrade-1.6.5.php new file mode 100644 index 00000000..56c75679 --- /dev/null +++ b/modules/dpdshipping/upgrade/Upgrade-1.6.5.php @@ -0,0 +1,34 @@ +execute( + 'ALTER TABLE ' . _DB_PREFIX_ . 'dpdshipping_shipping_history ADD COLUMN id_connection int(11) NULL'); + +} diff --git a/modules/dpdshipping/upgrade/index.php b/modules/dpdshipping/upgrade/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/upgrade/index.php @@ -0,0 +1,33 @@ + + Order deny,allow + Deny from all + + +# Apache 2.4 + + Require all denied + diff --git a/modules/dpdshipping/vendor/autoload.php b/modules/dpdshipping/vendor/autoload.php new file mode 100644 index 00000000..99b569de --- /dev/null +++ b/modules/dpdshipping/vendor/autoload.php @@ -0,0 +1,22 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + + // PSR-4 + /** + * @var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var list + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ + private $prefixesPsr0 = array(); + /** + * @var list + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var array + */ + private $missingClasses = array(); + + /** @var string|null */ + private $apcuPrefix; + + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return list + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return list + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return array Array of classname => path + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + $paths = (array) $paths; + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + $includeFile = self::$includeFile; + $includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } + + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } +} diff --git a/modules/dpdshipping/vendor/composer/InstalledVersions.php b/modules/dpdshipping/vendor/composer/InstalledVersions.php new file mode 100644 index 00000000..2052022f --- /dev/null +++ b/modules/dpdshipping/vendor/composer/InstalledVersions.php @@ -0,0 +1,396 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to + * @internal + */ + private static $selfDir = null; + + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool + */ + private static $installedIsLocalDir; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + + // when using reload, we disable the duplicate protection to ensure that self::$installed data is + // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, + // so we have to assume it does not, and that may result in duplicate data being returned when listing + // all installed packages for example + self::$installedIsLocalDir = false; + } + + /** + * @return string + */ + private static function getSelfDir() + { + if (self::$selfDir === null) { + self::$selfDir = strtr(__DIR__, '\\', '/'); + } + + return self::$selfDir; + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + $copiedLocalDir = false; + + if (self::$canGetVendors) { + $selfDir = self::getSelfDir(); + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + $vendorDir = strtr($vendorDir, '\\', '/'); + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + self::$installedByVendor[$vendorDir] = $required; + $installed[] = $required; + if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { + self::$installed = $required; + self::$installedIsLocalDir = true; + } + } + if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { + $copiedLocalDir = true; + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array() && !$copiedLocalDir) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/modules/dpdshipping/vendor/composer/LICENSE b/modules/dpdshipping/vendor/composer/LICENSE new file mode 100644 index 00000000..f27399a0 --- /dev/null +++ b/modules/dpdshipping/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/modules/dpdshipping/vendor/composer/autoload_classmap.php b/modules/dpdshipping/vendor/composer/autoload_classmap.php new file mode 100644 index 00000000..0fb0a2c1 --- /dev/null +++ b/modules/dpdshipping/vendor/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/modules/dpdshipping/vendor/composer/autoload_namespaces.php b/modules/dpdshipping/vendor/composer/autoload_namespaces.php new file mode 100644 index 00000000..15a2ff3a --- /dev/null +++ b/modules/dpdshipping/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($baseDir . '/src'), +); diff --git a/modules/dpdshipping/vendor/composer/autoload_real.php b/modules/dpdshipping/vendor/composer/autoload_real.php new file mode 100644 index 00000000..d7e226fe --- /dev/null +++ b/modules/dpdshipping/vendor/composer/autoload_real.php @@ -0,0 +1,38 @@ +register(false); + + return $loader; + } +} diff --git a/modules/dpdshipping/vendor/composer/autoload_static.php b/modules/dpdshipping/vendor/composer/autoload_static.php new file mode 100644 index 00000000..af3fc389 --- /dev/null +++ b/modules/dpdshipping/vendor/composer/autoload_static.php @@ -0,0 +1,36 @@ + + array ( + 'DpdShipping\\' => 12, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'DpdShipping\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit427332ba9bda24dc56ebb379caf743c6::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit427332ba9bda24dc56ebb379caf743c6::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit427332ba9bda24dc56ebb379caf743c6::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/modules/dpdshipping/vendor/composer/installed.json b/modules/dpdshipping/vendor/composer/installed.json new file mode 100644 index 00000000..f20a6c47 --- /dev/null +++ b/modules/dpdshipping/vendor/composer/installed.json @@ -0,0 +1,5 @@ +{ + "packages": [], + "dev": false, + "dev-package-names": [] +} diff --git a/modules/dpdshipping/vendor/composer/installed.php b/modules/dpdshipping/vendor/composer/installed.php new file mode 100644 index 00000000..e7b86011 --- /dev/null +++ b/modules/dpdshipping/vendor/composer/installed.php @@ -0,0 +1,23 @@ + array( + 'name' => 'dpdpoland/dpdshipping', + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => false, + ), + 'versions' => array( + 'dpdpoland/dpdshipping' => array( + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/modules/dpdshipping/vendor/composer/platform_check.php b/modules/dpdshipping/vendor/composer/platform_check.php new file mode 100644 index 00000000..6cd6b536 --- /dev/null +++ b/modules/dpdshipping/vendor/composer/platform_check.php @@ -0,0 +1,25 @@ += 70200)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + throw new \RuntimeException( + 'Composer detected issues in your platform: ' . implode(' ', $issues) + ); +} diff --git a/modules/dpdshipping/views/css/admin/index.php b/modules/dpdshipping/views/css/admin/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/views/css/admin/index.php @@ -0,0 +1,33 @@ + { + + $(document).on('click', '#addFidRow', function () { + const packagesTable = document.getElementById('fidTable'); + const tbody = packagesTable.getElementsByTagName('tbody')[0]; + addFidRow(tbody.rows.length); + }); + + $(document).on('click', '.dpdshipping-remove-row', function () { + $(this).closest('tr').remove(); + }); + + function addFidRow(index) { + const rowTemplate = ` + + + + + delete + + `; + const packagesTable = document.getElementById('fidTable'); + const tbody = packagesTable.getElementsByTagName('tbody')[0]; + + tbody.appendChild(createRow()); + + function createRow(row) { + const newRow = document.createElement('tr'); + newRow.innerHTML = rowTemplate; + return newRow; + } + } +}); diff --git a/modules/dpdshipping/views/js/configuration/index.php b/modules/dpdshipping/views/js/configuration/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/views/js/configuration/index.php @@ -0,0 +1,33 @@ + { + function handleSelectChange() { + const selectedValue = $(this).val(); + const parentContainer = $(this).closest('.row'); + if (selectedValue === 'STATIC_VALUE' || selectedValue === 'STATIC_VALUE_ONLY_FOR_EMPIK') { + parentContainer.find('.input-static-value').removeClass('d-none').addClass('d-block'); + } else { + parentContainer.find('.input-static-value').removeClass('d-block').addClass('d-none'); + } + } + + $('.select-with-static-value').each(handleSelectChange); + $(document).on('change', '.select-with-static-value', handleSelectChange); + + function handlePrintFormat() { + const selectedValue = $('#form_printFormat').val(); + + if (selectedValue === 'LBL_PRINTER') { + $('#form_labelType').removeAttr('disabled'); + } else { + $('#form_labelType').prop('selectedIndex', 0); + $('#form_labelType').attr('disabled', 'disabled'); + } + } + handlePrintFormat(); + $(document).on('change', '#form_printFormat', handlePrintFormat); + +}); \ No newline at end of file diff --git a/modules/dpdshipping/views/js/configuration/pickup-courier-settings-grid.js b/modules/dpdshipping/views/js/configuration/pickup-courier-settings-grid.js new file mode 100644 index 00000000..9812a155 --- /dev/null +++ b/modules/dpdshipping/views/js/configuration/pickup-courier-settings-grid.js @@ -0,0 +1,42 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + window.prestashop.component.initComponents( + [ + 'Grid' + ], + ); + const grid = new window.prestashop.component.Grid('dpdshipping_pickup_courier_settings'); + grid.addExtension(new window.prestashop.component.GridExtensions.BulkActionCheckboxExtension()); + // grid.addExtension(new window.prestashop.component.GridExtensions.ExportToSqlManagerExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.ReloadListExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.SubmitBulkActionExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.AjaxBulkActionExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.FiltersSubmitButtonEnablerExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.AsyncToggleColumnExtension()); + grid.addExtension(new window.prestashop.component.GridExtensions.PositionExtension(grid)); +}); diff --git a/modules/dpdshipping/views/js/configuration/special-price-data.js b/modules/dpdshipping/views/js/configuration/special-price-data.js new file mode 100644 index 00000000..f3abb9e3 --- /dev/null +++ b/modules/dpdshipping/views/js/configuration/special-price-data.js @@ -0,0 +1,222 @@ +/* + * Copyright 2025 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(() => { + const $importFileInput = $('#dpdSpecialPriceImportFile'); + const $selectedFileName = $('#selectedFileName'); + const $exportButton = $('#dpdSpecialPriceExportButton'); + const $importButton = $('#dpdSpecialPriceImportFileButton'); + + $importFileInput.on('change', function () { + const fileName = $(this).val().split('\\').pop(); + $selectedFileName.text(fileName ? fileName : 'No file chosen'); + }); + + $exportButton.on('click', function (e) { + e.preventDefault(); + $.ajax({ + url: dpdshipping_special_price_export_ajax_url, + method: 'GET', + data: { + dpdshipping_token: dpdshipping_token + }, + xhrFields: { + responseType: 'blob', + }, + success: function (data) { + const url = window.URL.createObjectURL(data); + const a = $('', { + href: url, + download: 'export-dpd-ceny-specjalne-prestashop.csv', + }).appendTo('body'); + a[0].click(); + window.URL.revokeObjectURL(url); + a.remove(); + }, + error: function () { + alert('Error exporting the file.'); + }, + }); + }); + + $importButton.on('click', function (e) { + e.preventDefault(); + const file = $importFileInput[0].files[0]; + if (file) { + const formData = new FormData(); + formData.append('csvFile', file); + formData.append('dpdshipping_token', dpdshipping_token); + + $.ajax({ + url: dpdshipping_special_price_import_ajax_url, + method: 'POST', + data: formData, + processData: false, + contentType: false, + success: function (response) { + if (response.success) { + location.reload(); + } else { + alert('Import failed: ' + response.message); + } + }, + error: function () { + alert('Error importing the file.'); + }, + }); + } else { + alert('Please select a file first.'); + } + }); + + const rowsPerPage = 50; + + function showPage(page) { + + const $tbody = $('#specialPriceTable').find('tbody'); + const $rows = $tbody.find('tr'); + const totalRows = $rows.length; + const totalPages = Math.ceil(totalRows / rowsPerPage); + + if (page < 1) page = 1; + if (page > totalPages) page = totalPages; + + $rows.hide(); + + const start = (page - 1) * rowsPerPage; + const end = start + rowsPerPage; + + $rows.slice(start, end).show(); + + $('.pagination-button').removeClass('active'); + $(`.pagination-button[data-page='${page}']`).addClass('active'); + + updatePaginationInfo(page, totalPages, rowsPerPage, totalRows); + } + + function updatePaginationInfo(page, totalPages, rowsPerPage, totalRows) { + const startRow = (page - 1) * rowsPerPage + 1; + let endRow = page * rowsPerPage; + if (endRow > totalRows) endRow = totalRows; + + $('#pagination-info-rows-from').text(startRow); + $('#pagination-info-rows-to').text(endRow); + $('#pagination-info-pages').text(totalRows); + } + + function createPagination() { + const $pagination = $('#dpdSpecialPricePagination'); + $pagination.empty(); + + const $tbody = $('#specialPriceTable').find('tbody'); + const $rows = $tbody.find('tr'); + const totalRows = $rows.length; + const totalPages = Math.ceil(totalRows / rowsPerPage); + + const $prev = $('Prev'); + if (currentPage === 1) { + $prev.addClass('disabled'); + } + $pagination.append($prev); + + let startPage = Math.max(1, currentPage - 2); + let endPage = Math.min(totalPages, currentPage + 2); + + if (currentPage <= 3) { + endPage = Math.min(5, totalPages); + } + if (currentPage >= totalPages - 2) { + startPage = Math.max(totalPages - 4, 1); + } + + if (startPage > 1) { + const $first = $(`1`); + $pagination.append($first); + if (startPage > 2) { + $pagination.append('...'); + } + } + + for (let i = startPage; i <= endPage; i++) { + const $btn = $(`${i}`); + if (i === currentPage) $btn.addClass('active'); + $pagination.append($btn); + } + + if (endPage < totalPages) { + if (endPage < totalPages - 1) { + $pagination.append('...'); + } + const $last = $(`${totalPages}`); + $pagination.append($last); + } + + const $next = $('Next'); + if (currentPage === totalPages) { + $next.addClass('disabled'); + } + $pagination.append($next); + + if (currentPage === endPage) { + $('#addFidRow').show(); + } else { + $('#addFidRow').hide(); + } + } + + let currentPage = 1; + + showPage(currentPage); + + createPagination(); + + $('#dpdSpecialPricePagination').on('click', '.pagination-button', function (e) { + e.preventDefault(); + + if ($(this).hasClass('disabled') || $(this).hasClass('active')) { + return; + } + + const $tbody = $('#specialPriceTable').find('tbody'); + const $rows = $tbody.find('tr'); + const totalRows = $rows.length; + const totalPages = Math.ceil(totalRows / rowsPerPage); + + const buttonText = $(this).text(); + + if (buttonText === 'Prev') { + if (currentPage > 1) { + currentPage--; + } + } else if (buttonText === 'Next') { + if (currentPage < totalPages) { + currentPage++; + } + } else { + currentPage = parseInt($(this).attr('data-page')); + } + + showPage(currentPage); + createPagination(); + }); +}); \ No newline at end of file diff --git a/modules/dpdshipping/views/js/configuration/special-price.js b/modules/dpdshipping/views/js/configuration/special-price.js new file mode 100644 index 00000000..4002c08d --- /dev/null +++ b/modules/dpdshipping/views/js/configuration/special-price.js @@ -0,0 +1,86 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(() => { + + $(document).on('click', '#addFidRow', function () { + const parentContainer = $("#specialPriceTable tbody tr:last"); + const clonedRow = parentContainer.clone(); + + setIndexForNewRow(clonedRow, true); + clonedRow.insertAfter(parentContainer); + }); + + $(document).on('click', '.dpdshipping-remove-row', function () { + $(this).closest('tr').remove(); + + $("#specialPriceTable tbody tr").each(function (index) { + function setIndexesAfterRemoveRow() { + const currentName = $(this).attr('name'); + const matches = currentName.match(/\[(\d+)\]/); + if (matches) { + const newIndex = index + 1; + const newName = currentName.replace(/\[(\d+)\]/, '[' + newIndex + ']'); + $(this).attr('name', newName); + } + } + + $(this).find('input').each(function () { + setIndexesAfterRemoveRow.call(this); + }); + + $(this).find('select').each(function () { + setIndexesAfterRemoveRow.call(this); + }); + }); + + }); + + $(document).on('click', '.dpdshipping-duplicate-row', function () { + const parentContainer = $(this).closest('tr'); + const clonedRow = parentContainer.clone(); + + setIndexForNewRow(clonedRow, false); + const lastRow = $("#specialPriceTable tbody tr:last"); + clonedRow.insertAfter(lastRow); + }); + + function setIndexForNewRow(clonedRow, emptyValue) { + function setIndexes() { + const index = parseInt($("#specialPriceTable tbody tr").length) + 1; + const currentName = $(this).attr('name'); + const newName = currentName.replace(/\[(\d+)\]/, '[' + index + ']'); + $(this).attr('name', newName); + if (emptyValue) + $(this).val(''); + } + + clonedRow.find('input').each(function () { + setIndexes.call(this); + }); + + clonedRow.find('select').each(function () { + setIndexes.call(this); + }); + } +}); diff --git a/modules/dpdshipping/views/js/dpdshipping-ajax.js b/modules/dpdshipping/views/js/dpdshipping-ajax.js new file mode 100644 index 00000000..c3ac5a35 --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-ajax.js @@ -0,0 +1,201 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + + function downloadFile(xhr, response) { + const contentType = xhr.getResponseHeader('Content-Type'); + const fileName = getFileName(xhr); + const blob = new Blob([response], {type: contentType}); + const link = document.createElement('a'); + link.href = window.URL.createObjectURL(blob); + link.download = fileName; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + + function getFileName(xhr) { + const contentDisposition = xhr.getResponseHeader('Content-Disposition'); + let fileName = 'downloaded-file'; + + if (contentDisposition && contentDisposition.indexOf('attachment') !== -1) { + const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/; + const matches = filenameRegex.exec(contentDisposition); + if (matches != null && matches[1]) { + fileName = matches[1].replace(/['"]/g, ''); + } + } + return fileName; + } + + $('#print-label').on('click', function (event) { + event.preventDefault(); + + const shippingHistoryId = $(this).data('shipping-history-id'); + const url = $(this).data('url'); + + $.ajax({ + url: url, + method: 'POST', + data: { + shippingHistoryId: shippingHistoryId, + token: dpdshipping_token + }, + xhrFields: { + responseType: 'blob' + }, + success: function (response, status, xhr) { + downloadFile(xhr, response); + $('.alert-messages').hide(); + $('.success-message-ajax').text(dpdshipping_translations.dpdshipping_label_success_text).show(); + $('.error-message-ajax').hide(); + }, + error: function () { + handleErrorResponse(dpdshipping_translations.dpdshipping_label_error_text); + } + }); + }); + + + $('#print-return-label').on('click', function (event) { + event.preventDefault(); + + const shippingHistoryId = $(this).data('shipping-history-id'); + const orderId = $(this).data('order-id'); + const url = $(this).data('url'); + + $.ajax({ + url: url, + method: 'POST', + data: { + shippingHistoryId: shippingHistoryId, + orderId: orderId, + token: dpdshipping_token + }, + xhrFields: { + responseType: 'blob' + }, + success: function (response, status, xhr) { + downloadFile(xhr, response); + $('.alert-messages').hide(); + $('.success-message-ajax').text(dpdshipping_translations.dpdshipping_return_label_success_text).show(); + $('.error-message-ajax').hide(); + }, + error: function () { + handleErrorResponse(dpdshipping_translations.dpdshipping_return_label_error_text); + } + }); + }); + + function handleErrorResponse(message) { + $('.alert-messages').hide(); + $('.success-message-ajax').hide(); + $('.error-message-ajax').text(message).show(); + } + + const $dpdConn = $('.js-dpd-connection'); + const $dpdPayer = $('.js-dpd-payer'); + if ($dpdConn.length === 0 || $dpdPayer.length === 0) return; + + const dpdOriginalByLabel = Object.create(null); + let dpdPlaceholder = null; + + $dpdPayer.find('option').each((_, el) => { + const $opt = $(el); + const val = String($opt.attr('value') ?? ''); + const text = $opt.text(); + if (val === '') { + dpdPlaceholder = { value: '', text: text || '—' }; + } else { + dpdOriginalByLabel[text] = val; + } + }); + + let dpdPayersByConn = {}; + try { + let dpdRaw = $dpdConn.attr('data-payers') || '{}'; + if (dpdRaw.includes('"') || dpdRaw.includes(''') || dpdRaw.includes('&')) { + dpdRaw = dpdRaw.replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&'); + } + dpdPayersByConn = JSON.parse(dpdRaw); + } catch { + dpdPayersByConn = {}; + } + + const dpdFillPayers = () => { + const dpdConnId = String($dpdConn.val() || ''); + const dpdMap = dpdPayersByConn[dpdConnId] || {}; + const dpdLabels = Object.keys(dpdMap); + const dpdRemembered = String($dpdPayer.val() || $dpdPayer.attr('data-selected') || ''); + + $dpdPayer.empty(); + + if (dpdLabels.length === 0) { + const text = dpdPlaceholder?.text ?? '—'; + $('') + .attr('value', item.range) + .text(item.range); + select.append(option); + } + }); + + const jsonString = JSON.stringify(response.data); + select.attr('data-timeframes', jsonString); + select.val(response.data.length > 0 ? response.data[0].range : '').change(); + + $('#pickupTimeContainer').show(); + } else if (response.success === false && response.errors && response.errors.length > 0) { + $('.errorMessagePickupCourier').text(response.errors[0]); + $('.errorMessagePickupCourier').show(); + } else { + $('.errorMessagePickupCourier').text('Unknown error'); + $('.errorMessagePickupCourier').show(); + } + }, error: function () { + $('.errorMessagePickupCourier').text('Unknown error'); + $('.errorMessagePickupCourier').show(); + } + }); + }); + + $('#pickup-courier-add-save-button').on('click', function (event) { + event.preventDefault(); + $('.errorMessagePickupCourier').hide(); + + const form = document.getElementById('dpdshipping_pickup_courier_form'); + + if (!form.checkValidity()) { + form.reportValidity(); + return; + } + if (!validateAddPickupCourier()) + return; + + + const pickupOrderSettingsId = $('#form_dpdshipping_pickup_courier_sender_address').val() + + $.ajax({ + url: dpdshipping_pickup_courier_pickup_courier_ajax_url, method: 'POST', data: { + pickupOrderSettingsId: pickupOrderSettingsId, + customerFullName: $('#form_customer_company').val(), + customerName: $('#form_customer_name').val(), + customerPhone: $('#form_customer_phone').val(), + senderFullName: $('#senderFullName').text(), + senderName: $('#senderName').text(), + senderAddress: $('#senderAddress').text(), + senderPostalCode: $('#senderPostalCode').text(), + senderCity: $('#senderCity').text(), + senderCountryCode: $('#senderCountryCode').text(), + senderPhone: $('#senderPhone').text(), + payerNumber: $('#payerNumber').text(), + payerName: "DPD_API", + pickupDate: $('#form_pickup_date').val(), + pickupTime: $('#form_pickup_time').val(), + letters: $('#form_letters').is(':checked'), + lettersCount: $('#form_letters_count').val(), + packages: $('#form_packages').is(':checked'), + packagesCount: $('#form_packages_count').val(), + packagesWeightSum: $('#form_packages_weight_sum').val(), + packagesWeightMax: $('#form_packages_weight_max').val(), + packagesSizeXMax: $('#form_packages_size_x_max').val(), + packagesSizeYMax: $('#form_packages_size_y_max').val(), + packagesSizeZMax: $('#form_packages_size_z_max').val(), + palette: $('#form_palette').is(':checked'), + paletteCount: $('#form_palette_count').val(), + paletteWeightSum: $('#form_palette_weight_sum').val(), + paletteWeightMx: $('#form_palette_weight_max').val(), + paletteSizeYMax: $('#form_palette_size_y_max').val(), + token: dpdshipping_token + }, success: function (response, status, xhr) { + if (response.success === true && response.data !== null) { + window.location.href = response.data.redirectPath; + } else if (response.success === false && response.errors && response.errors.length > 0) { + $('.errorMessagePickupCourier').text(response.errors[0]); + $('.errorMessagePickupCourier').show(); + } else { + $('.errorMessagePickupCourier').text('Unknown error'); + $('.errorMessagePickupCourier').show(); + } + }, error: function () { + $('.errorMessagePickupCourier').text('Unknown error'); + $('.errorMessagePickupCourier').show(); + } + }); + + function isEmptyInputData(fields) { + return fields.some(function (selector) { + return !$.trim($(selector).val()) && !$.trim($(selector).text()); + }); + } + + function validateAddPickupCourier() { + function showError(errorMsg) { + $('.errorMessagePickupCourier').text(errorMsg); + $('.errorMessagePickupCourier').show(); + } + + if (isEmptyInputData([ + '#form_customer_company', + '#form_customer_name', + '#form_customer_phone'])) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_customer); + return false; + } + + if (isEmptyInputData([ + '#senderFullName', + '#senderName', + '#senderAddress', + '#senderPostalCode', + '#senderCity', + '#senderCountryCode', + '#senderPhone', + ])) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_sender); + return false; + } + + if (isEmptyInputData([ + '#payerNumber', + ])) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_payer); + return false; + } + + if (isEmptyInputData([ + '#form_pickup_date', + '#form_pickup_time', + ])) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_pickup_date_time); + return false; + } + if (!$('#form_letters').is(':checked') && + !$('#form_packages').is(':checked') && + !$('#form_palette').is(':checked')) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_parcel); + return false; + } + if ($('#form_letters').is(':checked')) { + if (isEmptyInputData([ + '#form_letters_count', + ])) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_letters); + return false; + } + } + + if ($('#form_packages').is(':checked')) { + if (isEmptyInputData([ + '#form_packages_count', + '#form_packages_weight_sum', + '#form_packages_weight_max', + '#form_packages_size_x_max', + '#form_packages_size_y_max', + '#form_packages_size_z_max', + ])) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_packages); + return false; + } + } + + if ($('#form_palette').is(':checked')) { + if (isEmptyInputData([ + '#form_palette_count', + '#form_palette_weight_sum', + '#form_palette_weight_max', + '#form_palette_size_y_max' + ])) { + showError(dpdshipping_pickup_courier_pickup_courier_ajax_empty_palette); + return false; + } + } + + return true; + } + }); + + $('#form_pickup_time').on('change', function (event) { + const selectedRange = $(this).val(); + const timeFrames = $('#form_pickup_time').data('timeframes'); + const selectedTimeFrame = timeFrames.find(tf => tf.range === selectedRange); + + function getFormatedHour() { + const rangeParts = selectedTimeFrame.range.split('-'); + const startTime = rangeParts[0]; + + const startDate = new Date(); + const [startHour, startMinute] = startTime.split(':'); + startDate.setHours(parseInt(startHour)); + startDate.setMinutes(parseInt(startMinute)); + startDate.setSeconds(0); + + const offsetDate = new Date(startDate.getTime() - selectedTimeFrame.offset * 60000); + + const offsetHour = offsetDate.getHours().toString().padStart(2, '0'); + const offsetMinute = offsetDate.getMinutes().toString().padStart(2, '0'); + return `${offsetHour}:${offsetMinute}`; + } + + if (selectedTimeFrame) { + $('#timeFrameHour').text(getFormatedHour()); + $('#timeFrameDate').text($('#form_pickup_date').val()); + } else { + console.error('No matching time frame found for the selected range:', selectedRange); + } + }); +}); \ No newline at end of file diff --git a/modules/dpdshipping/views/js/dpdshipping-pickup-courier.js b/modules/dpdshipping/views/js/dpdshipping-pickup-courier.js new file mode 100644 index 00000000..8ebe526e --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pickup-courier.js @@ -0,0 +1,114 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + + setLetterFields($('#form_letters')) + setPackageFields($('#form_packages')) + setPaletteFields($('#form_palette')) + + $(document).on('change', '#form_letters', function () { + setLetterFields($('#form_letters')); + }); + + $(document).on('change', '#form_packages', function () { + setPackageFields($('#form_packages')); + }); + + $(document).on('change', '#form_palette', function () { + setPaletteFields($('#form_palette')); + }); + + + function checkConfigurationWarning() { + if ($('#form_dpdshipping_pickup_courier_sender_address option').length <= 1) { + $('.warnMessagePickupCourier').text(dpdshipping_pickup_courier_pickup_courier_empty_configuration); + $('.warnMessagePickupCourier').show(); + } + } + + checkConfigurationWarning() + + function setLetterFields(input) { + function getLetterFields() { + return $("label[for='form_letters_count'], #form_letters_count"); + } + + if (input.is(':checked')) { + getLetterFields().show(); + $('#form_palette').prop("checked", false); + $('#form_packages').prop("checked", false); + } else { + getLetterFields().hide(); + $('#form_letters_count').val(undefined); + } + } + + function setPackageFields(input) { + function getPackagesFields() { + return $( + "label[for='form_packages_count'], #form_packages_count, " + + "label[for='form_packages_weight_sum'], #form_packages_weight_sum, " + + "label[for='form_packages_weight_max'], #form_packages_weight_max, " + + "label[for='form_packages_size_x_max'], #form_packages_size_x_max, " + + "label[for='form_packages_size_y_max'], #form_packages_size_y_max, " + + "label[for='form_packages_size_z_max'], #form_packages_size_z_max"); + } + + if (input.is(':checked')) { + getPackagesFields().show(); + $('#form_letters').prop("checked", false); + $('#form_palette').prop("checked", false); + } else { + getPackagesFields().hide(); + $('#form_packages_count').val(undefined); + $('#form_packages_weight_sum').val(undefined); + $('#form_packages_weight_max').val(undefined); + $('#form_packages_size_x_max').val(undefined); + $('#form_packages_size_y_max').val(undefined); + $('#form_packages_size_z_max').val(undefined); + } + } + + function setPaletteFields(input) { + function getPaletteFields() { + return $( + "label[for='form_palette_count'], #form_palette_count, " + + "label[for='form_palette_weight_sum'], #form_palette_weight_sum, " + + "label[for='form_palette_weight_max'], #form_palette_weight_max, " + + "label[for='form_palette_size_y_max'], #form_palette_size_y_max"); + } + + if (input.is(':checked')) { + getPaletteFields().show(); + $('#form_letters').prop("checked", false); + $('#form_packages').prop("checked", false); + } else { + getPaletteFields().hide(); + $('#form_palette_count').val(undefined); + $('#form_palette_weight_sum').val(undefined); + $('#form_palette_weight_max').val(undefined); + $('#form_palette_size_y_max').val(undefined); + } + } +}); \ No newline at end of file diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-cod-iframe.js b/modules/dpdshipping/views/js/dpdshipping-pudo-cod-iframe.js new file mode 100644 index 00000000..1c50e4cc --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-cod-iframe.js @@ -0,0 +1,216 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +// noinspection JSUnresolvedReference + +console.log('[DPD Pudo COD] Skrypt załadowany'); + +if (typeof dpsShippingCodEventCreated == 'undefined') { + var dpsShippingCodEventCreated = false; +} + +if (typeof dpsShippingCodIframeCreated == 'undefined') { + var dpsShippingCodIframeCreated = false; +} + +/** + * Tworzy iframe dla mapy PUDO COD + */ +function dpsShippingCodCreateIframe() { + console.log('[DPD Pudo COD] Próba utworzenia iframe...'); + + // Sprawdź czy iframe już istnieje + if (document.getElementById("dpdshipping-widget-pudo-cod-iframe")) { + console.log('[DPD Pudo COD] Iframe już istnieje'); + return true; + } + + // Walidacja: sprawdź czy URL iframe jest zdefiniowany + if (typeof dpdshipping_iframe_cod_url === 'undefined' || !dpdshipping_iframe_cod_url) { + console.error('[DPD Pudo COD] Błąd: dpdshipping_iframe_cod_url nie jest zdefiniowany lub jest pusty'); + return false; + } + + // Walidacja: sprawdź czy element docelowy istnieje + var dpsShippingCod_script = document.getElementById("dpdshipping-widget-pudo-cod"); + if (!dpsShippingCod_script) { + console.error('[DPD Pudo COD] Błąd: Nie znaleziono elementu #dpdshipping-widget-pudo-cod'); + return false; + } + + var dpsShippingCod_iframe = document.createElement("iframe"); + dpsShippingCod_iframe.setAttribute("id", "dpdshipping-widget-pudo-cod-iframe"); + dpsShippingCod_iframe.setAttribute("allow", "geolocation"); + dpsShippingCod_iframe.style.width = "100%"; + dpsShippingCod_iframe.style.border = "none"; + dpsShippingCod_iframe.style.minHeight = "400px"; + dpsShippingCod_iframe.style.height = "768px"; + + dpsShippingCod_iframe.onerror = function() { + console.error('[DPD Pudo COD] Błąd ładowania iframe'); + }; + + dpsShippingCod_iframe.onload = function() { + console.log('[DPD Pudo COD] Iframe załadowany pomyślnie'); + }; + + dpsShippingCod_iframe.src = dpdshipping_iframe_cod_url; + + dpsShippingCod_script.parentNode.insertBefore(dpsShippingCod_iframe, dpsShippingCod_script); + console.log('[DPD Pudo COD] Iframe dodany do DOM, URL:', dpdshipping_iframe_cod_url); + + window.dpsShippingCod_iframe = dpsShippingCod_iframe; + dpsShippingCodIframeCreated = true; + + return true; +} + +// Obserwator DOM +function dpsShippingCodObserveDOM() { + if (document.getElementById("dpdshipping-widget-pudo-cod")) { + console.log('[DPD Pudo COD] Element znaleziony w DOM'); + dpsShippingCodCreateIframe(); + return; + } + + if (typeof MutationObserver !== 'undefined') { + console.log('[DPD Pudo COD] Uruchamiam MutationObserver...'); + var observer = new MutationObserver(function() { + if (document.getElementById("dpdshipping-widget-pudo-cod")) { + console.log('[DPD Pudo COD] Element pojawił się w DOM (MutationObserver)'); + observer.disconnect(); + dpsShippingCodCreateIframe(); + } + }); + observer.observe(document.body, { childList: true, subtree: true }); + + setTimeout(function() { + observer.disconnect(); + }, 30000); + } +} + +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', function() { + console.log('[DPD Pudo COD] DOMContentLoaded'); + dpsShippingCodObserveDOM(); + }); +} else { + console.log('[DPD Pudo COD] DOM już załadowany'); + dpsShippingCodObserveDOM(); +} + +$(document).ready(function() { + console.log('[DPD Pudo COD] jQuery ready'); + + $(document).on('click', '.dpdshipping-pudo-cod-open-map-btn, .dpdshipping-pudo-cod-change-map-btn', function() { + console.log('[DPD Pudo COD] Kliknięto przycisk otwierania mapy'); + setTimeout(function() { + dpsShippingCodCreateIframe(); + }, 200); + }); + + $(document).on('show.bs.modal shown.bs.modal', '#dpdshippingPudoCodModal', function() { + console.log('[DPD Pudo COD] Modal pokazywany'); + dpsShippingCodCreateIframe(); + }); +}); + +if (!dpsShippingCodEventCreated) { + var dpsShippingCod_eventListener = window[window.addEventListener ? "addEventListener" : "attachEvent"]; + var dpsShippingCod_messageEvent = ("attachEvent" === dpsShippingCod_eventListener) ? "onmessage" : "message"; + dpsShippingCod_eventListener(dpsShippingCod_messageEvent, function (a) { + if (typeof getDpdshippingIdPudoCodCarrier !== 'function' || typeof getDpdshippingSelectedCarrier !== 'function') { + return; + } + if (getDpdshippingIdPudoCodCarrier() === getDpdshippingSelectedCarrier()) { + var iframe = window.dpsShippingCod_iframe || document.getElementById("dpdshipping-widget-pudo-cod-iframe"); + if (a.data && a.data.height && !isNaN(a.data.height)) { + if (iframe) { + iframe.style.height = a.data.height + "px"; + } + } else if (a.data && a.data.point_id) { + dpdShippingCodPointSelected(a.data.point_id); + } + } + }, !1); + dpsShippingCodEventCreated = true; +} + +function dpdShippingCodPointSelected(pudoCode) { + if (!pudoCode) { + console.error('[DPD Pudo COD] Błąd: Brak kodu punktu'); + return; + } + + $('.container_dpdshipping_pudo_cod_error').css("display", "none"); + $('.dpdshipping-pudo-cod-new-point').css("display", "none"); + $('.dpdshipping-pudo-cod-selected-point').css("display", "block"); + + if (typeof dpdshippingSavePudoCode === 'function') { + dpdshippingSavePudoCode(pudoCode, $('#dpdshippingPudoCodModal')); + } + + if (typeof dpdshippingGetPudoAddress === 'function') { + dpdshippingGetPudoAddress(pudoCode, $('.dpdshipping-cod-selected-point')); + } + + if (typeof dpdshippingIsPointWithCod === 'function') { + dpdshippingIsPointWithCod(pudoCode); + } else { + dpdshippingIsPointWithCodInternal(pudoCode); + } + + console.log('[DPD Pudo COD] Wybrano punkt:', pudoCode); +} + +function dpdshippingIsPointWithCodInternal(pudoCode) { + if (typeof dpdshipping_pickup_is_point_with_cod_ajax_url === 'undefined') { + console.error('[DPD Pudo COD] Brak URL dla sprawdzenia COD'); + return; + } + + $.ajax({ + url: dpdshipping_pickup_is_point_with_cod_ajax_url, + type: 'GET', + data: { + dpdshipping_token: dpdshipping_token, + dpdshipping_csrf: dpdshipping_csrf, + dpdshipping_pudo_code: pudoCode + }, + success: function (response) { + var resultJson = JSON.parse(response); + if (resultJson.success && resultJson.data && Number(resultJson.data) === 1) { + $('.container_dpdshipping_pudo_cod_warning').css("display", "none"); + } else { + $('.container_dpdshipping_pudo_cod_warning').css("display", "block"); + if (typeof dpdshippingDisableOrderProcessBtn === 'function') { + dpdshippingDisableOrderProcessBtn(); + } + } + }, + error: function (error) { + console.error('[DPD Pudo COD] Błąd sprawdzania COD:', error); + } + }); +} diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-default.js b/modules/dpdshipping/views/js/dpdshipping-pudo-default.js new file mode 100644 index 00000000..5ee0d0f1 --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-default.js @@ -0,0 +1,30 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +function dpdshippingDisableOrderProcessBtn() { + $('button[name="confirmDeliveryOption"]').attr('disabled', 'disabled'); +} + +function dpdshippingEnableOrderProcessBtn() { + $('button[name="confirmDeliveryOption"]').removeAttr('disabled'); +} \ No newline at end of file diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-easycheckout.js b/modules/dpdshipping/views/js/dpdshipping-pudo-easycheckout.js new file mode 100644 index 00000000..47a6d55a --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-easycheckout.js @@ -0,0 +1,38 @@ +/* + * Copyright 2025 DPD Polska Sp. z o. o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2025 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + setTimeout(() => { + handleDpdShippingPudo() + }, 2000); +}) + +function dpdshippingDisableOrderProcessBtn() { + $("#payment-confirmation button").prop("disabled", true); + $("#payment-confirmation a").addClass("disabled").attr("aria-disabled", "true"); +} + +function dpdshippingEnableOrderProcessBtn() { + $("#payment-confirmation button").prop("disabled", false); + $("#payment-confirmation a").removeClass("disabled").removeAttr("aria-disabled"); +} \ No newline at end of file diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-iframe.js b/modules/dpdshipping/views/js/dpdshipping-pudo-iframe.js new file mode 100644 index 00000000..36d29e7e --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-iframe.js @@ -0,0 +1,179 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +// noinspection JSUnresolvedReference + +console.log('[DPD Pudo] Skrypt załadowany'); + +if (typeof dpdshippingEventCreated == 'undefined') { + var dpdshippingEventCreated = false; +} + +if (typeof dpdshippingIframeCreated == 'undefined') { + var dpdshippingIframeCreated = false; +} + +/** + * Tworzy iframe dla mapy PUDO + */ +function dpdshippingCreateIframe() { + console.log('[DPD Pudo] Próba utworzenia iframe...'); + + // Sprawdź czy iframe już istnieje + if (document.getElementById("dpdshipping-widget-pudo-iframe")) { + console.log('[DPD Pudo] Iframe już istnieje'); + return true; + } + + // Walidacja: sprawdź czy URL iframe jest zdefiniowany + if (typeof dpdshipping_iframe_url === 'undefined' || !dpdshipping_iframe_url) { + console.error('[DPD Pudo] Błąd: dpdshipping_iframe_url nie jest zdefiniowany lub jest pusty'); + return false; + } + + // Walidacja: sprawdź czy element docelowy istnieje + var dpdshipping_script = document.getElementById("dpdshipping-widget-pudo"); + if (!dpdshipping_script) { + console.error('[DPD Pudo] Błąd: Nie znaleziono elementu #dpdshipping-widget-pudo'); + return false; + } + + var dpdshipping_iframe = document.createElement("iframe"); + dpdshipping_iframe.setAttribute("id", "dpdshipping-widget-pudo-iframe"); + dpdshipping_iframe.setAttribute("allow", "geolocation"); + dpdshipping_iframe.style.width = "100%"; + dpdshipping_iframe.style.border = "none"; + dpdshipping_iframe.style.minHeight = "400px"; + dpdshipping_iframe.style.height = "768px"; + + dpdshipping_iframe.onerror = function() { + console.error('[DPD Pudo] Błąd ładowania iframe'); + }; + + dpdshipping_iframe.onload = function() { + console.log('[DPD Pudo] Iframe załadowany pomyślnie'); + }; + + dpdshipping_iframe.src = dpdshipping_iframe_url; + + dpdshipping_script.parentNode.insertBefore(dpdshipping_iframe, dpdshipping_script); + console.log('[DPD Pudo] Iframe dodany do DOM, URL:', dpdshipping_iframe_url); + + window.dpdshipping_iframe = dpdshipping_iframe; + dpdshippingIframeCreated = true; + + return true; +} + +// Obserwator DOM +function dpdshippingObserveDOM() { + if (document.getElementById("dpdshipping-widget-pudo")) { + console.log('[DPD Pudo] Element znaleziony w DOM'); + dpdshippingCreateIframe(); + return; + } + + if (typeof MutationObserver !== 'undefined') { + console.log('[DPD Pudo] Uruchamiam MutationObserver...'); + var observer = new MutationObserver(function() { + if (document.getElementById("dpdshipping-widget-pudo")) { + console.log('[DPD Pudo] Element pojawił się w DOM (MutationObserver)'); + observer.disconnect(); + dpdshippingCreateIframe(); + } + }); + observer.observe(document.body, { childList: true, subtree: true }); + + setTimeout(function() { + observer.disconnect(); + }, 30000); + } +} + +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', function() { + console.log('[DPD Pudo] DOMContentLoaded'); + dpdshippingObserveDOM(); + }); +} else { + console.log('[DPD Pudo] DOM już załadowany'); + dpdshippingObserveDOM(); +} + +$(document).ready(function() { + console.log('[DPD Pudo] jQuery ready'); + + $(document).on('click', '.dpdshipping-pudo-open-map-btn, .dpdshipping-pudo-change-map-btn', function() { + console.log('[DPD Pudo] Kliknięto przycisk otwierania mapy'); + setTimeout(function() { + dpdshippingCreateIframe(); + }, 200); + }); + + $(document).on('show.bs.modal shown.bs.modal', '#dpdshippingPudoModal', function() { + console.log('[DPD Pudo] Modal pokazywany'); + dpdshippingCreateIframe(); + }); +}); + +if (!dpdshippingEventCreated) { + var dpdshipping_eventListener = window[window.addEventListener ? "addEventListener" : "attachEvent"]; + var dpdshipping_messageEvent = ("attachEvent" === dpdshipping_eventListener) ? "onmessage" : "message"; + dpdshipping_eventListener(dpdshipping_messageEvent, function (a) { + if (typeof getDpdshippingIdPudoCarrier !== 'function' || typeof getDpdshippingSelectedCarrier !== 'function') { + return; + } + if (getDpdshippingIdPudoCarrier() === getDpdshippingSelectedCarrier()) { + var iframe = window.dpdshipping_iframe || document.getElementById("dpdshipping-widget-pudo-iframe"); + if (a.data && a.data.height && !isNaN(a.data.height)) { + if (iframe) { + iframe.style.height = a.data.height + "px"; + } + } else if (a.data && a.data.point_id) { + dpdShippingPointSelected(a.data.point_id); + } + } + }, !1); + dpdshippingEventCreated = true; +} + +function dpdShippingPointSelected(pudoCode) { + if (!pudoCode) { + console.error('[DPD Pudo] Błąd: Brak kodu punktu'); + return; + } + + $('.container_dpdshipping_pudo_error').css("display", "none"); + $('.dpdshipping-pudo-new-point').css("display", "none"); + $('.dpdshipping-pudo-selected-point').css("display", "block"); + + if (typeof dpdshippingSavePudoCode === 'function') { + dpdshippingSavePudoCode(pudoCode, $('#dpdshippingPudoModal')); + } + + if (typeof dpdshippingGetPudoAddress === 'function') { + dpdshippingGetPudoAddress(pudoCode, $('.dpdshipping-selected-point')); + } + + console.log('[DPD Pudo] Wybrano punkt:', pudoCode); +} diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestasmart.js b/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestasmart.js new file mode 100644 index 00000000..06379ebc --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestasmart.js @@ -0,0 +1,37 @@ +/* + * Copyright 2025 DPD Polska Sp. z o. o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2025 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + setTimeout(() => { + handleDpdShippingPudo() + }, 2000); +}) + +function dpdshippingDisableOrderProcessBtn() { + $("#confirm_order").css("pointer-events", "none"); +} + +function dpdshippingEnableOrderProcessBtn() { + $("#confirm_order").css("pointer-events", "auto"); +} + diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestateam-1.7.js b/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestateam-1.7.js new file mode 100644 index 00000000..7316fc53 --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestateam-1.7.js @@ -0,0 +1,37 @@ +/* + * Copyright 2025 DPD Polska Sp. z o. o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2025 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + setTimeout(() => { + handleDpdShippingPudo() + }, 2000); +}) + +function dpdshippingDisableOrderProcessBtn() { + $("#btn_place_order").css("pointer-events", "none"); +} + +function dpdshippingEnableOrderProcessBtn() { + $("#btn_place_order").css("pointer-events", "auto"); +} + diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestateam-8.js b/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestateam-8.js new file mode 100644 index 00000000..d02af775 --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-opc-prestateam-8.js @@ -0,0 +1,37 @@ +/* + * Copyright 2025 DPD Polska Sp. z o. o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2025 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + setTimeout(() => { + handleDpdShippingPudo() + }, 2000); +}) + +function dpdshippingDisableOrderProcessBtn() { + $("#opc_step_shipping_footer, #opc_step_payment_header").css("pointer-events", "none"); +} + +function dpdshippingEnableOrderProcessBtn() { + $("#opc_step_shipping_footer, #opc_step_payment_header").css("pointer-events", "auto"); +} + diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-supercheckout.js b/modules/dpdshipping/views/js/dpdshipping-pudo-supercheckout.js new file mode 100644 index 00000000..9a699ee3 --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-supercheckout.js @@ -0,0 +1,38 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + setTimeout(() => { + handleDpdShippingPudo() + }, 2000); +}) + +function dpdshippingDisableOrderProcessBtn() { + $('#supercheckout_confirm_order').attr('disabled', 'disabled'); + $('#supercheckout_confirm_order').css('pointer-events', 'none'); +} + +function dpdshippingEnableOrderProcessBtn() { + $('#supercheckout_confirm_order').removeAttr('disabled'); + $('#supercheckout_confirm_order').css('pointer-events', ''); +} \ No newline at end of file diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-swipbox-iframe.js b/modules/dpdshipping/views/js/dpdshipping-pudo-swipbox-iframe.js new file mode 100644 index 00000000..13c091be --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-swipbox-iframe.js @@ -0,0 +1,203 @@ +/* + * Copyright 2024 DPD Polska Sp. z o.o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2024 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +// noinspection JSUnresolvedReference + +console.log('[DPD SwipBox] Skrypt załadowany'); + +if (typeof dpsShippingSwipBoxEventCreated == 'undefined') { + var dpsShippingSwipBoxEventCreated = false; +} + +if (typeof dpsShippingSwipBoxIframeCreated == 'undefined') { + var dpsShippingSwipBoxIframeCreated = false; +} + +/** + * Tworzy iframe dla mapy SwipBox - wywoływane przy otwieraniu modala + */ +function dpsShippingSwipBoxCreateIframe() { + console.log('[DPD SwipBox] Próba utworzenia iframe...'); + + // Sprawdź czy iframe już istnieje + if (document.getElementById("dpdshipping-widget-pudo-swipbox-iframe")) { + console.log('[DPD SwipBox] Iframe już istnieje'); + return true; + } + + // Walidacja: sprawdź czy URL iframe jest zdefiniowany + if (typeof dpdshipping_iframe_swipbox_url === 'undefined' || !dpdshipping_iframe_swipbox_url) { + console.error('[DPD SwipBox] Błąd: dpdshipping_iframe_swipbox_url nie jest zdefiniowany lub jest pusty'); + console.error('[DPD SwipBox] Dostępne zmienne:', { + dpdshipping_iframe_swipbox_url: typeof dpdshipping_iframe_swipbox_url !== 'undefined' ? dpdshipping_iframe_swipbox_url : 'UNDEFINED', + dpdshipping_id_pudo_swipbox_carrier: typeof dpdshipping_id_pudo_swipbox_carrier !== 'undefined' ? dpdshipping_id_pudo_swipbox_carrier : 'UNDEFINED' + }); + return false; + } + + // Walidacja: sprawdź czy element docelowy istnieje + var dpsShippingSwipBox_script = document.getElementById("dpdshipping-widget-pudo-swipbox"); + if (!dpsShippingSwipBox_script) { + console.error('[DPD SwipBox] Błąd: Nie znaleziono elementu #dpdshipping-widget-pudo-swipbox'); + return false; + } + + var dpsShippingSwipBox_iframe = document.createElement("iframe"); + dpsShippingSwipBox_iframe.setAttribute("id", "dpdshipping-widget-pudo-swipbox-iframe"); + dpsShippingSwipBox_iframe.setAttribute("allow", "geolocation"); + dpsShippingSwipBox_iframe.style.width = "100%"; + dpsShippingSwipBox_iframe.style.border = "none"; + dpsShippingSwipBox_iframe.style.minHeight = "400px"; + dpsShippingSwipBox_iframe.style.height = "768px"; + + // Obsługa błędów ładowania iframe + dpsShippingSwipBox_iframe.onerror = function() { + console.error('[DPD SwipBox] Błąd ładowania iframe'); + }; + + dpsShippingSwipBox_iframe.onload = function() { + console.log('[DPD SwipBox] Iframe załadowany pomyślnie'); + }; + + // Ustaw src + dpsShippingSwipBox_iframe.src = dpdshipping_iframe_swipbox_url; + + dpsShippingSwipBox_script.parentNode.insertBefore(dpsShippingSwipBox_iframe, dpsShippingSwipBox_script); + console.log('[DPD SwipBox] Iframe dodany do DOM, URL:', dpdshipping_iframe_swipbox_url); + + // Eksportuj iframe do globalnego scope + window.dpsShippingSwipBox_iframe = dpsShippingSwipBox_iframe; + dpsShippingSwipBoxIframeCreated = true; + + return true; +} + +// Obserwator DOM - czeka na pojawienie się elementu +function dpsShippingSwipBoxObserveDOM() { + // Sprawdź czy element już istnieje + if (document.getElementById("dpdshipping-widget-pudo-swipbox")) { + console.log('[DPD SwipBox] Element znaleziony w DOM'); + dpsShippingSwipBoxCreateIframe(); + return; + } + + // Jeśli nie ma, obserwuj zmiany w DOM + if (typeof MutationObserver !== 'undefined') { + console.log('[DPD SwipBox] Uruchamiam MutationObserver...'); + var observer = new MutationObserver(function(mutations) { + if (document.getElementById("dpdshipping-widget-pudo-swipbox")) { + console.log('[DPD SwipBox] Element pojawił się w DOM (MutationObserver)'); + observer.disconnect(); + dpsShippingSwipBoxCreateIframe(); + } + }); + observer.observe(document.body, { childList: true, subtree: true }); + + // Timeout - zatrzymaj obserwację po 30 sekundach + setTimeout(function() { + observer.disconnect(); + }, 30000); + } +} + +// Próba utworzenia iframe przy DOMContentLoaded +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', function() { + console.log('[DPD SwipBox] DOMContentLoaded'); + dpsShippingSwipBoxObserveDOM(); + }); +} else { + // DOM już załadowany + console.log('[DPD SwipBox] DOM już załadowany'); + dpsShippingSwipBoxObserveDOM(); +} + +// Dodatkowa próba przy otwieraniu modala - nasłuchuj na zdarzenia modala +$(document).ready(function() { + console.log('[DPD SwipBox] jQuery ready'); + + // Nasłuchuj na otwieranie modala + $(document).on('click', '.dpdshipping-pudo-swipbox-open-map-btn, .dpdshipping-pudo-swipbox-change-map-btn', function() { + console.log('[DPD SwipBox] Kliknięto przycisk otwierania mapy'); + // Sprawdź ponownie po kliknięciu + setTimeout(function() { + console.log('[DPD SwipBox] Sprawdzam element po kliknięciu...'); + console.log('[DPD SwipBox] Modal:', document.getElementById('dpdshippingPudoSwipBoxModal')); + console.log('[DPD SwipBox] Script element:', document.getElementById('dpdshipping-widget-pudo-swipbox')); + dpsShippingSwipBoxCreateIframe(); + }, 200); + }); + + // Nasłuchuj na zdarzenie show modala (Bootstrap) + $(document).on('show.bs.modal shown.bs.modal', '#dpdshippingPudoSwipBoxModal', function() { + console.log('[DPD SwipBox] Modal pokazywany (Bootstrap event)'); + dpsShippingSwipBoxCreateIframe(); + }); +}); + +// Event listener dla wiadomości z iframe +if (!dpsShippingSwipBoxEventCreated) { + var dpsShippingSwipBox_eventListener = window[window.addEventListener ? "addEventListener" : "attachEvent"]; + var dpsShippingSwipBox_messageEvent = ("attachEvent" === dpsShippingSwipBox_eventListener) ? "onmessage" : "message"; + dpsShippingSwipBox_eventListener(dpsShippingSwipBox_messageEvent, function (a) { + if (typeof getDpdshippingIdPudoSwipBoxCarrier !== 'function' || typeof getDpdshippingSelectedCarrier !== 'function') { + return; + } + if (getDpdshippingIdPudoSwipBoxCarrier() === getDpdshippingSelectedCarrier()) { + var iframe = window.dpsShippingSwipBox_iframe || document.getElementById("dpdshipping-widget-pudo-swipbox-iframe"); + if (a.data && a.data.height && !isNaN(a.data.height)) { + if (iframe) { + iframe.style.height = a.data.height + "px"; + } + } else if (a.data && a.data.point_id) { + dpdShippingSwipBoxPointSelected(a.data.point_id); + } + } + }, !1); + dpsShippingSwipBoxEventCreated = true; +} + +function dpdShippingSwipBoxPointSelected(pudoSwipBoxe) { + if (!pudoSwipBoxe) { + console.error('[DPD SwipBox] Błąd: Brak ID punktu'); + return; + } + + $('.container_dpdshipping_pudo_swipbox_error').css("display", "none"); + $('.dpdshipping-pudo-swipbox-new-point').css("display", "none"); + $('.dpdshipping-pudo-swipbox-selected-point').css("display", "block"); + + if (typeof dpdshippingSavePudoCode === 'function') { + dpdshippingSavePudoCode(pudoSwipBoxe, $('#dpdshippingPudoSwipBoxModal')); + } else { + console.error('[DPD SwipBox] Funkcja dpdshippingSavePudoCode nie jest dostępna'); + } + + if (typeof dpdshippingGetPudoAddress === 'function') { + dpdshippingGetPudoAddress(pudoSwipBoxe, $('.dpdshipping-swipbox-selected-point')); + } else { + console.error('[DPD SwipBox] Funkcja dpdshippingGetPudoAddress nie jest dostępna'); + } + + console.log('[DPD SwipBox] Wybrano punkt:', pudoSwipBoxe); +} diff --git a/modules/dpdshipping/views/js/dpdshipping-pudo-thecheckout-prestasmart.js b/modules/dpdshipping/views/js/dpdshipping-pudo-thecheckout-prestasmart.js new file mode 100644 index 00000000..06379ebc --- /dev/null +++ b/modules/dpdshipping/views/js/dpdshipping-pudo-thecheckout-prestasmart.js @@ -0,0 +1,37 @@ +/* + * Copyright 2025 DPD Polska Sp. z o. o. + * + * NOTICE OF LICENSE + * + * Licensed under the EUPL-1.2 or later. + * You may not use this work except in compliance with the Licence. + * + * You may obtain a copy of the Licence at: + * https://joinup.ec.europa.eu/software/page/eupl + * It is also bundled with this package in the file LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the Licence is distributed on an AS IS basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions + * and limitations under the Licence. + * + * @author DPD Polska Sp. z o.o. + * @copyright 2025 DPD Polska Sp. z o.o. + * @license https://joinup.ec.europa.eu/software/page/eupl + */ + +$(document).ready(function () { + setTimeout(() => { + handleDpdShippingPudo() + }, 2000); +}) + +function dpdshippingDisableOrderProcessBtn() { + $("#confirm_order").css("pointer-events", "none"); +} + +function dpdshippingEnableOrderProcessBtn() { + $("#confirm_order").css("pointer-events", "auto"); +} + diff --git a/modules/dpdshipping/views/js/index.php b/modules/dpdshipping/views/js/index.php new file mode 100644 index 00000000..50743a85 --- /dev/null +++ b/modules/dpdshipping/views/js/index.php @@ -0,0 +1,33 @@ + 2) + $(button).closest('tr').remove(); + } + + function changeTable(type, customData) { + const lastContainer = $("#packagesTable tbody tr:last"); + const packagesTable = document.getElementById('packagesTable'); + if (!packagesTable) { + console.error('Table with ID "packagesTable" not found.'); + return; + } + + const tbodyByTagName = packagesTable.getElementsByTagName('tbody') + if (tbodyByTagName == null || tbodyByTagName.length === 0) { + console.error('No elements found in the table.'); + return; + } + + const tbody = tbodyByTagName[0]; + while (type !== "addRow" && tbody.firstChild) { + tbody.removeChild(tbody.firstChild); + } + + // Create new rows based on the selected action + if (type === 'single') { + const clonedRow = lastContainer.clone(); + let data = getSingleRow() + setInputsData(clonedRow, data); + setIndexForNewRow(clonedRow); + $("#packagesTable").append(clonedRow); + } else if (type === 'group') { + const productsData = $('#dpdShippingOrderProducts').data('products'); + Object.keys(productsData).forEach(function (index) { + const product = productsData[index]; + const clonedRow = lastContainer.clone(); + let data = { + weight: getProductWeight([product], true), + weightAdr: null, + customerData: getData([product], 300, 'customer-source'), + content: getData([product], 300, 'content-source'), + sizeX: '', + sizeY: '', + sizeZ: '' + } + setInputsData(clonedRow, data); + setIndexForNewRow(clonedRow); + $("#packagesTable").append(clonedRow); + }); + } else if (type === 'package') { + const productsData = $('#dpdShippingOrderProducts').data('products'); + Object.keys(productsData).forEach(function (index) { + const product = productsData[index]; + for (let i = 0; i < Math.ceil(product.product_quantity); i++) { + const clonedRow = lastContainer.clone(); + let data = { + weight: getProductWeight([product], false), + weightAdr: null, + customerData: getData([product], 300, 'customer-source'), + content: getData([product], 300, 'content-source'), + sizeX: '', + sizeY: '', + sizeZ: '' + } + setInputsData(clonedRow, data); + setIndexForNewRow(clonedRow); + $("#packagesTable").append(clonedRow); + } + }); + } else if (type === 'addRow') { + const clonedRow = lastContainer.clone(); + let data = { + weight: 1.0, + weightAdr: null, + customerData: "", + content: "", + sizeX: "", + sizeY: "", + sizeZ: "", + } + setInputsData(clonedRow, data); + setIndexForNewRow(clonedRow); + $("#packagesTable").append(clonedRow); + } else if (type === 'custom') { + Object.keys(customData).forEach(function (index) { + const parcel = customData[index]; + const clonedRow = lastContainer.clone(); + let data = { + weight: parcel.product_weight, + weightAdr: null, + customerData: parcel.customerData, + content: parcel.content, + sizeX: '', + sizeY: '', + sizeZ: '' + } + setInputsData(clonedRow, data); + setIndexForNewRow(clonedRow); + $("#packagesTable").append(clonedRow); + }); + } + + function setInputsData(clonedRow, data) { + + clonedRow.find('input').each(function () { + const inputType = $(this).attr('fieldType'); + switch (inputType) { + case 'weight': + $(this).val(data.weight); + break; + case 'weightAdr': + $(this).val(data.weightAdr); + break; + case 'customerData': + $(this).val(data.customerData); + break; + case 'content': + $(this).val(data.content); + break; + case 'sizeX': + $(this).val(data.sizeX); + break; + case 'sizeY': + $(this).val(data.sizeY); + break; + case 'sizeZ': + $(this).val(data.sizeZ); + break; + } + }); + } + + function setIndexForNewRow(clonedRow) { + function setIndexes() { + const index = parseInt($("#packagesTable tbody tr").length); + const currentName = $(this).attr('name'); + const newName = currentName.replace(/\[(\d+)\]/, '[' + index + ']'); + $(this).attr('name', newName); + + const currentId = $(this).attr('id'); + const newId = currentId.replace(/\_(\d+)\_/, '_' + index + '_'); + $(this).attr('id', newId); + } + + clonedRow.find('input').each(function () { + setIndexes.call(this); + }); + + clonedRow.find('select').each(function () { + setIndexes.call(this); + }); + } + + function getSingleRow() { + const productsData = $('#dpdShippingOrderProducts').data('products'); + + return { + weight: getProductWeight(productsData, true), + weightAdr: null, + customerData: getData(productsData, 300, 'customer-source'), + content: getData(productsData, 300, 'content-source'), + sizeX: '', + sizeY: '', + sizeZ: '' + } + } + + } + + function setDpdShippingCustomShippingRows() { + const parcels = Number($('#dpdShippingCustomShippingParcels').val()); + const newOptions = generateParcelsArray(parcels); + + const elements = $('.dpdShippingCustomParcelSelect'); + + elements.each(function () { + const select = $(this) + select.empty(); + $.each(newOptions, function (index, value) { + select.append($('