diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md
index 5ddbfe93..10d111e0 100644
--- a/CHANGELOG_de-DE.md
+++ b/CHANGELOG_de-DE.md
@@ -1,3 +1,6 @@
+# 6.5.4
+* Aktualisierung iDEAL Payment Naming
+
# 6.5.3
* **Wichtiger Hotfix**
* Dieser Hotfix behebt ein Problem, bei dem einige Webhooks in Shopware 6.6 nicht korrekt registriert wurden.
@@ -69,7 +72,7 @@
* EPS: Entfernung Bank Feld
# 6.2.1
-* Cardholder Name in Kreditkarten-Checkout hinzugefügt
+* Cardholder Name in Kreditkarten-Checkout hinzugefügt
# 6.2.0
* TWINT als weitere Zahlungsart hinzugefügt
diff --git a/CHANGELOG_en-GB.md b/CHANGELOG_en-GB.md
index 96b5f725..4ddb6117 100644
--- a/CHANGELOG_en-GB.md
+++ b/CHANGELOG_en-GB.md
@@ -1,3 +1,6 @@
+# 6.5.4
+* Updated iDEAL Payment naming
+
# 6.5.3
* **Important hotfix**
* This hotfix will fix an issue where some webhooks were not correctly registered in Shopware 6.6.
diff --git a/composer.json b/composer.json
index 243be51b..dc1f0bc2 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "unzerdev/shopware6",
"description": "Unzer payment integration for Shopware 6",
- "version": "6.5.3",
+ "version": "6.5.4",
"type": "shopware-platform-plugin",
"license": "Apache-2.0",
"minimum-stability": "dev",
diff --git a/src/Components/CancelService/CancelService.php b/src/Components/CancelService/CancelService.php
index df608534..db296e8f 100644
--- a/src/Components/CancelService/CancelService.php
+++ b/src/Components/CancelService/CancelService.php
@@ -95,6 +95,7 @@ public function cancelChargeById(string $orderTransactionId, string $chargeId, f
}
$this->updateOrderStatus($client, $transaction, $context);
+
return $responseCancellation;
}
@@ -123,6 +124,11 @@ public function cancelAuthorizationById(string $orderTransactionId, string $paym
$this->updateOrderStatus($client, $transaction, $context);
}
+ public function isPaylaterPaymentMethod(string $paymentMethodId): bool
+ {
+ return \in_array($paymentMethodId, self::PAYLATER_PAYMENT_METHODS, true);
+ }
+
protected function getOrderTransaction(string $orderTransactionId, Context $context): ?OrderTransactionEntity
{
$criteria = new Criteria([$orderTransactionId]);
@@ -141,11 +147,6 @@ protected function getCancelReasonCode(?string $reasonCode): string
return $reasonCode ?? CancelReasonCodes::REASON_CODE_CANCEL;
}
- public function isPaylaterPaymentMethod(string $paymentMethodId): bool
- {
- return \in_array($paymentMethodId, self::PAYLATER_PAYMENT_METHODS, true);
- }
-
private function updateOrderStatus(Unzer $client, OrderTransactionEntity $orderTransaction, Context $context): void
{
try {
diff --git a/src/Components/PaymentActions/PaymentActionService.php b/src/Components/PaymentActions/PaymentActionService.php
index 091ad4b8..99da8f4b 100644
--- a/src/Components/PaymentActions/PaymentActionService.php
+++ b/src/Components/PaymentActions/PaymentActionService.php
@@ -1,8 +1,7 @@
-logger->info('Capturing order', ['order' => $order->getId()]);
$orderTransaction = $this->unzerTransactionUtil->getOrderTransactionFromOrder($order, $context);
if ($orderTransaction === null) {
return false;
}
+ $this->logger->info('Capturing order', ['order' => $order->getId()]);
$client = $this->clientFactory->createClient(KeyPairContext::createFromOrderTransaction($orderTransaction));
try {
$charge = $client->performChargeOnPayment($orderTransaction->getId(), new Charge($orderTransaction->getAmount()->getTotalPrice()));
@@ -67,21 +64,18 @@ public function captureOrder(OrderEntity $order, Context $context): bool
return true;
}
-
-
-
/**
* @throws \Exception
*/
public function refundOrder(OrderEntity $order, Context $context): void
{
- $this->logger->info('Refunding order', ['order' => $order->getId()]);
$orderTransaction = $this->unzerTransactionUtil->getOrderTransactionFromOrder($order, $context);
if ($orderTransaction === null) {
return;
}
+ $this->logger->info('Refunding order', ['order' => $order->getId()]);
$client = $this->clientFactory->createClient(KeyPairContext::createFromOrderTransaction($orderTransaction));
try {
$payment = $client->fetchPayment($orderTransaction->getId());
@@ -98,7 +92,7 @@ public function refundOrder(OrderEntity $order, Context $context): void
null,
$context
);
- } catch (Throwable $e) {
+ } catch (\Throwable $e) {
$this->logger->error('Error while refunding charge', ['charge' => $charge->getId(), 'error' => $e->getMessage()]);
}
}
@@ -113,7 +107,7 @@ public function refundOrder(OrderEntity $order, Context $context): void
$authorization->getAmount() - $authorization->getCancelledAmount(),
$context
);
- } catch (Throwable $e) {
+ } catch (\Throwable $e) {
$this->logger->error('Error while refunding authorization', ['authorization' => $authorization->getId(), 'error' => $e->getMessage()]);
}
}
@@ -127,14 +121,11 @@ public function refundOrder(OrderEntity $order, Context $context): void
}
}
-
-
public function executeReturnRefunds(OrderEntity $order, Context $context): void
{
- $this->logger->info('Refunding order based on returns', ['order' => $order->getId()]);
-
- if($this->orderReturnRepository === null) {
+ if ($this->orderReturnRepository === null) {
$this->logger->warning('Returns repository does not exist');
+
return;
}
@@ -144,9 +135,10 @@ public function executeReturnRefunds(OrderEntity $order, Context $context): void
return;
}
+ $this->logger->info('Refunding order based on returns', ['order' => $order->getId()]);
$returnsToProcess = $this->getUnprocessedReturns($orderTransaction, $context);
- foreach($returnsToProcess as $returnEntity) {
+ foreach ($returnsToProcess as $returnEntity) {
$items = new RefundItemCollection();
foreach ($returnEntity->getLineItems() as $lineItem) {
$refundItem = new RefundItem(
@@ -163,8 +155,8 @@ public function executeReturnRefunds(OrderEntity $order, Context $context): void
amount: $returnEntity->getAmountTotal(),
context: $context,
items: $items,
- comment: 'SW Auto Refund from order #'.$order->getOrderNumber().' return #'.$returnEntity->getReturnNumber(),
- referenceText: $order->getOrderNumber().'/'.$returnEntity->getReturnNumber()
+ comment: 'SW Auto Refund from order #' . $order->getOrderNumber() . ' return #' . $returnEntity->getReturnNumber(),
+ referenceText: $order->getOrderNumber() . '/' . $returnEntity->getReturnNumber()
);
$transactionCustomFields = $orderTransaction->getCustomFields() ?? [];
@@ -191,38 +183,6 @@ public function executeReturnRefunds(OrderEntity $order, Context $context): void
],
], $context);
}
-
- }
-
- /**
- * @return OrderReturnEntity[]
- */
- protected function getUnprocessedReturns(OrderTransactionEntity $orderTransaction, Context $context): array
- {
- if ($this->orderReturnRepository === null) {
- return [];
- }
-
- $criteria = new Criteria();
- $criteria->addFilter(new EqualsFilter('orderId', $orderTransaction->getOrderId()));
- $criteria->addAssociation('lineItems.lineItem.orderLineItem');
-
- $returns = $this->orderReturnRepository->search($criteria, $context);
-
- $transactionCustomFields = $orderTransaction->getCustomFields() ?? [];
- $processedReturns = $transactionCustomFields['unzerRefundDetails']['processedReturns'] ?? [];
-
- $unprocessedReturns = [];
-
- foreach ($returns as $return) {
- if (isset($processedReturns[$return->getId()])) {
- continue;
- }
-
- $unprocessedReturns[] = $return;
- }
-
- return $unprocessedReturns;
}
public function doUnifiedRefund(OrderTransactionEntity $orderTransaction, float $amount, Context $context, ?RefundItemCollection $items = null, string $comment = '', string $referenceText = ''): string
@@ -230,7 +190,7 @@ public function doUnifiedRefund(OrderTransactionEntity $orderTransaction, float
$client = $this->clientFactory->createClient(KeyPairContext::createFromOrderTransaction($orderTransaction));
$payment = UnzerTransactionUtil::fetchPaymentFromOrderTransaction($orderTransaction, $client);
$charges = $payment->getCharges();
- $charge = reset($charges);//TODO
+ $charge = reset($charges); // TODO
$cancellation = $this->cancelService->cancelChargeById($orderTransaction->getId(), $charge->getId(), $amount, null, $context, $referenceText);
@@ -240,7 +200,7 @@ public function doUnifiedRefund(OrderTransactionEntity $orderTransaction, float
}
$transactionCustomFields['unzerRefundDetails'][$cancellation->getId()] = [
- 'items' => $items?$items->jsonSerialize():[],
+ 'items' => $items ? $items->jsonSerialize() : [],
'comment' => $comment,
'cancellation' => $cancellation->expose(),
];
@@ -252,15 +212,45 @@ public function doUnifiedRefund(OrderTransactionEntity $orderTransaction, float
$orderTransaction->setCustomFields($transactionCustomFields);
- if($items !== null && $items->count() > 0) {
+ if ($items !== null && $items->count() > 0) {
$this->processRefundItems($items, $context);
}
return $cancellation->getId();
}
+ /**
+ * @return OrderReturnEntity[]
+ */
+ protected function getUnprocessedReturns(OrderTransactionEntity $orderTransaction, Context $context): array
+ {
+ if ($this->orderReturnRepository === null) {
+ return [];
+ }
+
+ $criteria = new Criteria();
+ $criteria->addFilter(new EqualsFilter('orderId', $orderTransaction->getOrderId()));
+ $criteria->addAssociation('lineItems.lineItem.orderLineItem');
+
+ $returns = $this->orderReturnRepository->search($criteria, $context);
+
+ $transactionCustomFields = $orderTransaction->getCustomFields() ?? [];
+ $processedReturns = $transactionCustomFields['unzerRefundDetails']['processedReturns'] ?? [];
+
+ $unprocessedReturns = [];
+
+ foreach ($returns as $return) {
+ if (isset($processedReturns[$return->getId()])) {
+ continue;
+ }
+
+ $unprocessedReturns[] = $return;
+ }
+
+ return $unprocessedReturns;
+ }
- protected function processRefundItems(RefundItemCollection $items, Context $context)
+ protected function processRefundItems(RefundItemCollection $items, Context $context): void
{
foreach ($items->getElements() as $item) {
$lineItemId = $item->getId();
@@ -292,7 +282,7 @@ protected function processRefundItems(RefundItemCollection $items, Context $cont
}
if ($quantity > 0) {
$customFields = $lineItem->getCustomFields();
- if (!is_array($customFields)) {
+ if (!\is_array($customFields)) {
$customFields = [];
}
@@ -306,4 +296,4 @@ protected function processRefundItems(RefundItemCollection $items, Context $cont
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Components/PaymentActions/Struct/RefundItem.php b/src/Components/PaymentActions/Struct/RefundItem.php
index 5eabc68f..cc6e49e7 100644
--- a/src/Components/PaymentActions/Struct/RefundItem.php
+++ b/src/Components/PaymentActions/Struct/RefundItem.php
@@ -8,16 +8,13 @@
class RefundItem extends Struct
{
-
-
public function __construct(
protected string $id,
protected int $quantity = 0,
protected float $amount = 0.0,
protected int $resetStockQuantity = 0,
protected ?string $label = null
- )
- {
+ ) {
}
public static function fromArray(array $data): self
@@ -55,4 +52,4 @@ public function getLabel(): ?string
{
return $this->label;
}
-}
\ No newline at end of file
+}
diff --git a/src/Components/PaymentActions/Struct/RefundItemCollection.php b/src/Components/PaymentActions/Struct/RefundItemCollection.php
index 1d930213..ea9e41d4 100644
--- a/src/Components/PaymentActions/Struct/RefundItemCollection.php
+++ b/src/Components/PaymentActions/Struct/RefundItemCollection.php
@@ -30,12 +30,13 @@ public static function fromArray(array $items): self
return $collection;
}
- public function jsonSerialize():array
+ public function jsonSerialize(): array
{
$return = [];
foreach ($this->getElements() as $item) {
$return[] = $item->jsonSerialize();
}
+
return $return;
}
@@ -43,4 +44,4 @@ protected function getExpectedClass(): ?string
{
return RefundItem::class;
}
-}
\ No newline at end of file
+}
diff --git a/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php b/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php
index 5dbffd44..2b81e32d 100755
--- a/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php
+++ b/src/Components/PaymentHandler/AbstractUnzerPaymentHandler.php
@@ -93,26 +93,24 @@ abstract class AbstractUnzerPaymentHandler implements AsynchronousPaymentHandler
* @param MetadataResourceHydrator $metadataHydrator
*/
public function __construct(
- protected readonly ResourceHydratorInterface $basketHydrator,
+ protected readonly ResourceHydratorInterface $basketHydrator,
protected readonly CustomerResourceHydratorInterface $customerHydrator,
- protected readonly ResourceHydratorInterface $metadataHydrator,
- protected readonly EntityRepository $transactionRepository,
- protected readonly ConfigReaderInterface $configReader,
- protected readonly TransactionStateHandlerInterface $transactionStateHandler,
- protected readonly ClientFactoryInterface $clientFactory,
- protected readonly RequestStack $requestStack,
- protected readonly LoggerInterface $logger,
- protected readonly CustomFieldsHelperInterface $customFieldsHelper
- )
- {
+ protected readonly ResourceHydratorInterface $metadataHydrator,
+ protected readonly EntityRepository $transactionRepository,
+ protected readonly ConfigReaderInterface $configReader,
+ protected readonly TransactionStateHandlerInterface $transactionStateHandler,
+ protected readonly ClientFactoryInterface $clientFactory,
+ protected readonly RequestStack $requestStack,
+ protected readonly LoggerInterface $logger,
+ protected readonly CustomFieldsHelperInterface $customFieldsHelper
+ ) {
}
public function pay(
AsyncPaymentTransactionStruct $transaction,
- RequestDataBag $dataBag,
- SalesChannelContext $salesChannelContext
- ): RedirectResponse
- {
+ RequestDataBag $dataBag,
+ SalesChannelContext $salesChannelContext
+ ): RedirectResponse {
$this->logger->debug('Starting pay() base method in ' . static::class);
$currentRequest = $this->getCurrentRequestFromStack($transaction->getOrderTransaction()->getId());
@@ -169,10 +167,9 @@ public function pay(
public function finalize(
AsyncPaymentTransactionStruct $transaction,
- Request $request,
- SalesChannelContext $salesChannelContext
- ): void
- {
+ Request $request,
+ SalesChannelContext $salesChannelContext
+ ): void {
$this->logger->debug('Starting finalize() base method in ' . static::class);
try {
$this->pluginConfig = $this->configReader->read($salesChannelContext->getSalesChannel()->getId());
@@ -259,7 +256,7 @@ protected function executeFailTransition(string $transactionId, Context $context
protected function getUnzerCustomer(string $unzerCustomerId, string $paymentMethodId, OrderTransactionEntity $orderTransaction, SalesChannelContext $salesChannelContext): AbstractUnzerResource
{
$customer = $salesChannelContext->getCustomer();
- if(empty($orderTransaction->getOrder())){
+ if (empty($orderTransaction->getOrder())) {
$orderTransaction = $this->fetchTransactionById($orderTransaction->getId(), $salesChannelContext->getContext());
}
$fetchedCustomer = null;
diff --git a/src/Components/PaymentHandler/Traits/CanRecur.php b/src/Components/PaymentHandler/Traits/CanRecur.php
index 4bcf1bfa..7b5d9636 100644
--- a/src/Components/PaymentHandler/Traits/CanRecur.php
+++ b/src/Components/PaymentHandler/Traits/CanRecur.php
@@ -4,11 +4,8 @@
namespace UnzerPayment6\Components\PaymentHandler\Traits;
-use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity;
use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct;
-use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
-use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use UnzerSDK\Exceptions\UnzerApiException;
use UnzerSDK\Resources\AbstractUnzerResource;
diff --git a/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php b/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php
index c80da54d..d633d16e 100644
--- a/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php
+++ b/src/Components/PaymentHandler/UnzerWeroPaymentHandler.php
@@ -21,6 +21,6 @@ protected function getUnzerPaymentTypeObject(): Wero
protected function setBookingMode(): void
{
$this->bookingMode = BookingMode::CHARGE;
- #$this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE);
+ // $this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE);
}
}
diff --git a/src/Components/UnzerUtil/UnzerTransactionUtil.php b/src/Components/UnzerUtil/UnzerTransactionUtil.php
index 9efdcf88..9b103dfe 100644
--- a/src/Components/UnzerUtil/UnzerTransactionUtil.php
+++ b/src/Components/UnzerUtil/UnzerTransactionUtil.php
@@ -10,7 +10,6 @@
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsAnyFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
-use Throwable;
use UnzerPayment6\Components\TransactionStateHandler\TransactionStateHandlerInterface;
use UnzerPayment6\Installer\CustomFieldInstaller;
use UnzerPayment6\Installer\PaymentInstaller;
@@ -35,11 +34,10 @@
];
public function __construct(
- protected EntityRepository $orderTransactionRepository,
+ protected EntityRepository $orderTransactionRepository,
protected TransactionStateHandlerInterface $transactionStateHandler,
- protected LoggerInterface $logger,
- )
- {
+ protected LoggerInterface $logger,
+ ) {
}
public function getOrderTransaction(string $orderTransactionId, Context $context): ?OrderTransactionEntity
@@ -73,7 +71,6 @@ public function getOrderTransactionFromOrderNumber(string $orderNumber, Context
return $this->orderTransactionRepository->search($criteria, $context)->last();
}
-
public static function fetchPaymentFromOrderTransaction(OrderTransactionEntity $orderTransaction, Unzer $client): Payment
{
try {
@@ -101,7 +98,7 @@ public function updateOrderTransactionStatus(Unzer $client, OrderTransactionEnti
$payment,
$context
);
- } catch (Throwable $e) {
+ } catch (\Throwable $e) {
$this->logger->error('error updating transaction state from util: ' . $e->getMessage(), ['trace' => $e->getTraceAsString()]);
}
}
@@ -110,6 +107,4 @@ public function updateOrderTransaction(array $data, Context $context): void
{
$this->orderTransactionRepository->update([$data], $context);
}
-
-
}
diff --git a/src/Controllers/Administration/UnzerPaymentTransactionController.php b/src/Controllers/Administration/UnzerPaymentTransactionController.php
index 4fd12edd..64d16336 100644
--- a/src/Controllers/Administration/UnzerPaymentTransactionController.php
+++ b/src/Controllers/Administration/UnzerPaymentTransactionController.php
@@ -31,16 +31,15 @@
class UnzerPaymentTransactionController extends AbstractController
{
public function __construct(
- private readonly ClientFactoryInterface $clientFactory,
- private readonly UnzerTransactionUtil $unzerTransactionUtil,
- private readonly PaymentActionService $paymentTransactionService,
+ private readonly ClientFactoryInterface $clientFactory,
+ private readonly UnzerTransactionUtil $unzerTransactionUtil,
+ private readonly PaymentActionService $paymentTransactionService,
private readonly PaymentResourceHydratorInterface $hydrator,
- private readonly CancelServiceInterface $cancelService,
- private readonly ShipServiceInterface $shipService,
- private readonly BasketConverterInterface $basketConverter,
- private readonly LoggerInterface $logger
- )
- {
+ private readonly CancelServiceInterface $cancelService,
+ private readonly ShipServiceInterface $shipService,
+ private readonly BasketConverterInterface $basketConverter,
+ private readonly LoggerInterface $logger
+ ) {
}
#[Route(path: '/api/_action/unzer-payment/transaction/{orderTransactionId}/details', name: 'api.action.unzer.transaction.details', methods: ['GET'])]
@@ -84,8 +83,7 @@ public function fetchTransactionRefundInformation(string $orderTransactionId, Co
try {
$payment = UnzerTransactionUtil::fetchPaymentFromOrderTransaction($transaction, $client);
-
- //TODO: kill the overhead
+ // TODO: kill the overhead
$data = $this->hydrator->hydrateArray($payment, $transaction, $client);
$transactions = $data['transactions'];
$refunds = array_filter($transactions, function (array $transaction) {
@@ -102,7 +100,7 @@ public function fetchTransactionRefundInformation(string $orderTransactionId, Co
$charges = $payment->getCharges();
// TODO: currently the unified refunds run on the first charge only
/** @var Charge $charge */
- $charge = reset($charges);//TODO
+ $charge = reset($charges); // TODO
if ($charge) {
$amounts['charged'] = $charge->isSuccess() ? $charge->getAmount() : 0;
if ($this->cancelService->isPaylaterPaymentMethod($transaction->getPaymentMethodId())) {
@@ -189,25 +187,27 @@ public function unifiedRefund(Request $request, Context $context): JsonResponse
}
} catch (\Throwable $exception) {
$exceptionReturnValues = $this->handleException($exception, 'no order transaction found for unifiedRefund', $exception->getMessage());
+
return new JsonResponse($exceptionReturnValues[0], $exceptionReturnValues[1]);
}
- $amount = (float)$request->get('amount', 0);
- $referenceText = (string)$request->get('referenceText', '');
- $items = RefundItemCollection::fromArray((array)$request->get('items', []));
- $comment = (string)$request->get('comment', '');
+ $amount = (float) $request->get('amount', 0);
+ $referenceText = (string) $request->get('referenceText', '');
+ $items = RefundItemCollection::fromArray((array) $request->get('items', []));
+ $comment = (string) $request->get('comment', '');
try {
- $this->paymentTransactionService->doUnifiedRefund(
- orderTransaction: $orderTransaction,
- amount: $amount,
- context: $context,
- items: $items,
- comment: $comment,
- referenceText: $referenceText
- );
+ $this->paymentTransactionService->doUnifiedRefund(
+ orderTransaction: $orderTransaction,
+ amount: $amount,
+ context: $context,
+ items: $items,
+ comment: $comment,
+ referenceText: $referenceText
+ );
} catch (UnzerApiException|\Throwable $exception) {
$exceptionReturnValues = $this->handleException($exception, \sprintf('Error while executing refund transaction for order transaction [%s]: %s', $orderTransaction->getId(), $exception->getMessage()));
+
return new JsonResponse($exceptionReturnValues[0], $exceptionReturnValues[1]);
}
@@ -289,5 +289,4 @@ private function getInvoiceNumber(OrderTransactionEntity $transaction): ?string
return $invoiceNumber;
}
-
}
diff --git a/src/EventListeners/StateMachine/TransitionEventListener.php b/src/EventListeners/StateMachine/TransitionEventListener.php
index 8659dd87..37d17663 100644
--- a/src/EventListeners/StateMachine/TransitionEventListener.php
+++ b/src/EventListeners/StateMachine/TransitionEventListener.php
@@ -22,7 +22,6 @@
use UnzerPayment6\Components\Event\AutomaticShippingNotificationEvent;
use UnzerPayment6\Components\PaymentActions\PaymentActionService;
use UnzerPayment6\Components\ShipService\ShipServiceInterface;
-use UnzerPayment6\Components\UnzerUtil\UnzerTransactionUtil;
use UnzerPayment6\Components\Validator\AutomaticShippingValidatorInterface;
use UnzerPayment6\Installer\CustomFieldInstaller;
@@ -118,7 +117,6 @@ protected function doAutomaticTransactions(StateMachineTransitionEvent $event, ?
}
if (\is_array($autoCaptureStatus) && \in_array($event->getToPlace()->getId(), $autoCaptureStatus, true)) {
- $this->logger->info(\sprintf('Automatic capture for order [%s] was triggered', $order->getOrderNumber()));
try {
$this->paymentActionService->captureOrder($order, $event->getContext());
} catch (\Throwable $exception) {
@@ -157,8 +155,6 @@ protected function doAutomaticTransactions(StateMachineTransitionEvent $event, ?
]);
}
}
-
-
}
protected function setCustomFields(
diff --git a/src/Installer/PaymentInstaller.php b/src/Installer/PaymentInstaller.php
index aedcde70..64640348 100755
--- a/src/Installer/PaymentInstaller.php
+++ b/src/Installer/PaymentInstaller.php
@@ -5,6 +5,7 @@
namespace UnzerPayment6\Installer;
use League\Flysystem\Filesystem;
+use Shopware\Core\Checkout\Payment\Aggregate\PaymentMethodTranslation\PaymentMethodTranslationEntity;
use Shopware\Core\Checkout\Payment\PaymentMethodEntity;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
@@ -153,16 +154,16 @@ class PaymentInstaller implements InstallerInterface
[
'id' => self::PAYMENT_ID_IDEAL,
'handlerIdentifier' => UnzerIdealPaymentHandler::class,
- 'name' => 'iDEAL',
+ 'name' => 'iDEAL | Wero',
'technicalName' => 'unzer_ideal',
'translations' => [
'de-DE' => [
- 'name' => 'iDEAL',
- 'description' => 'iDEAL Zahlungen mit Unzer payments',
+ 'name' => 'iDEAL | Wero',
+ 'description' => 'iDEAL | Wero Zahlungen mit Unzer payments',
],
'en-GB' => [
- 'name' => 'iDEAL',
- 'description' => 'iDEAL payments with Unzer payments',
+ 'name' => 'iDEAL | Wero',
+ 'description' => 'iDEAL | Wero payments with Unzer payments',
],
],
],
@@ -511,6 +512,55 @@ private function upsertPaymentMethods(InstallContext $context): void
}
$this->removeOldPaymentMethods($context);
$this->deprecatePaymentMethods($context);
+ $this->renameIdeal($context->getContext());
+ }
+
+ private function renameIdeal(Context $context): void
+ {
+ $criteria = new Criteria([self::PAYMENT_ID_IDEAL]);
+ $criteria->addAssociation('translations.language.locale');
+ /** @var PaymentMethodEntity $existingPaymentMethod */
+ $existingPaymentMethod = $this->paymentMethodRepository->search($criteria, $context)->first();
+ if ($existingPaymentMethod === null) {
+ return;
+ }
+ $translations = [];
+ /** @var PaymentMethodTranslationEntity $translation */
+ foreach ($existingPaymentMethod->getTranslations()->getElements() as $uniqueId => $translation) {
+ $newName = null;
+ $newDescription = null;
+ if (stripos($translation->getName(), 'wero') === false) {
+ $newName = str_replace('iDEAL', 'iDEAL | Wero', $translation->getName());
+ }
+ if (stripos($translation->getDescription(), 'wero') === false) {
+ $newDescription = str_replace('iDEAL', 'iDEAL | Wero', $translation->getDescription());
+ }
+
+ if ($newName === null && $newDescription === null) {
+ continue;
+ }
+
+ $localeCode = $translation->getLanguage()->getLocale()->getCode();
+
+ $translations[$localeCode] = [
+ 'languageId' => $translation->getLanguageId(),
+ ];
+ if ($newName !== null) {
+ $translations[$localeCode]['name'] = $newName;
+ }
+ if ($newDescription !== null) {
+ $translations[$localeCode]['description'] = $newDescription;
+ }
+ }
+
+ if (empty($translations)) {
+ return;
+ }
+
+ $this->paymentMethodRepository->update([[
+ 'id' => $existingPaymentMethod->getId(),
+ 'translations' => $translations,
+ ]], $context);
}
private function deprecatePaymentMethods(InstallContext $context): void
diff --git a/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig b/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig
index 66dd32b0..627b665b 100644
--- a/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig
+++ b/src/Resources/app/administration/src/module/unzer-payment-configuration/page/unzer-payment-settings/unzer-payment-settings.html.twig
@@ -86,6 +86,9 @@
size="16px"
:class="{'unzer-additional-keys__title-icon': true, 'is-expanded': isAdditionalKeysExpanded}"
>
+
t.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}getWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/get-webhooks`,{privateKey:e},{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}getGooglePayGatewayMerchantId(e){return this.httpClient.get(`_action/${this.getApiBasePath()}/get-google-pay-gateway-merchant-id?salesChannelId=${e||""}`,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}}e.addServiceProvider("UnzerPaymentConfigurationService",t=>new n(e.getContainer("init").httpClient,t.loginService))},748:function(){let{Application:e}=Shopware,t=Shopware.Classes.ApiService;class n extends t{constructor(e,t,n="unzer-payment"){super(e,t,n)}fetchPaymentDetails(e){let n=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(n,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}chargeTransaction(e,n,a){let s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${a}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}refundTransaction(e,n,a,s=null){let i=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${n}/${a}`;return null!==s&&(i=`${i}/${s}`),this.httpClient.get(i,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}cancelTransaction(e,n,a){let s=`_action/${this.getApiBasePath()}/transaction/${e}/cancel/${n}/${a}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}ship(e){let n=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(n,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}}e.addServiceProvider("UnzerPaymentService",t=>new n(e.getContainer("init").httpClient,t.loginService))},337:function(){let{Component:e}=Shopware,{Criteria:t,EntityCollection:n}=Shopware.Data;e.extend("unzer-entity-multi-select-delivery-status","sw-entity-multi-id-select",{inject:["repositoryFactory"],props:{repository:{type:Object,required:!0,default(){return this.repositoryFactory.create("state_machine_state")}},criteria:{type:Object,required:!1,default(){let e=new t(1,100);return e.addFilter(t.equals("stateMachine.technicalName","order_delivery.state")),e}},entityCollection(){}}})},708:function(){let{Component:e}=Shopware,{Criteria:t}=Shopware.Data;e.extend("unzer-entity-single-select-delivery-status","sw-entity-single-select",{props:{criteria:{type:Object,required:!1,default(){let e=new t(1,100);return e.addFilter(t.equals("stateMachine.technicalName","order_delivery.state")),e}}}})},129:function(e,t,n){var a=n(296);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("0620ec53",a,!0,{})},425:function(e,t,n){var a=n(906);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("f0afdb6a",a,!0,{})},345:function(e,t,n){var a=n(836);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("61f99e4d",a,!0,{})},90:function(e,t,n){var a=n(325);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("05921a3e",a,!0,{})},34:function(e,t,n){var a=n(299);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("3bbcbade",a,!0,{})},534:function(e,t,n){"use strict";function a(e,t){for(var n=[],a={},s=0;s
n.parts.length&&(a.parts.length=n.parts.length)}else{for(var i=[],s=0;s\n {% block unzer_payment_actions_amount_field %}\n \n \n \n
\n {% endblock %}\n \n \n {% block unzer_payment_actions_charge_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block unzer_payment_actions_cancel_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.cancelButton\') }}\n \n {% endblock %}\n \n \n {% block unzer_payment_actions_reason_field %}\n \n \n {% endblock %}\n\n {% block unzer_payment_actions_refund_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n \n {% block unzer_payment_actions_button_container_inner %}{% endblock %}\n
\n \n\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.noActions\') }}\n
\n{% endblock %}',inject:["UnzerPaymentService"],mixins:[t.getByName("notification")],data(){return{isLoading:!1,isSuccessful:!1,transactionAmount:0,reasonCode:null}},props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0},decimalPrecision:{type:Number,required:!0,default:4}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type&&"error"!==this.transactionResource.state},isRefundPossible:function(){return"charge"===this.transactionResource.type&&"error"!==this.transactionResource.state&&!(this.transactionResource.isFirst&&"085b64d0028a8bd447294e03c4eb411a"===this.paymentResource.paymentMethodId&&"pending"!==this.paymentResource.state.name&&"partly"!==this.paymentResource.state.name)},maxTransactionAmount(){let e=0,t=this.isRefundPossible&&"085b64d0028a8bd447294e03c4eb411a"===this.paymentResource.paymentMethodId;return this.isRefundPossible&&(e=this.transactionResource.amount),this.isChargePossible&&(e=this.paymentResource.amount.remaining),"remainingAmount"in this.transactionResource&&(e=this.transactionResource.remainingAmount),this.transactionResource.isFirst&&t&&(e=this.paymentResource.amount.remaining),e/10**this.paymentResource.amount.decimalPrecision},reasonCodeSelection(){return[{label:this.$tc("unzer-payment.paymentDetails.actions.reason.cancel"),value:"CANCEL"},{label:this.$tc("unzer-payment.paymentDetails.actions.reason.credit"),value:"CREDIT"},{label:this.$tc("unzer-payment.paymentDetails.actions.reason.return"),value:"RETURN"}]}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.UnzerPaymentService.chargeTransaction(this.paymentResource.orderTransactionId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage")),"paylater-invoice-document-required"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.paylaterInvoiceDocumentRequiredErrorMessage")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.UnzerPaymentService.refundTransaction(this.paymentResource.orderTransactionId,this.transactionResource.id,this.transactionAmount,this.reasonCode).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})},startCancel(){this.$emit("cancel",this.transactionAmount)}}});let{Component:a,Mixin:s,Module:i}=Shopware;a.register("unzer-payment-detail",{template:'{% block unzer_payment_detail %}\n \n \n {% block unzer_payment_detail_container %}\n \n {% block unzer_payment_detail_container_left %}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.amountRemaining\') }}\n \n \n {{ formatCurrency(remainingAmount) }}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.amountCancelled\') }}\n \n \n {{ formatCurrency(cancelledAmount) }}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.amountCharged\') }}\n \n \n {{ formatCurrency(chargedAmount) }}\n \n {% block unzer_payment_detail_container_left_inner %}{% endblock %}\n \n {% endblock %}\n\n {% block unzer_payment_detail_container_right %}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.shortId\') }}\n \n {{ paymentResource.shortId }}\n \n {{ $tc(\'unzer-payment.paymentDetails.detail.id\') }}\n \n {{ paymentResource.id }}\n \n {{ $tc(\'unzer-payment.paymentDetails.detail.state\') }}\n \n \n {{ paymentResource.state.name }}\n \n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.descriptor\') }}\n \n \n {{ paymentResource.descriptor }}\n \n \n {% block unzer_payment_detail_container_right_inner %}{% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% block unzer_payment_detail_footer %}\n \n {% block unzer_payment_detail_ship_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.shipButton\') }}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}',inject:["UnzerPaymentService"],mixins:[s.getByName("notification")],data(){return{isLoading:!1,isSuccessful:!1,paylaterPaymentMethods:["09588ffee8064f168e909ff31889dd7f","12fbfbce271a43a89b3783453b88e9a6","6d6adcd4b7bf40499873c294a85f32ed"]}},props:{paymentResource:{type:Object,required:!0}},computed:{unzerMaxDigits(){let e=i.getModuleRegistry().get("unzer-payment");return e&&e.manifest?e.manifest.maxDigits:4},remainingAmount(){return this.paymentResource&&this.paymentResource.amount?this.formatAmount(this.paymentResource.amount.remaining,this.paymentResource.amount.decimalPrecision):0},cancelledAmount(){return this.paymentResource&&this.paymentResource.amount?this.formatAmount(this.paymentResource.amount.cancelled,this.paymentResource.amount.decimalPrecision):0},chargedAmount(){return this.paymentResource&&this.paymentResource.amount?this.formatAmount(this.paymentResource.amount.charged,this.paymentResource.amount.decimalPrecision):0}},methods:{reloadOrderDetail(){this.$emit("reloadOrderDetails")},ship(){this.isLoading=!0,this.UnzerPaymentService.ship(this.paymentResource.orderTransactionId).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t?t=this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t?t=this.$tc("unzer-payment.paymentDetails.notifications.invoiceNotFoundMessage"):"documentdate-missing-error"===t?t=this.$tc("unzer-payment.paymentDetails.notifications.documentDateMissingError"):"payment-missing-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.paymentMissingError")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})},formatAmount(e,t){return e/10**Math.min(this.unzerMaxDigits,t)},formatCurrency(e){return Shopware.Utils.format.currency(e||0,this.paymentResource.currency)},isPaylaterPaymentMethod(e){return this.paylaterPaymentMethods.indexOf(e)>=0}}});let{Component:r,Module:o,Mixin:c}=Shopware;r.register("unzer-payment-history",{template:'{% block unzer_payment_history %}\n \n {% block unzer_payment_history_container %}\n \n {% block unzer_payment_history_data_grid %}\n \n {% block unzer_payment_history_actions %}\n \n {% block unzer_payment_history_data_grid_item_actions %}\n { openCancelModal(item, cancelAmount) }"\n >\n \n {% endblock %}\n \n {% endblock %}\n\n {% block unzer_payment_history_actions_modals %}\n \n \n \n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.text\') }}\n
\n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.amountLabel\') }}\n {{ formatCurrency(cancelAmount) }}\n
\n \n {% block sw_confirm_modal_footer_cancel %}\n \n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.noButton\') }}\n \n {% endblock %}\n\n {% block sw_confirm_modal_footer_confirm %}\n \n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.yesButton\') }}\n \n {% endblock %}\n \n \n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}',inject:["repositoryFactory","UnzerPaymentService"],mixins:[c.getByName("notification")],data(){return{showCancelModal:!1,isCancelLoading:!1,cancelAmount:0}},props:{paymentResource:{type:Object,required:!0}},computed:{unzerMaxDigits(){let e=o.getModuleRegistry().get("unzer-payment");return e&&e.manifest?e.manifest.maxDigits:4},orderTransactionRepository:function(){return this.repositoryFactory.create("order_transaction")},decimalPrecision(){return this.paymentResource&&this.paymentResource.amount&&this.paymentResource.amount.decimalPrecision?Math.min(this.unzerMaxDigits,this.paymentResource.amount.decimalPrecision):this.unzerMaxDigits},data:function(){let e=[];return Object.values(this.paymentResource.transactions).forEach(t=>{let n=this.formatCurrency(this.formatAmount(parseFloat(t.amount),this.decimalPrecision)),a=Shopware.Filter.getByName("date")(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:a,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("unzer-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("unzer-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("unzer-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("unzer-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("unzer-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("unzer-payment.paymentDetails.history.type.shipment");case"refund":return this.$tc("unzer-payment.paymentDetails.history.type.refund");case"cancellation":return this.$tc("unzer-payment.paymentDetails.history.type.cancellation");default:return this.$tc("unzer-payment.paymentDetails.history.type.default")}},reload:function(){this.$emit("reload"),this.$emit("reloadOrderDetails")},formatAmount(e,t){return e/10**t},openCancelModal(e,t){this.showCancelModal=e.resource.id,this.cancelAmount=t},closeCancelModal(){this.showCancelModal=!1,this.cancelAmount=0},cancel(){this.isCancelLoading=!0,this.UnzerPaymentService.cancelTransaction(this.paymentResource.orderTransactionId,this.paymentResource.id,this.cancelAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.cancelSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.cancelSuccessMessage")}),this.reload()}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.cancelErrorMessage")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.cancelErrorTitle"),message:t}),this.isCancelLoading=!1,this.reload()})},formatCurrency(e){return Shopware.Utils.format.currency(e||0,this.paymentResource.currency)}}});let{Component:l}=Shopware;l.register("unzer-payment-metadata",{template:'{% block unzer_payment_metadata %}\n \n \n {% block unzer_payment_metadata_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}',props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){let e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("unzer-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("unzer-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});let{Component:d}=Shopware;d.register("unzer-payment-basket",{template:'{% block unzer_payment_basket %}\n \n \n {% block unzer_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}',props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){let e=[];return this.paymentResource.basket.basketItems.forEach(t=>{let n=this.formatCurrency(parseFloat(t.amountGross.toFixed(2))),a=this.formatCurrency(parseFloat(t.amountNet.toFixed(2)));t.amountDiscount>0&&(n=this.formatCurrency(-1*parseFloat(t.amountDiscount.toFixed(2))),a=this.formatCurrency(-1*parseFloat((t.amountDiscount-t.amountVat).toFixed(2)))),e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:a})}),e},columns:function(){return[{property:"quantity",label:this.$tc("unzer-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("unzer-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("unzer-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("unzer-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}},methods:{formatCurrency(e){return Shopware.Utils.format.currency(e||0,this.paymentResource.currency)}}});let{Criteria:u}=Shopware.Data,m=["bc4c2cbfb5fda0bf549e4807440d0a54","4673044aff79424a938d42e9847693c3","713c7a332b432dcd4092701eda522a7e","5123af5ce94a4a286641973e8de7eb60","17830aa7e6a00b99eab27f0e45ac5e0d","4ebb99451f36ba01f13d5871a30bce2c","d4b90a17af62c1bb2f6c3b1fed339425","4b9f8d08b46a83839fd0eb14fe00efe6","08fb8d9a72ab4ca62b811e74f2eca79f","6cc3b56ce9b0f80bd44039c047282a41","614ad722a03ee96baa2446793143215b","409fe641d6d62a4416edd6307d758791","085b64d0028a8bd447294e03c4eb411a","cd6f59d572e6c90dff77a48ce16b44db","fd96d03535a46d197f5adac17c9f8bac","09588ffee8064f168e909ff31889dd7f"];Shopware.Component.override("sw-order-create-details-footer",{template:'{% block sw_order_create_details_footer_payment_method %}\n \n{% endblock %}',computed:{paymentMethodCriteria(){let e=new u;return this.salesChannelId&&e.addFilter(u.equals("salesChannels.id",this.salesChannelId)),e.addFilter(u.not("AND",[u.equalsAny("id",m)])),e}}});let{Component:h,Context:p}=Shopware,{Criteria:y}=Shopware.Data;h.override("sw-order-detail",{template:"{% block sw_order_detail_content_tabs_general %}\n {% parent() %}\n\n {% block unzer_payment_payment_tab %}\n \n {{ $tc('unzer-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}",data(){return{isUnzerPayment:!1}},computed:{showTabs(){return!0}},watch:{orderId:{deep:!0,handler(){if(!this.orderId){this.isUnzerPayment=!1;return}let e=this.repositoryFactory.create("order"),t=new y(1,1);t.addAssociation("transactions"),e.get(this.orderId,p.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&(e.customFields.unzer_payment_is_transaction||e.customFields.heidelpay_is_transaction)&&(this.isUnzerPayment=!0)})})},immediate:!0}}}),Shopware.Component.override("sw-order-list",{template:'{% block sw_order_list_grid_columns %}\n {% parent() %}\n\n {% block unzer_payment_column_transaction %}\n \n \n {{ item.transactions.last().id }}\n \n \n {% endblock %}\n{% endblock %}',methods:{getOrderColumns(){let e=this.$super("getOrderColumns");return e.splice(1,0,{property:"unzerPaymentTransactionId",label:"unzer-payment.order-list.transactionId",allowResize:!0}),e}}});let{Component:g,Context:f,Mixin:b}=Shopware,{Criteria:k}=Shopware.Data;g.register("unzer-payment-tab",{template:'{% block unzer_payment_payment_details %}\n \n
\n {% block unzer_payment_payment_details_content %}\n \n \n {% block unzer_payment_payment_details_content_payment_detail %}\n \n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_payment_history %}\n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_payment_basket %}\n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_payment_metadata %}\n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_inner %}{% endblock %}\n \n \n {% endblock %}\n
\n
\n
\n{% endblock %}',inject:["UnzerPaymentService","repositoryFactory"],mixins:[b.getByName("notification")],data(){return{paymentResources:[],loadedResources:0,isLoading:!0,order:null}},created(){this.createdComponent()},computed:{orderRepository(){return this.repositoryFactory.create("order")}},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},resetDataAttributes(){this.paymentResources=[],this.loadedResources=0,this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){let e=this.$route.params.id,t=new k;t.addAssociation("currency").addAssociation("lineItems.promotion").getAssociation("transactions").addSorting(k.sort("createdAt","DESC")),this.orderRepository.get(e,f.api,t).then(e=>{this.order=e,e.transactions&&e.transactions.forEach((e,t)=>{if(!e.customFields||!e.customFields.unzer_payment_is_transaction&&!e.customFields.heidelpay_is_transaction){this.loadedResources++;return}this.UnzerPaymentService.fetchPaymentDetails(e.id).then(n=>{this.paymentResources[t]=n,this.paymentResources[t].orderTransactionId=e.id,this.loadedResources++,this.isLoading=this.order.transactions.length!==this.loadedResources}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage"),message:this.$tc("unzer-payment.paymentDetails.notifications.couldNotRetrieveMessage")}),this.isLoading=!1})})})},reloadOrderDetails(){setTimeout(()=>{this.findOrderDetailComponentAndReInit()},5e3)},async findOrderDetailComponentAndReInit(e=this){let t=e.$parent;return void 0===t?null:"sw-order-detail"!==t.$options.name?this.findOrderDetailComponentAndReInit(t):t.isOrderEditing?null:void t.createdComponent()}}});var w=JSON.parse('{"unzer-payment":{"tabTitle":"Unzer Payment","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandmitteilung","refund":"R\xfcckerstattung","cancellation":"Stornierung","default":""}},"actions":{"reason":{"placeholder":"Grund","cancel":"Abgebrochen","credit":"Gutschrift","return":"R\xfcckgabe"},"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"R\xfcckerstatten","defaultButton":"Erledigt","cancelButton":"Stornieren","noActions":"Keine Aktionen m\xf6glich","confirmCancelModal":{"text":"M\xf6chten Sie wirklich die Reservierung \xfcber den angegebenen Betrag stornieren?","amountLabel":"Betrag:","yesButton":"Ja","noButton":"Nein"}},"detail":{"cardTitle":"Zahlungsdetails","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (R\xfcckerstattet)","amountCharged":"Betrag (Eingezogen)","descriptor":"Verwendungszweck"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schl\xfcssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"R\xfcckerstatten","refundSuccessMessage":"Die R\xfcckerstattung wurde erfolgreich durchgef\xfchrt.","refundErrorTitle":"R\xfcckerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgef\xfchrt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden","couldNotRetrieveMessage":"Die Zahlungsdetails konnten nicht abgerufen werden, bitte pr\xfcfen Sie die Logdateien f\xfcr weitere Informationen.","documentDateMissingError":"Das Datum der Rechnung ist leer.","paymentMissingError":"Die Zahlung konnte nicht gefunden werden","paylaterInvoiceDocumentRequiredErrorMessage":"Bitte erstellen oder hinterlegen Sie zun\xe4chst eine Rechnung f\xfcr die Bestellung.","cancelSuccessTitle":"Stornierung","cancelErrorTitle":"Stornierung","cancelSuccessMessage":"Die Stornierung wurde erfolgreich durchgef\xfchrt.","cancelErrorMessage":"Die Stornierung konnte nicht durchgef\xfchrt werden."}},"order-list":{"transactionId":"Unzer Transaktions ID"},"methods":{"paylaterInvoice":{"main":"Rechnungskauf","b2b-eur":"Rechnungskauf B2B EUR","b2b-chf":"Rechnungskauf B2B CHF","b2c-eur":"Rechnungskauf B2C EUR","b2c-chf":"Rechnungskauf B2C CHF"},"paylaterInstallment":{"main":"Ratenkauf","b2c-eur":"Ratenkauf B2C EUR","b2c-chf":"Ratenkauf B2C CHF"},"paylaterDirectDebitSecured":{"main":"Lastschrift","b2c-eur":"Lastschrift B2C EUR"}}},"unzer-payment-settings":{"subheadings":{"paymentSettingsBookingModes":"Buchungsmodus","paymentSettingsSaveDevices":"Zahlungsmittel speichern","paymentSettingsExpressCheckout":"Express Checkout"},"module":{"title":"Unzer Payment","description":"Unzer Payment"},"google-pay":{"gatewayMerchantId":"Gateway H\xe4ndler ID"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korrekt! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren","privateKey":"Private Key","publicKey":"Public Key","additionalKeys":"API Keys f\xfcr weitere Zahlungsarten"},"modal":{"close":"Schlie\xdfen","webhook":{"title":"Webhooks","httpsInfo":"Es kann nur eine HTTPS-Domain pro Verkaufskanal registriert werden.","registered":"Webhook ist bereits registriert","placeholder":"Bitte w\xe4hlen Sie eine Domain aus","submit":{"register":"Webhooks registrieren","clear":"Webhooks ausw\xe4hlen | Ausgew\xe4hlten Webhook entfernen | Entferne {count} Webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle ben\xf6tigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns f\xfcr mehr Informationen"},"empty":"F\xfcr diesen Private Key sind keine Webhooks registriert. Bitte pr\xfcfen Sie ob dieser valide ist und ob Konfigurationen f\xfcr dedizierte Verkaufskan\xe4le vorgenommen wurden.","show":"Webhooks anzeigen"}},"sw-payment-card":{"deprecated":"Veraltet"}}'),z=JSON.parse('{"unzer-payment":{"tabTitle":"Unzer Payment","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","refund":"Refund","cancellation":"Cancel","default":""}},"actions":{"reason":{"placeholder":"Reason","cancel":"Cancel","credit":"Credit","return":"Return"},"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund","defaultButton":"Done","cancelButton":"Cancel","noActions":"No actions possible","confirmCancelModal":{"text":"Do you really want to cancel the authorization of the selected amount?","amountLabel":"Amount:","yesButton":"Yes","noButton":"No"}},"detail":{"cardTitle":"Payment Details","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)","descriptor":"Descriptor"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occurred!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order.","couldNotRetrieveMessage":"The payment details could not be retrieved, please check the log files for more information.","documentDateMissingError":"Document date for invoice is empty.","paymentMissingError":"Payment could not be found","paylaterInvoiceDocumentRequiredErrorMessage":"Please create or upload an invoice for the order first.","cancelSuccessTitle":"Cancel","cancelErrorTitle":"Cancel","cancelSuccessMessage":"The reversal was successfully completed.","cancelErrorMessage":"The reversal could not be performed."}},"order-list":{"transactionId":"Unzer transaction ID"},"methods":{"paylaterInvoice":{"main":"Invoice","b2b-eur":"Invoice B2B EUR","b2b-chf":"Invoice B2B CHF","b2c-eur":"Invoice B2C EUR","b2c-chf":"Invoice B2C CHF"},"paylaterInstallment":{"main":"Installment","b2c-eur":"Installment B2C EUR","b2c-chf":"Installment B2C CHF"},"paylaterDirectDebitSecured":{"main":"Direct Debit","b2c-eur":"Direct Debit B2C EUR"}}},"unzer-payment-settings":{"subheadings":{"paymentSettingsBookingModes":"Booking Modes","paymentSettingsSaveDevices":"Save Payment Details","paymentSettingsExpressCheckout":"Express Checkout"},"module":{"title":"Unzer Payment","description":"Unzer Payment"},"google-pay":{"gatewayMerchantId":"Gateway Merchant ID"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks","privateKey":"Private Key","publicKey":"Public Key","additionalKeys":"API Keys for additional payment methods"},"modal":{"close":"Close","webhook":{"title":"Webhooks","httpsInfo":"Only one HTTPS domain per sales channel can be registered.","registered":"Webhook is already registered","placeholder":"Please select a domain","submit":{"register":"Register webhooks","clear":"Select items to clear | Clear selected webhook | Clear {count} webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error has occurred!","message":"Please contact us for more information"},"empty":"There are no webhooks registered for this private key. Make sure the private key is valid and check for other specific sales channel configurations.","show":"Show webhooks"}},"sw-payment-card":{"deprecated":"Deprecated"}}');let{Module:v}=Shopware;v.register("unzer-payment",{type:"plugin",name:"UnzerPayment",title:"unzer-payment.general.title",description:"unzer-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",maxDigits:4,snippets:{"de-DE":w,"en-GB":z},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"unzer-payment-tab",name:"unzer-payment.payment.detail",path:"/sw/order/detail/:id/unzer-payment",isChildren:!0,meta:{parentPath:"sw.order.index"}}),e(t)}}),n(129);let S=Shopware.Data.Criteria;Shopware.Component.register("unzer-payment-register-webhook",{template:'{% block unzer_payment_payment_register_webhook %}\n \n {% block unzer_payment_payment_register_webhook_button %}\n \n {{ $tc(\'unzer-payment-settings.form.webhookButton\') }}\n \n {% endblock %}\n\n {% block unzer_payment_payment_register_webhook_modal %}\n \n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.httpsInfo\') }}\n \n \n \n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.registered\') }}\n \n \n \n \n \n\n \n \n {{ $tc(\'unzer-payment-settings.modal.close\') }}\n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.submit.register\') }}\n \n \n \n {% endblock %}\n
\n{% endblock %}',mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","UnzerPaymentConfigurationService"],props:{webhooks:{type:Array,required:!0},isLoading:{type:Boolean,required:!1},selectedSalesChannelId:{type:String,required:!1},privateKey:{type:String,required:!0},isDisabled:{type:Boolean,required:!1}},computed:{salesChannelRepository(){return this.repositoryFactory.create("sales_channel")}},data(){return{isModalActive:!1,isRegistering:!1,isRegistrationSuccessful:!1,isDataLoading:!1,selection:{},selectedDomain:null,entitySelection:{},salesChannels:{}}},created(){this.createdComponent()},methods:{createdComponent(){this.loadData()},loadData(e,t){let n=this;this.isDataLoading=!0;let a=new S(e,t);a.addAssociation("domains"),this.salesChannelRepository.search(a,Shopware.Context.api).then(e=>{n.salesChannels=e,n.isDataLoading=!1})},onPageChange(e){this.loadData(e.page,e.limit)},openModal(){this.$emit("modal-open"),this.isModalActive=!0},closeModal(){this.isModalActive=!1},registerWebhooks(){let e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.UnzerPaymentConfigurationService.registerWebhooks({selection:this.entitySelection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t),this.$emit("webhook-registered",t)}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment-settings.webhook.globalError.title"),message:this.$tc("unzer-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isRegistering=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1,this.selection={}},onSelectItem(e,t){t&&(t.privateKey=this.privateKey,this.entitySelection[t.salesChannelId]=t)},messageGeneration(e){let t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n})})},isWebhookRegisteredForSalesChannel(e){let t=!1,n=this.getSalesChannelById(e);return!!this.webhooks.length&&(n.domains.forEach(e=>{this.webhooks.forEach(n=>{if(n.url.indexOf(e.url)>-1)return t=!0,!0})}),t)},getSalesChannelById(e){let t=null;return this.salesChannels.forEach(n=>{if(n.id===e)return t=n,!0}),t},getSalesChannelDomainCriteria(e){let t=new S;return t.addFilter(S.prefix("url","https://")),t.addFilter(S.equals("salesChannelId",e)),t}}});let{Component:_,Mixin:C,Context:P}=Shopware;_.register("unzer-webhooks-modal",{template:'\n \n {{ $tc(\'unzer-payment-settings.webhook.empty\') }}\n \n \n \n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.submit.clear\', webhookSelectionLength, {count: webhookSelectionLength}) }}\n \n
\n',mixins:[C.getByName("notification")],inject:["UnzerPaymentConfigurationService"],props:{keyPair:{type:Array,required:!0},webhooks:{type:Array,required:!0},isLoadingWebhooks:{type:Boolean}},data(){return{isClearing:!1,isClearingSuccessful:!1,webhookSelection:null,webhookSelectionLength:0}},computed:{webhookColumns(){return[{property:"event",dataIndex:"event",label:"Event"},{property:"url",dataIndex:"url",label:"URL"}]}},methods:{clearWebhooks(e){let t=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.UnzerPaymentConfigurationService.clearWebhooks({privateKey:e,selection:this.webhookSelection}).then(n=>{t.isClearingSuccessful=!0,t.webhookSelection=[],t.webhookSelectionLength=0,t.$refs.webhookDataGrid.resetSelection(),t.$emit("load-webhooks",e),void 0!==n&&t.messageGeneration(n)}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment-settings.webhook.globalError.title"),message:this.$tc("unzer-payment-settings.webhook.globalError.message")})}).finally(()=>{t.isLoading=!1,t.isClearing=!1})},onClearingFinished(){this.isClearingSuccessful=!1,this.isClearing=!1},onSelectWebhook(e){this.webhookSelectionLength=Object.keys(e).length,this.webhookSelection=e},messageGeneration(e){let t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n})})}}}),n(708),n(337);let{Component:D}=Shopware;D.register("unzer-payment-plugin-icon",{template:'{% block unzer_plugin_icon %}\n
\n{% endblock %}',computed:{assetFilter(){return Shopware.Filter.getByName("asset")}}}),n(425);let{Component:R}=Shopware;R.register("unzer-settings-subheading",{template:'{% block unzer_settings_subheading %}\n {{ label }}
\n{% endblock %}',computed:{label(){let e=this.$attrs.name.split("."),t=e[e.length-1];return this.$tc("unzer-payment-settings.subheadings."+t)}}});let{Component:$}=Shopware;$.override("sw-system-config",{template:"{% block sw_system_config_content_card_field %}\n \n \n \n \n \n {% parent() %}\n \n{% endblock %}",inject:["UnzerPaymentConfigurationService"],data(){return{readOnlyUnzerGooglePayGatewayMerchantId:{}}},watch:{currentSalesChannelId(){this.getUnzerGooglePayGatewayMerchantId(),this.$emit("sales-channel-changed",this.actualConfigData[this.currentSalesChannelId],this.currentSalesChannelId)},isLoading(e){this.$emit("loading-changed",e),!1===e&&this.getUnzerGooglePayGatewayMerchantId()}},computed:{unzerGooglePayGatewayMerchantId(){return this.readOnlyUnzerGooglePayGatewayMerchantId||""}},methods:{async createdComponent(){await this.$super("createdComponent"),this.getUnzerGooglePayGatewayMerchantId()},getUnzerGooglePayGatewayMerchantId(){"UnzerPayment6.settings"===this.domain&&this.UnzerPaymentConfigurationService.getGooglePayGatewayMerchantId(this.currentSalesChannelId).then(e=>{this.readOnlyUnzerGooglePayGatewayMerchantId=e.gatewayMerchantId}).catch(()=>{})}}}),n(345);let{Component:M,Mixin:I,Context:T}=Shopware;M.register("unzer-payment-settings",{template:'{% block unzer_payment_settings %}\n \n {% block unzer_payment_settings_header %}\n \n \n {{ $tc(\'sw-settings.index.title\') }}\n \n {{ $tc(\'unzer-payment-settings.module.title\') }}\n
\n \n {% endblock %}\n\n {% block unzer_payment_settings_actions %}\n \n {% block unzer_payment_settings_actions_save %}\n \n {{ $tc(\'global.default.save\') }}\n \n {% endblock %}\n \n {% endblock %}\n\n {% block unzer_payment_settings_content %}\n \n \n \n \n \n \n {{ $tc(\'unzer-payment-settings.webhook.show\') }}\n \n \n \n \n {{ $tc(\'unzer-payment-settings.form.testButton\') }}\n \n \n \n
\n
\n {{ $tc(\'unzer-payment-settings.form.additionalKeys\') }}\n
\n
\n
\n
\n
\n \n
\n {{ keyPairSettingGroupTitle(keyPairSetting) }}\n
\n
\n \n
\n {{ keyPairSettingTitle(keyPairSetting) }}\n
\n
\n
\n
\n \n {{ $tc(\'unzer-payment-settings.webhook.show\') }}\n \n \n \n \n {{ $tc(\'unzer-payment-settings.form.testButton\') }}\n \n
\n
\n \n
\n
\n \n \n \n \n \n \n \n {% endblock %}\n \n{% endblock %}',mixins:[I.getByName("notification"),I.getByName("sw-inline-snippet")],inject:["repositoryFactory","UnzerPaymentConfigurationService"],data(){return{isLoading:!0,isLoadingWebhooks:!0,isAdditionalKeysExpanded:!1,selectedKeyPairForTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},webhooks:[],loadedWebhooksPrivateKey:!1,selectedSalesChannelId:null,keyPairSettings:[{key:"b2b-eur",group:"paylaterInvoice"},{key:"b2b-chf",group:"paylaterInvoice"},{key:"b2c-eur",group:"paylaterInvoice"},{key:"b2c-chf",group:"paylaterInvoice"},{key:"b2c-eur",group:"paylaterInstallment"},{key:"b2c-chf",group:"paylaterInstallment"},{key:"b2c-eur",group:"paylaterDirectDebitSecured"}],openModalKeyPair:null}},metaInfo(){return{title:"UnzerPayment"}},computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")},arrowIconName(){return T.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i)[3]>=5?"regular-chevron-right-xs":"small-arrow-medium-right"},defaultKeyPair(){return{privateKey:this.getConfigValue("privateKey"),publicKey:this.getConfigValue("publicKey")}}},watch:{openModalKeyPair(e){e&&e.privateKey!==this.loadedWebhooksPrivateKey&&this.loadWebhooks(e.privateKey)}},methods:{getConfigValue(e){if(!this.config||!this.$refs.systemConfig||!this.$refs.systemConfig.actualConfigData||!this.$refs.systemConfig.actualConfigData.null)return"";let t=this.$refs.systemConfig.actualConfigData.null;return this.config[`UnzerPayment6.settings.${e}`]||t[`UnzerPayment6.settings.${e}`]},onValidateCredentials(e){this.isTestSuccessful=!1,this.selectedKeyPairForTesting=e;let t=this.getArrayKeyOfKeyPairSetting(e),n=e;-1!==t&&(n=this.keyPairSettings[t]);let a={publicKey:n.publicKey,privateKey:n.privateKey,salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.UnzerPaymentConfigurationService.validateCredentials(a).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment-settings.form.message.success.title"),message:this.$tc("unzer-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.selectedKeyPairForTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment-settings.form.message.error.title"),message:this.$tc("unzer-payment-settings.form.message.error.message")}),this.onTestFinished()})},onTestFinished(){this.selectedKeyPairForTesting=!1,this.isTestSuccessful=!1},setPublicKey(e,t){this.keyPairSettings[this.getArrayKeyOfKeyPairSetting(e)].publicKey=t},setPrivateKey(e,t){this.keyPairSettings[this.getArrayKeyOfKeyPairSetting(e)].privateKey=t},getArrayKeyOfKeyPairSetting(e){return this.keyPairSettings.findIndex(t=>t.key===e.key&&t.group===e.group)},onSave(){this.isLoading=!0,["paylaterInvoice","paylaterInstallment","paylaterDirectDebitSecured"].forEach(e=>{this.config[`UnzerPayment6.settings.${e}`]=[]}),this.keyPairSettings.reduce((e,t)=>(t&&t.privateKey&&t.publicKey&&e[`UnzerPayment6.settings.${t.group}`].push(t),e),this.config),this.$refs.systemConfig.saveAll().then(()=>{this.isSaveSuccessful=!0;let e=this.$tc("sw-plugin-config.messageSaveSuccess");"sw-plugin-config.messageSaveSuccess"===e&&(e=this.$tc("sw-extension-store.component.sw-extension-config.messageSaveSuccess")),this.createNotificationSuccess({title:this.$tc("global.default.success"),message:e}),document.dispatchEvent(new CustomEvent("unzer-settings-saved",{}))}).catch(e=>{this.isSaveSuccessful=!1,this.createNotificationError({title:this.$tc("global.default.error"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e,this.isLoading=!1,this.syncKeyPairConfig()},onLoadingChanged(e){this.isLoading=e},onSalesChannelChanged(e,t){e&&this.onConfigChange(e),this.selectedSalesChannelId=t},onWebhookRegistered(e){this.loadWebhooks(e)},loadWebhooks(e){this.isLoadingWebhooks=!0,this.UnzerPaymentConfigurationService.getWebhooks(e).then(t=>{this.webhooks=t,this.webhookSelection=null,this.webhookSelectionLength=0,this.loadedWebhooksPrivateKey=e}).catch(()=>{this.webhooks=[],this.loadedWebhooksPrivateKey=!1}).finally(()=>{this.isLoadingWebhooks=!1,this.isClearingSuccessful=!1})},getBind(e,t){let n;return t!==this.config&&(this.config=t),this.$refs.systemConfig.config.forEach(t=>{t.elements.forEach(t=>{if(t.name===e.name){n=t;return}})}),n||e},keyPairSettingTitle(e){return this.$tc(`unzer-payment.methods.${e.group}.${e.key}`)},keyPairSettingGroupTitle(e){return this.$tc(`unzer-payment.methods.${e.group}.main`)},isShowWebhooksButtonEnabled(e){return e&&e.privateKey&&e.publicKey},isRegisterWebhooksButtonEnabled(e){return!this.isLoading&&e&&e.privateKey},syncKeyPairConfig(){let e=this;["paylaterInvoice","paylaterInstallment","paylaterDirectDebitSecured"].forEach(t=>{this.config[`UnzerPayment6.settings.${t}`]&&this.config[`UnzerPayment6.settings.${t}`].forEach(t=>{e.keyPairSettings.forEach((e,n,a)=>{e.group===t.group&&e.key===t.key&&(a[n]=t)})})})},toggleAdditionalKeys(){this.isAdditionalKeysExpanded=!this.isAdditionalKeysExpanded}}});let{Module:A}=Shopware;A.register("unzer-payment-configuration",{type:"plugin",name:"UnzerPayment",title:"unzer-payment-settings.module.title",description:"unzer-payment-settings.module.description",version:"1.1.0",targetVersion:"1.1.0",snippets:{"de-DE":w,"en-GB":z},routes:{settings:{component:"unzer-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}},settingsItem:{name:"unzer-payment-configuration",to:"unzer.payment.configuration.settings",label:"unzer-payment-settings.module.title",group:"plugins",iconComponent:"unzer-payment-plugin-icon",backgroundEnabled:!1}}),n(748),n(963),Shopware.Component.override("sw-payment-card",{template:'{% block sw_payment_card_description %}\n \n
\n \n {{ $tc(\'sw-payment-card.deprecated\') }}\n \n
\n
\n
\n{% endblock %}',snippets:{"de-DE":w,"en-GB":z}}),n(34)}()}();
\ No newline at end of file
+!function(){var e={296:function(){},906:function(){},836:function(){},325:function(){},299:function(){},963:function(){let{Application:e}=Shopware,t=Shopware.Classes.ApiService;class n extends t{constructor(e,t,n="unzer-payment"){super(e,t,n)}validateCredentials(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-credentials`,e,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}registerWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/register-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}clearWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/clear-webhooks`,e,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}getWebhooks(e){return this.httpClient.post(`_action/${this.getApiBasePath()}/get-webhooks`,{privateKey:e},{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}getGooglePayGatewayMerchantId(e){return this.httpClient.get(`_action/${this.getApiBasePath()}/get-google-pay-gateway-merchant-id?salesChannelId=${e||""}`,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}}e.addServiceProvider("UnzerPaymentConfigurationService",t=>new n(e.getContainer("init").httpClient,t.loginService))},748:function(){let{Application:e}=Shopware,t=Shopware.Classes.ApiService;class n extends t{constructor(e,t,n="unzer-payment"){super(e,t,n)}fetchPaymentDetails(e){let n=`_action/${this.getApiBasePath()}/transaction/${e}/details`;return this.httpClient.get(n,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}chargeTransaction(e,n,a){let s=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${a}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}refundTransaction(e,n,a,s=null){let i=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${n}/${a}`;return null!==s&&(i=`${i}/${s}`),this.httpClient.get(i,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}cancelTransaction(e,n,a){let s=`_action/${this.getApiBasePath()}/transaction/${e}/cancel/${n}/${a}`;return this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}ship(e){let n=`_action/${this.getApiBasePath()}/transaction/${e}/ship`;return this.httpClient.get(n,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}}e.addServiceProvider("UnzerPaymentService",t=>new n(e.getContainer("init").httpClient,t.loginService))},337:function(){let{Component:e}=Shopware,{Criteria:t,EntityCollection:n}=Shopware.Data;e.extend("unzer-entity-multi-select-delivery-status","sw-entity-multi-id-select",{inject:["repositoryFactory"],props:{repository:{type:Object,required:!0,default(){return this.repositoryFactory.create("state_machine_state")}},criteria:{type:Object,required:!1,default(){let e=new t(1,100);return e.addFilter(t.equals("stateMachine.technicalName","order_delivery.state")),e}},entityCollection(){}}})},708:function(){let{Component:e}=Shopware,{Criteria:t}=Shopware.Data;e.extend("unzer-entity-single-select-delivery-status","sw-entity-single-select",{props:{criteria:{type:Object,required:!1,default(){let e=new t(1,100);return e.addFilter(t.equals("stateMachine.technicalName","order_delivery.state")),e}}}})},129:function(e,t,n){var a=n(296);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("0620ec53",a,!0,{})},425:function(e,t,n){var a=n(906);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("f0afdb6a",a,!0,{})},345:function(e,t,n){var a=n(836);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("61f99e4d",a,!0,{})},90:function(e,t,n){var a=n(325);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("05921a3e",a,!0,{})},34:function(e,t,n){var a=n(299);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("3bbcbade",a,!0,{})},534:function(e,t,n){"use strict";function a(e,t){for(var n=[],a={},s=0;sn.parts.length&&(a.parts.length=n.parts.length)}else{for(var i=[],s=0;s\n {% block unzer_payment_actions_amount_field %}\n \n \n \n
\n {% endblock %}\n \n \n {% block unzer_payment_actions_charge_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.chargeButton\') }}\n \n {% endblock %}\n\n {% block unzer_payment_actions_cancel_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.cancelButton\') }}\n \n {% endblock %}\n \n \n {% block unzer_payment_actions_reason_field %}\n \n \n {% endblock %}\n\n {% block unzer_payment_actions_refund_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.refundButton\') }}\n \n {% endblock %}\n \n {% block unzer_payment_actions_button_container_inner %}{% endblock %}\n
\n \n\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.noActions\') }}\n
\n{% endblock %}',inject:["UnzerPaymentService"],mixins:[t.getByName("notification")],data(){return{isLoading:!1,isSuccessful:!1,transactionAmount:0,reasonCode:null}},props:{transactionResource:{type:Object,required:!0},paymentResource:{type:Object,required:!0},decimalPrecision:{type:Number,required:!0,default:4}},computed:{isChargePossible:function(){return"authorization"===this.transactionResource.type&&"error"!==this.transactionResource.state},isRefundPossible:function(){return"charge"===this.transactionResource.type&&"error"!==this.transactionResource.state&&!(this.transactionResource.isFirst&&"085b64d0028a8bd447294e03c4eb411a"===this.paymentResource.paymentMethodId&&"pending"!==this.paymentResource.state.name&&"partly"!==this.paymentResource.state.name)},maxTransactionAmount(){let e=0,t=this.isRefundPossible&&"085b64d0028a8bd447294e03c4eb411a"===this.paymentResource.paymentMethodId;return this.isRefundPossible&&(e=this.transactionResource.amount),this.isChargePossible&&(e=this.paymentResource.amount.remaining),"remainingAmount"in this.transactionResource&&(e=this.transactionResource.remainingAmount),this.transactionResource.isFirst&&t&&(e=this.paymentResource.amount.remaining),e/10**this.paymentResource.amount.decimalPrecision},reasonCodeSelection(){return[{label:this.$tc("unzer-payment.paymentDetails.actions.reason.cancel"),value:"CANCEL"},{label:this.$tc("unzer-payment.paymentDetails.actions.reason.credit"),value:"CREDIT"},{label:this.$tc("unzer-payment.paymentDetails.actions.reason.return"),value:"RETURN"}]}},created(){this.transactionAmount=this.maxTransactionAmount},methods:{charge(){this.isLoading=!0,this.UnzerPaymentService.chargeTransaction(this.paymentResource.orderTransactionId,this.transactionResource.id,this.transactionAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.chargeSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.chargeSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage")),"paylater-invoice-document-required"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.paylaterInvoiceDocumentRequiredErrorMessage")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.chargeErrorTitle"),message:t}),this.isLoading=!1})},refund(){this.isLoading=!0,this.UnzerPaymentService.refundTransaction(this.paymentResource.orderTransactionId,this.transactionResource.id,this.transactionAmount,this.reasonCode).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.refundSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.refundSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.refundErrorTitle"),message:t}),this.isLoading=!1})},startCancel(){this.$emit("cancel",this.transactionAmount)}}});let{Component:a,Mixin:s,Module:i}=Shopware;a.register("unzer-payment-detail",{template:'{% block unzer_payment_detail %}\n \n \n {% block unzer_payment_detail_container %}\n \n {% block unzer_payment_detail_container_left %}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.amountRemaining\') }}\n \n \n {{ formatCurrency(remainingAmount) }}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.amountCancelled\') }}\n \n \n {{ formatCurrency(cancelledAmount) }}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.amountCharged\') }}\n \n \n {{ formatCurrency(chargedAmount) }}\n \n {% block unzer_payment_detail_container_left_inner %}{% endblock %}\n \n {% endblock %}\n\n {% block unzer_payment_detail_container_right %}\n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.shortId\') }}\n \n {{ paymentResource.shortId }}\n \n {{ $tc(\'unzer-payment.paymentDetails.detail.id\') }}\n \n {{ paymentResource.id }}\n \n {{ $tc(\'unzer-payment.paymentDetails.detail.state\') }}\n \n \n {{ paymentResource.state.name }}\n \n \n \n {{ $tc(\'unzer-payment.paymentDetails.detail.descriptor\') }}\n \n \n {{ paymentResource.descriptor }}\n \n \n {% block unzer_payment_detail_container_right_inner %}{% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n {% block unzer_payment_detail_footer %}\n \n {% block unzer_payment_detail_ship_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.shipButton\') }}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}',inject:["UnzerPaymentService"],mixins:[s.getByName("notification")],data(){return{isLoading:!1,isSuccessful:!1,paylaterPaymentMethods:["09588ffee8064f168e909ff31889dd7f","12fbfbce271a43a89b3783453b88e9a6","6d6adcd4b7bf40499873c294a85f32ed"]}},props:{paymentResource:{type:Object,required:!0}},computed:{unzerMaxDigits(){let e=i.getModuleRegistry().get("unzer-payment");return e&&e.manifest?e.manifest.maxDigits:4},remainingAmount(){return this.paymentResource&&this.paymentResource.amount?this.formatAmount(this.paymentResource.amount.remaining,this.paymentResource.amount.decimalPrecision):0},cancelledAmount(){return this.paymentResource&&this.paymentResource.amount?this.formatAmount(this.paymentResource.amount.cancelled,this.paymentResource.amount.decimalPrecision):0},chargedAmount(){return this.paymentResource&&this.paymentResource.amount?this.formatAmount(this.paymentResource.amount.charged,this.paymentResource.amount.decimalPrecision):0}},methods:{reloadOrderDetail(){this.$emit("reloadOrderDetails")},ship(){this.isLoading=!0,this.UnzerPaymentService.ship(this.paymentResource.orderTransactionId).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.shipSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.shipSuccessMessage")}),this.isSuccessful=!0,this.$emit("reload")}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t?t=this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage"):"invoice-missing-error"===t?t=this.$tc("unzer-payment.paymentDetails.notifications.invoiceNotFoundMessage"):"documentdate-missing-error"===t?t=this.$tc("unzer-payment.paymentDetails.notifications.documentDateMissingError"):"payment-missing-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.paymentMissingError")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.shipErrorTitle"),message:t}),this.isLoading=!1})},formatAmount(e,t){return e/10**Math.min(this.unzerMaxDigits,t)},formatCurrency(e){return Shopware.Utils.format.currency(e||0,this.paymentResource.currency)},isPaylaterPaymentMethod(e){return this.paylaterPaymentMethods.indexOf(e)>=0}}});let{Component:r,Module:o,Mixin:c}=Shopware;r.register("unzer-payment-history",{template:'{% block unzer_payment_history %}\n \n {% block unzer_payment_history_container %}\n \n {% block unzer_payment_history_data_grid %}\n \n {% block unzer_payment_history_actions %}\n \n {% block unzer_payment_history_data_grid_item_actions %}\n { openCancelModal(item, cancelAmount) }"\n >\n \n {% endblock %}\n \n {% endblock %}\n\n {% block unzer_payment_history_actions_modals %}\n \n \n \n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.text\') }}\n
\n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.amountLabel\') }}\n {{ formatCurrency(cancelAmount) }}\n
\n \n {% block sw_confirm_modal_footer_cancel %}\n \n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.noButton\') }}\n \n {% endblock %}\n\n {% block sw_confirm_modal_footer_confirm %}\n \n {{ $t(\'unzer-payment.paymentDetails.actions.confirmCancelModal.yesButton\') }}\n \n {% endblock %}\n \n \n \n {% endblock %}\n \n {% endblock %}\n \n {% endblock %}\n \n{% endblock %}',inject:["repositoryFactory","UnzerPaymentService"],mixins:[c.getByName("notification")],data(){return{showCancelModal:!1,isCancelLoading:!1,cancelAmount:0}},props:{paymentResource:{type:Object,required:!0}},computed:{unzerMaxDigits(){let e=o.getModuleRegistry().get("unzer-payment");return e&&e.manifest?e.manifest.maxDigits:4},orderTransactionRepository:function(){return this.repositoryFactory.create("order_transaction")},decimalPrecision(){return this.paymentResource&&this.paymentResource.amount&&this.paymentResource.amount.decimalPrecision?Math.min(this.unzerMaxDigits,this.paymentResource.amount.decimalPrecision):this.unzerMaxDigits},data:function(){let e=[];return Object.values(this.paymentResource.transactions).forEach(t=>{let n=this.formatCurrency(this.formatAmount(parseFloat(t.amount),this.decimalPrecision)),a=Shopware.Filter.getByName("date")(t.date,{hour:"numeric",minute:"numeric",second:"numeric"});e.push({type:this.transactionTypeRenderer(t.type),amount:n,date:a,resource:t})}),e},columns:function(){return[{property:"type",label:this.$tc("unzer-payment.paymentDetails.history.column.type"),rawData:!0},{property:"amount",label:this.$tc("unzer-payment.paymentDetails.history.column.amount"),rawData:!0},{property:"date",label:this.$tc("unzer-payment.paymentDetails.history.column.date"),rawData:!0}]}},methods:{transactionTypeRenderer:function(e){switch(e){case"authorization":return this.$tc("unzer-payment.paymentDetails.history.type.authorization");case"charge":return this.$tc("unzer-payment.paymentDetails.history.type.charge");case"shipment":return this.$tc("unzer-payment.paymentDetails.history.type.shipment");case"refund":return this.$tc("unzer-payment.paymentDetails.history.type.refund");case"cancellation":return this.$tc("unzer-payment.paymentDetails.history.type.cancellation");default:return this.$tc("unzer-payment.paymentDetails.history.type.default")}},reload:function(){this.$emit("reload"),this.$emit("reloadOrderDetails")},formatAmount(e,t){return e/10**t},openCancelModal(e,t){this.showCancelModal=e.resource.id,this.cancelAmount=t},closeCancelModal(){this.showCancelModal=!1,this.cancelAmount=0},cancel(){this.isCancelLoading=!0,this.UnzerPaymentService.cancelTransaction(this.paymentResource.orderTransactionId,this.paymentResource.id,this.cancelAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment.paymentDetails.notifications.cancelSuccessTitle"),message:this.$tc("unzer-payment.paymentDetails.notifications.cancelSuccessMessage")}),this.reload()}).catch(e=>{let t=e.response.data.errors[0];"generic-error"===t&&(t=this.$tc("unzer-payment.paymentDetails.notifications.cancelErrorMessage")),this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.cancelErrorTitle"),message:t}),this.isCancelLoading=!1,this.reload()})},formatCurrency(e){return Shopware.Utils.format.currency(e||0,this.paymentResource.currency)}}});let{Component:l}=Shopware;l.register("unzer-payment-metadata",{template:'{% block unzer_payment_metadata %}\n \n \n {% block unzer_payment_metadata_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}',props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){let e=[];return this.paymentResource.metadata.forEach(t=>{e.push({key:t.key,value:t.value})}),e},columns:function(){return[{property:"key",label:this.$tc("unzer-payment.paymentDetails.metadata.column.key"),rawData:!0},{property:"value",label:this.$tc("unzer-payment.paymentDetails.metadata.column.value"),rawData:!0}]}}});let{Component:d}=Shopware;d.register("unzer-payment-basket",{template:'{% block unzer_payment_basket %}\n \n \n {% block unzer_payment_basket_container %}\n \n \n {% endblock %}\n \n \n{% endblock %}',props:{paymentResource:{type:Object,required:!0}},computed:{data:function(){let e=[];return this.paymentResource.basket.basketItems.forEach(t=>{let n=this.formatCurrency(parseFloat(t.amountGross.toFixed(2))),a=this.formatCurrency(parseFloat(t.amountNet.toFixed(2)));t.amountDiscount>0&&(n=this.formatCurrency(-1*parseFloat(t.amountDiscount.toFixed(2))),a=this.formatCurrency(-1*parseFloat((t.amountDiscount-t.amountVat).toFixed(2)))),e.push({quantity:t.quantity,title:t.title,amountGross:n,amountNet:a})}),e},columns:function(){return[{property:"quantity",label:this.$tc("unzer-payment.paymentDetails.basket.column.quantity"),rawData:!0},{property:"title",label:this.$tc("unzer-payment.paymentDetails.basket.column.title"),rawData:!0},{property:"amountGross",label:this.$tc("unzer-payment.paymentDetails.basket.column.amountGross"),rawData:!0},{property:"amountNet",label:this.$tc("unzer-payment.paymentDetails.basket.column.amountNet"),rawData:!0}]}},methods:{formatCurrency(e){return Shopware.Utils.format.currency(e||0,this.paymentResource.currency)}}});let{Criteria:u}=Shopware.Data,m=["bc4c2cbfb5fda0bf549e4807440d0a54","4673044aff79424a938d42e9847693c3","713c7a332b432dcd4092701eda522a7e","5123af5ce94a4a286641973e8de7eb60","17830aa7e6a00b99eab27f0e45ac5e0d","4ebb99451f36ba01f13d5871a30bce2c","d4b90a17af62c1bb2f6c3b1fed339425","4b9f8d08b46a83839fd0eb14fe00efe6","08fb8d9a72ab4ca62b811e74f2eca79f","6cc3b56ce9b0f80bd44039c047282a41","614ad722a03ee96baa2446793143215b","409fe641d6d62a4416edd6307d758791","085b64d0028a8bd447294e03c4eb411a","cd6f59d572e6c90dff77a48ce16b44db","fd96d03535a46d197f5adac17c9f8bac","09588ffee8064f168e909ff31889dd7f"];Shopware.Component.override("sw-order-create-details-footer",{template:'{% block sw_order_create_details_footer_payment_method %}\n \n{% endblock %}',computed:{paymentMethodCriteria(){let e=new u;return this.salesChannelId&&e.addFilter(u.equals("salesChannels.id",this.salesChannelId)),e.addFilter(u.not("AND",[u.equalsAny("id",m)])),e}}});let{Component:h,Context:p}=Shopware,{Criteria:y}=Shopware.Data;h.override("sw-order-detail",{template:"{% block sw_order_detail_content_tabs_general %}\n {% parent() %}\n\n {% block unzer_payment_payment_tab %}\n \n {{ $tc('unzer-payment.tabTitle') }}\n \n {% endblock %}\n{% endblock %}",data(){return{isUnzerPayment:!1}},computed:{showTabs(){return!0}},watch:{orderId:{deep:!0,handler(){if(!this.orderId){this.isUnzerPayment=!1;return}let e=this.repositoryFactory.create("order"),t=new y(1,1);t.addAssociation("transactions"),e.get(this.orderId,p.api,t).then(e=>{e.transactions.forEach(e=>{e.customFields&&(e.customFields.unzer_payment_is_transaction||e.customFields.heidelpay_is_transaction)&&(this.isUnzerPayment=!0)})})},immediate:!0}}}),Shopware.Component.override("sw-order-list",{template:'{% block sw_order_list_grid_columns %}\n {% parent() %}\n\n {% block unzer_payment_column_transaction %}\n \n \n {{ item.transactions.last().id }}\n \n \n {% endblock %}\n{% endblock %}',methods:{getOrderColumns(){let e=this.$super("getOrderColumns");return e.splice(1,0,{property:"unzerPaymentTransactionId",label:"unzer-payment.order-list.transactionId",allowResize:!0}),e}}});let{Component:g,Context:f,Mixin:b}=Shopware,{Criteria:k}=Shopware.Data;g.register("unzer-payment-tab",{template:'{% block unzer_payment_payment_details %}\n \n
\n {% block unzer_payment_payment_details_content %}\n \n \n {% block unzer_payment_payment_details_content_payment_detail %}\n \n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_payment_history %}\n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_payment_basket %}\n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_payment_metadata %}\n \n \n {% endblock %}\n\n {% block unzer_payment_payment_details_content_inner %}{% endblock %}\n \n \n {% endblock %}\n
\n
\n
\n{% endblock %}',inject:["UnzerPaymentService","repositoryFactory"],mixins:[b.getByName("notification")],data(){return{paymentResources:[],loadedResources:0,isLoading:!0,order:null}},created(){this.createdComponent()},computed:{orderRepository(){return this.repositoryFactory.create("order")}},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},methods:{createdComponent(){this.loadData()},resetDataAttributes(){this.paymentResources=[],this.loadedResources=0,this.isLoading=!0},reloadPaymentDetails(){this.resetDataAttributes(),this.loadData()},loadData(){let e=this.$route.params.id,t=new k;t.addAssociation("currency").addAssociation("lineItems.promotion").getAssociation("transactions").addSorting(k.sort("createdAt","DESC")),this.orderRepository.get(e,f.api,t).then(e=>{this.order=e,e.transactions&&e.transactions.forEach((e,t)=>{if(!e.customFields||!e.customFields.unzer_payment_is_transaction&&!e.customFields.heidelpay_is_transaction){this.loadedResources++;return}this.UnzerPaymentService.fetchPaymentDetails(e.id).then(n=>{this.paymentResources[t]=n,this.paymentResources[t].orderTransactionId=e.id,this.loadedResources++,this.isLoading=this.order.transactions.length!==this.loadedResources}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment.paymentDetails.notifications.genericErrorMessage"),message:this.$tc("unzer-payment.paymentDetails.notifications.couldNotRetrieveMessage")}),this.isLoading=!1})})})},reloadOrderDetails(){setTimeout(()=>{this.findOrderDetailComponentAndReInit()},5e3)},async findOrderDetailComponentAndReInit(e=this){let t=e.$parent;return void 0===t?null:"sw-order-detail"!==t.$options.name?this.findOrderDetailComponentAndReInit(t):t.isOrderEditing?null:void t.createdComponent()}}});var w=JSON.parse('{"unzer-payment":{"tabTitle":"Unzer Payment","paymentDetails":{"history":{"cardTitle":"Zahlungsverlauf","column":{"type":"Typ","amount":"Betrag","date":"Datum"},"type":{"authorization":"Reservierung","charge":"Einzug","shipment":"Versandmitteilung","refund":"R\xfcckerstattung","cancellation":"Stornierung","default":""}},"actions":{"reason":{"placeholder":"Grund","cancel":"Abgebrochen","credit":"Gutschrift","return":"R\xfcckgabe"},"chargeButton":"Einziehen","shipButton":"Versandmitteilung","refundButton":"R\xfcckerstatten","defaultButton":"Erledigt","cancelButton":"Stornieren","noActions":"Keine Aktionen m\xf6glich","confirmCancelModal":{"text":"M\xf6chten Sie wirklich die Reservierung \xfcber den angegebenen Betrag stornieren?","amountLabel":"Betrag:","yesButton":"Ja","noButton":"Nein"}},"detail":{"cardTitle":"Zahlungsdetails","shortId":"Short-ID","id":"Zahlungs-ID","state":"Status","amountRemaining":"Betrag (Rest)","amountCancelled":"Betrag (R\xfcckerstattet)","amountCharged":"Betrag (Eingezogen)","descriptor":"Verwendungszweck"},"metadata":{"cardTitle":"Metadaten","column":{"key":"Schl\xfcssel","value":"Wert"}},"basket":{"cardTitle":"Warenkorb","column":{"quantity":"Anzahl","title":"Titel","amountGross":"Betrag (brutto)","amountNet":"Betrag (netto)"}},"notifications":{"genericErrorMessage":"Es ist ein Fehler aufgetreten!","refundSuccessTitle":"R\xfcckerstatten","refundSuccessMessage":"Die R\xfcckerstattung wurde erfolgreich durchgef\xfchrt.","refundErrorTitle":"R\xfcckerstatten","chargeSuccessTitle":"Einziehen","chargeSuccessMessage":"Das Einziehen der Zahlung wurde erfolgreich durchgef\xfchrt.","chargeErrorTitle":"Einziehen","shipSuccessTitle":"Versandmitteilung","shipSuccessMessage":"Die Versandmitteilung wurde erfolgreich gesendet.","shipErrorTitle":"Versandmitteilung","invoiceNotFoundMessage":"Zu dieser Bestellung wurde keine Rechnung gefunden","couldNotRetrieveMessage":"Die Zahlungsdetails konnten nicht abgerufen werden, bitte pr\xfcfen Sie die Logdateien f\xfcr weitere Informationen.","documentDateMissingError":"Das Datum der Rechnung ist leer.","paymentMissingError":"Die Zahlung konnte nicht gefunden werden","paylaterInvoiceDocumentRequiredErrorMessage":"Bitte erstellen oder hinterlegen Sie zun\xe4chst eine Rechnung f\xfcr die Bestellung.","cancelSuccessTitle":"Stornierung","cancelErrorTitle":"Stornierung","cancelSuccessMessage":"Die Stornierung wurde erfolgreich durchgef\xfchrt.","cancelErrorMessage":"Die Stornierung konnte nicht durchgef\xfchrt werden."}},"order-list":{"transactionId":"Unzer Transaktions ID"},"methods":{"paylaterInvoice":{"main":"Rechnungskauf","b2b-eur":"Rechnungskauf B2B EUR","b2b-chf":"Rechnungskauf B2B CHF","b2c-eur":"Rechnungskauf B2C EUR","b2c-chf":"Rechnungskauf B2C CHF"},"paylaterInstallment":{"main":"Ratenkauf","b2c-eur":"Ratenkauf B2C EUR","b2c-chf":"Ratenkauf B2C CHF"},"paylaterDirectDebitSecured":{"main":"Lastschrift","b2c-eur":"Lastschrift B2C EUR"}}},"unzer-payment-settings":{"subheadings":{"paymentSettingsBookingModes":"Buchungsmodus","paymentSettingsSaveDevices":"Zahlungsmittel speichern","paymentSettingsExpressCheckout":"Express Checkout"},"module":{"title":"Unzer Payment","description":"Unzer Payment"},"google-pay":{"gatewayMerchantId":"Gateway H\xe4ndler ID"},"form":{"message":{"success":{"title":"Test erfolgreich","message":"Die angegebenen API-Zugangsdaten sind korrekt!"},"error":{"title":"Test fehlgeschlagen","message":"Die angegebenen API-Zugangsdaten sind nicht korrekt! Bitte korrigieren Sie die Eingabe und versuchen Sie es erneut."}},"testButton":"API Zugangsdaten testen","webhookButton":"Webhooks registrieren","privateKey":"Private Key","publicKey":"Public Key","additionalKeys":"API Keys f\xfcr weitere Zahlungsarten","additionalKeysHelpText":"Wenn die Felder f\xfcr zus\xe4tzliche Schl\xfcsselpaare leer sind, werden standardm\xe4\xdfig die Hauptschl\xfcsselpaare \xfcbernommen."},"modal":{"close":"Schlie\xdfen","webhook":{"title":"Webhooks","httpsInfo":"Es kann nur eine HTTPS-Domain pro Verkaufskanal registriert werden.","registered":"Webhook ist bereits registriert","placeholder":"Bitte w\xe4hlen Sie eine Domain aus","submit":{"register":"Webhooks registrieren","clear":"Webhooks ausw\xe4hlen | Ausgew\xe4hlten Webhook entfernen | Entferne {count} Webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registriert | Webhooks registriert","error":"Der Webhook konnte nicht registriert werden | Die Webhooks konnten nicht registriert werden"},"clear":{"done":"Webhook entfernt | Webhooks entfernt","error":"Der Webhook konnte nicht entfernt werden | Die Webhooks konnten nicht entfernt werden"},"missing":{"fields":"Nicht alle ben\xf6tigten Felder sind vorhanden","context":"Der Kontext konnte nicht aktualisiert werden","selection":"Es wurden keine Domains selektiert"},"notFound":{"salesChannelDomain":"Die spezifizierte Domain wurde nicht gefunden"},"globalError":{"title":"Ein Fehler ist aufgetreten","message":"Bitte kontaktieren sie uns f\xfcr mehr Informationen"},"empty":"F\xfcr diesen Private Key sind keine Webhooks registriert. Bitte pr\xfcfen Sie ob dieser valide ist und ob Konfigurationen f\xfcr dedizierte Verkaufskan\xe4le vorgenommen wurden.","show":"Webhooks anzeigen"}},"sw-payment-card":{"deprecated":"Veraltet"}}'),z=JSON.parse('{"unzer-payment":{"tabTitle":"Unzer Payment","paymentDetails":{"history":{"cardTitle":"Payment History","column":{"type":"Type","amount":"Amount","date":"Date"},"type":{"authorization":"Authorization","charge":"Charging","shipment":"Shipping notification","refund":"Refund","cancellation":"Cancel","default":""}},"actions":{"reason":{"placeholder":"Reason","cancel":"Cancel","credit":"Credit","return":"Return"},"chargeButton":"Charge","shipButton":"Shipping notice","refundButton":"Refund","defaultButton":"Done","cancelButton":"Cancel","noActions":"No actions possible","confirmCancelModal":{"text":"Do you really want to cancel the authorization of the selected amount?","amountLabel":"Amount:","yesButton":"Yes","noButton":"No"}},"detail":{"cardTitle":"Payment Details","shortId":"Short-ID","id":"Payment-ID","state":"State","amountRemaining":"Amount (Remaining)","amountCancelled":"Amount (Cancelled)","amountCharged":"Amount (Charged)","descriptor":"Descriptor"},"metadata":{"cardTitle":"Metadata","column":{"key":"Key","value":"Value"}},"basket":{"cardTitle":"Basket","column":{"quantity":"Quantity","title":"Title","amountGross":"Amount (gross)","amountNet":"Amount (net)"}},"notifications":{"genericErrorMessage":"An error has occurred!","refundSuccessTitle":"Refund","refundSuccessMessage":"The reimbursement was successfully completed.","refundErrorTitle":"Refund","chargeSuccessTitle":"Charge","chargeSuccessMessage":"The collection of the payment was carried out successfully.","chargeErrorTitle":"Charge","shipSuccessTitle":"Shipping notice","shipSuccessMessage":"The shipping notification was successfully sent.","shipErrorTitle":"Shipping notice","invoiceNotFoundMessage":"No invoice was found for this order.","couldNotRetrieveMessage":"The payment details could not be retrieved, please check the log files for more information.","documentDateMissingError":"Document date for invoice is empty.","paymentMissingError":"Payment could not be found","paylaterInvoiceDocumentRequiredErrorMessage":"Please create or upload an invoice for the order first.","cancelSuccessTitle":"Cancel","cancelErrorTitle":"Cancel","cancelSuccessMessage":"The reversal was successfully completed.","cancelErrorMessage":"The reversal could not be performed."}},"order-list":{"transactionId":"Unzer transaction ID"},"methods":{"paylaterInvoice":{"main":"Invoice","b2b-eur":"Invoice B2B EUR","b2b-chf":"Invoice B2B CHF","b2c-eur":"Invoice B2C EUR","b2c-chf":"Invoice B2C CHF"},"paylaterInstallment":{"main":"Installment","b2c-eur":"Installment B2C EUR","b2c-chf":"Installment B2C CHF"},"paylaterDirectDebitSecured":{"main":"Direct Debit","b2c-eur":"Direct Debit B2C EUR"}}},"unzer-payment-settings":{"subheadings":{"paymentSettingsBookingModes":"Booking Modes","paymentSettingsSaveDevices":"Save Payment Details","paymentSettingsExpressCheckout":"Express Checkout"},"module":{"title":"Unzer Payment","description":"Unzer Payment"},"google-pay":{"gatewayMerchantId":"Gateway Merchant ID"},"form":{"message":{"success":{"title":"Test succeeded","message":"The provided credentials are valid!"},"error":{"title":"Test failed","message":"API Credentials are invalid, please correct them and try again!"}},"testButton":"Test API credentials","webhookButton":"Register webhooks","privateKey":"Private Key","publicKey":"Public Key","additionalKeys":"API Keys for additional payment methods","additionalKeysHelpText":"If additional keypairs fields are empty, main keypairs will be inherited by default."},"modal":{"close":"Close","webhook":{"title":"Webhooks","httpsInfo":"Only one HTTPS domain per sales channel can be registered.","registered":"Webhook is already registered","placeholder":"Please select a domain","submit":{"register":"Register webhooks","clear":"Select items to clear | Clear selected webhook | Clear {count} webhooks"}}},"webhook":{"messagePrefix":"Domain: ","register":{"done":"Webhook registered | Webhooks registered","error":"Webhook could not be registered | Webhooks could not be registered"},"clear":{"done":"Webhook cleared | Webhooks cleared","error":"Webhook could not be cleared | Webhooks could not be cleared"},"missing":{"fields":"Some mandatory fields are missing","context":"The context could not be refreshed","selection":"No domain was selected"},"notFound":{"salesChannelDomain":"The selected domain could not be found"},"globalError":{"title":"An error has occurred!","message":"Please contact us for more information"},"empty":"There are no webhooks registered for this private key. Make sure the private key is valid and check for other specific sales channel configurations.","show":"Show webhooks"}},"sw-payment-card":{"deprecated":"Deprecated"}}');let{Module:v}=Shopware;v.register("unzer-payment",{type:"plugin",name:"UnzerPayment",title:"unzer-payment.general.title",description:"unzer-payment.general.descriptionTextModule",version:"0.0.1",targetVersion:"0.0.1",maxDigits:4,snippets:{"de-DE":w,"en-GB":z},routeMiddleware(e,t){"sw.order.detail"===t.name&&t.children.push({component:"unzer-payment-tab",name:"unzer-payment.payment.detail",path:"/sw/order/detail/:id/unzer-payment",isChildren:!0,meta:{parentPath:"sw.order.index"}}),e(t)}}),n(129);let S=Shopware.Data.Criteria;Shopware.Component.register("unzer-payment-register-webhook",{template:'{% block unzer_payment_payment_register_webhook %}\n \n {% block unzer_payment_payment_register_webhook_button %}\n \n {{ $tc(\'unzer-payment-settings.form.webhookButton\') }}\n \n {% endblock %}\n\n {% block unzer_payment_payment_register_webhook_modal %}\n \n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.httpsInfo\') }}\n \n \n \n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.registered\') }}\n \n \n \n \n \n\n \n \n {{ $tc(\'unzer-payment-settings.modal.close\') }}\n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.submit.register\') }}\n \n \n \n {% endblock %}\n
\n{% endblock %}',mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","UnzerPaymentConfigurationService"],props:{webhooks:{type:Array,required:!0},isLoading:{type:Boolean,required:!1},selectedSalesChannelId:{type:String,required:!1},privateKey:{type:String,required:!0},isDisabled:{type:Boolean,required:!1}},computed:{salesChannelRepository(){return this.repositoryFactory.create("sales_channel")}},data(){return{isModalActive:!1,isRegistering:!1,isRegistrationSuccessful:!1,isDataLoading:!1,selection:{},selectedDomain:null,entitySelection:{},salesChannels:{}}},created(){this.createdComponent()},methods:{createdComponent(){this.loadData()},loadData(e,t){let n=this;this.isDataLoading=!0;let a=new S(e,t);a.addAssociation("domains"),this.salesChannelRepository.search(a,Shopware.Context.api).then(e=>{n.salesChannels=e,n.isDataLoading=!1})},onPageChange(e){this.loadData(e.page,e.limit)},openModal(){this.$emit("modal-open"),this.isModalActive=!0},closeModal(){this.isModalActive=!1},registerWebhooks(){let e=this;this.isRegistrationSuccessful=!1,this.isRegistering=!0,this.UnzerPaymentConfigurationService.registerWebhooks({selection:this.entitySelection}).then(t=>{e.isRegistrationSuccessful=!0,void 0!==t&&e.messageGeneration(t),this.$emit("webhook-registered",t)}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment-settings.webhook.globalError.title"),message:this.$tc("unzer-payment-settings.webhook.globalError.message")})}).finally(()=>{e.isRegistering=!1})},onRegistrationFinished(){this.isRegistrationSuccessful=!1,this.selection={}},onSelectItem(e,t){t&&(t.privateKey=this.privateKey,this.entitySelection[t.salesChannelId]=t)},messageGeneration(e){let t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n})})},isWebhookRegisteredForSalesChannel(e){let t=!1,n=this.getSalesChannelById(e);return!!this.webhooks.length&&(n.domains.forEach(e=>{this.webhooks.forEach(n=>{if(n.url.indexOf(e.url)>-1)return t=!0,!0})}),t)},getSalesChannelById(e){let t=null;return this.salesChannels.forEach(n=>{if(n.id===e)return t=n,!0}),t},getSalesChannelDomainCriteria(e){let t=new S;return t.addFilter(S.prefix("url","https://")),t.addFilter(S.equals("salesChannelId",e)),t}}});let{Component:_,Mixin:C,Context:P}=Shopware;_.register("unzer-webhooks-modal",{template:'\n \n {{ $tc(\'unzer-payment-settings.webhook.empty\') }}\n \n \n \n \n \n {{ $tc(\'unzer-payment-settings.modal.webhook.submit.clear\', webhookSelectionLength, {count: webhookSelectionLength}) }}\n \n
\n',mixins:[C.getByName("notification")],inject:["UnzerPaymentConfigurationService"],props:{keyPair:{type:Array,required:!0},webhooks:{type:Array,required:!0},isLoadingWebhooks:{type:Boolean}},data(){return{isClearing:!1,isClearingSuccessful:!1,webhookSelection:null,webhookSelectionLength:0}},computed:{webhookColumns(){return[{property:"event",dataIndex:"event",label:"Event"},{property:"url",dataIndex:"url",label:"URL"}]}},methods:{clearWebhooks(e){let t=this;this.isClearingSuccessful=!1,this.isClearing=!0,this.isLoading=!0,this.UnzerPaymentConfigurationService.clearWebhooks({privateKey:e,selection:this.webhookSelection}).then(n=>{t.isClearingSuccessful=!0,t.webhookSelection=[],t.webhookSelectionLength=0,t.$refs.webhookDataGrid.resetSelection(),t.$emit("load-webhooks",e),void 0!==n&&t.messageGeneration(n)}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment-settings.webhook.globalError.title"),message:this.$tc("unzer-payment-settings.webhook.globalError.message")})}).finally(()=>{t.isLoading=!1,t.isClearing=!1})},onClearingFinished(){this.isClearingSuccessful=!1,this.isClearing=!1},onSelectWebhook(e){this.webhookSelectionLength=Object.keys(e).length,this.webhookSelection=e},messageGeneration(e){let t=e.length;Object.keys(e).forEach(n=>{e[n].success?this.createNotificationSuccess({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n}):this.createNotificationError({title:this.$tc(e[n].message,t),message:this.$tc("unzer-payment-settings.webhook.messagePrefix",t)+n})})}}}),n(708),n(337);let{Component:D}=Shopware;D.register("unzer-payment-plugin-icon",{template:'{% block unzer_plugin_icon %}\n
\n{% endblock %}',computed:{assetFilter(){return Shopware.Filter.getByName("asset")}}}),n(425);let{Component:R}=Shopware;R.register("unzer-settings-subheading",{template:'{% block unzer_settings_subheading %}\n {{ label }}
\n{% endblock %}',computed:{label(){let e=this.$attrs.name.split("."),t=e[e.length-1];return this.$tc("unzer-payment-settings.subheadings."+t)}}});let{Component:$}=Shopware;$.override("sw-system-config",{template:"{% block sw_system_config_content_card_field %}\n \n \n \n \n \n {% parent() %}\n \n{% endblock %}",inject:["UnzerPaymentConfigurationService"],data(){return{readOnlyUnzerGooglePayGatewayMerchantId:{}}},watch:{currentSalesChannelId(){this.getUnzerGooglePayGatewayMerchantId(),this.$emit("sales-channel-changed",this.actualConfigData[this.currentSalesChannelId],this.currentSalesChannelId)},isLoading(e){this.$emit("loading-changed",e),!1===e&&this.getUnzerGooglePayGatewayMerchantId()}},computed:{unzerGooglePayGatewayMerchantId(){return this.readOnlyUnzerGooglePayGatewayMerchantId||""}},methods:{async createdComponent(){await this.$super("createdComponent"),this.getUnzerGooglePayGatewayMerchantId()},getUnzerGooglePayGatewayMerchantId(){"UnzerPayment6.settings"===this.domain&&this.UnzerPaymentConfigurationService.getGooglePayGatewayMerchantId(this.currentSalesChannelId).then(e=>{this.readOnlyUnzerGooglePayGatewayMerchantId=e.gatewayMerchantId}).catch(()=>{})}}}),n(345);let{Component:M,Mixin:I,Context:T}=Shopware;M.register("unzer-payment-settings",{template:'{% block unzer_payment_settings %}\n \n {% block unzer_payment_settings_header %}\n \n \n {{ $tc(\'sw-settings.index.title\') }}\n \n {{ $tc(\'unzer-payment-settings.module.title\') }}\n
\n \n {% endblock %}\n\n {% block unzer_payment_settings_actions %}\n \n {% block unzer_payment_settings_actions_save %}\n \n {{ $tc(\'global.default.save\') }}\n \n {% endblock %}\n \n {% endblock %}\n\n {% block unzer_payment_settings_content %}\n \n \n \n \n \n \n {{ $tc(\'unzer-payment-settings.webhook.show\') }}\n \n \n \n \n {{ $tc(\'unzer-payment-settings.form.testButton\') }}\n \n \n \n
\n
\n {{ $tc(\'unzer-payment-settings.form.additionalKeys\') }}\n
\n
\n
\n
\n
\n
\n \n
\n {{ keyPairSettingGroupTitle(keyPairSetting) }}\n
\n
\n \n
\n {{ keyPairSettingTitle(keyPairSetting) }}\n
\n
\n
\n
\n \n {{ $tc(\'unzer-payment-settings.webhook.show\') }}\n \n \n \n \n {{ $tc(\'unzer-payment-settings.form.testButton\') }}\n \n
\n
\n \n
\n
\n \n \n \n \n \n \n \n {% endblock %}\n \n{% endblock %}',mixins:[I.getByName("notification"),I.getByName("sw-inline-snippet")],inject:["repositoryFactory","UnzerPaymentConfigurationService"],data(){return{isLoading:!0,isLoadingWebhooks:!0,isAdditionalKeysExpanded:!1,selectedKeyPairForTesting:!1,isTestSuccessful:!1,isSaveSuccessful:!1,config:{},webhooks:[],loadedWebhooksPrivateKey:!1,selectedSalesChannelId:null,keyPairSettings:[{key:"b2b-eur",group:"paylaterInvoice"},{key:"b2b-chf",group:"paylaterInvoice"},{key:"b2c-eur",group:"paylaterInvoice"},{key:"b2c-chf",group:"paylaterInvoice"},{key:"b2c-eur",group:"paylaterInstallment"},{key:"b2c-chf",group:"paylaterInstallment"},{key:"b2c-eur",group:"paylaterDirectDebitSecured"}],openModalKeyPair:null}},metaInfo(){return{title:"UnzerPayment"}},computed:{paymentMethodRepository(){return this.repositoryFactory.create("payment_method")},arrowIconName(){return T.app.config.version.match(/((\d+)\.?(\d+?)\.?(\d+)?\.?(\d*))-?([A-z]+?\d+)?/i)[3]>=5?"regular-chevron-right-xs":"small-arrow-medium-right"},defaultKeyPair(){return{privateKey:this.getConfigValue("privateKey"),publicKey:this.getConfigValue("publicKey")}}},watch:{openModalKeyPair(e){e&&e.privateKey!==this.loadedWebhooksPrivateKey&&this.loadWebhooks(e.privateKey)}},methods:{getConfigValue(e){if(!this.config||!this.$refs.systemConfig||!this.$refs.systemConfig.actualConfigData||!this.$refs.systemConfig.actualConfigData.null)return"";let t=this.$refs.systemConfig.actualConfigData.null;return this.config[`UnzerPayment6.settings.${e}`]||t[`UnzerPayment6.settings.${e}`]},onValidateCredentials(e){this.isTestSuccessful=!1,this.selectedKeyPairForTesting=e;let t=this.getArrayKeyOfKeyPairSetting(e),n=e;-1!==t&&(n=this.keyPairSettings[t]);let a={publicKey:n.publicKey,privateKey:n.privateKey,salesChannel:this.$refs.systemConfig.currentSalesChannelId};this.UnzerPaymentConfigurationService.validateCredentials(a).then(()=>{this.createNotificationSuccess({title:this.$tc("unzer-payment-settings.form.message.success.title"),message:this.$tc("unzer-payment-settings.form.message.success.message")}),this.isTestSuccessful=!0,this.selectedKeyPairForTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("unzer-payment-settings.form.message.error.title"),message:this.$tc("unzer-payment-settings.form.message.error.message")}),this.onTestFinished()})},onTestFinished(){this.selectedKeyPairForTesting=!1,this.isTestSuccessful=!1},setPublicKey(e,t){this.keyPairSettings[this.getArrayKeyOfKeyPairSetting(e)].publicKey=t},setPrivateKey(e,t){this.keyPairSettings[this.getArrayKeyOfKeyPairSetting(e)].privateKey=t},getArrayKeyOfKeyPairSetting(e){return this.keyPairSettings.findIndex(t=>t.key===e.key&&t.group===e.group)},onSave(){this.isLoading=!0,["paylaterInvoice","paylaterInstallment","paylaterDirectDebitSecured"].forEach(e=>{this.config[`UnzerPayment6.settings.${e}`]=[]}),this.keyPairSettings.reduce((e,t)=>(t&&t.privateKey&&t.publicKey&&e[`UnzerPayment6.settings.${t.group}`].push(t),e),this.config),this.$refs.systemConfig.saveAll().then(()=>{this.isSaveSuccessful=!0;let e=this.$tc("sw-plugin-config.messageSaveSuccess");"sw-plugin-config.messageSaveSuccess"===e&&(e=this.$tc("sw-extension-store.component.sw-extension-config.messageSaveSuccess")),this.createNotificationSuccess({title:this.$tc("global.default.success"),message:e}),document.dispatchEvent(new CustomEvent("unzer-settings-saved",{}))}).catch(e=>{this.isSaveSuccessful=!1,this.createNotificationError({title:this.$tc("global.default.error"),message:e}),this.isLoading=!1})},onConfigChange(e){this.config=e,this.isLoading=!1,this.syncKeyPairConfig()},onLoadingChanged(e){this.isLoading=e},onSalesChannelChanged(e,t){e&&this.onConfigChange(e),this.selectedSalesChannelId=t},onWebhookRegistered(e){this.loadWebhooks(e)},loadWebhooks(e){this.isLoadingWebhooks=!0,this.UnzerPaymentConfigurationService.getWebhooks(e).then(t=>{this.webhooks=t,this.webhookSelection=null,this.webhookSelectionLength=0,this.loadedWebhooksPrivateKey=e}).catch(()=>{this.webhooks=[],this.loadedWebhooksPrivateKey=!1}).finally(()=>{this.isLoadingWebhooks=!1,this.isClearingSuccessful=!1})},getBind(e,t){let n;return t!==this.config&&(this.config=t),this.$refs.systemConfig.config.forEach(t=>{t.elements.forEach(t=>{if(t.name===e.name){n=t;return}})}),n||e},keyPairSettingTitle(e){return this.$tc(`unzer-payment.methods.${e.group}.${e.key}`)},keyPairSettingGroupTitle(e){return this.$tc(`unzer-payment.methods.${e.group}.main`)},isShowWebhooksButtonEnabled(e){return e&&e.privateKey&&e.publicKey},isRegisterWebhooksButtonEnabled(e){return!this.isLoading&&e&&e.privateKey},syncKeyPairConfig(){let e=this;["paylaterInvoice","paylaterInstallment","paylaterDirectDebitSecured"].forEach(t=>{this.config[`UnzerPayment6.settings.${t}`]&&this.config[`UnzerPayment6.settings.${t}`].forEach(t=>{e.keyPairSettings.forEach((e,n,a)=>{e.group===t.group&&e.key===t.key&&(a[n]=t)})})})},toggleAdditionalKeys(){this.isAdditionalKeysExpanded=!this.isAdditionalKeysExpanded}}});let{Module:A}=Shopware;A.register("unzer-payment-configuration",{type:"plugin",name:"UnzerPayment",title:"unzer-payment-settings.module.title",description:"unzer-payment-settings.module.description",version:"1.1.0",targetVersion:"1.1.0",snippets:{"de-DE":w,"en-GB":z},routes:{settings:{component:"unzer-payment-settings",path:"settings",meta:{parentPath:"sw.settings.index"}}},settingsItem:{name:"unzer-payment-configuration",to:"unzer.payment.configuration.settings",label:"unzer-payment-settings.module.title",group:"plugins",iconComponent:"unzer-payment-plugin-icon",backgroundEnabled:!1}}),n(748),n(963),Shopware.Component.override("sw-payment-card",{template:'{% block sw_payment_card_description %}\n \n
\n \n {{ $tc(\'sw-payment-card.deprecated\') }}\n \n
\n
\n
\n{% endblock %}',snippets:{"de-DE":w,"en-GB":z}}),n(34)}()}();
\ No newline at end of file