mirror of
https://github.com/vr-payment/shopware-6.git
synced 2026-06-13 15:37:35 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 36ec0cac03 |
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
# 6.2.2
|
# 6.2.3
|
||||||
- Fixed issue with payment method availability rules being ignored
|
- Fix issue with cart clearing on payment method change
|
||||||
|
- Fixed issue with missing payment methods
|
||||||
|
|
||||||
# 6.2.1
|
# 6.2.1
|
||||||
- Fixed issue with multiple discount codes
|
- Fixed issue with multiple discount codes
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
# 6.2.2
|
# 6.2.3
|
||||||
- Problem behoben, bei dem die Verfügbarkeitsregeln für Zahlungsmethoden ignoriert wurden
|
- Problem mit dem Leeren des Warenkorbs bei Änderung der Zahlungsmethode behoben
|
||||||
|
- Problem mit fehlenden Zahlungsmethoden behoben
|
||||||
|
|
||||||
# 6.2.1
|
# 6.2.1
|
||||||
- Problem mit mehreren Rabattcodes behoben
|
- Problem mit mehreren Rabattcodes behoben
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ The VR Payment Payment Plugin integrates modern payment processing into Shopware
|
|||||||
- **VR Payment Account:** Obtain `Space ID`, `User ID`, and `API Key` from the [VR Payment Dashboard](https://gateway.vr-payment.de/).
|
- **VR Payment Account:** Obtain `Space ID`, `User ID`, and `API Key` from the [VR Payment Dashboard](https://gateway.vr-payment.de/).
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.2/docs/en/documentation.html)
|
- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.3/docs/en/documentation.html)
|
||||||
- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.2/docs/de/documentation.html)
|
- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.3/docs/de/documentation.html)
|
||||||
- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.2/docs/fr/documentation.html)
|
- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.3/docs/fr/documentation.html)
|
||||||
- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.2/docs/it/documentation.html)
|
- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/6.2.3/docs/it/documentation.html)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ Configure supported methods (e.g., credit cards, Apple Pay) via the [VR Payment
|
|||||||
___________________________________________________________________________________
|
___________________________________________________________________________________
|
||||||
| Shopware 6 version | Plugin major version | Supported until |
|
| Shopware 6 version | Plugin major version | Supported until |
|
||||||
|-------------------------------|------------------------|------------------------|
|
|-------------------------------|------------------------|------------------------|
|
||||||
| Shopware 6.6.x | 6.x | December 2026 |
|
| Shopware 6.6.x | 6.x | Further notice |
|
||||||
| Shopware 6.5.x | 5.x | October 2024 |
|
| Shopware 6.5.x | 5.x | October 2024 |
|
||||||
-----------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -59,5 +59,5 @@
|
|||||||
"vrpayment/sdk": "^4.0.0"
|
"vrpayment/sdk": "^4.0.0"
|
||||||
},
|
},
|
||||||
"type": "shopware-platform-plugin",
|
"type": "shopware-platform-plugin",
|
||||||
"version": "6.2.2"
|
"version": "6.2.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -684,6 +684,13 @@ class PaymentMethodConfigurationService {
|
|||||||
], $context);
|
], $context);
|
||||||
|
|
||||||
// Media insert/update
|
// Media insert/update
|
||||||
|
|
||||||
|
// detect if collision, return existing id
|
||||||
|
$existingId = $this->checkMediaAlreadyExists($paymentMethodConfiguration->getResolvedImageUrl(), $context);
|
||||||
|
if ($existingId) {
|
||||||
|
return $existingId;
|
||||||
|
}
|
||||||
|
|
||||||
$mediaDefinition = $this->container->get(MediaDefinition::class);
|
$mediaDefinition = $this->container->get(MediaDefinition::class);
|
||||||
$this->mediaSerializer->setRegistry($this->serializerRegistry);
|
$this->mediaSerializer->setRegistry($this->serializerRegistry);
|
||||||
|
|
||||||
@@ -704,6 +711,32 @@ class PaymentMethodConfigurationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the payment method icon is already uploaded.
|
||||||
|
*
|
||||||
|
* @param string $paymentMethodUrl
|
||||||
|
* @param \Shopware\Core\Framework\Context $context
|
||||||
|
*
|
||||||
|
* @return string|bool
|
||||||
|
*/
|
||||||
|
private function checkMediaAlreadyExists($paymentMethodUrl, $context) {
|
||||||
|
// detect if collision, return existing id
|
||||||
|
if (!preg_match('#/([^/]+)\.[^/.]+$#', $paymentMethodUrl, $matches)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$filename = $matches[1];
|
||||||
|
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->addFilter(new EqualsFilter('fileName', $filename));
|
||||||
|
|
||||||
|
$existing = $this->mediaRepository->search($criteria, $context)->first();
|
||||||
|
|
||||||
|
if ($existing) {
|
||||||
|
return $existing->getId();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves media default folder for a given payment method configuration.
|
* Retrieves media default folder for a given payment method configuration.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -609,13 +609,10 @@ class TransactionService
|
|||||||
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://';
|
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://';
|
||||||
$homeUrl = $protocol . $_SERVER['HTTP_HOST'];
|
$homeUrl = $protocol . $_SERVER['HTTP_HOST'];
|
||||||
$currency = $salesChannelContext->getCurrency()->getIsoCode();
|
$currency = $salesChannelContext->getCurrency()->getIsoCode();
|
||||||
$language = $this->localeCodeProvider->getLocaleCodeFromContext($salesChannelContext->getContext());
|
|
||||||
|
|
||||||
$transactionPayload = (new TransactionCreate())
|
$transactionPayload = (new TransactionCreate())
|
||||||
->setBillingAddress($billingAddress)
|
->setBillingAddress($billingAddress)
|
||||||
->setLineItems($lineItems)
|
->setLineItems($lineItems)
|
||||||
->setCurrency($currency)
|
->setCurrency($currency)
|
||||||
->setLanguage($language)
|
|
||||||
->setSpaceViewId($settings->getSpaceViewId())
|
->setSpaceViewId($settings->getSpaceViewId())
|
||||||
->setAutoConfirmationEnabled(false)
|
->setAutoConfirmationEnabled(false)
|
||||||
->setChargeRetryEnabled(false)
|
->setChargeRetryEnabled(false)
|
||||||
@@ -664,10 +661,7 @@ class TransactionService
|
|||||||
$billingAddress->setOrganizationName($customerBillingAddress->getCompany());
|
$billingAddress->setOrganizationName($customerBillingAddress->getCompany());
|
||||||
|
|
||||||
$currency = $salesChannelContext->getCurrency()->getIsoCode();
|
$currency = $salesChannelContext->getCurrency()->getIsoCode();
|
||||||
$language = $this->localeCodeProvider->getLocaleCodeFromContext($salesChannelContext->getContext());
|
|
||||||
|
|
||||||
$pendingTransaction->setCurrency($currency);
|
$pendingTransaction->setCurrency($currency);
|
||||||
$pendingTransaction->setLanguage($language);
|
|
||||||
$pendingTransaction->setBillingAddress($billingAddress);
|
$pendingTransaction->setBillingAddress($billingAddress);
|
||||||
|
|
||||||
$settings->getApiClient()->getTransactionService()
|
$settings->getApiClient()->getTransactionService()
|
||||||
|
|||||||
@@ -698,16 +698,6 @@ class WebHookController extends AbstractController {
|
|||||||
private function unholdAndCancelDelivery(string $orderId, Context $context): void
|
private function unholdAndCancelDelivery(string $orderId, Context $context): void
|
||||||
{
|
{
|
||||||
$order = $this->getOrderEntity($orderId, $context);
|
$order = $this->getOrderEntity($orderId, $context);
|
||||||
try {
|
|
||||||
$this->orderService->orderStateTransition(
|
|
||||||
$order->getId(),
|
|
||||||
StateMachineTransitionActions::ACTION_CANCEL,
|
|
||||||
new ParameterBag(),
|
|
||||||
$context
|
|
||||||
);
|
|
||||||
} catch (\Exception $exception) {
|
|
||||||
$this->logger->info($exception->getMessage(), $exception->getTrace());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -378,16 +378,6 @@ abstract class WebHookStrategyBase implements WebHookStrategyInterface {
|
|||||||
protected function unholdAndCancelDelivery(string $orderId, Context $context): void
|
protected function unholdAndCancelDelivery(string $orderId, Context $context): void
|
||||||
{
|
{
|
||||||
$order = $this->getOrderEntity($orderId, $context);
|
$order = $this->getOrderEntity($orderId, $context);
|
||||||
try {
|
|
||||||
$this->orderService->orderStateTransition(
|
|
||||||
$order->getId(),
|
|
||||||
StateMachineTransitionActions::ACTION_CANCEL,
|
|
||||||
new ParameterBag(),
|
|
||||||
$context
|
|
||||||
);
|
|
||||||
} catch (\Exception $exception) {
|
|
||||||
$this->logger->info($exception->getMessage(), $exception->getTrace());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ use VRPaymentPayment\Core\{
|
|||||||
Settings\Options\Integration,
|
Settings\Options\Integration,
|
||||||
Settings\Service\SettingsService,
|
Settings\Service\SettingsService,
|
||||||
Storefront\Checkout\Struct\CheckoutPageData,
|
Storefront\Checkout\Struct\CheckoutPageData,
|
||||||
Util\LocaleCodeProvider,
|
|
||||||
Util\Payload\CustomProducts\CustomProductsLineItemTypes,
|
Util\Payload\CustomProducts\CustomProductsLineItemTypes,
|
||||||
Util\Payload\TransactionPayload
|
Util\Payload\TransactionPayload
|
||||||
};
|
};
|
||||||
@@ -127,11 +126,6 @@ class CheckoutController extends StorefrontController {
|
|||||||
*/
|
*/
|
||||||
private CacheItemPoolInterface $cache;
|
private CacheItemPoolInterface $cache;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var LocaleCodeProvider
|
|
||||||
*/
|
|
||||||
private LocaleCodeProvider $localeCodeProvider;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PaymentController constructor.
|
* PaymentController constructor.
|
||||||
*
|
*
|
||||||
@@ -154,8 +148,7 @@ class CheckoutController extends StorefrontController {
|
|||||||
AbstractOrderRoute $orderRoute,
|
AbstractOrderRoute $orderRoute,
|
||||||
OrderTransactionStateHandler $orderTransactionStateHandler,
|
OrderTransactionStateHandler $orderTransactionStateHandler,
|
||||||
StateMachineRegistry $stateMachineRegistry,
|
StateMachineRegistry $stateMachineRegistry,
|
||||||
ParameterBagInterface $params,
|
ParameterBagInterface $params
|
||||||
LocaleCodeProvider $localeCodeProvider
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->cartService = $cartService;
|
$this->cartService = $cartService;
|
||||||
@@ -167,7 +160,6 @@ class CheckoutController extends StorefrontController {
|
|||||||
$this->orderTransactionStateHandler = $orderTransactionStateHandler;
|
$this->orderTransactionStateHandler = $orderTransactionStateHandler;
|
||||||
$this->stateMachineRegistry = $stateMachineRegistry;
|
$this->stateMachineRegistry = $stateMachineRegistry;
|
||||||
$this->cache = new FilesystemAdapter('vrpayment', 0, rtrim($params->get('kernel.cache_dir'), '/') . '/vrpayment-cache');
|
$this->cache = new FilesystemAdapter('vrpayment', 0, rtrim($params->get('kernel.cache_dir'), '/') . '/vrpayment-cache');
|
||||||
$this->localeCodeProvider = $localeCodeProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -251,9 +243,7 @@ class CheckoutController extends StorefrontController {
|
|||||||
return $this->redirect($recreateCartUrl, Response::HTTP_MOVED_PERMANENTLY);
|
return $this->redirect($recreateCartUrl, Response::HTTP_MOVED_PERMANENTLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
$localeCode = $this->localeCodeProvider->getLocaleCodeFromContext($salesChannelContext->getContext());
|
$javascriptUrl = $this->getTransactionJavaScriptUrl($transaction->getId());
|
||||||
$paymentPageLocale = $this->localeCodeProvider->mapToPaymentPageLocale($localeCode);
|
|
||||||
$javascriptUrl = $this->getTransactionJavaScriptUrl($transaction->getId(), $paymentPageLocale);
|
|
||||||
|
|
||||||
// Set Checkout Page Data
|
// Set Checkout Page Data
|
||||||
$checkoutPageData = (new CheckoutPageData())
|
$checkoutPageData = (new CheckoutPageData())
|
||||||
@@ -280,14 +270,13 @@ class CheckoutController extends StorefrontController {
|
|||||||
* Get transaction Javascript URL
|
* Get transaction Javascript URL
|
||||||
*
|
*
|
||||||
* @param int $transactionId
|
* @param int $transactionId
|
||||||
* @param string $paymentPageLocale The payment page locale.
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @throws \VRPayment\Sdk\ApiException
|
* @throws \VRPayment\Sdk\ApiException
|
||||||
* @throws \VRPayment\Sdk\Http\ConnectionException
|
* @throws \VRPayment\Sdk\Http\ConnectionException
|
||||||
* @throws \VRPayment\Sdk\VersioningException
|
* @throws \VRPayment\Sdk\VersioningException
|
||||||
*/
|
*/
|
||||||
private function getTransactionJavaScriptUrl(int $transactionId, string $paymentPageLocale = ''): string
|
private function getTransactionJavaScriptUrl(int $transactionId): string
|
||||||
{
|
{
|
||||||
$javascriptUrl = '';
|
$javascriptUrl = '';
|
||||||
switch ($this->settings->getIntegration()) {
|
switch ($this->settings->getIntegration()) {
|
||||||
@@ -303,12 +292,6 @@ class CheckoutController extends StorefrontController {
|
|||||||
$this->logger->critical(strtr('invalid integration : :integration', [':integration' => $this->settings->getIntegration()]));
|
$this->logger->critical(strtr('invalid integration : :integration', [':integration' => $this->settings->getIntegration()]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($javascriptUrl && $paymentPageLocale) {
|
|
||||||
$separator = str_contains($javascriptUrl, '?') ? '&' : '?';
|
|
||||||
$javascriptUrl .= $separator . 'language=' . $paymentPageLocale;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $javascriptUrl;
|
return $javascriptUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ use Shopware\Core\{Checkout\Order\Aggregate\OrderTransaction\OrderTransactionCol
|
|||||||
Checkout\Order\OrderEntity,
|
Checkout\Order\OrderEntity,
|
||||||
Content\MailTemplate\Service\Event\MailBeforeValidateEvent};
|
Content\MailTemplate\Service\Event\MailBeforeValidateEvent};
|
||||||
use Shopware\Core\Checkout\Payment\PaymentMethodCollection;
|
use Shopware\Core\Checkout\Payment\PaymentMethodCollection;
|
||||||
|
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
|
||||||
|
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
|
||||||
|
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
|
||||||
|
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\MultiFilter;
|
||||||
use Shopware\Core\System\SalesChannel\SalesChannelContext;
|
use Shopware\Core\System\SalesChannel\SalesChannelContext;
|
||||||
use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent;
|
use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent;
|
||||||
use Shopware\Storefront\Page\Account\PaymentMethod\AccountPaymentMethodPageLoadedEvent;
|
use Shopware\Storefront\Page\Account\PaymentMethod\AccountPaymentMethodPageLoadedEvent;
|
||||||
@@ -35,6 +39,7 @@ use VRPaymentPayment\Sdk\{Model\AddressCreate,
|
|||||||
Model\TransactionCreate,
|
Model\TransactionCreate,
|
||||||
Model\TransactionPending};
|
Model\TransactionPending};
|
||||||
use Shopware\Core\Framework\Struct\ArrayEntity;
|
use Shopware\Core\Framework\Struct\ArrayEntity;
|
||||||
|
use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CheckoutSubscriber
|
* Class CheckoutSubscriber
|
||||||
@@ -69,6 +74,9 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
private $paymentMethodUtil;
|
private $paymentMethodUtil;
|
||||||
|
|
||||||
|
/** @var EntityRepository */
|
||||||
|
private EntityRepository $paymentMethodRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CheckoutSubscriber constructor.
|
* CheckoutSubscriber constructor.
|
||||||
*
|
*
|
||||||
@@ -77,12 +85,13 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
* @param \VRPaymentPayment\Core\Settings\Service\SettingsService $settingsService
|
* @param \VRPaymentPayment\Core\Settings\Service\SettingsService $settingsService
|
||||||
* @param \VRPaymentPayment\Core\Util\PaymentMethodUtil $paymentMethodUtil
|
* @param \VRPaymentPayment\Core\Util\PaymentMethodUtil $paymentMethodUtil
|
||||||
*/
|
*/
|
||||||
public function __construct(PaymentMethodConfigurationService $paymentMethodConfigurationService, TransactionService $transactionService, SettingsService $settingsService, PaymentMethodUtil $paymentMethodUtil)
|
public function __construct(PaymentMethodConfigurationService $paymentMethodConfigurationService, TransactionService $transactionService, SettingsService $settingsService, PaymentMethodUtil $paymentMethodUtil, EntityRepository $paymentMethodRepository)
|
||||||
{
|
{
|
||||||
$this->paymentMethodConfigurationService = $paymentMethodConfigurationService;
|
$this->paymentMethodConfigurationService = $paymentMethodConfigurationService;
|
||||||
$this->transactionService = $transactionService;
|
$this->transactionService = $transactionService;
|
||||||
$this->settingsService = $settingsService;
|
$this->settingsService = $settingsService;
|
||||||
$this->paymentMethodUtil = $paymentMethodUtil;
|
$this->paymentMethodUtil = $paymentMethodUtil;
|
||||||
|
$this->paymentMethodRepository = $paymentMethodRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,25 +293,26 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the original payment method collection (which already has Shopware's availability rules applied)
|
|
||||||
* to only include WhitelabelMachineName methods that are also allowed by the API.
|
|
||||||
* Non-WhitelabelMachineName methods are kept as-is.
|
|
||||||
*
|
|
||||||
* @param int $spaceId
|
* @param int $spaceId
|
||||||
* @param $event
|
* @param CheckoutConfirmPageLoadedEvent $event
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function setPossiblePaymentMethods(int $spaceId, $event): void
|
private function setPossiblePaymentMethods(int $spaceId, $event): void
|
||||||
{
|
{
|
||||||
|
$paymentIds = [];
|
||||||
$paymentMethodCollection = $event->getPage()->getPaymentMethods();
|
$paymentMethodCollection = $event->getPage()->getPaymentMethods();
|
||||||
|
|
||||||
|
foreach ($paymentMethodCollection as $paymentMethodCollectionItem) {
|
||||||
|
$isVRPaymentPM = VRPaymentPaymentHandler::class === $paymentMethodCollectionItem->getHandlerIdentifier();
|
||||||
|
if (!$isVRPaymentPM) {
|
||||||
|
$paymentIds[] = $paymentMethodCollectionItem->getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$allowedWLMethods = [];
|
||||||
$paymentMethodConfigurations = $this->paymentMethodConfigurationService
|
$paymentMethodConfigurations = $this->paymentMethodConfigurationService
|
||||||
->getAllPaymentMethodConfigurations($spaceId, $event->getSalesChannelContext()->getContext());
|
->getAllPaymentMethodConfigurations($spaceId, $event->getSalesChannelContext()->getContext());
|
||||||
|
|
||||||
$allowedIds = $this->getAllowedPaymentMethodIds($event->getSalesChannelContext());
|
|
||||||
|
|
||||||
// Build a map of Shopware payment method ID => configuration for methods allowed by the API.
|
|
||||||
$allowedWLConfigByPmId = [];
|
|
||||||
foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) {
|
foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) {
|
||||||
if ($paymentMethodConfiguration->getPaymentMethod() === null) {
|
if ($paymentMethodConfiguration->getPaymentMethod() === null) {
|
||||||
continue;
|
continue;
|
||||||
@@ -310,33 +320,32 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
$pmId = $paymentMethodConfiguration->getPaymentMethod()->getId();
|
$pmId = $paymentMethodConfiguration->getPaymentMethod()->getId();
|
||||||
$pmConfigId = $paymentMethodConfiguration->getPaymentMethodConfigurationId();
|
$pmConfigId = $paymentMethodConfiguration->getPaymentMethodConfigurationId();
|
||||||
|
$allowedIds = $this->getAllowedPaymentMethodIds($event->getSalesChannelContext());
|
||||||
|
|
||||||
if ($paymentMethodConfiguration->getSpaceId() === $spaceId
|
if ($paymentMethodConfiguration->getSpaceId() === $spaceId
|
||||||
&& \in_array($pmConfigId, $allowedIds, true)) {
|
&& \in_array($pmConfigId, $allowedIds, true)) {
|
||||||
$allowedWLConfigByPmId[$pmId] = $paymentMethodConfiguration;
|
$allowedWLMethods[] = $pmId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter the original collection to preserve Shopware's availability rule filtering.
|
$allPaymentIds = array_unique(array_merge($paymentIds, $allowedWLMethods));
|
||||||
// Non-WLM methods pass through unchanged; WLM methods are kept only if allowed by the API.
|
|
||||||
$collection = new PaymentMethodCollection();
|
$collection = new PaymentMethodCollection();
|
||||||
foreach ($paymentMethodCollection as $method) {
|
if (!empty($allPaymentIds)) {
|
||||||
$isVRPaymentPM = VRPaymentPaymentHandler::class === $method->getHandlerIdentifier();
|
$criteria = new Criteria($allPaymentIds);
|
||||||
|
$criteria->addFilter(new EqualsFilter('active', true));
|
||||||
|
$criteria->addFilter(
|
||||||
|
new EqualsFilter('salesChannels.id', $event->getSalesChannelContext()->getSalesChannelId())
|
||||||
|
);
|
||||||
|
$criteria->addSorting(new FieldSorting('position', FieldSorting::ASCENDING));
|
||||||
|
$criteria->addAssociation('media');
|
||||||
|
|
||||||
if (!$isVRPaymentPM) {
|
$result = $this->paymentMethodRepository->search($criteria, $event->getContext());
|
||||||
$collection->add($method);
|
foreach ($result->getEntities() as $method) {
|
||||||
continue;
|
if (!$collection->has($method->getId())) {
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($allowedWLConfigByPmId[$method->getId()])) {
|
|
||||||
$method->addExtension('vrpayment_config', $allowedWLConfigByPmId[$method->getId()]);
|
|
||||||
$collection->add($method);
|
$collection->add($method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$collection->sort(function ($a, $b) {
|
|
||||||
return ($a->getPosition() ?? 0) <=> ($b->getPosition() ?? 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
$event->getPage()->setPaymentMethods($collection);
|
$event->getPage()->setPaymentMethods($collection);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Analytics {
|
|||||||
self::SHOP_SYSTEM => 'shopware',
|
self::SHOP_SYSTEM => 'shopware',
|
||||||
self::SHOP_SYSTEM_VERSION => $shopwareVersion,
|
self::SHOP_SYSTEM_VERSION => $shopwareVersion,
|
||||||
self::SHOP_SYSTEM_AND_VERSION => 'shopware-' . $shopwareVersion,
|
self::SHOP_SYSTEM_AND_VERSION => 'shopware-' . $shopwareVersion,
|
||||||
self::PLUGIN_SYSTEM_VERSION => '6.2.2',
|
self::PLUGIN_SYSTEM_VERSION => '6.2.3',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,26 +91,6 @@ class LocaleCodeProvider {
|
|||||||
return $language->getLocale() ? $language->getLocale()->getCode() : $defaultLocale;
|
return $language->getLocale() ? $language->getLocale()->getCode() : $defaultLocale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Maps a locale code to a VRPayment-supported payment page locale by matching the language prefix.
|
|
||||||
* E.g. de-CH -> de-DE, fr-CH -> fr-FR, en-US -> en-GB, it-CH -> it-IT.
|
|
||||||
*
|
|
||||||
* @param string $localeCode
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function mapToPaymentPageLocale(string $localeCode): string
|
|
||||||
{
|
|
||||||
$supportedLocales = [
|
|
||||||
'de' => self::LOCALE_GERMANY_GERMAN,
|
|
||||||
'fr' => self::LOCALE_FRANCE_FRENCH,
|
|
||||||
'it' => self::LOCALE_ITALY_ITALIAN,
|
|
||||||
'en' => self::LOCALE_GREAT_BRITAIN_ENGLISH,
|
|
||||||
];
|
|
||||||
|
|
||||||
$languagePrefix = substr($localeCode, 0, 2);
|
|
||||||
|
|
||||||
return $supportedLocales[$languagePrefix] ?? self::LOCALE_GREAT_BRITAIN_ENGLISH;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Shopware\Core\Framework\Context $context
|
* @param \Shopware\Core\Framework\Context $context
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
<argument type="service" id="Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStateHandler"/>
|
<argument type="service" id="Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStateHandler"/>
|
||||||
<argument type="service" id="Shopware\Core\System\StateMachine\StateMachineRegistry"/>
|
<argument type="service" id="Shopware\Core\System\StateMachine\StateMachineRegistry"/>
|
||||||
<argument type="service" id="Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface"/>
|
<argument type="service" id="Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface"/>
|
||||||
<argument type="service" id="VRPaymentPayment\Core\Util\LocaleCodeProvider"/>
|
|
||||||
<call method="setLogger">
|
<call method="setLogger">
|
||||||
<argument type="service" id="monolog.logger.vrpayment_payment"/>
|
<argument type="service" id="monolog.logger.vrpayment_payment"/>
|
||||||
</call>
|
</call>
|
||||||
@@ -34,6 +33,7 @@
|
|||||||
<argument id="VRPaymentPayment\Core\Api\Transaction\Service\TransactionService" type="service"/>
|
<argument id="VRPaymentPayment\Core\Api\Transaction\Service\TransactionService" type="service"/>
|
||||||
<argument id="VRPaymentPayment\Core\Settings\Service\SettingsService" type="service"/>
|
<argument id="VRPaymentPayment\Core\Settings\Service\SettingsService" type="service"/>
|
||||||
<argument id="VRPaymentPayment\Core\Util\PaymentMethodUtil" type="service"/>
|
<argument id="VRPaymentPayment\Core\Util\PaymentMethodUtil" type="service"/>
|
||||||
|
<argument id="payment_method.repository" type="service"/>
|
||||||
<call method="setLogger">
|
<call method="setLogger">
|
||||||
<argument type="service" id="monolog.logger.vrpayment_payment"/>
|
<argument type="service" id="monolog.logger.vrpayment_payment"/>
|
||||||
</call>
|
</call>
|
||||||
|
|||||||
Reference in New Issue
Block a user