From 10a874bbd06eaa3667bcfd5cee5de080183ded69 Mon Sep 17 00:00:00 2001 From: Patrick Weinstein Date: Tue, 1 Apr 2025 16:07:53 +0200 Subject: [PATCH] v6.4.1 - New config setting to capture and refund on status change --- CHANGELOG_de-DE.md | 3 + CHANGELOG_en-GB.md | 3 + README.md | 56 ++----- composer.json | 2 +- .../CancelService/CancelService.php | 15 +- .../CancelService/CancelServiceInterface.php | 6 +- .../ClientFactory/ClientFactory.php | 26 ++-- src/Components/ConfigReader/ConfigReader.php | 2 + .../UnzerUtil/UnzerTransactionUtil.php | 137 ++++++++++++++++++ src/DependencyInjection/event_listeners.xml | 2 + src/DependencyInjection/services.xml | 21 ++- .../StateMachine/TransitionEventListener.php | 91 ++++++++++-- .../index.js | 35 +++++ .../unzer-payment-configuration/index.js | 1 + src/Resources/config/settings.xml | 18 +++ .../administration/js/unzer-payment6.js | 2 +- 16 files changed, 331 insertions(+), 89 deletions(-) create mode 100644 src/Components/UnzerUtil/UnzerTransactionUtil.php create mode 100644 src/Resources/app/administration/src/module/unzer-payment-configuration/component/unzer-entity-multi-select-delivery-status/index.js diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index 67085046..561a4f29 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,6 @@ +# 6.4.1 +* Neue Konfigurationsoption für automatischen Einzug / Refund bei Statuswechsel + # 6.4.0 * Unzer Direkt-Überweisung als neue Zahlungsmethode hinzugefügt * Update PHP-SDK diff --git a/CHANGELOG_en-GB.md b/CHANGELOG_en-GB.md index 089d8700..bd7c20d9 100644 --- a/CHANGELOG_en-GB.md +++ b/CHANGELOG_en-GB.md @@ -1,3 +1,6 @@ +# 6.4.1 +* New config setting to capture and refund on status change + # 6.4.0 * Unzer Direct Bank Transfer added as new payment method * Update PHP-SDK diff --git a/README.md b/README.md index ff4f727e..381bd043 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,35 @@ -# Unzer Payment plugin for Shopware 6 +# UnzerPayment -Use Unzer Payment plugin for Shopware 6 to provide an easy-to-install payment gateway integration for all your online payments. - -## Description - -Accept payments with cards, bank transfers, wallets, and other global and local payment methods. Unzer Payment plugin helps you with quick and easy integration, full support, and flexible solutions that grow with your business. We are your payment partner for every situation. - -## Features - -* Seamless integration into the Shop-system -* Merchant-friendly order management with up-to-date payment details, real-time billing and refunds made easy. -* Payment processing via the Unzer Payment API -* 3D-Secure authentication -* PCI-DSS Level 1 certified - -## Content security policy (CSP) - -If you are using a Content Security Policy (CSP) you must include different Unzer URL's to your policy, which are required by the UI components to work. For more information, please go to [Unzer Documentation CSP Information](https://docs.unzer.com/online-payments/ui-component-v2/#content-security-policy-csp). - -## Supported payment methods - -Unzer payment integration for Shopware 6 includes the following payment methods: +Unzer payment integration for Shopware 6 including the following payment methods: * Alipay * Apple Pay * Bancontact * Credit Card -* Unzer Direct Bank Transfer +* Direct Bank Transfer * EPS * Google Pay * iDEAL +* Invoice * PayPal * Prepayment -* SEPA Direct Debit +* SEPA direct debit * SOFORT * TWINT -* Unzer Direct Debit -* Unzer direct Debit (secured) +* Unzer Direct +* Unzer direct debit (secured) * Unzer Invoice B2C / B2B (secured) * Unzer Installment (secured) * WeChat Pay -Regarding plugin compatibility, please take a look at the release notes for more information. +Regarding plugin compatibility, please take a look at the [Shopware store page](https://store.shopware.com/en/unzer48059319318f/unzer-payments-for-shopware-6.html). ## Installation - ### For production - 1. Upload the plugin files into the `custom/plugins` folder in your shopware installation. 2. Inside the plugin directory `custom/plugins/UnzerPayment6` run `composer install --no-dev` 3. Switch to admin and install the plugin using the Shopware plugin manager and configure it as you need. ### For development - 1. Clone the plugin repository into the `custom/plugins` folder in your shopware installation. 2. Inside the plugin directory run `composer install` 3. Go to the plugin manager and install/activate the plugin. @@ -62,18 +40,8 @@ Regarding plugin compatibility, please take a look at the release notes for more This will automatically generate all files required for the plugin to work correctly -## User Guide - -Please find information on installation, configuration, usage etc on our [documentation pages](https://docs.unzer.com/plugins/shopware-6). - -## Support - -For any issues or questions please get in touch with our support. - -**Email**: support@unzer.com - -**Phone**: +49 (0)6221/6471-100 - -**Twitter**: [@UnzerTech](https://twitter.com/UnzerTech) +## Configuration +After the actual plugin installation it is necessary to add the new payment methods to the desired sales channel. +Currently, the only sales channel that is supported is the Storefront. -**Webpage**: https://unzer.com/ +Further information and configuration you can find within the manual diff --git a/composer.json b/composer.json index 193f09fc..18fcff56 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "unzerdev/shopware6", "description": "Unzer payment integration for Shopware 6", - "version": "6.4.0", + "version": "6.4.1", "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 6a282d26..7a07182e 100644 --- a/src/Components/CancelService/CancelService.php +++ b/src/Components/CancelService/CancelService.php @@ -4,6 +4,7 @@ namespace UnzerPayment6\Components\CancelService; +use Psr\Log\LoggerInterface; use Shopware\Core\Checkout\Cart\Tax\Struct\CalculatedTax; use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity; use Shopware\Core\Checkout\Payment\PaymentException; @@ -28,13 +29,16 @@ class CancelService implements CancelServiceInterface private EntityRepository $orderTransactionRepository; private ClientFactoryInterface $clientFactory; + private LoggerInterface $logger; public function __construct( EntityRepository $orderTransactionRepository, - ClientFactoryInterface $clientFactory + ClientFactoryInterface $clientFactory, + LoggerInterface $logger ) { $this->orderTransactionRepository = $orderTransactionRepository; $this->clientFactory = $clientFactory; + $this->logger = $logger; } /** @@ -98,7 +102,7 @@ public function cancelChargeById(string $orderTransactionId, string $chargeId, f /** * {@inheritdoc} */ - public function cancelAuthorizationById(string $orderTransactionId, string $authorizationId, float $amountGross, Context $context): void + public function cancelAuthorizationById(string $orderTransactionId, string $paymentId, float $amountGross, Context $context): void { $transaction = $this->getOrderTransaction($orderTransactionId, $context); @@ -107,14 +111,15 @@ public function cancelAuthorizationById(string $orderTransactionId, string $auth } $client = $this->clientFactory->createClient(KeyPairContext::createFromOrderTransaction($transaction)); + $authorization = $client->fetchAuthorization($paymentId); if ($this->isPaylaterPaymentMethod($transaction->getPaymentMethodId())) { - $client->cancelAuthorizedPayment($authorizationId, new Cancellation($amountGross)); + $this->logger->info('Canceling authorization by payment', ['authorization' => $authorization->getPayment()]); + $client->cancelAuthorizedPayment($authorization->getPayment(), new Cancellation($amountGross)); return; } - - $authorization = $client->fetchAuthorization($authorizationId); + $this->logger->info('Canceling authorization', ['authorization' => $authorization]); $authorization->cancel($amountGross); } diff --git a/src/Components/CancelService/CancelServiceInterface.php b/src/Components/CancelService/CancelServiceInterface.php index 495ead65..68e39bfb 100644 --- a/src/Components/CancelService/CancelServiceInterface.php +++ b/src/Components/CancelService/CancelServiceInterface.php @@ -27,9 +27,9 @@ public function cancelChargeById( * @throws RuntimeException */ public function cancelAuthorizationById( - string $orderTransactionId, - string $authorizationId, - float $amountGross, + string $orderTransactionId, + string $paymentId, + float $amountGross, Context $context ): void; } diff --git a/src/Components/ClientFactory/ClientFactory.php b/src/Components/ClientFactory/ClientFactory.php index 552b805a..f60c7864 100644 --- a/src/Components/ClientFactory/ClientFactory.php +++ b/src/Components/ClientFactory/ClientFactory.php @@ -21,42 +21,42 @@ class ClientFactory implements ClientFactoryInterface public function __construct(ConfigReaderInterface $configReader, DebugHandlerInterface $debugHandler, KeyPairConfigReader $keyPairConfigReader) { - $this->configReader = $configReader; - $this->debugHandler = $debugHandler; + $this->configReader = $configReader; + $this->debugHandler = $debugHandler; $this->keyPairConfigReader = $keyPairConfigReader; } public function createClient(KeyPairContext $keyPairContext, string $locale = self::DEFAULT_LOCALE): Unzer { - $config = $this->configReader->read($keyPairContext->getSalesChannelId()); - $client = new Unzer($this->keyPairConfigReader->getPrivateKey($keyPairContext), $locale); - $client->setDebugMode((bool) $config->get(ConfigReader::CONFIG_KEY_EXTENDED_LOGGING)); - $client->setDebugHandler($this->debugHandler); + $this->applyGlobalClientSettings($client, $keyPairContext->getSalesChannelId()); return $client; } public function createClientFromPrivateKey(string $privateKey, string $salesChannelId = '', string $locale = self::DEFAULT_LOCALE): Unzer { - $config = $this->configReader->read($salesChannelId); - $client = new Unzer($privateKey, $locale); - $client->setDebugMode((bool) $config->get(ConfigReader::CONFIG_KEY_EXTENDED_LOGGING)); - $client->setDebugHandler($this->debugHandler); + $this->applyGlobalClientSettings($client, $salesChannelId); return $client; } public function createClientFromPublicKey(string $publicKey, string $salesChannelId = '', string $locale = self::DEFAULT_LOCALE): Unzer { - $config = $this->configReader->read($salesChannelId); $privateKey = $this->keyPairConfigReader->getMatchingKey($publicKey, $salesChannelId); $client = new Unzer($privateKey, $locale); - $client->setDebugMode((bool) $config->get(ConfigReader::CONFIG_KEY_EXTENDED_LOGGING)); - $client->setDebugHandler($this->debugHandler); + $this->applyGlobalClientSettings($client, $salesChannelId); return $client; } + + protected function applyGlobalClientSettings(Unzer $client, string $salesChannelId = '') + { + $config = $this->configReader->read($salesChannelId); + $client->setDebugMode((bool)$config->get(ConfigReader::CONFIG_KEY_EXTENDED_LOGGING)); + $client->setDebugHandler($this->debugHandler); + $client->setClientIp($_SERVER['REMOTE_ADDR'] ?? null); + } } diff --git a/src/Components/ConfigReader/ConfigReader.php b/src/Components/ConfigReader/ConfigReader.php index f449aed9..21319b62 100644 --- a/src/Components/ConfigReader/ConfigReader.php +++ b/src/Components/ConfigReader/ConfigReader.php @@ -41,6 +41,8 @@ class ConfigReader implements ConfigReaderInterface public const CONFIG_KEY_GOOGLE_PAY_BUTTON_SIZE_MODE = 'googlePayButtonSizeMode'; public const CONFIG_KEY_PAYPAL_SHOW_SAVE_ACCOUNT = 'paypalShowSaveAccount'; + public const CONFIG_KEY_DELIVERY_STATUS_FOR_CAPTURE = 'deliveryStatusForAutomaticCapture'; + public const CONFIG_KEY_DELIVERY_STATUS_FOR_REFUND = 'deliveryStatusForAutomaticRefund'; private SystemConfigService $systemConfigService; diff --git a/src/Components/UnzerUtil/UnzerTransactionUtil.php b/src/Components/UnzerUtil/UnzerTransactionUtil.php new file mode 100644 index 00000000..78f59c15 --- /dev/null +++ b/src/Components/UnzerUtil/UnzerTransactionUtil.php @@ -0,0 +1,137 @@ +addFilter(new EqualsFilter('orderId', $orderEntity->getId())); + $criteria->addFilter(new EqualsAnyFilter('paymentMethodId', PaymentInstaller::PAYMENT_METHOD_IDS)); + $criteria->addAssociations([ + 'order', + 'order.billingAddress', + 'order.currency', + 'order.documents', + 'order.documents.documentType', + 'paymentMethod', + ]); + return $this->orderTransactionRepository->search($criteria, $context)->first(); + } + + /** + * @throws Exception + */ + public function captureOrder(OrderEntity $order, Context $context): bool + { + $this->logger->info('Capturing order', ['order' => $order->getId()]); + $orderTransaction = $this->getOrderTransactionFromOrder($order, $context); + + if ($orderTransaction === null) { + return false; + } + + $client = $this->clientFactory->createClient(KeyPairContext::createFromOrderTransaction($orderTransaction)); + try { + $charge = $client->performChargeOnPayment($orderTransaction->getId(), new Charge($orderTransaction->getAmount()->getTotalPrice())); + $this->transactionStateHandler->transformTransactionState( + $orderTransaction->getId(), + $charge->getPayment(), + $context + ); + } catch (UnzerApiException $e) { + throw new Exception($e->getMerchantMessage() ?: $e->getClientMessage()); + } + + return true; + } + + public function refundOrder(OrderEntity $order, Context $context) + { + $this->logger->info('Refunding order', ['order' => $order->getId()]); + $orderTransaction = $this->getOrderTransactionFromOrder($order, $context); + + if ($orderTransaction === null) { + return false; + } + + $client = $this->clientFactory->createClient(KeyPairContext::createFromOrderTransaction($orderTransaction)); + try { + $payment = $client->fetchPayment($orderTransaction->getId()); + foreach ($payment->getCharges() as $charge) { + try { + if ($charge->isError()) { + continue; + } + $this->logger->info('Refunding charge', ['chargeId' => $charge->getId()]); + $this->cancelService->cancelChargeById( + $orderTransaction->getId(), + $charge->getId(), + $charge->getAmount()-$charge->getCancelledAmount(), + null, + $context + ); + } catch (\Throwable $e) { + $this->logger->error('Error while refunding charge', ['charge' => $charge->getId(), 'error' => $e->getMessage()]); + } + } + $authorization = $payment->getAuthorization(); + if ($authorization !== null && !$authorization->isError()) { + try { + $this->logger->info('Refunding authorization', ['paymentId' => $payment->getId(), 'authorizationId' => $authorization->getId()]); + + $this->cancelService->cancelAuthorizationById( + $orderTransaction->getId(), + $payment->getId(), + $authorization->getAmount() - $authorization->getCancelledAmount(), + $context + ); + } catch (\Throwable $e) { + $this->logger->error('Error while refunding authorization', ['authorization' => $authorization->getId(), 'error' => $e->getMessage()]); + } + } + $this->transactionStateHandler->transformTransactionState( + $orderTransaction->getId(), + $payment, + $context + ); + } catch (UnzerApiException $e) { + throw new Exception($e->getMerchantMessage() ?: $e->getClientMessage()); + } + + } + + +} \ No newline at end of file diff --git a/src/DependencyInjection/event_listeners.xml b/src/DependencyInjection/event_listeners.xml index 644629b6..24b470f3 100644 --- a/src/DependencyInjection/event_listeners.xml +++ b/src/DependencyInjection/event_listeners.xml @@ -43,6 +43,8 @@ + + diff --git a/src/DependencyInjection/services.xml b/src/DependencyInjection/services.xml index cee77758..e63a1d81 100644 --- a/src/DependencyInjection/services.xml +++ b/src/DependencyInjection/services.xml @@ -12,7 +12,7 @@ - + @@ -27,19 +27,20 @@ - - + + + - - + + - + @@ -81,5 +82,13 @@ + + + + + + + + diff --git a/src/EventListeners/StateMachine/TransitionEventListener.php b/src/EventListeners/StateMachine/TransitionEventListener.php index a7ab3583..c5559e85 100644 --- a/src/EventListeners/StateMachine/TransitionEventListener.php +++ b/src/EventListeners/StateMachine/TransitionEventListener.php @@ -18,8 +18,11 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Throwable; +use UnzerPayment6\Components\ConfigReader\ConfigReader; +use UnzerPayment6\Components\ConfigReader\ConfigReaderInterface; use UnzerPayment6\Components\Event\AutomaticShippingNotificationEvent; use UnzerPayment6\Components\ShipService\ShipServiceInterface; +use UnzerPayment6\Components\UnzerUtil\UnzerTransactionUtil; use UnzerPayment6\Components\Validator\AutomaticShippingValidatorInterface; use UnzerPayment6\Installer\CustomFieldInstaller; @@ -45,23 +48,30 @@ class TransitionEventListener implements EventSubscriberInterface /** @var ShipServiceInterface */ private $shipService; + private ConfigReaderInterface $configReader; + private UnzerTransactionUtil $unzerTransactionUtil; public function __construct( - EntityRepository $orderRepository, - EntityRepository $orderDeliveryRepository, - EntityRepository $transactionRepository, + EntityRepository $orderRepository, + EntityRepository $orderDeliveryRepository, + EntityRepository $transactionRepository, AutomaticShippingValidatorInterface $automaticShippingValidator, - LoggerInterface $logger, - EventDispatcherInterface $eventDispatcher, - ShipServiceInterface $shipService - ) { - $this->orderRepository = $orderRepository; - $this->orderDeliveryRepository = $orderDeliveryRepository; - $this->transactionRepository = $transactionRepository; - $this->logger = $logger; + LoggerInterface $logger, + EventDispatcherInterface $eventDispatcher, + ShipServiceInterface $shipService, + ConfigReaderInterface $configReader, + UnzerTransactionUtil $unzerTransactionUtil + ) + { + $this->orderRepository = $orderRepository; + $this->orderDeliveryRepository = $orderDeliveryRepository; + $this->transactionRepository = $transactionRepository; + $this->logger = $logger; $this->automaticShippingValidator = $automaticShippingValidator; - $this->eventDispatcher = $eventDispatcher; - $this->shipService = $shipService; + $this->eventDispatcher = $eventDispatcher; + $this->shipService = $shipService; + $this->configReader = $configReader; + $this->unzerTransactionUtil = $unzerTransactionUtil; } /** @@ -76,7 +86,15 @@ public static function getSubscribedEvents(): array public function onStateMachineTransition(StateMachineTransitionEvent $event): void { + $order = $this->getOrderFromEvent($event); + $this->registerShipping($event, $order); + $this->doAutomaticTransactions($event, $order); + + } + + protected function registerShipping(StateMachineTransitionEvent $event, ?OrderEntity $order): void + { if (!$order || !$this->automaticShippingValidator->shouldSendAutomaticShipping($order, $event->getToPlace())) { return; @@ -123,17 +141,58 @@ public function onStateMachineTransition(StateMachineTransitionEvent $event): vo } } + protected function doAutomaticTransactions(StateMachineTransitionEvent $event, ?OrderEntity $order) + { + if ($order === null) { + return; + } + $config = $this->configReader->read($order->getSalesChannelId()); + + $autoCaptureStatus = $config->get(ConfigReader::CONFIG_KEY_DELIVERY_STATUS_FOR_CAPTURE); + if (is_scalar($autoCaptureStatus)) { + $autoCaptureStatus = [$autoCaptureStatus]; + } + + if (is_array($autoCaptureStatus) && in_array($event->getToPlace()->getId(), $autoCaptureStatus)) { + $this->logger->info(sprintf('Automatic capture for order [%s] was triggered', $order->getOrderNumber())); + try { + $this->unzerTransactionUtil->captureOrder($order, $event->getContext()); + } catch (Throwable $exception) { + $this->logger->error(sprintf('Error while executing automatic capture for order [%s]: %s', $order->getOrderNumber(), $exception->getMessage()), [ + 'trace' => $exception->getTraceAsString(), + ]); + } + } + + $autoRefundStatus = $config->get(ConfigReader::CONFIG_KEY_DELIVERY_STATUS_FOR_REFUND); + if (is_scalar($autoRefundStatus)) { + $autoRefundStatus = [$autoRefundStatus]; + } + if (is_array($autoRefundStatus) && in_array($event->getToPlace()->getId(), $autoRefundStatus)) { + $this->logger->info(sprintf('Automatic refund for order [%s] was triggered', $order->getOrderNumber())); + try { + $this->unzerTransactionUtil->refundOrder($order, $event->getContext()); + } catch (Throwable $exception) { + $this->logger->error(sprintf('Error while executing automatic refund for order [%s]: %s', $order->getOrderNumber(), $exception->getMessage()), [ + 'trace' => $exception->getTraceAsString(), + ]); + } + } + + } + protected function setCustomFields( - Context $context, + Context $context, OrderTransactionEntity $transaction - ): void { + ): void + { $customFields = $transaction->getCustomFields() ?? []; $customFields = array_merge($customFields, [ CustomFieldInstaller::UNZER_PAYMENT_IS_SHIPPED => true, ]); $update = [ - 'id' => $transaction->getId(), + 'id' => $transaction->getId(), 'customFields' => $customFields, ]; diff --git a/src/Resources/app/administration/src/module/unzer-payment-configuration/component/unzer-entity-multi-select-delivery-status/index.js b/src/Resources/app/administration/src/module/unzer-payment-configuration/component/unzer-entity-multi-select-delivery-status/index.js new file mode 100644 index 00000000..cc0f21de --- /dev/null +++ b/src/Resources/app/administration/src/module/unzer-payment-configuration/component/unzer-entity-multi-select-delivery-status/index.js @@ -0,0 +1,35 @@ +const { Component } = Shopware; +const { Criteria, EntityCollection } = Shopware.Data; + +// extend the existing component `sw-entity-single-select` by +// overwriting the default criteria +Component.extend('unzer-entity-multi-select-delivery-status', 'sw-entity-multi-id-select', { + inject: ['repositoryFactory'], + props: { + repository: { + type: Object, + required: true, + default(){ + return this.repositoryFactory.create('state_machine_state'); + } + }, + criteria: { + type: Object, + required: false, + default() { + const criteria = new Criteria(1, 100); + + criteria.addFilter( + Criteria.equals( + 'stateMachine.technicalName', + 'order_delivery.state' + ) + ); + + return criteria; + } + }, + entityCollection() { + } + } +}); diff --git a/src/Resources/app/administration/src/module/unzer-payment-configuration/index.js b/src/Resources/app/administration/src/module/unzer-payment-configuration/index.js index 7721eb25..5d3cd6fb 100644 --- a/src/Resources/app/administration/src/module/unzer-payment-configuration/index.js +++ b/src/Resources/app/administration/src/module/unzer-payment-configuration/index.js @@ -1,6 +1,7 @@ import './component/register-webhook'; import './component/unzer-webhooks-modal'; import './component/unzer-entity-single-select-delivery-status'; +import './component/unzer-entity-multi-select-delivery-status'; import './component/unzer-payment-apple-pay-certificates'; import './component/unzer-payment-plugin-icon'; diff --git a/src/Resources/config/settings.xml b/src/Resources/config/settings.xml index fe05e081..76354523 100755 --- a/src/Resources/config/settings.xml +++ b/src/Resources/config/settings.xml @@ -139,6 +139,24 @@ Automatic shipping notifications (if active) will be sent if an order enters the selected status. Leave empty to disable automatic shipping notifications. Die automatische Versandbenachrichtigung wird, wenn aktiv, ausgelöst sobald eine Bestellung den hier ausgewählten Status erhält. Lassen Sie dieses Feld leer, um keine automatischen Versandbenachrichtigungen anzustoßen. + + + deliveryStatusForAutomaticCapture + state_machine_state + + + Leave blank, if you don't want to use automatic capture + Leer lassen, um keinen automatischen Zahlungseinzug auszulösen + + + + deliveryStatusForAutomaticRefund + state_machine_state + + + Leave blank, if you don't want to use automatic refund + Leer lassen, um keine automatische Rückzahlung auszulösen + diff --git a/src/Resources/public/administration/js/unzer-payment6.js b/src/Resources/public/administration/js/unzer-payment6.js index 7d40c41c..7a86cc8d 100644 --- a/src/Resources/public/administration/js/unzer-payment6.js +++ b/src/Resources/public/administration/js/unzer-payment6.js @@ -1 +1 @@ -(function(){var e={633:function(){},257:function(){},612:function(){},885:function(){},443:function(){let{Application:e}=Shopware,t=Shopware.Classes.ApiService;class n extends t{constructor(e,t,n="unzer-payment"){super(e,t,n)}checkCertificates(e){let n=`_action/${this.getApiBasePath()}/apple-pay/certificates`;return e&&(n+=`/${e}`),this.httpClient.get(n,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}async updateCertificates(e,n,a,i){let s=`_action/${this.getApiBasePath()}/apple-pay/certificates`;e&&(s+=`/${e}`);let r={};for(let e in n)if(n[e]){let t=n[e];r[e]=await t.text()}return(a&&(r.inheritMerchantIdentification=!0),i&&(r.inheritPaymentProcessing=!0),0===r.length)?new Promise:this.httpClient.post(s,r,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}}e.addServiceProvider("UnzerPaymentApplePayService",t=>new n(e.getContainer("init").httpClient,t.loginService))},547: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))},962: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 i=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${a}`;return this.httpClient.get(i,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}refundTransaction(e,n,a,i=null){let s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${n}/${a}`;return null!==i&&(s=`${s}/${i}`),this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}cancelTransaction(e,n,a){let i=`_action/${this.getApiBasePath()}/transaction/${e}/cancel/${n}/${a}`;return this.httpClient.get(i,{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))},858: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}}}})},119:function(e,t,n){var a=n(633);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),n(346).Z("ad0e5d12",a,!0,{})},569:function(e,t,n){var a=n(257);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),n(346).Z("24d8f2ae",a,!0,{})},326:function(e,t,n){var a=n(612);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),n(346).Z("6560ac9a",a,!0,{})},467:function(e,t,n){var a=n(885);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),n(346).Z("76697e96",a,!0,{})},346:function(e,t,n){"use strict";function a(e,t){for(var n=[],a={},i=0;in.parts.length&&(a.parts.length=n.parts.length)}else{for(var r=[],i=0;i\n {% block unzer_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\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 \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\n {% block unzer_payment_actions_default_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.defaultButton\') }}\n \n {% endblock %}\n\n {% block unzer_payment_actions_button_container_inner %}{% endblock %}\n
\n \n{% endblock %}\n',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},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible&&(e=this.transactionResource.amount),this.isChargePossible&&(e=this.paymentResource.amount.remaining),"remainingAmount"in this.transactionResource&&(e=this.transactionResource.remainingAmount),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.orderId,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.orderId,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:i,Module:s}=Shopware;a.register("unzer-payment-detail",{template:'{% block unzer_payment_detail %}\n \n \n\n {% block unzer_payment_detail_footer %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["UnzerPaymentService"],mixins:[i.getByName("notification")],data(){return{isLoading:!1,isSuccessful:!1,paylaterPaymentMethods:["09588ffee8064f168e909ff31889dd7f","12fbfbce271a43a89b3783453b88e9a6","6d6adcd4b7bf40499873c294a85f32ed"]}},props:{paymentResource:{type:Object,required:!0}},computed:{unzerMaxDigits(){let e=s.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.orderId).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 {% endblock %}\n \n{% endblock %}\n',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.orderId,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})},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{% endblock %}\n',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 \n{% endblock %}\n',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:p}=Shopware.Data,u=["bc4c2cbfb5fda0bf549e4807440d0a54","4673044aff79424a938d42e9847693c3","713c7a332b432dcd4092701eda522a7e","5123af5ce94a4a286641973e8de7eb60","17830aa7e6a00b99eab27f0e45ac5e0d","4ebb99451f36ba01f13d5871a30bce2c","d4b90a17af62c1bb2f6c3b1fed339425","4b9f8d08b46a83839fd0eb14fe00efe6","08fb8d9a72ab4ca62b811e74f2eca79f","6cc3b56ce9b0f80bd44039c047282a41","614ad722a03ee96baa2446793143215b","409fe641d6d62a4416edd6307d758791","085b64d0028a8bd447294e03c4eb411a","cd6f59d572e6c90dff77a48ce16b44db","95aa098aac8f11e9a2a32a2ae2dbcce4","fd96d03535a46d197f5adac17c9f8bac","09588ffee8064f168e909ff31889dd7f"];Shopware.Component.override("sw-order-create-details-footer",{template:'{% block sw_order_create_details_footer_payment_method %}\n \n{% endblock %}\n',computed:{paymentMethodCriteria(){let e=new p;return this.salesChannelId&&e.addFilter(p.equals("salesChannels.id",this.salesChannelId)),e.addFilter(p.not("AND",[p.equalsAny("id",u)])),e}}});let{Component:h,Context:m}=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 %}\n",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,m.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 {% endblock %}\n{% endblock %}\n',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:w}=Shopware.Data;g.register("unzer-payment-tab",{template:'{% block unzer_payment_payment_details %}\n
\n
\n {% block unzer_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n',inject:["UnzerPaymentService","repositoryFactory"],mixins:[b.getByName("notification")],data(){return{paymentResources:[],loadedResources:0,isLoading:!0}},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 w;t.getAssociation("transactions").addSorting(w.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(e=>{this.paymentResources[t]=e,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 k=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","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":{"b2b-eur":"Rechnungskauf B2B EUR","b2b-chf":"Rechnungskauf B2B CHF","b2c-eur":"Rechnungskauf B2C EUR","b2c-chf":"Rechnungskauf B2C CHF"},"paylaterInstallment":{"b2c-eur":"Ratenkauf B2C EUR","b2c-chf":"Ratenkauf B2C CHF"},"paylaterDirectDebitSecured":{"b2c-eur":"Lastschrift B2C EUR"}}},"unzer-payment-settings":{"module":{"title":"Unzer Payment","description":"Unzer Payment"},"apple-pay":{"certificates":{"title":"Apple Pay Zertifikate (Veraltet)","textExisting":"Wir haben unsere Integration mit Apple Pay aktualisiert, aber da Sie sie bereits eingerichtet haben, brauchen Sie im Moment nichts zu tun.

Wenn Ihre Apple-Pay-Zertifikate jedoch bald ablaufen, k\xf6nnen Sie auf die neue Integration umsteigen.

Sie k\xf6nnen nat\xfcrlich auch jetzt schon auf die neue Integration umsteigen, wenn Sie m\xf6chten, und m\xfcssen sich dann in Zukunft keine Gedanken mehr \xfcber ablaufende Zertifikate, einen Wechsel der Integration usw. machen.","textAll":"Bevor Sie Apple Pay aktivieren, stellen Sie bitte sicher, dass Sie unsere Checkliste gelesen haben.","check":{"paymentProcessingValid":{"true":"Das Payment Processing-Zertifikat ist vorhanden und g\xfcltig","false":"Das Payment Processing-Zertifikat fehlt"},"paymentProcessingActive":{"true":"Das Payment Processing-Zertifikat ist aktiv","false":"Das Payment Processing-Zertifikat ist nicht aktiv"},"merchantIdentificationValid":{"true":"Das Merchant Identification-Zertifikat ist vorhanden","false":"Das Merchant Identification-Zertifikat fehlt"},"merchantIdentificationValidUntil":{"true":"Das Merchant Identification-Zertifikat ist g\xfcltig","false":"Das Merchant Identification-Zertifikat ist abgelaufen und muss erneuert werden"}},"update":{"success":{"title":"Erfolg","message":"Die Zertifikate wurden erfolgreich aktualisiert"},"error":{"title":"Fehler","message":"Bei der Aktualisierung der Zertifikate trat ein Fehler auf","messageInvalidCertificate":"Die \xfcbergebenen Zertifikatsdaten f\xfcr {type} sind ung\xfcltig","messageMissingCertificateFiles":"Die \xfcbergebenen Zertifikatsdaten f\xfcr {type} sind unvollst\xe4ndig"}}},"paymentProcessingCertificate":{"label":"Payment Processing Zertifikat (apple_pay.pem)","helpText":"Zertifikat und Schl\xfcssel m\xfcssen nach den Schritten der Unzer-Dokumentation vorbereitet werden."},"paymentProcessingKey":{"label":"Payment Processing Zertifikatsschl\xfcssel (privatekey.key)"},"publicKey":{"changeNotice":"Bitte beachten: Nach dem \xc4ndern der Unzer Keys muss das Apple Pay Payment Processing Certificate neu hochgeladen werden."},"merchantIdentificationCertificate":{"label":"Merchant Identification Zertifikat (merchant_id.pem)","helpText":"Zertifikat und Schl\xfcssel m\xfcssen nach den Schritten der Unzer-Dokumentation vorbereitet werden."},"merchantIdentificationKey":{"label":"Merchant Identification Zertifikatsschl\xfcssel (merchant_id.key)"}},"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"},"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"}}'),C=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","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":{"b2b-eur":"Invoice B2B EUR","b2b-chf":"Invoice B2B CHF","b2c-eur":"Invoice B2C EUR","b2c-chf":"Invoice B2C CHF"},"paylaterInstallment":{"b2c-eur":"Installment B2C EUR","b2c-chf":"Installment B2C CHF"},"paylaterDirectDebitSecured":{"b2c-eur":"Direct Debit B2C EUR"}}},"unzer-payment-settings":{"module":{"title":"Unzer Payment","description":"Unzer Payment"},"apple-pay":{"certificates":{"title":"Apple Pay Certificates (Deprecated)","textExisting":"We have updated our integration with Apple Pay, but since you already have it set up, you don\'t need to do anything just now.

However, when your Apple Pay certificates are about to expire, you can change to the new integration.

You can of course change to the new integration now, if you want, and then you don\'t have to worry about expiring certificates, changing integration, etc. in the future.","textAll":"Before you activate Apple Pay, please make sure you have read our checklist.","check":{"paymentProcessingValid":{"true":"The Payment Processing certificate is present and valid","false":"The Payment Processing certificate is missing"},"paymentProcessingActive":{"true":"The Payment Processing certificate is active","false":"The Payment Processing certificate is inactive"},"merchantIdentificationValid":{"true":"The Merchant Identification certificate is present","false":"The Merchant Identification certificate is missing"},"merchantIdentificationValidUntil":{"true":"The Merchant Identification certificate is valid","false":"The Merchant Identification certificate is expired and must be renewed"}},"update":{"success":{"title":"Success","message":"Certificates were updated successfully"},"error":{"title":"Error","message":"An error occurred during certificate update","messageInvalidCertificate":"The given certificate data for {type} is invalid","messageMissingCertificateFiles":"The given certificate data for {type} is incomplete"}}},"paymentProcessingCertificate":{"label":"Payment Processing Certificate","helpText":"Certificate and Key have to be prepared as specified in the Unzer documentation."},"paymentProcessingKey":{"label":"Payment Processing Certificate Key (Private Key)"},"publicKey":{"changeNotice":"Please note: After changing the Unzer keys, you have to re-upload your Apple Pay Payment Processing Certificate."},"merchantIdentificationCertificate":{"label":"Merchant Identification Certificate","helpText":"Certificate and Key have to be prepared as specified in the Unzer documentation."},"merchantIdentificationKey":{"label":"Merchant Identification Certificate Key (Private Key)"}},"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"},"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":k,"en-GB":C},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(119);let P=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\n \n \n {% endblock %}\n
\n{% endblock %}\n',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;n.isDataLoading=!0;let a=new P(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){console.log(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 P;return t.addFilter(P.prefix("url","https://")),t.addFilter(P.equals("salesChannelId",e)),t}}});let{Component:z,Mixin:S,Context:_}=Shopware;z.register("unzer-webhooks-modal",{template:'\n \n {{ $tc(\'unzer-payment-settings.webhook.empty\') }}\n \n\n
\n \n \n\n \n {{ $tc(\'unzer-payment-settings.modal.webhook.submit.clear\', webhookSelectionLength, {count: webhookSelectionLength}) }}\n \n
\n\n',mixins:[S.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(858),Shopware.Component.register("unzer-payment-apple-pay-certificates",{template:'{% block unzer_payment_apple_pay_certificates %}\n \n \n \n{% endblock %}\n',mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","UnzerPaymentApplePayService"],props:{isLoading:{type:Boolean,required:!1},selectedSalesChannelId:{type:String,required:!1},parentRefs:{required:!0}},data(){return{isUpdating:!1,isUpdateSuccessful:!1,isDataLoading:!1,paymentProcessingCertificate:!1,paymentProcessingKey:!1,merchantIdentificationCertificate:!1,merchantIdentificationKey:!1,merchantIdentificationValid:!1,merchantIdentificationValidUntil:null,paymentProcessingValid:!1,paymentProcessingActive:!1}},computed:{isNotDefaultSalesChannel(){return null!==this.selectedSalesChannelId},now(){return Date.now()},parentConfigData(){return this.parentRefs&&this.parentRefs.systemConfig&&this.parentRefs.systemConfig.actualConfigData&&this.parentRefs.systemConfig.actualConfigData[this.selectedSalesChannelId]||{}}},created(){this.createdComponent()},methods:{createdComponent(){this.loadData()},loadData(){this.checkCertificates()},checkCertificates(){let e=this;e.isDataLoading=!0,this.UnzerPaymentApplePayService.checkCertificates(this.selectedSalesChannelId).then(e=>{void 0!==e&&(this.merchantIdentificationValid=e.merchantIdentificationValid,this.merchantIdentificationValidUntil=e.merchantIdentificationValidUntil?new Date(e.merchantIdentificationValidUntil):null,this.paymentProcessingValid=e.paymentProcessingValid,this.paymentProcessingActive=e.paymentProcessingActive)}).finally(()=>{e.isDataLoading=!1})},onSave(){return this.updateCertificates()},resetFileFieldsMerchantIdentification(){this.$refs.merchantIdentificationCertificateInput.onRemoveIconClick(),this.$refs.merchantIdentificationKeyInput.onRemoveIconClick()},resetFileFieldsPaymentProcessing(){this.$refs.paymentProcessingCertificateInput.onRemoveIconClick(),this.$refs.paymentProcessingKeyInput.onRemoveIconClick()},updateCertificates(){let e=this;return(this.isUpdateSuccessful=!1,this.isUpdating=!0,this.paymentProcessingCertificate||this.paymentProcessingKey||this.merchantIdentificationCertificate||this.merchantIdentificationKey||this.$refs.inheritWrapperMerchantIdentificationCertificate.isInherited||this.$refs.inheritWrapperPaymentProcessingCertificate.isInherited)?this.UnzerPaymentApplePayService.updateCertificates(this.selectedSalesChannelId,{paymentProcessingCertificate:this.paymentProcessingCertificate,paymentProcessingKey:this.paymentProcessingKey,merchantIdentificationCertificate:this.merchantIdentificationCertificate,merchantIdentificationKey:this.merchantIdentificationKey},this.$refs.inheritWrapperMerchantIdentificationCertificate.isInherited,this.$refs.inheritWrapperPaymentProcessingCertificate.isInherited).then(t=>{e.isUpdateSuccessful=!0,e.createNotificationSuccess({title:e.$tc("unzer-payment-settings.apple-pay.certificates.update.success.title"),message:e.$tc("unzer-payment-settings.apple-pay.certificates.update.success.message")}),e.$emit("certificate-updated",t),e.parentRefs.systemConfig.loadCurrentSalesChannelConfig?e.parentRefs.systemConfig.loadCurrentSalesChannelConfig():(delete e.parentRefs.systemConfig.actualConfigData[this.selectedSalesChannelId],e.parentRefs.systemConfig.readAll()),e.checkCertificates(),e.resetFileFieldsPaymentProcessing(),e.resetFileFieldsMerchantIdentification()}).catch(t=>{let n="unzer-payment-settings.apple-pay.certificates.update.error.message";t&&t.response&&t.response.data&&t.response.data.message&&(n=t.response.data.message);let a={};t&&t.response&&t.response.data&&t.response.data.translationData&&(a=t.response.data.translationData),e.createNotificationError({title:e.$tc("unzer-payment-settings.apple-pay.certificates.update.error.title"),message:e.$t(n,a)})}).finally(()=>{e.isUpdating=!1}):(this.isUpdateSuccessful=!0,this.isUpdating=!1,Promise.resolve())},onInputChangePaymentProcessing(e){e&&this.$refs.inheritWrapperPaymentProcessingCertificate.removeInheritance()},onInputChangeMerchantIdentification(e){e&&this.$refs.inheritWrapperMerchantIdentificationCertificate.removeInheritance()},getInheritedValue(e){let t=this.parentRefs.systemConfig;return t?t.getInheritedValue&&t.actualConfigData.null?t.getInheritedValue({name:"UnzerPayment6.settings."+e,type:"text"}):t.actualConfigData.null&&t.actualConfigData.null["UnzerPayment6.settings."+e]||null:null}}});let{Component:D}=Shopware;D.register("unzer-payment-plugin-icon",{template:'{% block unzer_plugin_icon %}\n \n{% endblock %}\n',computed:{assetFilter(){return Shopware.Filter.getByName("asset")}}});let{Component:I}=Shopware;I.override("sw-system-config",{template:'{% block sw_system_config_content_card_field %}\n \n{% endblock %}\n',inject:["UnzerPaymentConfigurationService"],data(){return{readOnlyUnzerGooglePayGatewayMerchantId:{}}},watch:{currentSalesChannelId(){this.getUnzerGooglePayGatewayMerchantId(),this.$emit("sales-channel-changed",this.actualConfigData[this.currentSalesChannelId],this.currentSalesChannelId)}},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(569);let{Component:$,Mixin:R,Context:M}=Shopware;$.register("unzer-payment-settings",{template:'{% block unzer_payment_settings %}\n \n {% block unzer_payment_settings_header %}\n \n {% endblock %}\n\n {% block unzer_payment_settings_actions %}\n \n {% endblock %}\n\n {% block unzer_payment_settings_content %}\n \n {% endblock %}\n \n{% endblock %}\n',mixins:[R.getByName("notification"),R.getByName("sw-inline-snippet")],inject:["repositoryFactory","UnzerPaymentConfigurationService"],data(){return{isLoading:!0,isLoadingWebhooks:!0,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 M.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}),this.$refs.applePayCertificates.onSave().then(()=>{this.isLoading=!1})}).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(),this.$refs.applePayCertificates.loadData()},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}`)},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)})})})}}});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":k,"en-GB":C},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(962),n(443),n(547),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":k,"en-GB":C}}),n(467)}()})(); \ No newline at end of file +!function(){var e={39:function(){},943:function(){},956:function(){},436:function(){},47:function(){let{Application:e}=Shopware,t=Shopware.Classes.ApiService;class n extends t{constructor(e,t,n="unzer-payment"){super(e,t,n)}checkCertificates(e){let n=`_action/${this.getApiBasePath()}/apple-pay/certificates`;return e&&(n+=`/${e}`),this.httpClient.get(n,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}async updateCertificates(e,n,a,i){let s=`_action/${this.getApiBasePath()}/apple-pay/certificates`;e&&(s+=`/${e}`);let r={};for(let e in n)if(n[e]){let t=n[e];r[e]=await t.text()}return(a&&(r.inheritMerchantIdentification=!0),i&&(r.inheritPaymentProcessing=!0),0===r.length)?new Promise:this.httpClient.post(s,r,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}}e.addServiceProvider("UnzerPaymentApplePayService",t=>new n(e.getContainer("init").httpClient,t.loginService))},650: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))},213: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 i=`_action/${this.getApiBasePath()}/transaction/${e}/charge/${a}`;return this.httpClient.get(i,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}refundTransaction(e,n,a,i=null){let s=`_action/${this.getApiBasePath()}/transaction/${e}/refund/${n}/${a}`;return null!==i&&(s=`${s}/${i}`),this.httpClient.get(s,{headers:this.getBasicHeaders()}).then(e=>t.handleResponse(e))}cancelTransaction(e,n,a){let i=`_action/${this.getApiBasePath()}/transaction/${e}/cancel/${n}/${a}`;return this.httpClient.get(i,{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))},410: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(){}}})},421: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}}}})},434:function(e,t,n){var a=n(39);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("2d68c4fa",a,!0,{})},806:function(e,t,n){var a=n(943);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("abbee774",a,!0,{})},683:function(e,t,n){var a=n(956);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("53fb75b7",a,!0,{})},73:function(e,t,n){var a=n(436);a.__esModule&&(a=a.default),"string"==typeof a&&(a=[[e.id,a,""]]),a.locals&&(e.exports=a.locals),(0,n(534).A)("2543d738",a,!0,{})},534:function(e,t,n){"use strict";function a(e,t){for(var n=[],a={},i=0;in.parts.length&&(a.parts.length=n.parts.length)}else{for(var s=[],i=0;i\n {% block unzer_payment_actions_amount_field %}\n
\n \n \n
\n {% endblock %}\n\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 \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\n {% block unzer_payment_actions_default_button %}\n \n {{ $tc(\'unzer-payment.paymentDetails.actions.defaultButton\') }}\n \n {% endblock %}\n\n {% block unzer_payment_actions_button_container_inner %}{% endblock %}\n
\n \n{% endblock %}\n',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},isRefundPossible:function(){return"charge"===this.transactionResource.type},maxTransactionAmount(){let e=0;return this.isRefundPossible&&(e=this.transactionResource.amount),this.isChargePossible&&(e=this.paymentResource.amount.remaining),"remainingAmount"in this.transactionResource&&(e=this.transactionResource.remainingAmount),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.orderId,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.orderId,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:i,Module:s}=Shopware;a.register("unzer-payment-detail",{template:'{% block unzer_payment_detail %}\n \n \n\n {% block unzer_payment_detail_footer %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["UnzerPaymentService"],mixins:[i.getByName("notification")],data(){return{isLoading:!1,isSuccessful:!1,paylaterPaymentMethods:["09588ffee8064f168e909ff31889dd7f","12fbfbce271a43a89b3783453b88e9a6","6d6adcd4b7bf40499873c294a85f32ed"]}},props:{paymentResource:{type:Object,required:!0}},computed:{unzerMaxDigits(){let e=s.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.orderId).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 {% endblock %}\n \n{% endblock %}\n',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.orderId,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})},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{% endblock %}\n',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 \n{% endblock %}\n',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:p}=Shopware.Data,u=["bc4c2cbfb5fda0bf549e4807440d0a54","4673044aff79424a938d42e9847693c3","713c7a332b432dcd4092701eda522a7e","5123af5ce94a4a286641973e8de7eb60","17830aa7e6a00b99eab27f0e45ac5e0d","4ebb99451f36ba01f13d5871a30bce2c","d4b90a17af62c1bb2f6c3b1fed339425","4b9f8d08b46a83839fd0eb14fe00efe6","08fb8d9a72ab4ca62b811e74f2eca79f","6cc3b56ce9b0f80bd44039c047282a41","614ad722a03ee96baa2446793143215b","409fe641d6d62a4416edd6307d758791","085b64d0028a8bd447294e03c4eb411a","cd6f59d572e6c90dff77a48ce16b44db","95aa098aac8f11e9a2a32a2ae2dbcce4","fd96d03535a46d197f5adac17c9f8bac","09588ffee8064f168e909ff31889dd7f"];Shopware.Component.override("sw-order-create-details-footer",{template:'{% block sw_order_create_details_footer_payment_method %}\n \n{% endblock %}\n',computed:{paymentMethodCriteria(){let e=new p;return this.salesChannelId&&e.addFilter(p.equals("salesChannels.id",this.salesChannelId)),e.addFilter(p.not("AND",[p.equalsAny("id",u)])),e}}});let{Component:h,Context:m}=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 %}\n",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,m.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 {% endblock %}\n{% endblock %}\n',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:w}=Shopware.Data;g.register("unzer-payment-tab",{template:'{% block unzer_payment_payment_details %}\n
\n
\n {% block unzer_payment_payment_details_content %}\n \n {% endblock %}\n
\n\n \n
\n{% endblock %}\n',inject:["UnzerPaymentService","repositoryFactory"],mixins:[b.getByName("notification")],data(){return{paymentResources:[],loadedResources:0,isLoading:!0}},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 w;t.getAssociation("transactions").addSorting(w.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(e=>{this.paymentResources[t]=e,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 k=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","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":{"b2b-eur":"Rechnungskauf B2B EUR","b2b-chf":"Rechnungskauf B2B CHF","b2c-eur":"Rechnungskauf B2C EUR","b2c-chf":"Rechnungskauf B2C CHF"},"paylaterInstallment":{"b2c-eur":"Ratenkauf B2C EUR","b2c-chf":"Ratenkauf B2C CHF"},"paylaterDirectDebitSecured":{"b2c-eur":"Lastschrift B2C EUR"}}},"unzer-payment-settings":{"module":{"title":"Unzer Payment","description":"Unzer Payment"},"apple-pay":{"certificates":{"title":"Apple Pay Zertifikate (Veraltet)","textExisting":"Wir haben unsere Integration mit Apple Pay aktualisiert, aber da Sie sie bereits eingerichtet haben, brauchen Sie im Moment nichts zu tun.

Wenn Ihre Apple-Pay-Zertifikate jedoch bald ablaufen, k\xf6nnen Sie auf die neue Integration umsteigen.

Sie k\xf6nnen nat\xfcrlich auch jetzt schon auf die neue Integration umsteigen, wenn Sie m\xf6chten, und m\xfcssen sich dann in Zukunft keine Gedanken mehr \xfcber ablaufende Zertifikate, einen Wechsel der Integration usw. machen.","textAll":"Bevor Sie Apple Pay aktivieren, stellen Sie bitte sicher, dass Sie unsere Checkliste gelesen haben.","check":{"paymentProcessingValid":{"true":"Das Payment Processing-Zertifikat ist vorhanden und g\xfcltig","false":"Das Payment Processing-Zertifikat fehlt"},"paymentProcessingActive":{"true":"Das Payment Processing-Zertifikat ist aktiv","false":"Das Payment Processing-Zertifikat ist nicht aktiv"},"merchantIdentificationValid":{"true":"Das Merchant Identification-Zertifikat ist vorhanden","false":"Das Merchant Identification-Zertifikat fehlt"},"merchantIdentificationValidUntil":{"true":"Das Merchant Identification-Zertifikat ist g\xfcltig","false":"Das Merchant Identification-Zertifikat ist abgelaufen und muss erneuert werden"}},"update":{"success":{"title":"Erfolg","message":"Die Zertifikate wurden erfolgreich aktualisiert"},"error":{"title":"Fehler","message":"Bei der Aktualisierung der Zertifikate trat ein Fehler auf","messageInvalidCertificate":"Die \xfcbergebenen Zertifikatsdaten f\xfcr {type} sind ung\xfcltig","messageMissingCertificateFiles":"Die \xfcbergebenen Zertifikatsdaten f\xfcr {type} sind unvollst\xe4ndig"}}},"paymentProcessingCertificate":{"label":"Payment Processing Zertifikat (apple_pay.pem)","helpText":"Zertifikat und Schl\xfcssel m\xfcssen nach den Schritten der Unzer-Dokumentation vorbereitet werden."},"paymentProcessingKey":{"label":"Payment Processing Zertifikatsschl\xfcssel (privatekey.key)"},"publicKey":{"changeNotice":"Bitte beachten: Nach dem \xc4ndern der Unzer Keys muss das Apple Pay Payment Processing Certificate neu hochgeladen werden."},"merchantIdentificationCertificate":{"label":"Merchant Identification Zertifikat (merchant_id.pem)","helpText":"Zertifikat und Schl\xfcssel m\xfcssen nach den Schritten der Unzer-Dokumentation vorbereitet werden."},"merchantIdentificationKey":{"label":"Merchant Identification Zertifikatsschl\xfcssel (merchant_id.key)"}},"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"},"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"}}'),C=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","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":{"b2b-eur":"Invoice B2B EUR","b2b-chf":"Invoice B2B CHF","b2c-eur":"Invoice B2C EUR","b2c-chf":"Invoice B2C CHF"},"paylaterInstallment":{"b2c-eur":"Installment B2C EUR","b2c-chf":"Installment B2C CHF"},"paylaterDirectDebitSecured":{"b2c-eur":"Direct Debit B2C EUR"}}},"unzer-payment-settings":{"module":{"title":"Unzer Payment","description":"Unzer Payment"},"apple-pay":{"certificates":{"title":"Apple Pay Certificates (Deprecated)","textExisting":"We have updated our integration with Apple Pay, but since you already have it set up, you don\'t need to do anything just now.

However, when your Apple Pay certificates are about to expire, you can change to the new integration.

You can of course change to the new integration now, if you want, and then you don\'t have to worry about expiring certificates, changing integration, etc. in the future.","textAll":"Before you activate Apple Pay, please make sure you have read our checklist.","check":{"paymentProcessingValid":{"true":"The Payment Processing certificate is present and valid","false":"The Payment Processing certificate is missing"},"paymentProcessingActive":{"true":"The Payment Processing certificate is active","false":"The Payment Processing certificate is inactive"},"merchantIdentificationValid":{"true":"The Merchant Identification certificate is present","false":"The Merchant Identification certificate is missing"},"merchantIdentificationValidUntil":{"true":"The Merchant Identification certificate is valid","false":"The Merchant Identification certificate is expired and must be renewed"}},"update":{"success":{"title":"Success","message":"Certificates were updated successfully"},"error":{"title":"Error","message":"An error occurred during certificate update","messageInvalidCertificate":"The given certificate data for {type} is invalid","messageMissingCertificateFiles":"The given certificate data for {type} is incomplete"}}},"paymentProcessingCertificate":{"label":"Payment Processing Certificate","helpText":"Certificate and Key have to be prepared as specified in the Unzer documentation."},"paymentProcessingKey":{"label":"Payment Processing Certificate Key (Private Key)"},"publicKey":{"changeNotice":"Please note: After changing the Unzer keys, you have to re-upload your Apple Pay Payment Processing Certificate."},"merchantIdentificationCertificate":{"label":"Merchant Identification Certificate","helpText":"Certificate and Key have to be prepared as specified in the Unzer documentation."},"merchantIdentificationKey":{"label":"Merchant Identification Certificate Key (Private Key)"}},"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"},"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":k,"en-GB":C},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(434);let P=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\n \n \n {% endblock %}\n
\n{% endblock %}\n',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;n.isDataLoading=!0;let a=new P(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){console.log(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 P;return t.addFilter(P.prefix("url","https://")),t.addFilter(P.equals("salesChannelId",e)),t}}});let{Component:z,Mixin:S,Context:_}=Shopware;z.register("unzer-webhooks-modal",{template:'\n \n {{ $tc(\'unzer-payment-settings.webhook.empty\') }}\n \n\n
\n \n \n\n \n {{ $tc(\'unzer-payment-settings.modal.webhook.submit.clear\', webhookSelectionLength, {count: webhookSelectionLength}) }}\n \n
\n\n',mixins:[S.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(421),n(410),Shopware.Component.register("unzer-payment-apple-pay-certificates",{template:'{% block unzer_payment_apple_pay_certificates %}\n \n \n \n{% endblock %}\n',mixins:[Shopware.Mixin.getByName("notification")],inject:["repositoryFactory","UnzerPaymentApplePayService"],props:{isLoading:{type:Boolean,required:!1},selectedSalesChannelId:{type:String,required:!1},parentRefs:{required:!0}},data(){return{isUpdating:!1,isUpdateSuccessful:!1,isDataLoading:!1,paymentProcessingCertificate:!1,paymentProcessingKey:!1,merchantIdentificationCertificate:!1,merchantIdentificationKey:!1,merchantIdentificationValid:!1,merchantIdentificationValidUntil:null,paymentProcessingValid:!1,paymentProcessingActive:!1}},computed:{isNotDefaultSalesChannel(){return null!==this.selectedSalesChannelId},now(){return Date.now()},parentConfigData(){return this.parentRefs&&this.parentRefs.systemConfig&&this.parentRefs.systemConfig.actualConfigData&&this.parentRefs.systemConfig.actualConfigData[this.selectedSalesChannelId]||{}}},created(){this.createdComponent()},methods:{createdComponent(){this.loadData()},loadData(){this.checkCertificates()},checkCertificates(){let e=this;e.isDataLoading=!0,this.UnzerPaymentApplePayService.checkCertificates(this.selectedSalesChannelId).then(e=>{void 0!==e&&(this.merchantIdentificationValid=e.merchantIdentificationValid,this.merchantIdentificationValidUntil=e.merchantIdentificationValidUntil?new Date(e.merchantIdentificationValidUntil):null,this.paymentProcessingValid=e.paymentProcessingValid,this.paymentProcessingActive=e.paymentProcessingActive)}).finally(()=>{e.isDataLoading=!1})},onSave(){return this.updateCertificates()},resetFileFieldsMerchantIdentification(){this.$refs.merchantIdentificationCertificateInput.onRemoveIconClick(),this.$refs.merchantIdentificationKeyInput.onRemoveIconClick()},resetFileFieldsPaymentProcessing(){this.$refs.paymentProcessingCertificateInput.onRemoveIconClick(),this.$refs.paymentProcessingKeyInput.onRemoveIconClick()},updateCertificates(){let e=this;return(this.isUpdateSuccessful=!1,this.isUpdating=!0,this.paymentProcessingCertificate||this.paymentProcessingKey||this.merchantIdentificationCertificate||this.merchantIdentificationKey||this.$refs.inheritWrapperMerchantIdentificationCertificate.isInherited||this.$refs.inheritWrapperPaymentProcessingCertificate.isInherited)?this.UnzerPaymentApplePayService.updateCertificates(this.selectedSalesChannelId,{paymentProcessingCertificate:this.paymentProcessingCertificate,paymentProcessingKey:this.paymentProcessingKey,merchantIdentificationCertificate:this.merchantIdentificationCertificate,merchantIdentificationKey:this.merchantIdentificationKey},this.$refs.inheritWrapperMerchantIdentificationCertificate.isInherited,this.$refs.inheritWrapperPaymentProcessingCertificate.isInherited).then(t=>{e.isUpdateSuccessful=!0,e.createNotificationSuccess({title:e.$tc("unzer-payment-settings.apple-pay.certificates.update.success.title"),message:e.$tc("unzer-payment-settings.apple-pay.certificates.update.success.message")}),e.$emit("certificate-updated",t),e.parentRefs.systemConfig.loadCurrentSalesChannelConfig?e.parentRefs.systemConfig.loadCurrentSalesChannelConfig():(delete e.parentRefs.systemConfig.actualConfigData[this.selectedSalesChannelId],e.parentRefs.systemConfig.readAll()),e.checkCertificates(),e.resetFileFieldsPaymentProcessing(),e.resetFileFieldsMerchantIdentification()}).catch(t=>{let n="unzer-payment-settings.apple-pay.certificates.update.error.message";t&&t.response&&t.response.data&&t.response.data.message&&(n=t.response.data.message);let a={};t&&t.response&&t.response.data&&t.response.data.translationData&&(a=t.response.data.translationData),e.createNotificationError({title:e.$tc("unzer-payment-settings.apple-pay.certificates.update.error.title"),message:e.$t(n,a)})}).finally(()=>{e.isUpdating=!1}):(this.isUpdateSuccessful=!0,this.isUpdating=!1,Promise.resolve())},onInputChangePaymentProcessing(e){e&&this.$refs.inheritWrapperPaymentProcessingCertificate.removeInheritance()},onInputChangeMerchantIdentification(e){e&&this.$refs.inheritWrapperMerchantIdentificationCertificate.removeInheritance()},getInheritedValue(e){let t=this.parentRefs.systemConfig;return t?t.getInheritedValue&&t.actualConfigData.null?t.getInheritedValue({name:"UnzerPayment6.settings."+e,type:"text"}):t.actualConfigData.null&&t.actualConfigData.null["UnzerPayment6.settings."+e]||null:null}}});let{Component:D}=Shopware;D.register("unzer-payment-plugin-icon",{template:'{% block unzer_plugin_icon %}\n \n{% endblock %}\n',computed:{assetFilter(){return Shopware.Filter.getByName("asset")}}});let{Component:I}=Shopware;I.override("sw-system-config",{template:'{% block sw_system_config_content_card_field %}\n \n{% endblock %}\n',inject:["UnzerPaymentConfigurationService"],data(){return{readOnlyUnzerGooglePayGatewayMerchantId:{}}},watch:{currentSalesChannelId(){this.getUnzerGooglePayGatewayMerchantId(),this.$emit("sales-channel-changed",this.actualConfigData[this.currentSalesChannelId],this.currentSalesChannelId)}},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(806);let{Component:$,Mixin:R,Context:M}=Shopware;$.register("unzer-payment-settings",{template:'{% block unzer_payment_settings %}\n \n {% block unzer_payment_settings_header %}\n \n {% endblock %}\n\n {% block unzer_payment_settings_actions %}\n \n {% endblock %}\n\n {% block unzer_payment_settings_content %}\n \n {% endblock %}\n \n{% endblock %}\n',mixins:[R.getByName("notification"),R.getByName("sw-inline-snippet")],inject:["repositoryFactory","UnzerPaymentConfigurationService"],data(){return{isLoading:!0,isLoadingWebhooks:!0,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 M.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}),this.$refs.applePayCertificates.onSave().then(()=>{this.isLoading=!1})}).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(),this.$refs.applePayCertificates.loadData()},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}`)},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)})})})}}});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":k,"en-GB":C},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(213),n(47),n(650),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":k,"en-GB":C}}),n(73)}()}(); \ No newline at end of file