diff --git a/config/config.yml b/config/config.yml index f200194da..22825106d 100644 --- a/config/config.yml +++ b/config/config.yml @@ -22,7 +22,7 @@ services: Mollie\Install\Installer: arguments: - '@mollie' - - '@Mollie\Service\ImageService' + - '@Mollie\Service\OrderStateImageService' - '@Mollie\Install\DatabaseTableInstaller' Mollie\Install\Uninstall: diff --git a/config/service.yml b/config/service.yml index f222831de..008f7b2cc 100644 --- a/config/service.yml +++ b/config/service.yml @@ -54,7 +54,7 @@ services: Mollie\Service\ErrorDisplayService: - Mollie\Service\ImageService: + Mollie\Service\OrderStateImageService: Mollie\Service\CountryService: arguments: diff --git a/logo.gif b/logo.gif index fc8b573a6..a3311bb1a 100644 Binary files a/logo.gif and b/logo.gif differ diff --git a/logo.png b/logo.png index 0092ec331..a3311bb1a 100644 Binary files a/logo.png and b/logo.png differ diff --git a/src/Install/Installer.php b/src/Install/Installer.php index 1770086bb..a278eddf1 100644 --- a/src/Install/Installer.php +++ b/src/Install/Installer.php @@ -45,7 +45,7 @@ use Language; use Mollie; use Mollie\Config\Config; -use Mollie\Service\ImageService; +use Mollie\Service\OrderStateImageService; use Mollie\Utility\MultiLangUtility; use OrderState; use PrestaShopDatabaseException; @@ -69,7 +69,7 @@ class Installer implements InstallerInterface private $module; /** - * @var ImageService + * @var OrderStateImageService */ private $imageService; @@ -80,7 +80,7 @@ class Installer implements InstallerInterface public function __construct( Mollie $module, - ImageService $imageService, + OrderStateImageService $imageService, InstallerInterface $databaseTableInstaller ) { $this->module = $module; diff --git a/src/Service/ImageService.php b/src/Service/OrderStateImageService.php similarity index 72% rename from src/Service/ImageService.php rename to src/Service/OrderStateImageService.php index 9db3dbd20..b4bf2b35b 100644 --- a/src/Service/ImageService.php +++ b/src/Service/OrderStateImageService.php @@ -35,12 +35,43 @@ namespace Mollie\Service; -class ImageService +class OrderStateImageService { + /** + * @var int + */ public function createOrderStateLogo($orderStateId) { $source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png'; $destination = _PS_ORDER_STATE_IMG_DIR_ . $orderStateId . '.gif'; @copy($source, $destination); } + + /** + * @var int + */ + public function deleteOrderStateLogo($orderStateId) + { + $destination = _PS_ORDER_STATE_IMG_DIR_ . $orderStateId . '.gif'; + @unlink($destination); + } + + /** + * @var int + */ + public function createTemporaryOrderStateLogo($orderStateId) + { + $source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png'; + $destination = _PS_TMP_IMG_DIR_ . 'order_state_mini_' . $orderStateId . '_1.gif'; + @copy($source, $destination); + } + + /** + * @var int + */ + public function deleteTemporaryOrderStateLogo($orderStateId) + { + $destination = _PS_TMP_IMG_DIR_ . 'order_state_mini_' . $orderStateId . '_1.gif'; + @unlink($destination); + } } diff --git a/upgrade/Upgrade-4.2.0.php b/upgrade/Upgrade-4.2.0.php index 6a2298da3..b90123611 100644 --- a/upgrade/Upgrade-4.2.0.php +++ b/upgrade/Upgrade-4.2.0.php @@ -35,6 +35,7 @@ use Mollie\Config\Config; use Mollie\Install\Installer; +use Mollie\Service\OrderStateImageService; if (!defined('_PS_VERSION_')) { exit; @@ -71,5 +72,22 @@ function upgrade_module_4_2_0($module) ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;' ); + /** + * @var OrderStateImageService $imageService + */ + $imageService = $module->getMollieContainer(OrderStateImageService::class); + $mollieOrderStatuses = Config::getMollieOrderStatuses(); + + foreach ($mollieOrderStatuses as $mollieOrderStatus) { + $orderStatusId = Configuration::get($mollieOrderStatus); + + if ($orderStatusId) { + $imageService->deleteOrderStateLogo($orderStatusId); + $imageService->deleteTemporaryOrderStateLogo($orderStatusId); + $imageService->createOrderStateLogo($orderStatusId); + $imageService->createTemporaryOrderStateLogo($orderStatusId); + } + } + return true; } diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index fce8549f0..1a58957d2 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -37,8 +37,8 @@ * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { @@ -60,7 +60,7 @@ class ClassLoader public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index 62ecfd8d0..f27399a04 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,3 +1,4 @@ + Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy @@ -17,3 +18,4 @@ 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/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 1b299ff25..1023233bf 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -11,6 +11,7 @@ 'ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => $vendorDir . '/composer/autoload_real.php', 'Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php', 'Composer\\Autoload\\ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => $vendorDir . '/composer/autoload_static.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'MolCarrierInformation' => $baseDir . '/src/Entity/MolCarrierInformation.php', 'MolCustomer' => $baseDir . '/src/Entity/MolCustomer.php', 'MolOrderFee' => $baseDir . '/src/Entity/MolOrderFee.php', @@ -47,9 +48,9 @@ 'MolliePrefix\\Constant_Check' => $vendorDir . '/prestashop/php-dev-tools/tests/modules_samples/constant_check/constant_check.php', 'MolliePrefix\\DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php', 'MolliePrefix\\Error' => $vendorDir . '/paragonie/random_compat/lib/error_polyfill.php', - 'MolliePrefix\\Fakemodule' => $vendorDir . '/prestashop/header-stamp/tests/integration/expected/fakemodule/fakemodule.php', + 'MolliePrefix\\Fakemodule' => $vendorDir . '/prestashop/header-stamp/tests/integration/module-samples/fakemodule/fakemodule.php', 'MolliePrefix\\FolderComparator' => $vendorDir . '/prestashop/header-stamp/tests/integration/runner/FolderComparator.php', - 'MolliePrefix\\Gsitemap' => $vendorDir . '/prestashop/header-stamp/tests/integration/expected/gsitemap/gsitemap.php', + 'MolliePrefix\\Gsitemap' => $vendorDir . '/prestashop/header-stamp/tests/integration/module-samples/gsitemap/gsitemap.php', 'MolliePrefix\\GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php', 'MolliePrefix\\GuzzleHttp\\ClientInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ClientInterface.php', 'MolliePrefix\\GuzzleHttp\\Cookie\\CookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php', @@ -824,7 +825,7 @@ 'MolliePrefix\\Symfony\\Polyfill\\Php70\\Php70' => $vendorDir . '/symfony/polyfill-php70/Php70.php', 'MolliePrefix\\Symfony\\Polyfill\\Php72\\Php72' => $vendorDir . '/symfony/polyfill-php72/Php72.php', 'MolliePrefix\\TypeError' => $vendorDir . '/paragonie/random_compat/lib/error_polyfill.php', - 'MolliePrefix\\dashproducts' => $vendorDir . '/prestashop/header-stamp/tests/integration/expected/dashproducts/dashproducts.php', + 'MolliePrefix\\dashproducts' => $vendorDir . '/prestashop/header-stamp/tests/integration/module-samples/dashproducts/dashproducts.php', 'MollieQrcodeModuleFrontController' => $baseDir . '/controllers/front/qrcode.php', 'MollieReturnModuleFrontController' => $baseDir . '/controllers/front/return.php', 'MollieWebhookModuleFrontController' => $baseDir . '/controllers/front/webhook.php', @@ -911,7 +912,6 @@ 'Mollie\\Service\\CustomerService' => $baseDir . '/src/Service/CustomerService.php', 'Mollie\\Service\\ErrorDisplayService' => $baseDir . '/src/Service/ErrorDisplayService.php', 'Mollie\\Service\\ExceptionService' => $baseDir . '/src/Service/ExceptionService.php', - 'Mollie\\Service\\ImageService' => $baseDir . '/src/Service/ImageService.php', 'Mollie\\Service\\IssuerService' => $baseDir . '/src/Service/IssuerService.php', 'Mollie\\Service\\LanguageService' => $baseDir . '/src/Service/LanguageService.php', 'Mollie\\Service\\MailService' => $baseDir . '/src/Service/MailService.php', @@ -921,6 +921,7 @@ 'Mollie\\Service\\MolliePaymentMailService' => $baseDir . '/src/Service/MolliePaymentMailService.php', 'Mollie\\Service\\OrderCartAssociationService' => $baseDir . '/src/Service/OrderCartAssociationService.php', 'Mollie\\Service\\OrderFeeService' => $baseDir . '/src/Service/OrderFeeService.php', + 'Mollie\\Service\\OrderStateImageService' => $baseDir . '/src/Service/OrderStateImageService.php', 'Mollie\\Service\\OrderStatusService' => $baseDir . '/src/Service/OrderStatusService.php', 'Mollie\\Service\\PaymentMethodService' => $baseDir . '/src/Service/PaymentMethodService.php', 'Mollie\\Service\\PaymentMethod\\PaymentMethodSortProvider' => $baseDir . '/src/Service/PaymentMethod/PaymentMethodSortProvider.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 3aa62dcb4..376dee4bd 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -22,13 +22,15 @@ public static function getLoader() return self::$loader; } + require __DIR__ . '/platform_check.php'; + spl_autoload_register(array('ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc', 'loadClassLoader'), true, false); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; + require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc::getInitializer($loader)); } else { diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 31339cb9c..d3070867a 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -236,6 +236,7 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc 'ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => __DIR__ . '/..' . '/composer/autoload_real.php', 'Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/composer/ClassLoader.php', 'Composer\\Autoload\\ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => __DIR__ . '/..' . '/composer/autoload_static.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'MolCarrierInformation' => __DIR__ . '/../..' . '/src/Entity/MolCarrierInformation.php', 'MolCustomer' => __DIR__ . '/../..' . '/src/Entity/MolCustomer.php', 'MolOrderFee' => __DIR__ . '/../..' . '/src/Entity/MolOrderFee.php', @@ -272,9 +273,9 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc 'MolliePrefix\\Constant_Check' => __DIR__ . '/..' . '/prestashop/php-dev-tools/tests/modules_samples/constant_check/constant_check.php', 'MolliePrefix\\DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php', 'MolliePrefix\\Error' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php', - 'MolliePrefix\\Fakemodule' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/expected/fakemodule/fakemodule.php', + 'MolliePrefix\\Fakemodule' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/module-samples/fakemodule/fakemodule.php', 'MolliePrefix\\FolderComparator' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/runner/FolderComparator.php', - 'MolliePrefix\\Gsitemap' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/expected/gsitemap/gsitemap.php', + 'MolliePrefix\\Gsitemap' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/module-samples/gsitemap/gsitemap.php', 'MolliePrefix\\GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php', 'MolliePrefix\\GuzzleHttp\\ClientInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ClientInterface.php', 'MolliePrefix\\GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php', @@ -1049,7 +1050,7 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc 'MolliePrefix\\Symfony\\Polyfill\\Php70\\Php70' => __DIR__ . '/..' . '/symfony/polyfill-php70/Php70.php', 'MolliePrefix\\Symfony\\Polyfill\\Php72\\Php72' => __DIR__ . '/..' . '/symfony/polyfill-php72/Php72.php', 'MolliePrefix\\TypeError' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php', - 'MolliePrefix\\dashproducts' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/expected/dashproducts/dashproducts.php', + 'MolliePrefix\\dashproducts' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/module-samples/dashproducts/dashproducts.php', 'MollieQrcodeModuleFrontController' => __DIR__ . '/../..' . '/controllers/front/qrcode.php', 'MollieReturnModuleFrontController' => __DIR__ . '/../..' . '/controllers/front/return.php', 'MollieWebhookModuleFrontController' => __DIR__ . '/../..' . '/controllers/front/webhook.php', @@ -1136,7 +1137,6 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc 'Mollie\\Service\\CustomerService' => __DIR__ . '/../..' . '/src/Service/CustomerService.php', 'Mollie\\Service\\ErrorDisplayService' => __DIR__ . '/../..' . '/src/Service/ErrorDisplayService.php', 'Mollie\\Service\\ExceptionService' => __DIR__ . '/../..' . '/src/Service/ExceptionService.php', - 'Mollie\\Service\\ImageService' => __DIR__ . '/../..' . '/src/Service/ImageService.php', 'Mollie\\Service\\IssuerService' => __DIR__ . '/../..' . '/src/Service/IssuerService.php', 'Mollie\\Service\\LanguageService' => __DIR__ . '/../..' . '/src/Service/LanguageService.php', 'Mollie\\Service\\MailService' => __DIR__ . '/../..' . '/src/Service/MailService.php', @@ -1146,6 +1146,7 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc 'Mollie\\Service\\MolliePaymentMailService' => __DIR__ . '/../..' . '/src/Service/MolliePaymentMailService.php', 'Mollie\\Service\\OrderCartAssociationService' => __DIR__ . '/../..' . '/src/Service/OrderCartAssociationService.php', 'Mollie\\Service\\OrderFeeService' => __DIR__ . '/../..' . '/src/Service/OrderFeeService.php', + 'Mollie\\Service\\OrderStateImageService' => __DIR__ . '/../..' . '/src/Service/OrderStateImageService.php', 'Mollie\\Service\\OrderStatusService' => __DIR__ . '/../..' . '/src/Service/OrderStatusService.php', 'Mollie\\Service\\PaymentMethodService' => __DIR__ . '/../..' . '/src/Service/PaymentMethodService.php', 'Mollie\\Service\\PaymentMethod\\PaymentMethodSortProvider' => __DIR__ . '/../..' . '/src/Service/PaymentMethod/PaymentMethodSortProvider.php', diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index aace02733..8b379f446 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -1,22 +1,26 @@ = 50600)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . \PHP_VERSION . '.'; + +if (!(PHP_VERSION_ID >= 50600)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.'; } + if ($issues) { - if (!\headers_sent()) { - \header('HTTP/1.1 500 Internal Server Error'); + 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; + 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; } } - \trigger_error('Composer detected issues in your platform: ' . \implode(' ', $issues), \E_USER_ERROR); + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); } diff --git a/views/img/logo_small.png b/views/img/logo_small.png index d55ffbdbe..a3311bb1a 100644 Binary files a/views/img/logo_small.png and b/views/img/logo_small.png differ