Add InPost Pay integration to admin templates
- Created a new template for the cart rule form with custom label, switch, and choice widgets. - Implemented the InPost Pay block in the order details template for displaying delivery method, APM, and VAT invoice request. - Added legacy support for the order details template to maintain compatibility with older PrestaShop versions.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace izi\prestashop\CacheClearer;
|
||||
|
||||
use izi\prestashop\Repository\BasketSessionRepository;
|
||||
|
||||
final class BindingKeysCacheClearer implements CacheClearerInterface
|
||||
{
|
||||
/**
|
||||
* @var BasketSessionRepository
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
public function __construct(BasketSessionRepository $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function clear(): void
|
||||
{
|
||||
$this->repository->resetBindingKeysCache();
|
||||
}
|
||||
}
|
||||
10
modules/inpostizi/src/CacheClearer/CacheClearerInterface.php
Normal file
10
modules/inpostizi/src/CacheClearer/CacheClearerInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace izi\prestashop\CacheClearer;
|
||||
|
||||
interface CacheClearerInterface
|
||||
{
|
||||
public function clear();
|
||||
}
|
||||
28
modules/inpostizi/src/CacheClearer/ChainCacheClearer.php
Normal file
28
modules/inpostizi/src/CacheClearer/ChainCacheClearer.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace izi\prestashop\CacheClearer;
|
||||
|
||||
final class ChainCacheClearer implements CacheClearerInterface
|
||||
{
|
||||
/**
|
||||
* @var iterable|CacheClearerInterface[]
|
||||
*/
|
||||
private $clearers;
|
||||
|
||||
/**
|
||||
* @param iterable<CacheClearerInterface> $clearers
|
||||
*/
|
||||
public function __construct(iterable $clearers)
|
||||
{
|
||||
$this->clearers = $clearers;
|
||||
}
|
||||
|
||||
public function clear(): void
|
||||
{
|
||||
foreach ($this->clearers as $clearer) {
|
||||
$clearer->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
modules/inpostizi/src/CacheClearer/Psr16CacheClearer.php
Normal file
29
modules/inpostizi/src/CacheClearer/Psr16CacheClearer.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace izi\prestashop\CacheClearer;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
||||
final class Psr16CacheClearer implements CacheClearerInterface
|
||||
{
|
||||
/**
|
||||
* @var CacheInterface
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
public function __construct(CacheInterface $cache)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
public function clear(): void
|
||||
{
|
||||
if ($this->cache->clear()) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new \RuntimeException('Failed to clear cache.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user