mirror of
https://github.com/vr-payment/shopware-6.git
synced 2026-06-04 10:53:18 +00:00
Release 7.1.2
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
# 7.1.2
|
||||||
|
- Support the ability to have different spaces for differet sales channels
|
||||||
|
- Fixed issue where Twint would not appear sometimes
|
||||||
|
|
||||||
|
# 7.1.1
|
||||||
|
- Updated documentation
|
||||||
|
- Fixed issue with addresses not being correctly synced
|
||||||
|
|
||||||
# 7.1.0
|
# 7.1.0
|
||||||
## Feature
|
## Feature
|
||||||
- Support subscription payment methods
|
- Support subscription payment methods
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
# 7.1.2
|
||||||
|
- Unterstützung der Möglichkeit, unterschiedliche Bereiche für verschiedene Vertriebskanäle zu nutzen.
|
||||||
|
- Problem behoben, bei dem Twint manchmal nicht angezeigt wurde.
|
||||||
|
|
||||||
|
# 7.1.1
|
||||||
|
- Dokumentation aktualisiert
|
||||||
|
- Problem behoben, bei dem Adressen nicht korrekt synchronisiert wurden.
|
||||||
|
|
||||||
# 7.1.0
|
# 7.1.0
|
||||||
– Unterstützung für Abonnement-Zahlungsmethoden
|
– Unterstützung für Abonnement-Zahlungsmethoden
|
||||||
– Support für Shopware 6.7.2.0
|
– Support für Shopware 6.7.2.0
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ Please note that this plugin is for versions 6.5, 6.6 or 6.7. For the 6.4 plugin
|
|||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- For English documentation click [here](@WalleeDocPath(/docs/en/documentation.html))
|
- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.2/docs/en/documentation.html)
|
||||||
- Für die deutsche Dokumentation klicken Sie [hier](@WalleeDocPath(/docs/de/documentation.html))
|
- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.2/docs/de/documentation.html)
|
||||||
- Pour la documentation Française, cliquez [ici](@WalleeDocPath(/docs/fr/documentation.html))
|
- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.2/docs/fr/documentation.html)
|
||||||
- Per la documentazione in tedesco, clicca [qui](@WalleeDocPath(/docs/it/documentation.html))
|
- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.1.2/docs/it/documentation.html)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
+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": "7.1.1"
|
"version": "7.1.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
||||||
<link rel="canonical" href="@WalleeCanonicalPath(https://plugin-documentation.wallee.com/wallee-payment, VRPaymentPayment/docs/de/documentation.html)" />
|
<link rel="canonical" href="https://plugin-documentation.wallee.com/wallee-payment/shopware-6/master/VRPaymentPayment/docs/de/documentation.html" />
|
||||||
<title>VR Payment Zahlungs-Plugin für Shopware 6</title>
|
<title>VR Payment Zahlungs-Plugin für Shopware 6</title>
|
||||||
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
||||||
<link href="assets/base.css" rel="stylesheet" />
|
<link href="assets/base.css" rel="stylesheet" />
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="@WalleeReleasePath()">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.2/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
||||||
<link rel="canonical" href="@WalleeCanonicalPath(https://plugin-documentation.wallee.com/wallee-payment, VRPaymentPayment/docs/en/documentation.html)" />
|
<link rel="canonical" href="https://plugin-documentation.wallee.com/wallee-payment/shopware-6/master/VRPaymentPayment/docs/en/documentation.html" />
|
||||||
<title>VR Payment Shopware 6 Documentation</title>
|
<title>VR Payment Shopware 6 Documentation</title>
|
||||||
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
||||||
<link href="assets/base.css" rel="stylesheet" />
|
<link href="assets/base.css" rel="stylesheet" />
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="@WalleeReleasePath()">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.2/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
||||||
<link rel="canonical" href="@WalleeCanonicalPath(https://plugin-documentation.wallee.com/wallee-payment, VRPaymentPayment/docs/fr/documentation.html)" />
|
<link rel="canonical" href="https://plugin-documentation.wallee.com/wallee-payment/shopware-6/master/VRPaymentPayment/docs/fr/documentation.html" />
|
||||||
<title>VR Payment Plugin pour Shopware 6</title>
|
<title>VR Payment Plugin pour Shopware 6</title>
|
||||||
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
||||||
<link href="assets/base.css" rel="stylesheet" />
|
<link href="assets/base.css" rel="stylesheet" />
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="@WalleeReleasePath()">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.2/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
<meta name="keywords" value="VR Payment, Shopware, Shopware Plugin, Payment, Payment Integration, Documentation"><meta name="description" value="The documentation for the Shopware 6 plugin that enables processing payments with VR Payment.">
|
||||||
<link rel="canonical" href="@WalleeCanonicalPath(https://plugin-documentation.wallee.com/wallee-payment, VRPaymentPayment/docs/it/documentation.html)" />
|
<link rel="canonical" href="https://plugin-documentation.wallee.com/wallee-payment/shopware-6/master/VRPaymentPayment/docs/it/documentation.html" />
|
||||||
<title>VR Payment Shopware 6 Documentation</title>
|
<title>VR Payment Shopware 6 Documentation</title>
|
||||||
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
<link href="assets/monokai-sublime.css" rel="stylesheet" />
|
||||||
<link href="assets/base.css" rel="stylesheet" />
|
<link href="assets/base.css" rel="stylesheet" />
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="@WalleeReleasePath()">
|
<a href="https://github.com/vr-payment/shopware-6/releases/tag/7.1.2/">
|
||||||
Source
|
Source
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+123
-102
@@ -251,9 +251,9 @@ class PaymentMethodConfigurationService {
|
|||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
$paymentMethodData = [];
|
$paymentMethodData = [];
|
||||||
$salesChannelPaymentMethodData = [];
|
|
||||||
|
|
||||||
$criteria = (new Criteria())->addFilter(new EqualsFilter('state', 'ACTIVE'));
|
$criteria = (new Criteria())->addFilter(new EqualsFilter('state', 'ACTIVE'))
|
||||||
|
->addFilter(new EqualsFilter('spaceId', $this->getSpaceId()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $vRPaymentPMConfigurationRepository
|
* @var $vRPaymentPMConfigurationRepository
|
||||||
@@ -344,40 +344,67 @@ class PaymentMethodConfigurationService {
|
|||||||
$paymentMethodConfigurations = $this->getPaymentMethodConfigurations();
|
$paymentMethodConfigurations = $this->getPaymentMethodConfigurations();
|
||||||
$this->logger->debug('Updating payment methods', $paymentMethodConfigurations);
|
$this->logger->debug('Updating payment methods', $paymentMethodConfigurations);
|
||||||
|
|
||||||
/**
|
|
||||||
* @var $paymentMethodConfiguration \VRPayment\Sdk\Model\PaymentMethodConfiguration
|
|
||||||
*/
|
|
||||||
foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) {
|
foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) {
|
||||||
|
$entity = $this->getPaymentMethodConfigurationEntity(
|
||||||
$paymentMethodConfigurationEntity = $this->getPaymentMethodConfigurationEntity(
|
$paymentMethodConfiguration->getSpaceId(),
|
||||||
$paymentMethodConfiguration->getSpaceId(),
|
$paymentMethodConfiguration->getId(),
|
||||||
$paymentMethodConfiguration->getId(),
|
$context
|
||||||
$context
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$id = is_null($paymentMethodConfigurationEntity) ? Uuid::randomHex() : $paymentMethodConfigurationEntity->getId();
|
$configId = $entity ? $entity->getId() : Uuid::randomHex();
|
||||||
|
$technicalName = $paymentMethodConfiguration->getName();
|
||||||
|
|
||||||
|
$paymentMethodId = $this->getOrCreatePaymentMethodId(
|
||||||
|
$technicalName,
|
||||||
|
VRPaymentPaymentHandler::class,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $id,
|
'id' => $configId,
|
||||||
'paymentMethodConfigurationId' => $paymentMethodConfiguration->getId(),
|
'paymentMethodConfigurationId' => $paymentMethodConfiguration->getId(),
|
||||||
'paymentMethodId' => $id,
|
'paymentMethodId' => $paymentMethodId,
|
||||||
'data' => json_decode(strval($paymentMethodConfiguration), true),
|
'data' => json_decode(strval($paymentMethodConfiguration), true),
|
||||||
'sortOrder' => $paymentMethodConfiguration->getSortOrder(),
|
'sortOrder' => $paymentMethodConfiguration->getSortOrder(),
|
||||||
'spaceId' => $paymentMethodConfiguration->getSpaceId(),
|
'spaceId' => $paymentMethodConfiguration->getSpaceId(),
|
||||||
'state' => CreationEntityState::ACTIVE,
|
'state' => CreationEntityState::ACTIVE,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->upsertPaymentMethod($id, $paymentMethodConfiguration, $context);
|
try {
|
||||||
|
$this->upsertPaymentMethod($paymentMethodId, $paymentMethodConfiguration, $context);
|
||||||
try {
|
$this->container
|
||||||
$this->container->get(PaymentMethodConfigurationEntityDefinition::ENTITY_NAME . '.repository')->upsert([$data], $context);
|
->get(PaymentMethodConfigurationEntityDefinition::ENTITY_NAME . '.repository')
|
||||||
} catch (\Exception $e) {
|
->upsert([$data], $context);
|
||||||
$this->logger->error($e->getMessage(), [$e->getTraceAsString()]);
|
} catch (\Exception $e) {
|
||||||
}
|
$this->logger->error($e->getMessage(), [$e->getTraceAsString()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getOrCreatePaymentMethodId(string $technicalName, string $handlerIdentifier, Context $context): string
|
||||||
|
{
|
||||||
|
$criteria = new Criteria();
|
||||||
|
$criteria->addFilter(new EqualsFilter('technicalName', $technicalName));
|
||||||
|
$criteria->setLimit(1);
|
||||||
|
|
||||||
|
$existing = $this->paymentMethodRepository->search($criteria, $context)->first();
|
||||||
|
if ($existing !== null) {
|
||||||
|
return $existing->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
$paymentMethodId = Uuid::randomHex();
|
||||||
|
|
||||||
|
$this->paymentMethodRepository->upsert([[
|
||||||
|
'id' => $paymentMethodId,
|
||||||
|
'handlerIdentifier' => $handlerIdentifier,
|
||||||
|
'technicalName' => $technicalName,
|
||||||
|
'name' => $technicalName,
|
||||||
|
'active' => false,
|
||||||
|
]], $context);
|
||||||
|
|
||||||
|
return $paymentMethodId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch active merchant payment methods from VRPayment API
|
* Fetch active merchant payment methods from VRPayment API
|
||||||
*
|
*
|
||||||
@@ -467,53 +494,6 @@ class PaymentMethodConfigurationService {
|
|||||||
return $configurations->getElements();
|
return $configurations->getElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update or insert Payment Method
|
|
||||||
*
|
|
||||||
* @param string $id
|
|
||||||
* @param \VRPayment\Sdk\Model\PaymentMethodConfiguration $paymentMethodConfiguration
|
|
||||||
* @param \Shopware\Core\Framework\Context $context
|
|
||||||
*
|
|
||||||
* @throws \VRPayment\Sdk\ApiException
|
|
||||||
* @throws \VRPayment\Sdk\Http\ConnectionException
|
|
||||||
* @throws \VRPayment\Sdk\VersioningException
|
|
||||||
*/
|
|
||||||
protected function upsertPaymentMethod(
|
|
||||||
string $id,
|
|
||||||
PaymentMethodConfiguration $paymentMethodConfiguration,
|
|
||||||
Context $context
|
|
||||||
): void
|
|
||||||
{
|
|
||||||
/** @var PluginIdProvider $pluginIdProvider */
|
|
||||||
$pluginIdProvider = $this->container->get(PluginIdProvider::class);
|
|
||||||
$pluginId = $pluginIdProvider->getPluginIdByBaseClass(
|
|
||||||
VRPaymentPayment::class,
|
|
||||||
$context
|
|
||||||
);
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'id' => $id,
|
|
||||||
'handlerIdentifier' => VRPaymentPaymentHandler::class,
|
|
||||||
'pluginId' => $pluginId,
|
|
||||||
'position' => $paymentMethodConfiguration->getSortOrder() - 100,
|
|
||||||
'afterOrderEnabled' => true,
|
|
||||||
'active' => true,
|
|
||||||
'translations' => $this->getPaymentMethodConfigurationTranslation($paymentMethodConfiguration, $context),
|
|
||||||
'technicalName' => $paymentMethodConfiguration->getName(),
|
|
||||||
];
|
|
||||||
|
|
||||||
$data['mediaId'] = $this->upsertMedia($id, $paymentMethodConfiguration, $context);
|
|
||||||
|
|
||||||
$data = array_filter($data);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$this->paymentMethodRepository->upsert([$data], $context);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$this->logger->error($e->getMessage(), [$e->getTraceAsString()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \VRPayment\Sdk\Model\PaymentMethodConfiguration $paymentMethodConfiguration
|
* @param \VRPayment\Sdk\Model\PaymentMethodConfiguration $paymentMethodConfiguration
|
||||||
* @param \Shopware\Core\Framework\Context $context
|
* @param \Shopware\Core\Framework\Context $context
|
||||||
@@ -605,54 +585,95 @@ class PaymentMethodConfigurationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload Payment Method icons
|
* Update or insert Payment Method
|
||||||
*
|
*/
|
||||||
* @param string $id
|
protected function upsertPaymentMethod(
|
||||||
* @param \VRPayment\Sdk\Model\PaymentMethodConfiguration $paymentMethodConfiguration
|
string $id,
|
||||||
* @param \Shopware\Core\Framework\Context $context
|
PaymentMethodConfiguration $paymentMethodConfiguration,
|
||||||
*
|
Context $context
|
||||||
* @return string|null
|
): void {
|
||||||
|
/** @var PluginIdProvider $pluginIdProvider */
|
||||||
|
$pluginIdProvider = $this->container->get(PluginIdProvider::class);
|
||||||
|
$pluginId = $pluginIdProvider->getPluginIdByBaseClass(
|
||||||
|
VRPaymentPayment::class,
|
||||||
|
$context
|
||||||
|
);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'id' => $id,
|
||||||
|
'handlerIdentifier' => VRPaymentPaymentHandler::class,
|
||||||
|
'pluginId' => $pluginId,
|
||||||
|
'position' => $paymentMethodConfiguration->getSortOrder() - 100,
|
||||||
|
'afterOrderEnabled' => true,
|
||||||
|
'active' => true,
|
||||||
|
'translations' => $this->getPaymentMethodConfigurationTranslation($paymentMethodConfiguration, $context),
|
||||||
|
'technicalName' => $paymentMethodConfiguration->getName(),
|
||||||
|
];
|
||||||
|
|
||||||
|
$mediaId = $this->upsertMedia($id, $paymentMethodConfiguration, $context);
|
||||||
|
if ($mediaId) {
|
||||||
|
$data['mediaId'] = $mediaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->paymentMethodRepository->upsert([$data], $context);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->logger->error($e->getMessage(), [$e->getTraceAsString()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload or update Payment Method icons
|
||||||
*/
|
*/
|
||||||
protected function upsertMedia(string $id, PaymentMethodConfiguration $paymentMethodConfiguration, Context $context): ?string
|
protected function upsertMedia(string $id, PaymentMethodConfiguration $paymentMethodConfiguration, Context $context): ?string
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$existingRecord = $this->getMediaDefaultFolderForPaymentMethod($paymentMethodConfiguration, $context);
|
$folderKey = 'payment_method_' . $paymentMethodConfiguration->getId();
|
||||||
|
|
||||||
if ($existingRecord->count() > 0) {
|
// Check existing default folder
|
||||||
$id = $existingRecord->first()->getId();
|
$criteria = new Criteria();
|
||||||
|
$criteria->addFilter(new EqualsFilter('entity', $folderKey));
|
||||||
|
$existingFolder = $this->mediaDefaultFolderRepository->search($criteria, $context);
|
||||||
|
|
||||||
|
$folderId = $id;
|
||||||
|
if ($existingFolder->count() > 0) {
|
||||||
|
$folderId = $existingFolder->first()->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure default folder
|
||||||
$this->mediaDefaultFolderRepository->upsert([
|
$this->mediaDefaultFolderRepository->upsert([
|
||||||
[
|
[
|
||||||
'id' => $id,
|
'id' => $folderId,
|
||||||
'associationFields' => [],
|
'associationFields' => [],
|
||||||
'entity' => 'payment_method_' . $paymentMethodConfiguration->getId(),
|
'entity' => $folderKey,
|
||||||
],
|
],
|
||||||
], $context);
|
], $context);
|
||||||
|
|
||||||
|
// Ensure media folder
|
||||||
$this->mediaFolderRepository->upsert([
|
$this->mediaFolderRepository->upsert([
|
||||||
[
|
[
|
||||||
'id' => $id,
|
'id' => $folderId,
|
||||||
'defaultFolderId' => $id,
|
'defaultFolderId' => $folderId,
|
||||||
'name' => $paymentMethodConfiguration->getName(),
|
'name' => $paymentMethodConfiguration->getName(),
|
||||||
'useParentConfiguration' => false,
|
'useParentConfiguration' => false,
|
||||||
'configuration' => [],
|
'configuration' => [],
|
||||||
],
|
],
|
||||||
], $context);
|
], $context);
|
||||||
|
|
||||||
/**
|
// Media insert/update
|
||||||
* @var \Shopware\Core\Content\Media\MediaDefinition
|
|
||||||
*/
|
|
||||||
$mediaDefinition = $this->container->get(MediaDefinition::class);
|
$mediaDefinition = $this->container->get(MediaDefinition::class);
|
||||||
$this->mediaSerializer->setRegistry($this->serializerRegistry);
|
$this->mediaSerializer->setRegistry($this->serializerRegistry);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'title' => $paymentMethodConfiguration->getName(),
|
'title' => $paymentMethodConfiguration->getName(),
|
||||||
'url' => $paymentMethodConfiguration->getResolvedImageUrl(),
|
'url' => $paymentMethodConfiguration->getResolvedImageUrl(),
|
||||||
'mediaFolderId' => $id,
|
'mediaFolderId' => $folderId,
|
||||||
];
|
];
|
||||||
|
|
||||||
$data = $this->mediaSerializer->deserialize(new Config([], [], []), $mediaDefinition, $data);
|
$data = $this->mediaSerializer->deserialize(new Config([], [], []), $mediaDefinition, $data);
|
||||||
$this->mediaRepository->upsert([$data], $context);
|
$this->mediaRepository->upsert([$data], $context);
|
||||||
|
|
||||||
return $id;
|
return $id;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->critical($e->getMessage(), [$e->getTraceAsString()]);
|
$this->logger->critical($e->getMessage(), [$e->getTraceAsString()]);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use Shopware\Core\{
|
|||||||
System\SalesChannel\SalesChannelContext
|
System\SalesChannel\SalesChannelContext
|
||||||
};
|
};
|
||||||
use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent;
|
use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent;
|
||||||
|
use Shopware\Storefront\Page\Account\Order\AccountEditOrderPageLoadedEvent;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use VRPayment\Sdk\Model\{
|
use VRPayment\Sdk\Model\{
|
||||||
AddressCreate,
|
AddressCreate,
|
||||||
@@ -46,6 +47,9 @@ use VRPaymentPayment\Core\{
|
|||||||
Util\Payload\CustomProducts\CustomProductsLineItemTypes,
|
Util\Payload\CustomProducts\CustomProductsLineItemTypes,
|
||||||
Util\Payload\TransactionPayload
|
Util\Payload\TransactionPayload
|
||||||
};
|
};
|
||||||
|
use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemEntity;
|
||||||
|
use Shopware\Core\Framework\Struct\ArrayEntity;
|
||||||
|
use Shopware\Commercial\Subscription\Framework\Struct\SubscriptionContextStruct;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TransactionService
|
* Class TransactionService
|
||||||
@@ -185,10 +189,20 @@ class TransactionService
|
|||||||
$orderTransaction->getPaymentMethodId(),
|
$orderTransaction->getPaymentMethodId(),
|
||||||
$orderTransaction->getOrder()->getSalesChannelId()
|
$orderTransaction->getOrder()->getSalesChannelId()
|
||||||
);
|
);
|
||||||
$_SESSION['transactionId'] = null;
|
|
||||||
$_SESSION['arrayOfPossibleMethods'] = null;
|
$salesChannelContext->getContext()->addExtension(
|
||||||
$_SESSION['addressCheck'] = null;
|
'checkoutState',
|
||||||
$_SESSION['currencyCheck'] = null;
|
new ArrayEntity([
|
||||||
|
'transactionId' => null,
|
||||||
|
'addressHash' => null,
|
||||||
|
'currency' => null,
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
$salesChannelContext->getContext()->addExtension(
|
||||||
|
'possibleMethods',
|
||||||
|
new ArrayEntity(['ids' => []])
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$this->holdDelivery($orderTransaction->getOrder()->getId(), $salesChannelContext->getContext());
|
$this->holdDelivery($orderTransaction->getOrder()->getId(), $salesChannelContext->getContext());
|
||||||
@@ -502,24 +516,22 @@ class TransactionService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SalesChannelContext $salesChannelContext
|
* @param SalesChannelContext $salesChannelContext
|
||||||
* @param CheckoutConfirmPageLoadedEvent|null $event
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function createPendingTransaction(SalesChannelContext $salesChannelContext, ?CheckoutConfirmPageLoadedEvent $event = null): int
|
public function createPendingTransaction(SalesChannelContext $salesChannelContext, $event = null): int
|
||||||
{
|
{
|
||||||
$expiredTransaction = true;
|
$expiredTransaction = true;
|
||||||
$transactionId = $_SESSION['transactionId'] ?? null;
|
$transactionId = $_SESSION['transactionId'] ?? null;
|
||||||
$settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId());
|
$settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId());
|
||||||
|
if (!$settings) {
|
||||||
|
throw new \Exception('Space settings not configured');
|
||||||
|
}
|
||||||
|
|
||||||
if ($transactionId) {
|
if ($transactionId) {
|
||||||
$transactionService = $settings->getApiClient()->getTransactionService();
|
$transactionService = $settings->getApiClient()->getTransactionService();
|
||||||
$pendingTransaction = $transactionService->read($settings->getSpaceId(), $transactionId);
|
$pendingTransaction = $transactionService->read($settings->getSpaceId(), $transactionId);
|
||||||
$failedStates = [
|
if ($pendingTransaction->getState() === TransactionState::PENDING) {
|
||||||
TransactionState::DECLINE,
|
|
||||||
TransactionState::FAILED,
|
|
||||||
TransactionState::VOIDED,
|
|
||||||
];
|
|
||||||
if (!in_array($pendingTransaction->getState(), $failedStates)) {
|
|
||||||
$expiredTransaction = false;
|
$expiredTransaction = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,12 +542,19 @@ class TransactionService
|
|||||||
$customer = $salesChannelContext->getCustomer();
|
$customer = $salesChannelContext->getCustomer();
|
||||||
$lineItems = [];
|
$lineItems = [];
|
||||||
if ($event) {
|
if ($event) {
|
||||||
$cartLineItems = $event->getPage()->getCart()->getLineItems()->getElements();
|
if ($event instanceof CheckoutConfirmPageLoadedEvent) {
|
||||||
foreach ($cartLineItems as $cartLineItem) {
|
$cartLineItems = $event->getPage()->getCart()->getLineItems()->getElements();
|
||||||
if ($cartLineItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) {
|
foreach ($cartLineItems as $cartLineItem) {
|
||||||
continue;
|
if ($cartLineItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$lineItems[] = $this->createTempLineItem($cartLineItem);
|
||||||
|
}
|
||||||
|
} elseif ($event instanceof AccountEditOrderPageLoadedEvent) {
|
||||||
|
$order = $event->getPage()->getOrder();
|
||||||
|
foreach ($order->getLineItems() as $orderLineItem) {
|
||||||
|
$lineItems[] = $this->createTempLineItem($orderLineItem);
|
||||||
}
|
}
|
||||||
$lineItems[] = $this->createTempLineItem($cartLineItem);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,6 +570,10 @@ class TransactionService
|
|||||||
$billingAddress = $this->buildAddress($salesChannelContext, $customer->getActiveBillingAddress());
|
$billingAddress = $this->buildAddress($salesChannelContext, $customer->getActiveBillingAddress());
|
||||||
$shippingAddress = $this->buildAddress($salesChannelContext, $customer->getActiveShippingAddress());
|
$shippingAddress = $this->buildAddress($salesChannelContext, $customer->getActiveShippingAddress());
|
||||||
|
|
||||||
|
if (!$settings) {
|
||||||
|
throw new \Exception('Space settings not configured');
|
||||||
|
}
|
||||||
|
|
||||||
$transactionPayload = (new TransactionCreate())
|
$transactionPayload = (new TransactionCreate())
|
||||||
->setBillingAddress($billingAddress)
|
->setBillingAddress($billingAddress)
|
||||||
->setShippingAddress($shippingAddress)
|
->setShippingAddress($shippingAddress)
|
||||||
@@ -562,8 +585,11 @@ class TransactionService
|
|||||||
->setCustomerEmailAddress($customer->getEmail())
|
->setCustomerEmailAddress($customer->getEmail())
|
||||||
->setCustomerId($customerId)
|
->setCustomerId($customerId)
|
||||||
->setSuccessUrl($homeUrl . '?success')
|
->setSuccessUrl($homeUrl . '?success')
|
||||||
->setFailedUrl($homeUrl . '?fail')
|
->setFailedUrl($homeUrl . '?fail');
|
||||||
->setTokenizationMode(TokenizationMode::FORCE_CREATION);
|
|
||||||
|
if($this->isSubscription($salesChannelContext)) {
|
||||||
|
$transactionPayload->setTokenizationMode(TokenizationMode::FORCE_CREATION);
|
||||||
|
}
|
||||||
|
|
||||||
$transactionService = $settings->getApiClient()->getTransactionService();
|
$transactionService = $settings->getApiClient()->getTransactionService();
|
||||||
$transaction = $transactionService->create($settings->getSpaceId(), $transactionPayload);
|
$transaction = $transactionService->create($settings->getSpaceId(), $transactionPayload);
|
||||||
@@ -685,22 +711,30 @@ class TransactionService
|
|||||||
return $chargeAttempts ? $chargeAttempts[0] : null;
|
return $chargeAttempts ? $chargeAttempts[0] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function createTempLineItem($productData): LineItemCreate
|
||||||
* @param LineItem $productData
|
{
|
||||||
* @return LineItemCreate
|
$lineItem = new LineItemCreate();
|
||||||
*/
|
|
||||||
private function createTempLineItem(LineItem $productData): LineItemCreate
|
|
||||||
{
|
|
||||||
$lineItem = new LineItemCreate();
|
|
||||||
$lineItem->setName($productData->getLabel());
|
|
||||||
$lineItem->setUniqueId($productData->getId());
|
|
||||||
$lineItem->setSku($productData->getId());
|
|
||||||
$lineItem->setQuantity($productData->getQuantity());
|
|
||||||
$lineItem->setAmountIncludingTax($productData->getPrice()->getUnitPrice());
|
|
||||||
$lineItem->setType(LineItemType::PRODUCT);
|
|
||||||
|
|
||||||
return $lineItem;
|
if ($productData instanceof LineItem) {
|
||||||
}
|
$lineItem->setName($productData->getLabel());
|
||||||
|
$lineItem->setUniqueId($productData->getId());
|
||||||
|
$lineItem->setSku($productData->getReferencedId() ?? $productData->getId());
|
||||||
|
$lineItem->setQuantity($productData->getQuantity());
|
||||||
|
$lineItem->setAmountIncludingTax($productData->getPrice()->getUnitPrice());
|
||||||
|
} elseif ($productData instanceof OrderLineItemEntity) {
|
||||||
|
$lineItem->setName($productData->getLabel());
|
||||||
|
$lineItem->setUniqueId($productData->getId());
|
||||||
|
$lineItem->setSku($productData->getProductId() ?? $productData->getIdentifier() ?? $productData->getId());
|
||||||
|
$lineItem->setQuantity($productData->getQuantity());
|
||||||
|
$lineItem->setAmountIncludingTax($productData->getUnitPrice());
|
||||||
|
} else {
|
||||||
|
throw new \InvalidArgumentException('Unsupported line item type: ' . get_class($productData));
|
||||||
|
}
|
||||||
|
|
||||||
|
$lineItem->setType(LineItemType::PRODUCT);
|
||||||
|
|
||||||
|
return $lineItem;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a VRPayment address from Shopware customer address.
|
* Build a VRPayment address from Shopware customer address.
|
||||||
@@ -749,4 +783,21 @@ class TransactionService
|
|||||||
|
|
||||||
return $address;
|
return $address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if it's subscription context.
|
||||||
|
*
|
||||||
|
* @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function isSubscription(SalesChannelContext $salesChannelContext): bool {
|
||||||
|
$extensionName = 'subscription';
|
||||||
|
if (class_exists(\Shopware\Commercial\Subscription\Framework\Struct\SubscriptionContextStruct::class)) {
|
||||||
|
$extensionName = SubscriptionContextStruct::SUBSCRIPTION_EXTENSION;
|
||||||
|
}
|
||||||
|
if ($salesChannelContext->hasExtension($extensionName)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,8 +224,18 @@ class WebHookController extends AbstractController {
|
|||||||
// Configuration
|
// Configuration
|
||||||
$salesChannelId = $salesChannelId == 'null' ? null : $salesChannelId;
|
$salesChannelId = $salesChannelId == 'null' ? null : $salesChannelId;
|
||||||
$this->settings = $this->settingsService->getSettings($salesChannelId);
|
$this->settings = $this->settingsService->getSettings($salesChannelId);
|
||||||
|
|
||||||
$signature = $request->server->get('HTTP_X_SIGNATURE');
|
$signature = $request->server->get('HTTP_X_SIGNATURE');
|
||||||
$requestJson = json_decode($request->getContent(), true);
|
$requestJson = json_decode($request->getContent(), true);
|
||||||
|
|
||||||
|
if ($requestJson['eventId'] == null && $requestJson['entityId'] == null && $requestJson['listenerEntityId'] == null && $requestJson['listenerEntityId'] == null && $requestJson['listenerEntityTechnicalName'] == null && $requestJson['spaceId'] == null) {
|
||||||
|
throw new \InvalidArgumentException('Empty webhook');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->settings->getSpaceId() || !$this->settings->getUserId() || !$this->settings->getApplicationKey()) {
|
||||||
|
throw new \InvalidArgumentException('Not correct webhook configuration for salesChannelId: ' . $salesChannelId . ' Debug: ' . var_dump($requestJson));
|
||||||
|
}
|
||||||
|
|
||||||
$apiClient = $this->settings->getApiClient();
|
$apiClient = $this->settings->getApiClient();
|
||||||
$callBackData->assign($requestJson);
|
$callBackData->assign($requestJson);
|
||||||
|
|
||||||
|
|||||||
@@ -4,33 +4,41 @@ namespace VRPaymentPayment\Core\Storefront\Checkout\Subscriber;
|
|||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Shopware\Core\{Checkout\Order\Aggregate\OrderTransaction\OrderTransactionCollection,
|
use Shopware\Core\{Checkout\Order\Aggregate\OrderTransaction\OrderTransactionCollection,
|
||||||
Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStates,
|
Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStates,
|
||||||
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\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\PaymentMethod\AccountPaymentMethodPageLoadedEvent;
|
||||||
use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent;
|
use Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent;
|
||||||
|
use Shopware\Storefront\Page\Checkout\Finish\CheckoutFinishPageLoadedEvent;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use VRPaymentPayment\Core\{Api\Transaction\Service\OrderMailService,
|
use VRPaymentPayment\Core\{Api\Transaction\Service\TransactionService,
|
||||||
Api\Transaction\Service\TransactionService,
|
Checkout\PaymentHandler\VRPaymentPaymentHandler,
|
||||||
Checkout\PaymentHandler\VRPaymentPaymentHandler,
|
Settings\Service\SettingsService,
|
||||||
Settings\Service\SettingsService,
|
Settings\Struct\Settings,
|
||||||
Settings\Struct\Settings,
|
Util\PaymentMethodUtil};
|
||||||
Util\PaymentMethodUtil};
|
|
||||||
use VRPaymentPayment\Core\Api\PaymentMethodConfiguration\Service\PaymentMethodConfigurationService;
|
use VRPaymentPayment\Core\Api\PaymentMethodConfiguration\Service\PaymentMethodConfigurationService;
|
||||||
use VRPaymentPayment\Sdk\{Model\AddressCreate,
|
use VRPaymentPayment\Sdk\{Model\AddressCreate,
|
||||||
Model\ChargeAttempt,
|
Model\ChargeAttempt,
|
||||||
Model\CreationEntityState,
|
Model\CreationEntityState,
|
||||||
Model\CriteriaOperator,
|
Model\CriteriaOperator,
|
||||||
Model\EntityQuery,
|
Model\EntityQuery,
|
||||||
Model\EntityQueryFilter,
|
Model\EntityQueryFilter,
|
||||||
Model\EntityQueryFilterType,
|
Model\EntityQueryFilterType,
|
||||||
Model\LineItemAttributeCreate,
|
Model\LineItemAttributeCreate,
|
||||||
Model\LineItemCreate,
|
Model\LineItemCreate,
|
||||||
Model\LineItemType,
|
Model\LineItemType,
|
||||||
Model\TaxCreate,
|
Model\TaxCreate,
|
||||||
Model\Transaction,
|
Model\Transaction,
|
||||||
Model\TransactionCreate,
|
Model\TransactionCreate,
|
||||||
Model\TransactionPending};
|
Model\TransactionPending};
|
||||||
|
use Shopware\Core\Framework\Struct\ArrayEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CheckoutSubscriber
|
* Class CheckoutSubscriber
|
||||||
@@ -65,6 +73,9 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
private $paymentMethodUtil;
|
private $paymentMethodUtil;
|
||||||
|
|
||||||
|
/** @var EntityRepository */
|
||||||
|
private EntityRepository $paymentMethodRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CheckoutSubscriber constructor.
|
* CheckoutSubscriber constructor.
|
||||||
*
|
*
|
||||||
@@ -72,13 +83,15 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
* @param \VRPaymentPayment\Core\Api\Transaction\Service\TransactionService $transactionService
|
* @param \VRPaymentPayment\Core\Api\Transaction\Service\TransactionService $transactionService
|
||||||
* @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
|
||||||
|
* @param EntityRepository $paymentMethodRepository
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +112,9 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
CheckoutConfirmPageLoadedEvent::class => ['onConfirmPageLoaded', 1],
|
CheckoutConfirmPageLoadedEvent::class => 'onCheckoutConfirmLoaded',
|
||||||
|
AccountEditOrderPageLoadedEvent::class => 'onAccountOrderEditLoaded',
|
||||||
|
AccountPaymentMethodPageLoadedEvent::class => 'onAccountPaymentMethodLoaded',
|
||||||
"subscription." . CheckoutConfirmPageLoadedEvent::class => ['onConfirmPageLoaded', 1],
|
"subscription." . CheckoutConfirmPageLoadedEvent::class => ['onConfirmPageLoaded', 1],
|
||||||
MailBeforeValidateEvent::class => ['onMailBeforeValidate', 1],
|
MailBeforeValidateEvent::class => ['onMailBeforeValidate', 1],
|
||||||
];
|
];
|
||||||
@@ -154,9 +169,10 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent $event
|
* @param CheckoutConfirmPageLoadedEvent $event
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function onConfirmPageLoaded(CheckoutConfirmPageLoadedEvent $event): void
|
public function onCheckoutConfirmLoaded(CheckoutConfirmPageLoadedEvent $event): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$salesChannelContext = $event->getSalesChannelContext();
|
$salesChannelContext = $event->getSalesChannelContext();
|
||||||
@@ -169,7 +185,7 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
$createdTransactionId = $this->transactionService->createPendingTransaction($salesChannelContext, $event);
|
$createdTransactionId = $this->transactionService->createPendingTransaction($salesChannelContext, $event);
|
||||||
$this->updateTempTransactionIfNeeded($salesChannelContext, $createdTransactionId);
|
$this->updateTempTransactionIfNeeded($salesChannelContext, $createdTransactionId);
|
||||||
|
|
||||||
$this->getAvailablePaymentMethods($settings, $createdTransactionId);
|
$this->getAvailablePaymentMethods($settings, $createdTransactionId, $salesChannelContext);
|
||||||
$this->setPossiblePaymentMethods($settings->getSpaceId(), $event);
|
$this->setPossiblePaymentMethods($settings->getSpaceId(), $event);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
@@ -177,10 +193,74 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param AccountEditOrderPageLoadedEvent $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function onAccountOrderEditLoaded(AccountEditOrderPageLoadedEvent $event): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->handlePaymentMethodFiltering($event);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->logger->error($e->getMessage());
|
||||||
|
$this->removeVRPaymentPaymentMethodFromConfirmPage($event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param AccountPaymentMethodPageLoadedEvent $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function onAccountPaymentMethodLoaded(AccountPaymentMethodPageLoadedEvent $event): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->handlePaymentMethodFiltering($event);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->logger->error($e->getMessage());
|
||||||
|
$this->removeVRPaymentPaymentMethodFromConfirmPage($event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent $event
|
* @param \Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent $event
|
||||||
*/
|
*/
|
||||||
private function removeVRPaymentPaymentMethodFromConfirmPage(CheckoutConfirmPageLoadedEvent $event): void
|
public function onConfirmPageLoaded(CheckoutConfirmPageLoadedEvent $event): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->handlePaymentMethodFiltering($event);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->logger->error($e->getMessage());
|
||||||
|
$this->removeVRPaymentPaymentMethodFromConfirmPage($event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function handlePaymentMethodFiltering($event): void
|
||||||
|
{
|
||||||
|
$salesChannelContext = $event->getSalesChannelContext();
|
||||||
|
$settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId());
|
||||||
|
|
||||||
|
if (is_null($settings)) {
|
||||||
|
$this->logger->notice('Removing payment methods because settings are invalid');
|
||||||
|
$this->removeVRPaymentPaymentMethodFromConfirmPage($event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$createdTransactionId = $this->transactionService->createPendingTransaction($salesChannelContext, $event);
|
||||||
|
$this->updateTempTransactionIfNeeded($salesChannelContext, $createdTransactionId);
|
||||||
|
|
||||||
|
$this->getAvailablePaymentMethods($settings, $createdTransactionId, $salesChannelContext);
|
||||||
|
$this->setPossiblePaymentMethods($settings->getSpaceId(), $event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function removeVRPaymentPaymentMethodFromConfirmPage($event): void
|
||||||
{
|
{
|
||||||
$paymentMethodCollection = $event->getPage()->getPaymentMethods();
|
$paymentMethodCollection = $event->getPage()->getPaymentMethods();
|
||||||
$paymentMethodIds = $this->paymentMethodUtil->getVRPaymentPaymentMethodIds($event->getContext());
|
$paymentMethodIds = $this->paymentMethodUtil->getVRPaymentPaymentMethodIds($event->getContext());
|
||||||
@@ -194,7 +274,7 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
* @param int $createdTransactionId
|
* @param int $createdTransactionId
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function getAvailablePaymentMethods(Settings $settings, int $createdTransactionId): void
|
private function getAvailablePaymentMethods(Settings $settings, int $createdTransactionId, SalesChannelContext $salesChannelContext): void
|
||||||
{
|
{
|
||||||
$transactionService = $settings->getApiClient()->getTransactionService();
|
$transactionService = $settings->getApiClient()->getTransactionService();
|
||||||
$possiblePaymentMethods = $transactionService->fetchPaymentMethods(
|
$possiblePaymentMethods = $transactionService->fetchPaymentMethods(
|
||||||
@@ -204,9 +284,13 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
);
|
);
|
||||||
$arrayOfPossibleMethods = [];
|
$arrayOfPossibleMethods = [];
|
||||||
foreach ($possiblePaymentMethods as $possiblePaymentMethod) {
|
foreach ($possiblePaymentMethods as $possiblePaymentMethod) {
|
||||||
$arrayOfPossibleMethods[] = $possiblePaymentMethod->getid();
|
$arrayOfPossibleMethods[] = $possiblePaymentMethod->getId();
|
||||||
}
|
}
|
||||||
$_SESSION['arrayOfPossibleMethods'] = $arrayOfPossibleMethods;
|
|
||||||
|
$salesChannelContext->getContext()->addExtension(
|
||||||
|
'possibleMethods',
|
||||||
|
new ArrayEntity(['ids' => $arrayOfPossibleMethods])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,48 +298,101 @@ class CheckoutSubscriber implements EventSubscriberInterface
|
|||||||
* @param CheckoutConfirmPageLoadedEvent $event
|
* @param CheckoutConfirmPageLoadedEvent $event
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function setPossiblePaymentMethods(int $spaceId, CheckoutConfirmPageLoadedEvent $event): void
|
private function setPossiblePaymentMethods(int $spaceId, $event): void
|
||||||
{
|
{
|
||||||
$localPaymentMethods = [];
|
$paymentIds = [];
|
||||||
$paymentMethodConfigurations = $this->paymentMethodConfigurationService->getAllPaymentMethodConfigurations($spaceId, $event->getSalesChannelContext()->getContext());
|
$paymentMethodCollection = $event->getPage()->getPaymentMethods();
|
||||||
foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) {
|
|
||||||
$localPaymentMethods[$paymentMethodConfiguration->getId()] = $paymentMethodConfiguration->getPaymentMethodConfigurationId();
|
foreach ($paymentMethodCollection as $paymentMethodCollectionItem) {
|
||||||
|
$isVRPaymentPM = VRPaymentPaymentHandler::class === $paymentMethodCollectionItem->getHandlerIdentifier();
|
||||||
|
if (!$isVRPaymentPM) {
|
||||||
|
$paymentIds[] = $paymentMethodCollectionItem->getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$paymentMethodCollection = $event->getPage()->getPaymentMethods();
|
$allowedWLMethods = [];
|
||||||
foreach ($paymentMethodCollection as $paymentMethodCollectionItem) {
|
$paymentMethodConfigurations = $this->paymentMethodConfigurationService
|
||||||
$isVRPaymentPM = VRPaymentPaymentHandler::class == $paymentMethodCollectionItem->getHandlerIdentifier();
|
->getAllPaymentMethodConfigurations($spaceId, $event->getSalesChannelContext()->getContext());
|
||||||
if (!$isVRPaymentPM) {
|
|
||||||
|
foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) {
|
||||||
|
if ($paymentMethodConfiguration->getPaymentMethod() === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$paymentMethodConfigurationId = $localPaymentMethods[$paymentMethodCollectionItem->getId()];
|
$pmId = $paymentMethodConfiguration->getPaymentMethod()->getId();
|
||||||
if (!\in_array($paymentMethodConfigurationId, $_SESSION['arrayOfPossibleMethods'])) {
|
$pmConfigId = $paymentMethodConfiguration->getPaymentMethodConfigurationId();
|
||||||
$paymentMethodCollection->remove($paymentMethodCollectionItem->getId());
|
$allowedIds = $this->getAllowedPaymentMethodIds($event->getSalesChannelContext());
|
||||||
|
|
||||||
|
if ($paymentMethodConfiguration->getSpaceId() === $spaceId
|
||||||
|
&& \in_array($pmConfigId, $allowedIds, true)) {
|
||||||
|
$allowedWLMethods[] = $pmId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$allPaymentIds = array_unique(array_merge($paymentIds, $allowedWLMethods));
|
||||||
* @param SalesChannelContext $salesChannelContext
|
$collection = new PaymentMethodCollection();
|
||||||
* @param int $createdTransactionId
|
if (!empty($allPaymentIds)) {
|
||||||
* @return void
|
$criteria = new Criteria($allPaymentIds);
|
||||||
*/
|
$criteria->addFilter(new EqualsFilter('active', true));
|
||||||
private function updateTempTransactionIfNeeded(SalesChannelContext $salesChannelContext, int $createdTransactionId): void
|
$criteria->addFilter(
|
||||||
{
|
new EqualsFilter('salesChannels.id', $event->getSalesChannelContext()->getSalesChannelId())
|
||||||
$addressCheck = $_SESSION['addressCheck'] ?? null;
|
);
|
||||||
$currencyCheck = $_SESSION['currencyCheck'] ?? null;
|
|
||||||
|
|
||||||
$customer = $salesChannelContext->getCustomer();
|
$result = $this->paymentMethodRepository->search($criteria, $event->getContext());
|
||||||
$addressHash = md5(json_encode((array)$customer));
|
foreach ($result->getEntities() as $method) {
|
||||||
$currency = $salesChannelContext->getCurrency()->getIsoCode();
|
if (!$collection->has($method->getId())) {
|
||||||
if (($addressCheck && $currencyCheck) && $addressCheck !== $addressHash || $currencyCheck !== $currency) {
|
$collection->add($method);
|
||||||
if ($createdTransactionId) {
|
}
|
||||||
$this->transactionService->updateTempTransaction($salesChannelContext, $createdTransactionId);
|
|
||||||
}
|
}
|
||||||
$_SESSION['arrayOfPossibleMethods'] = null;
|
|
||||||
$_SESSION['addressCheck'] = $addressHash;
|
|
||||||
$_SESSION['currencyCheck'] = $currency;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$event->getPage()->setPaymentMethods($collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SalesChannelContext $salesChannelContext
|
||||||
|
* @param int $createdTransactionId
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function updateTempTransactionIfNeeded(SalesChannelContext $salesChannelContext, int $createdTransactionId): void
|
||||||
|
{
|
||||||
|
$ctx = $salesChannelContext->getContext();
|
||||||
|
|
||||||
|
/** @var ArrayEntity|null $ext */
|
||||||
|
$ext = $ctx->getExtension('checkoutState');
|
||||||
|
|
||||||
|
$oldAddressHash = $ext instanceof ArrayEntity ? $ext->get('addressHash') : null;
|
||||||
|
$oldCurrency = $ext instanceof ArrayEntity ? $ext->get('currency') : null;
|
||||||
|
|
||||||
|
$customer = $salesChannelContext->getCustomer();
|
||||||
|
$addressHash = md5(json_encode((array) $customer));
|
||||||
|
$currency = $salesChannelContext->getCurrency()->getIsoCode();
|
||||||
|
|
||||||
|
$needsUpdate = ($oldAddressHash !== $addressHash) || ($oldCurrency !== $currency);
|
||||||
|
|
||||||
|
if ($needsUpdate) {
|
||||||
|
if ($createdTransactionId) {
|
||||||
|
$this->transactionService->updateTempTransaction($salesChannelContext, $createdTransactionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ctx->addExtension('possibleMethods', new ArrayEntity(['ids' => []]));
|
||||||
|
$ctx->addExtension(
|
||||||
|
'checkoutState',
|
||||||
|
new ArrayEntity([
|
||||||
|
'addressHash' => $addressHash,
|
||||||
|
'currency' => $currency,
|
||||||
|
])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SalesChannelContext $salesChannelContext
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function getAllowedPaymentMethodIds(SalesChannelContext $salesChannelContext): array
|
||||||
|
{
|
||||||
|
$ext = $salesChannelContext->getContext()->getExtension('possibleMethods');
|
||||||
|
return $ext instanceof ArrayEntity ? ($ext->get('ids') ?? []) : [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Analytics {
|
|||||||
self::SHOP_SYSTEM => 'shopware',
|
self::SHOP_SYSTEM => 'shopware',
|
||||||
self::SHOP_SYSTEM_VERSION => '6',
|
self::SHOP_SYSTEM_VERSION => '6',
|
||||||
self::SHOP_SYSTEM_AND_VERSION => 'shopware-6',
|
self::SHOP_SYSTEM_AND_VERSION => 'shopware-6',
|
||||||
self::PLUGIN_SYSTEM_VERSION => '7.1.1',
|
self::PLUGIN_SYSTEM_VERSION => '7.1.2',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,9 +231,16 @@ class TransactionPayload extends AbstractPayload
|
|||||||
->setShippingAddress($shippingAddress)
|
->setShippingAddress($shippingAddress)
|
||||||
->setShippingMethod($transactionData['shipping_method']);
|
->setShippingMethod($transactionData['shipping_method']);
|
||||||
|
|
||||||
$paymentConfiguration = $this->getPaymentConfiguration($this->salesChannelContext->getPaymentMethod()->getId());
|
$paymentConfiguration = $this->getPaymentConfiguration(
|
||||||
|
$this->salesChannelContext->getPaymentMethod()->getId(),
|
||||||
|
$this->settings->getSpaceId()
|
||||||
|
);
|
||||||
|
|
||||||
$transactionPayload->setAllowedPaymentMethodConfigurations([$paymentConfiguration->getPaymentMethodConfigurationId()]);
|
if ($paymentConfiguration) {
|
||||||
|
$transactionPayload->setAllowedPaymentMethodConfigurations([
|
||||||
|
$paymentConfiguration->getPaymentMethodConfigurationId()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$successUrl = $this->transaction->getReturnUrl() . '&status=paid';
|
$successUrl = $this->transaction->getReturnUrl() . '&status=paid';
|
||||||
$failedUrl = $this->getFailUrl($this->order->getId()) . '&status=fail';
|
$failedUrl = $this->getFailUrl($this->order->getId()) . '&status=fail';
|
||||||
@@ -899,19 +906,21 @@ class TransactionPayload extends AbstractPayload
|
|||||||
return $addressPayload;
|
return $addressPayload;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $id
|
* @param string $paymentMethodId
|
||||||
*
|
* @param int $spaceId
|
||||||
* @return \VRPaymentPayment\Core\Api\PaymentMethodConfiguration\Entity\PaymentMethodConfigurationEntity
|
* @return PaymentMethodConfigurationEntity|null
|
||||||
*/
|
*/
|
||||||
protected function getPaymentConfiguration(string $id): PaymentMethodConfigurationEntity
|
protected function getPaymentConfiguration(string $paymentMethodId, int $spaceId): ?PaymentMethodConfigurationEntity
|
||||||
{
|
{
|
||||||
$criteria = (new Criteria([$id]));
|
$criteria = new Criteria();
|
||||||
|
$criteria->addFilter(new EqualsFilter('paymentMethodId', $paymentMethodId));
|
||||||
|
$criteria->addFilter(new EqualsFilter('spaceId', $spaceId));
|
||||||
|
|
||||||
return $this->container->get('vrpayment_payment_method_configuration.repository')
|
return $this->container->get('vrpayment_payment_method_configuration.repository')
|
||||||
->search($criteria, $this->salesChannelContext->getContext())
|
->search($criteria, $this->salesChannelContext->getContext())
|
||||||
->getEntities()->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get failure URL
|
* Get failure URL
|
||||||
|
|||||||
+6
-6
@@ -14,7 +14,7 @@
|
|||||||
{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_id %}
|
{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_id %}
|
||||||
<sw-inherit-wrapper
|
<sw-inherit-wrapper
|
||||||
v-model:value="actualConfigData[CONFIG_SPACE_ID]"
|
v-model:value="actualConfigData[CONFIG_SPACE_ID]"
|
||||||
:inheritedValue="selectedSalesChannelId === null ? null : allConfigs['null'][CONFIG_SPACE_ID]"
|
:inheritedValue="getInheritedValue(CONFIG_SPACE_ID)"
|
||||||
:customInheritationCheckFunction="checkNumberFieldInheritance">
|
:customInheritationCheckFunction="checkNumberFieldInheritance">
|
||||||
<template #content="props">
|
<template #content="props">
|
||||||
<mt-number-field
|
<mt-number-field
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
:mapInheritance="props"
|
:mapInheritance="props"
|
||||||
:label="$tc('vrpayment-settings.settingForm.credentials.spaceId.label')"
|
:label="$tc('vrpayment-settings.settingForm.credentials.spaceId.label')"
|
||||||
:helpText="$tc('vrpayment-settings.settingForm.credentials.spaceId.tooltipText')"
|
:helpText="$tc('vrpayment-settings.settingForm.credentials.spaceId.tooltipText')"
|
||||||
:disabled="props.isInherited || !acl.can('vrpayment.editor')"
|
:disabled="!acl.can('vrpayment.editor')"
|
||||||
:model-value="props.currentValue"
|
:model-value="props.currentValue"
|
||||||
:error="spaceIdErrorState"
|
:error="spaceIdErrorState"
|
||||||
@update:model-value="props.updateCurrentValue">
|
@update:model-value="props.updateCurrentValue">
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_user_id %}
|
{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_user_id %}
|
||||||
<sw-inherit-wrapper
|
<sw-inherit-wrapper
|
||||||
v-model:value="actualConfigData[CONFIG_USER_ID]"
|
v-model:value="actualConfigData[CONFIG_USER_ID]"
|
||||||
:inheritedValue="selectedSalesChannelId === null ? null : allConfigs['null'][CONFIG_USER_ID]"
|
:inheritedValue="getInheritedValue(CONFIG_USER_ID)"
|
||||||
:customInheritationCheckFunction="checkNumberFieldInheritance">
|
:customInheritationCheckFunction="checkNumberFieldInheritance">
|
||||||
<template #content="props">
|
<template #content="props">
|
||||||
<mt-number-field
|
<mt-number-field
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
:mapInheritance="props"
|
:mapInheritance="props"
|
||||||
:label="$tc('vrpayment-settings.settingForm.credentials.userId.label')"
|
:label="$tc('vrpayment-settings.settingForm.credentials.userId.label')"
|
||||||
:helpText="$tc('vrpayment-settings.settingForm.credentials.userId.tooltipText')"
|
:helpText="$tc('vrpayment-settings.settingForm.credentials.userId.tooltipText')"
|
||||||
:disabled="props.isInherited || !acl.can('vrpayment.editor')"
|
:disabled="!acl.can('vrpayment.editor')"
|
||||||
:model-value="props.currentValue"
|
:model-value="props.currentValue"
|
||||||
:error="userIdErrorState"
|
:error="userIdErrorState"
|
||||||
@update:model-value="props.updateCurrentValue">
|
@update:model-value="props.updateCurrentValue">
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_application_key %}
|
{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_application_key %}
|
||||||
<sw-inherit-wrapper
|
<sw-inherit-wrapper
|
||||||
v-model:value="actualConfigData[CONFIG_APPLICATION_KEY]"
|
v-model:value="actualConfigData[CONFIG_APPLICATION_KEY]"
|
||||||
:inheritedValue="selectedSalesChannelId === null ? null : allConfigs['null'][CONFIG_APPLICATION_KEY]"
|
:inheritedValue="getInheritedValue(CONFIG_APPLICATION_KEY)"
|
||||||
:customInheritationCheckFunction="checkTextFieldInheritance">
|
:customInheritationCheckFunction="checkTextFieldInheritance">
|
||||||
<template #content="props">
|
<template #content="props">
|
||||||
<mt-password-field
|
<mt-password-field
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
:mapInheritance="props"
|
:mapInheritance="props"
|
||||||
:label="$tc('vrpayment-settings.settingForm.credentials.applicationKey.label')"
|
:label="$tc('vrpayment-settings.settingForm.credentials.applicationKey.label')"
|
||||||
:helpText="$tc('vrpayment-settings.settingForm.credentials.applicationKey.tooltipText')"
|
:helpText="$tc('vrpayment-settings.settingForm.credentials.applicationKey.tooltipText')"
|
||||||
:disabled="props.isInherited || !acl.can('vrpayment.editor')"
|
:disabled="!acl.can('vrpayment.editor')"
|
||||||
:model-value="props.currentValue"
|
:model-value="props.currentValue"
|
||||||
:error="applicationKeyErrorState"
|
:error="applicationKeyErrorState"
|
||||||
@update:model-value="props.updateCurrentValue">
|
@update:model-value="props.updateCurrentValue">
|
||||||
|
|||||||
+29
-23
@@ -6,7 +6,7 @@ import constants from '../../page/vrpayment-settings/configuration-constants'
|
|||||||
const {Component, Mixin} = Shopware;
|
const {Component, Mixin} = Shopware;
|
||||||
|
|
||||||
Component.register('sw-vrpayment-credentials', {
|
Component.register('sw-vrpayment-credentials', {
|
||||||
template: template,
|
template,
|
||||||
|
|
||||||
name: 'VRPaymentCredentials',
|
name: 'VRPaymentCredentials',
|
||||||
|
|
||||||
@@ -29,7 +29,9 @@ Component.register('sw-vrpayment-credentials', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
selectedSalesChannelId: {
|
selectedSalesChannelId: {
|
||||||
required: true
|
type: [String, null],
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
},
|
},
|
||||||
spaceIdFilled: {
|
spaceIdFilled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -68,38 +70,42 @@ Component.register('sw-vrpayment-credentials', {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
currentConfig() {
|
||||||
|
if (this.selectedSalesChannelId && this.allConfigs[this.selectedSalesChannelId]) {
|
||||||
|
return this.allConfigs[this.selectedSalesChannelId];
|
||||||
|
}
|
||||||
|
return this.allConfigs['null'] || {};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
checkTextFieldInheritance(value) {
|
||||||
|
return !value || value.length <= 0;
|
||||||
|
},
|
||||||
|
|
||||||
checkTextFieldInheritance(value) {
|
checkNumberFieldInheritance(value) {
|
||||||
if (typeof value !== 'string') {
|
return value == null || value === '';
|
||||||
return true;
|
},
|
||||||
}
|
|
||||||
|
|
||||||
return value.length <= 0;
|
checkBoolFieldInheritance(value) {
|
||||||
},
|
return typeof value !== 'boolean';
|
||||||
|
},
|
||||||
checkNumberFieldInheritance(value) {
|
|
||||||
if (typeof value !== 'number') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value.length <= 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
checkBoolFieldInheritance(value) {
|
|
||||||
return typeof value !== 'boolean';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Emits the 'check-api-connection-event' with the current API connection parameters.
|
// Emits the 'check-api-connection-event' with the current API connection parameters.
|
||||||
// Used to trigger API connection testing from this component.
|
// Used to trigger API connection testing from this component.
|
||||||
emitCheckApiConnectionEvent() {
|
emitCheckApiConnectionEvent() {
|
||||||
const apiConnectionParams = {
|
const apiConnectionParams = {
|
||||||
spaceId: this.actualConfigData[constants.CONFIG_SPACE_ID],
|
spaceId: this.currentConfig[constants.CONFIG_SPACE_ID],
|
||||||
userId: this.actualConfigData[constants.CONFIG_USER_ID],
|
userId: this.currentConfig[constants.CONFIG_USER_ID],
|
||||||
applicationKey: this.actualConfigData[constants.CONFIG_APPLICATION_KEY]
|
applicationKey: this.currentConfig[constants.CONFIG_APPLICATION_KEY]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$emit('check-api-connection-event', apiConnectionParams);
|
this.$emit('check-api-connection-event', apiConnectionParams);
|
||||||
|
},
|
||||||
|
|
||||||
|
getInheritedValue(key) {
|
||||||
|
return this.allConfigs['null']?.[key] ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+122
-123
@@ -1,146 +1,145 @@
|
|||||||
{% block vrpayment_settings %}
|
{% block vrpayment_settings %}
|
||||||
<sw-page class="vrpayment-settings">
|
<sw-page class="vrpayment-settings">
|
||||||
|
|
||||||
{% block vrpayment_settings_header %}
|
{% block vrpayment_settings_header %}
|
||||||
<template #smart-bar-header>
|
<template #smart-bar-header>
|
||||||
<h2>
|
<h2>
|
||||||
{{ $tc('sw-settings.index.title') }}
|
{{ $tc('sw-settings.index.title') }}
|
||||||
<mt-icon name="small-arrow-medium-right" size="16px"></mt-icon>
|
<mt-icon name="small-arrow-medium-right" size="16px"></mt-icon>
|
||||||
{{ $tc('vrpayment-settings.header') }}
|
{{ $tc('vrpayment-settings.header') }}
|
||||||
</h2>
|
</h2>
|
||||||
</template>
|
</template>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block vrpayment_settings_actions %}
|
{% block vrpayment_settings_actions %}
|
||||||
<template #smart-bar-actions>
|
<template #smart-bar-actions>
|
||||||
{% block vrpayment_settings_actions_save %}
|
{% block vrpayment_settings_actions_save %}
|
||||||
<mt-button
|
<mt-button
|
||||||
v-model:value="isSaveSuccessful"
|
v-model:value="isSaveSuccessful"
|
||||||
class="sw-settings-login-registration__save-action"
|
class="sw-settings-login-registration__save-action"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
:isLoading="isLoading"
|
:isLoading="isLoading"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
@click="onSave">
|
@click="onSave">
|
||||||
{{ $tc('vrpayment-settings.settingForm.save') }}
|
{{ $tc('vrpayment-settings.settingForm.save') }}
|
||||||
</mt-button>
|
</mt-button>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</template>
|
</template>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block vrpayment_settings_content %}
|
{% block vrpayment_settings_content %}
|
||||||
<template #content>
|
<template #content>
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card %}
|
{% block vrpayment_settings_content_card %}
|
||||||
<mt-card-view>
|
<mt-card-view>
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config %}
|
{% block vrpayment_settings_content_card_channel_config %}
|
||||||
<sw-sales-channel-config v-model:value="config"
|
<sw-sales-channel-config v-model:value="config"
|
||||||
ref="configComponent"
|
ref="configComponent"
|
||||||
:domain="CONFIG_DOMAIN">
|
:domain="CONFIG_DOMAIN">
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config_sales_channel %}
|
{% block vrpayment_settings_content_card_channel_config_sales_channel %}
|
||||||
<template #select="{ onInput, selectedSalesChannelId, salesChannel }">
|
<template #select="{ onInput, selectedSalesChannelId, salesChannel }">
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config_sales_channel_card %}
|
{% block vrpayment_settings_content_card_channel_config_sales_channel_card %}
|
||||||
<mt-card title="Sales Channel Switch">
|
<mt-card title="Sales Channel Switch">
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_title %}
|
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_title %}
|
||||||
<sw-entity-single-select
|
<sw-single-select
|
||||||
v-model:value="selectedSalesChannelId"
|
:value="selectedSalesChannelId"
|
||||||
labelProperty="translated.name"
|
:options="salesChannel.map(sc => ({ id: sc.id, name: sc.translated.name }))"
|
||||||
valueProperty="id"
|
labelProperty="name"
|
||||||
:mapInheritance="props"
|
valueProperty="id"
|
||||||
:isLoading="isLoading"
|
:isLoading="isLoading"
|
||||||
entity="sales_channel"
|
@update:value="onInput"
|
||||||
@update:value="onInput">
|
/>
|
||||||
</sw-entity-single-select>
|
{% endblock %}
|
||||||
{% endblock %}
|
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer %}
|
||||||
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer %}
|
<template #footer>
|
||||||
<template #footer>
|
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer_container %}
|
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer_container %}
|
||||||
<sw-container columns="2fr 1fr" gap="0px 30px">
|
<sw-container columns="2fr 1fr" gap="0px 30px">
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer_container_text %}
|
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer_container_text %}
|
||||||
<p>{{ $tc('vrpayment-settings.salesChannelCard.button.description') }}</p>
|
<p>{{ $tc('vrpayment-settings.salesChannelCard.button.description') }}</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer_container_button %}
|
{% block vrpayment_settings_content_card_channel_config_sales_channel_card_footer_container_button %}
|
||||||
<sw-button
|
<sw-button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
v-model:value="isSetDefaultPaymentSuccessful"
|
v-model:value="isSetDefaultPaymentSuccessful"
|
||||||
:isLoading="isSettingDefaultPaymentMethods"
|
:isLoading="isSettingDefaultPaymentMethods"
|
||||||
@click="onSetPaymentMethodDefault">
|
@click="onSetPaymentMethodDefault">
|
||||||
{{ $tc('vrpayment-settings.salesChannelCard.button.label') }}
|
{{ $tc('vrpayment-settings.salesChannelCard.button.label') }}
|
||||||
</sw-button>
|
</sw-button>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</sw-container>
|
</sw-container>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</template>
|
</template>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</mt-card>
|
</mt-card>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</template>
|
</template>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_channel_config_cards %}
|
{% block vrpayment_settings_content_card_channel_config_cards %}
|
||||||
<template #content="{ actualConfigData, allConfigs, selectedSalesChannelId }">
|
<template #content="{ actualConfigData, allConfigs, selectedSalesChannelId }">
|
||||||
<div v-if="actualConfigData">
|
<div v-if="actualConfigData">
|
||||||
|
|
||||||
<sw-vrpayment-credentials
|
<sw-vrpayment-credentials
|
||||||
:actualConfigData="actualConfigData"
|
:actualConfigData="actualConfigData"
|
||||||
:allConfigs="allConfigs"
|
:allConfigs="allConfigs"
|
||||||
:selectedSalesChannelId="selectedSalesChannelId"
|
:selectedSalesChannelId="selectedSalesChannelId"
|
||||||
:spaceIdErrorState="spaceIdErrorState"
|
:spaceIdErrorState="spaceIdErrorState"
|
||||||
:userIdErrorState="userIdErrorState"
|
:userIdErrorState="userIdErrorState"
|
||||||
:applicationKeyErrorState="applicationKeyErrorState"
|
:applicationKeyErrorState="applicationKeyErrorState"
|
||||||
:spaceIdFilled="spaceIdFilled"
|
:spaceIdFilled="spaceIdFilled"
|
||||||
:userIdFilled="userIdFilled"
|
:userIdFilled="userIdFilled"
|
||||||
:applicationKeyFilled="applicationKeyFilled"
|
:applicationKeyFilled="applicationKeyFilled"
|
||||||
:isLoading="isLoading"
|
:isLoading="isLoading"
|
||||||
:isTesting="isTesting"
|
:isTesting="isTesting"
|
||||||
@check-api-connection-event="onCheckApiConnection"
|
@check-api-connection-event="onCheckApiConnection"
|
||||||
></sw-vrpayment-credentials>
|
></sw-vrpayment-credentials>
|
||||||
|
|
||||||
<sw-vrpayment-options
|
<sw-vrpayment-options
|
||||||
:actualConfigData="actualConfigData"
|
:actualConfigData="actualConfigData"
|
||||||
:allConfigs="allConfigs"
|
:allConfigs="allConfigs"
|
||||||
:isLoading="isLoading"
|
:isLoading="isLoading"
|
||||||
:selectedSalesChannelId="selectedSalesChannelId"
|
:selectedSalesChannelId="selectedSalesChannelId"
|
||||||
>
|
>
|
||||||
</sw-vrpayment-options>
|
</sw-vrpayment-options>
|
||||||
|
|
||||||
<sw-vrpayment-storefront-options
|
<sw-vrpayment-storefront-options
|
||||||
:actualConfigData="actualConfigData"
|
:actualConfigData="actualConfigData"
|
||||||
:allConfigs="allConfigs"
|
:allConfigs="allConfigs"
|
||||||
:isLoading="isLoading"
|
:isLoading="isLoading"
|
||||||
:selectedSalesChannelId="selectedSalesChannelId"
|
:selectedSalesChannelId="selectedSalesChannelId"
|
||||||
>
|
>
|
||||||
</sw-vrpayment-storefront-options>
|
</sw-vrpayment-storefront-options>
|
||||||
|
|
||||||
<sw-vrpayment-advanced-options
|
<sw-vrpayment-advanced-options
|
||||||
:actualConfigData="actualConfigData"
|
:actualConfigData="actualConfigData"
|
||||||
:allConfigs="allConfigs"
|
:allConfigs="allConfigs"
|
||||||
:isLoading="isLoading"
|
:isLoading="isLoading"
|
||||||
:selectedSalesChannelId="selectedSalesChannelId"
|
:selectedSalesChannelId="selectedSalesChannelId"
|
||||||
>
|
>
|
||||||
</sw-vrpayment-advanced-options>
|
</sw-vrpayment-advanced-options>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
</sw-sales-channel-config>
|
</sw-sales-channel-config>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block vrpayment_settings_content_card_loading %}
|
{% block vrpayment_settings_content_card_loading %}
|
||||||
<mt-loader v-if="isLoading"></mt-loader>
|
<mt-loader v-if="isLoading"></mt-loader>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</mt-card-view>
|
</mt-card-view>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</sw-page>
|
</sw-page>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ Component.register('vrpayment-settings', {
|
|||||||
watch: {
|
watch: {
|
||||||
config: {
|
config: {
|
||||||
handler(configData) {
|
handler(configData) {
|
||||||
const defaultConfig = this.$refs.configComponent.allConfigs.null;
|
const defaultConfig = (this.$refs.configComponent.allConfigs || {}).null || {};
|
||||||
const salesChannelId = this.$refs.configComponent.selectedSalesChannelId;
|
const salesChannelId = this.$refs.configComponent.selectedSalesChannelId;
|
||||||
if (salesChannelId === null) {
|
if (salesChannelId === null) {
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,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