diff --git a/CHANGELOG.md b/CHANGELOG.md index f5931db..2cbbc44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ +# 7.3.0 +- Headless storefront support + # 7.2.0 -- Datenbanktabelle umbenannt, um Namenskonflikte mit älteren Plugins zu vermeiden. -- Problem mit fehlgeschlagenen Rückerstattungen bei Zahlungen mit Rechnungen behoben. +- Renamed database table to avoid a naming conflict with legacy plugins +- Fixed issue with refunds failing for payments using Invoice +- Fix to respect sort order of payment methods # 7.1.6 - Improved rounding handling to force 2 decimal places diff --git a/CHANGELOG_de-DE.md b/CHANGELOG_de-DE.md index 5a56441..26c128f 100644 --- a/CHANGELOG_de-DE.md +++ b/CHANGELOG_de-DE.md @@ -1,3 +1,6 @@ +# 7.3.0 +- Headless Storefront unterstützung + # 7.2.0 - Datenbanktabelle umbenannt, um Namenskonflikte mit älteren Plugins zu vermeiden. - Problem mit fehlgeschlagenen Rückerstattungen bei Zahlungen mit Rechnungen behoben. diff --git a/README.md b/README.md index 2b59036..7d652f7 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,10 @@ Please note that this plugin is for versions 6.5, 6.6 or 6.7. For the 6.4 plugin ## Documentation -- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.2.0/docs/en/documentation.html) -- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.2.0/docs/de/documentation.html) -- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.2.0/docs/fr/documentation.html) -- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.2.0/docs/it/documentation.html) +- For English documentation click [here](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.3.0/docs/en/documentation.html) +- Für die deutsche Dokumentation klicken Sie [hier](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.3.0/docs/de/documentation.html) +- Pour la documentation Française, cliquez [ici](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.3.0/docs/fr/documentation.html) +- Per la documentazione in tedesco, clicca [qui](https://docs.plugin-documentation.vr-payment.de/vr-payment/shopware-6/7.3.0/docs/it/documentation.html) ## Installation diff --git a/composer.json b/composer.json index c78a5ac..0becadc 100644 --- a/composer.json +++ b/composer.json @@ -59,5 +59,5 @@ "vrpayment/sdk": "^4.0.0" }, "type": "shopware-platform-plugin", - "version": "7.2.0" + "version": "7.3.0" } diff --git a/docs/de/documentation.html b/docs/de/documentation.html index 9af9eb7..cf0182a 100644 --- a/docs/de/documentation.html +++ b/docs/de/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/docs/en/documentation.html b/docs/en/documentation.html index 36c47ae..8e63bd1 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/docs/fr/documentation.html b/docs/fr/documentation.html index 6e3b236..44b86c3 100644 --- a/docs/fr/documentation.html +++ b/docs/fr/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/docs/it/documentation.html b/docs/it/documentation.html index 2b54fda..57282f3 100644 --- a/docs/it/documentation.html +++ b/docs/it/documentation.html @@ -23,7 +23,7 @@
  • - + Source
  • diff --git a/src/Core/Api/Transaction/Service/TransactionService.php b/src/Core/Api/Transaction/Service/TransactionService.php index e67ca20..0d52f1c 100644 --- a/src/Core/Api/Transaction/Service/TransactionService.php +++ b/src/Core/Api/Transaction/Service/TransactionService.php @@ -1,7 +1,10 @@ -container = $container; $this->localeCodeProvider = $localeCodeProvider; $this->settingsService = $settingsService; + $this->cache = $cache; } /** @@ -132,8 +143,7 @@ class TransactionService public function create( PaymentTransactionStruct $transaction, SalesChannelContext $salesChannelContext - ): string - { + ): string { $criteria = new Criteria([$transaction->getOrderTransactionId()]); $criteria->addAssociation('order'); $orderTransaction = $this->container->get('order_transaction.repository')->search($criteria, $salesChannelContext->getContext())->first(); @@ -142,13 +152,28 @@ class TransactionService $settings = $this->settingsService->getSettings($salesChannelId); $apiClient = $settings->getApiClient(); - $transactionId = $_SESSION['transactionId'] ?? null; + // Get transaction ID from cache (headless) or session (storefront). + $transactionId = $this->getTransactionIdFromContext($salesChannelContext); + $pendingTransaction = null; + + // Try to read the pending transaction if we have an ID stored. if ($transactionId !== null) { - $pendingTransaction = $this->read($_SESSION['transactionId'], $salesChannelId); + try { + $pendingTransaction = $this->read($transactionId, $salesChannelId); + // Verify it's still in PENDING state - otherwise we can't reuse it. + if ($pendingTransaction != null && $pendingTransaction->getState() !== TransactionState::PENDING) { + $pendingTransaction = null; + } + } catch (\Exception $e) { + // Transaction may have been deleted, expired, or is invalid - we'll create a new one. + $this->logger?->debug('Could not read pending transaction, will create new one: ' . $e->getMessage()); + $pendingTransaction = null; + } } - if ($transactionId === null || $pendingTransaction === null || $pendingTransaction->getState() !== TransactionState::PENDING) { - unset($_SESSION['transactionId']); + // Create a new transaction if we don't have a valid pending one. + if ($pendingTransaction === null) { + $this->clearTransactionIdFromContext($salesChannelContext); $pendingTransactionId = $this->createPendingTransaction($salesChannelContext); $pendingTransaction = $this->read($pendingTransactionId, $salesChannelId); } @@ -161,6 +186,7 @@ class TransactionService $transaction )); $transactionPayloadClass->setLogger($this->logger); + $transactionPayloadClass->setTransactionId($pendingTransaction->getId()); $transactionPayload = $transactionPayloadClass->get($pendingTransaction->getVersion()); $createdTransaction = $apiClient->getTransactionService() @@ -170,7 +196,8 @@ class TransactionService $transaction, $salesChannelContext->getContext(), $createdTransaction->getId(), - $settings->getSpaceId() + $settings->getSpaceId(), + $salesChannelContext->getToken() ); $redirectUrl = $this->container->get('router')->generate( @@ -179,6 +206,16 @@ class TransactionService UrlGeneratorInterface::ABSOLUTE_URL ); + // If the request comes from the Store API (headless), we should not redirect to a Storefront Twig page. + // Instead, we return the returnUrl so the headless client can handle the next steps (e.g. rendering the iframe). + $request = $this->container->get('request_stack')->getCurrentRequest(); + if ($request) { + $routeScope = $request->attributes->get('_route_scope', []); + if (in_array('store-api', $routeScope, true)) { + $redirectUrl = $transaction->getReturnUrl(); + } + } + if ($settings->getIntegration() == Integration::PAYMENT_PAGE) { $redirectUrl = $apiClient->getTransactionPaymentPageService() ->paymentPageUrl($settings->getSpaceId(), $createdTransaction->getId()); @@ -216,7 +253,8 @@ class TransactionService * * @return void */ - public function createRecurringTransaction(TransactionCreate $sdkTransactionCreate, string $spaceId = ""): Transaction { + public function createRecurringTransaction(TransactionCreate $sdkTransactionCreate, string $spaceId = ""): Transaction + { $settings = $this->settingsService->getSettings(); if (empty($spaceId)) { $spaceId = $settings->getSpaceId(); @@ -245,15 +283,21 @@ class TransactionService PaymentTransactionStruct $transaction, Context $context, int $vrpaymentTransactionId, - int $spaceId - ): void - { + int $spaceId, + ?string $token = null + ): void { + $customFields = [ + TransactionPayload::ORDER_TRANSACTION_CUSTOM_FIELDS_VRPAYMENT_TRANSACTION_ID => $vrpaymentTransactionId, + TransactionPayload::ORDER_TRANSACTION_CUSTOM_FIELDS_VRPAYMENT_SPACE_ID => $spaceId, + ]; + + if ($token) { + $customFields[TransactionPayload::ORDER_TRANSACTION_CUSTOM_FIELDS_VRPAYMENT_TOKEN] = $token; + } + $data = [ 'id' => $transaction->getOrderTransactionId(), - 'customFields' => [ - TransactionPayload::ORDER_TRANSACTION_CUSTOM_FIELDS_VRPAYMENT_TRANSACTION_ID => $vrpaymentTransactionId, - TransactionPayload::ORDER_TRANSACTION_CUSTOM_FIELDS_VRPAYMENT_SPACE_ID => $spaceId, - ], + 'customFields' => $customFields, ]; $this->container->get('order_transaction.repository')->update([$data], $context); } @@ -271,8 +315,7 @@ class TransactionService Context $context, string $paymentMethodId = null, string $salesChannelId = null - ): void - { + ): void { try { $transactionId = $transaction->getId(); @@ -351,7 +394,6 @@ class TransactionService $data = array_filter($data); $this->container->get(TransactionEntityDefinition::ENTITY_NAME . '.repository')->upsert([$data], $context); - } catch (\Exception $exception) { $this->logger->critical(__CLASS__ . ' : ' . __FUNCTION__ . ' : ' . $exception->getMessage()); } @@ -402,7 +444,6 @@ class TransactionService } catch (\Exception $e) { throw CartException::orderNotFound($orderId); } - } /** @@ -450,7 +491,8 @@ class TransactionService return $this->container->get(TransactionEntityDefinition::ENTITY_NAME . '.repository') ->search( (new Criteria())->addFilter(new EqualsFilter('transactionId', $transactionId)) - ->addAssociations(['refunds']), $context + ->addAssociations(['refunds']), + $context ) ->first(); } @@ -468,7 +510,8 @@ class TransactionService return $this->container->get(TransactionEntityDefinition::ENTITY_NAME . '.repository') ->search( (new Criteria())->addFilter(new EqualsFilter('orderTransactionId', $orderTransactionId)) - ->addAssociations(['refunds']), $context + ->addAssociations(['refunds']), + $context ) ->first(); } @@ -485,7 +528,8 @@ class TransactionService { return $this->container->get(RefundEntityDefinition::ENTITY_NAME . '.repository') ->search( - (new Criteria())->addFilter(new EqualsFilter('transactionId', $transactionId)), $context + (new Criteria())->addFilter(new EqualsFilter('transactionId', $transactionId)), + $context ) ->getEntities(); } @@ -528,17 +572,23 @@ class TransactionService public function createPendingTransaction(SalesChannelContext $salesChannelContext, $event = null): int { $expiredTransaction = true; - $transactionId = $_SESSION['transactionId'] ?? null; + // Get transaction ID from cache (headless) or session (storefront). + $transactionId = $this->getTransactionIdFromContext($salesChannelContext); $settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId()); if (!$settings) { throw new \Exception('Space settings not configured'); } if ($transactionId) { - $transactionService = $settings->getApiClient()->getTransactionService(); - $pendingTransaction = $transactionService->read($settings->getSpaceId(), $transactionId); - if ($pendingTransaction->getState() === TransactionState::PENDING) { - $expiredTransaction = false; + try { + $transactionService = $settings->getApiClient()->getTransactionService(); + $pendingTransaction = $transactionService->read($settings->getSpaceId(), $transactionId); + if ($pendingTransaction->getState() === TransactionState::PENDING) { + $expiredTransaction = false; + } + } catch (\Exception $e) { + // Transaction may have been deleted, expired, or is invalid - treat as expired. + $expiredTransaction = true; } } @@ -546,23 +596,10 @@ class TransactionService $settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId()); $customer = $salesChannelContext->getCustomer(); - $lineItems = []; - if ($event) { - if ($event instanceof CheckoutConfirmPageLoadedEvent) { - $cartLineItems = $event->getPage()->getCart()->getLineItems()->getElements(); - foreach ($cartLineItems as $cartLineItem) { - if ($cartLineItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) { - continue; - } - $lineItems[] = $this->createTempLineItem($cartLineItem); - } - } elseif ($event instanceof AccountEditOrderPageLoadedEvent) { - $order = $event->getPage()->getOrder(); - foreach ($order->getLineItems() as $orderLineItem) { - $lineItems[] = $this->createTempLineItem($orderLineItem); - } - } + if ($customer === null) { + throw new \Exception('Customer is required to create a transaction'); } + $lineItems = $this->extractLineItems($event); $customerId = ""; if ($customer->getGuest() === false) { @@ -593,14 +630,16 @@ class TransactionService ->setSuccessUrl($homeUrl . '?success') ->setFailedUrl($homeUrl . '?fail'); - if($this->isSubscription($salesChannelContext)) { + if ($this->isSubscription($salesChannelContext)) { $transactionPayload->setTokenizationMode(TokenizationMode::FORCE_CREATION); } $transactionService = $settings->getApiClient()->getTransactionService(); $transaction = $transactionService->create($settings->getSpaceId(), $transactionPayload); $transactionId = $transaction->getId(); - $_SESSION['transactionId'] = $transactionId; + + // Store in cache and session for transaction reuse. + $this->storeTransactionIdInContext($salesChannelContext, $transactionId); } return $transactionId; @@ -611,7 +650,7 @@ class TransactionService * @param int $transactionId * @return void */ - public function updateTempTransaction(SalesChannelContext $salesChannelContext, int $transactionId): void + public function updateTempTransaction(SalesChannelContext $salesChannelContext, int $transactionId, array $lineItems = []): void { $pendingTransaction = new TransactionPending(); $pendingTransaction->setId($transactionId); @@ -629,10 +668,50 @@ class TransactionService $pendingTransaction->setBillingAddress($billingAddress); $pendingTransaction->setShippingAddress($shippingAddress); + if (!empty($lineItems)) { + $pendingTransaction->setLineItems($lineItems); + } + $settings->getApiClient()->getTransactionService() ->update($settings->getSpaceId(), $pendingTransaction); } + /** + * Extracts line items from the given source (Event or Cart). + * + * @param mixed $source + * @return array + */ + public function extractLineItems($source): array + { + $lineItems = []; + if ($source) { + if ($source instanceof CheckoutConfirmPageLoadedEvent) { + $cartLineItems = $source->getPage()->getCart()->getLineItems()->getElements(); + foreach ($cartLineItems as $cartLineItem) { + if ($cartLineItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) { + continue; + } + $lineItems[] = $this->createTempLineItem($cartLineItem); + } + } elseif ($source instanceof AccountEditOrderPageLoadedEvent) { + $order = $source->getPage()->getOrder(); + foreach ($order->getLineItems() as $orderLineItem) { + $lineItems[] = $this->createTempLineItem($orderLineItem); + } + } elseif ($source instanceof \Shopware\Core\Checkout\Cart\Cart) { + $cartLineItems = $source->getLineItems()->getElements(); + foreach ($cartLineItems as $cartLineItem) { + if ($cartLineItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) { + continue; + } + $lineItems[] = $this->createTempLineItem($cartLineItem); + } + } + } + return $lineItems; + } + /** * @param ChargeAttempt|null $chargeAttempt * @param string $descriptorKey @@ -717,32 +796,32 @@ class TransactionService return $chargeAttempts ? $chargeAttempts[0] : null; } - private function createTempLineItem($productData): LineItemCreate - { - $lineItem = new LineItemCreate(); + private function createTempLineItem($productData): LineItemCreate + { + $lineItem = new LineItemCreate(); - $roundedPrice = $this->round($productData->getPrice()->getUnitPrice()); + $roundedPrice = $this->round($productData->getPrice()->getUnitPrice()); - if ($productData instanceof LineItem) { - $lineItem->setName($productData->getLabel()); - $lineItem->setUniqueId($productData->getId()); - $lineItem->setSku($productData->getReferencedId() ?? $productData->getId()); - $lineItem->setQuantity($productData->getQuantity()); - $lineItem->setAmountIncludingTax($roundedPrice); - } elseif ($productData instanceof OrderLineItemEntity) { - $lineItem->setName($productData->getLabel()); - $lineItem->setUniqueId($productData->getId()); - $lineItem->setSku($productData->getProductId() ?? $productData->getIdentifier() ?? $productData->getId()); - $lineItem->setQuantity($productData->getQuantity()); - $lineItem->setAmountIncludingTax($roundedPrice); - } else { - throw new \InvalidArgumentException('Unsupported line item type: ' . get_class($productData)); - } + if ($productData instanceof LineItem) { + $lineItem->setName($productData->getLabel()); + $lineItem->setUniqueId($productData->getId()); + $lineItem->setSku($productData->getReferencedId() ?? $productData->getId()); + $lineItem->setQuantity($productData->getQuantity()); + $lineItem->setAmountIncludingTax($roundedPrice); + } elseif ($productData instanceof OrderLineItemEntity) { + $lineItem->setName($productData->getLabel()); + $lineItem->setUniqueId($productData->getId()); + $lineItem->setSku($productData->getProductId() ?? $productData->getIdentifier() ?? $productData->getId()); + $lineItem->setQuantity($productData->getQuantity()); + $lineItem->setAmountIncludingTax($roundedPrice); + } else { + throw new \InvalidArgumentException('Unsupported line item type: ' . get_class($productData)); + } - $lineItem->setType(LineItemType::PRODUCT); + $lineItem->setType(LineItemType::PRODUCT); - return $lineItem; - } + return $lineItem; + } /** * Build a VRPayment address from Shopware customer address. @@ -785,8 +864,8 @@ class TransactionService $address->setSalutation($salutationEntity?->getDisplayName() ?? ''); $address->setGender( strtolower($salutationEntity?->getSalutationKey() ?? '') === 'mr' - ? Gender::MALE - : Gender::FEMALE + ? Gender::MALE + : Gender::FEMALE ); return $address; @@ -798,7 +877,8 @@ class TransactionService * @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext * @return bool */ - private function isSubscription(SalesChannelContext $salesChannelContext): bool { + private function isSubscription(SalesChannelContext $salesChannelContext): bool + { $extensionName = 'subscription'; if (class_exists(\Shopware\Commercial\Subscription\Framework\Struct\SubscriptionContextStruct::class)) { $extensionName = SubscriptionContextStruct::SUBSCRIPTION_EXTENSION; @@ -810,12 +890,98 @@ class TransactionService } /** - * @param $amount - * @param int $precision - * - * @return float - */ - private function round($value, $precision = 2): float { + * @param $amount + * @param int $precision + * + * @return float + */ + private function round($value, $precision = 2): float + { return \round($value, $precision); } + + /** + * Generates a cache key for the pending transaction ID. + * Uses customer ID for authenticated users, which works for both headless and storefront. + * + * @param SalesChannelContext $salesChannelContext + * @return string|null + */ + private function getPendingTransactionCacheKey(SalesChannelContext $salesChannelContext): ?string + { + $customer = $salesChannelContext->getCustomer(); + if ($customer) { + return 'vrpn_pending_transaction_id_customer_' . $customer->getId(); + } + return null; + } + + /** + * Retrieves the stored pending transaction ID from cache or session. + * Uses customer ID as cache key for headless (stateless) support. + * Falls back to session for Storefront (stateful) compatibility. + * + * @param SalesChannelContext $salesChannelContext + * @return int|null The transaction ID if found, otherwise null. + */ + private function getTransactionIdFromContext(SalesChannelContext $salesChannelContext): ?int + { + // Try cache first (for headless/API where session might not persist or be shared). + $cacheKey = $this->getPendingTransactionCacheKey($salesChannelContext); + if ($cacheKey) { + $item = $this->cache->getItem($cacheKey); + if ($item->isHit()) { + return (int) $item->get(); + } + } + + // Fallback to PHP session for traditional Storefront compatibility. + if (isset($_SESSION['transactionId'])) { + return (int) $_SESSION['transactionId']; + } + + return null; + } + + /** + * Clears the pending transaction ID from cache and session. + * + * @param SalesChannelContext $salesChannelContext + */ + private function clearTransactionIdFromContext(SalesChannelContext $salesChannelContext): void + { + // Clear from cache key. + $cacheKey = $this->getPendingTransactionCacheKey($salesChannelContext); + if ($cacheKey) { + $this->cache->deleteItem($cacheKey); + } + + // Clear from session. + if (isset($_SESSION['transactionId'])) { + unset($_SESSION['transactionId']); + } + } + + /** + * Stores the pending transaction ID in cache and session. + * This persists in the database (via cache) and works across all request types (Storefront & headless). + * + * @param SalesChannelContext $salesChannelContext + * @param int $transactionId + */ + private function storeTransactionIdInContext(SalesChannelContext $salesChannelContext, int $transactionId): void + { + // Store in cache for headless. + $cacheKey = $this->getPendingTransactionCacheKey($salesChannelContext); + if ($cacheKey) { + $item = $this->cache->getItem($cacheKey); + $item->set($transactionId); + // Expire after 2 hours to avoid stale data (matching typical cart lifetime). + $item->expiresAfter(7200); + $this->cache->save($item); + } + + // Store in session for Storefront. + $_SESSION['transactionId'] = $transactionId; + } } diff --git a/src/Core/Checkout/PaymentHandler/VRPaymentPaymentHandler.php b/src/Core/Checkout/PaymentHandler/VRPaymentPaymentHandler.php index 517e495..fa8a5bc 100644 --- a/src/Core/Checkout/PaymentHandler/VRPaymentPaymentHandler.php +++ b/src/Core/Checkout/PaymentHandler/VRPaymentPaymentHandler.php @@ -1,4 +1,6 @@ -getOrderTransactionId(); $orderTransaction = $this->orderTransactionRepository->search( (new Criteria([$orderTransactionId])) ->addAssociation('order') ->addAssociation('stateMachineState'), - $context + $context )->getEntities()->first(); $contextSource = $context->getSource(); @@ -175,14 +176,13 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler Request $request, PaymentTransactionStruct $transaction, Context $context - ): void - { + ): void { $orderTransactionId = $transaction->getOrderTransactionId(); $orderTransaction = $this->orderTransactionRepository->search( (new Criteria([$orderTransactionId])) ->addAssociation('order') ->addAssociation('stateMachineState'), - $context + $context )->getEntities()->first(); if ($orderTransaction->getOrder()->getAmountTotal() > 0) { @@ -209,7 +209,7 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler $this->orderTransactionStateHandler->paid($orderTransaction->getId(), $context); } - $token = $request->getSession()->get('sw-context-token'); + $token = $this->getContextToken($request); if ($token) { $orderEntity = $this->pluginTransactionService->getOrderEntity( $orderTransaction->getOrder()->getId(), @@ -222,6 +222,24 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler $salesChannelContext->getContext()->addState('do-cart-delete'); $this->logger->info('Clearing cart with token: ' . $token); $this->cartPersister->delete($salesChannelContext->getToken(), $salesChannelContext); + } else { + // Fallback: Try to get token from transaction custom fields (for Headless redirects) + $customFields = $orderTransaction->getCustomFields() ?? []; + $storedToken = $customFields[TransactionPayload::ORDER_TRANSACTION_CUSTOM_FIELDS_VRPAYMENT_TOKEN] ?? null; + + if ($storedToken) { + $this->logger->info('Clearing cart with stored token: ' . $storedToken); + $orderEntity = $this->pluginTransactionService->getOrderEntity( + $orderTransaction->getOrder()->getId(), + $context + ); + $salesChannelId = $orderEntity->getSalesChannelId(); + $parameters = new SalesChannelContextServiceParameters($salesChannelId, $storedToken, originalContext: $context); + $salesChannelContext = $this->salesChannelContextService->get($parameters); + + $salesChannelContext->getContext()->addState('do-cart-delete'); + $this->cartPersister->delete($salesChannelContext->getToken(), $salesChannelContext); + } } } @@ -232,7 +250,7 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler PaymentHandlerType $type, string $paymentMethodId, Context $context - ): bool { + ): bool { // Both PaymentHandlerType::RECURRING and PaymentHandlerType::REFUND are supported //TODO: check that the payment method really supports recurring. // In order to do that, we need to get this information in when synching the payment methods. @@ -284,7 +302,7 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler throw PaymentException::recurringInterrupted($newTransactionId, 'No orders found associated with the subscription.'); } - $orders->sort(fn (OrderEntity $a, OrderEntity $b) => $a->getCreatedAt() <=> $b->getCreatedAt()); + $orders->sort(fn(OrderEntity $a, OrderEntity $b) => $a->getCreatedAt() <=> $b->getCreatedAt()); /** @var OrderEntity|null $originalOrder */ $originalOrder = $orders->first(); @@ -296,7 +314,7 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler /** @var OrderTransactionEntity|null $originalTransaction */ $originalTransaction = $originalTransactions->filter( - fn (OrderTransactionEntity $t) => $t->getStateMachineState()?->getTechnicalName() === OrderTransactionStates::STATE_PAID + fn(OrderTransactionEntity $t) => $t->getStateMachineState()?->getTechnicalName() === OrderTransactionStates::STATE_PAID )->first(); if ($originalTransaction === null) { @@ -305,7 +323,8 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler $newOrderTransaction = $this->orderTransactionRepository->search( (new Criteria([$newTransactionId])) - ->addAssociation('order'), $context + ->addAssociation('order'), + $context )->getEntities()->first(); $orderNumber = $newOrderTransaction->getOrder()->getOrderNumber(); @@ -378,8 +397,7 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler // Update the new order transaction with the new transaction details $this->orderTransactionRepository->update([$data], $context); $this->pluginTransactionService->upsert($newSdkTransaction, $context); - } - catch (\Throwable $e) { + } catch (\Throwable $e) { $errorMessage = 'An error occurred during the communication with external payment gateway : ' . $e->getMessage(); $this->logger->critical($errorMessage); throw PaymentException::recurringInterrupted($transaction->getOrderTransactionId(), $errorMessage); @@ -392,7 +410,8 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler * @param \VRPayment\Sdk\Model\Address $address The address model from the SDK. * @return \VRPayment\Sdk\Model\AddressCreate The newly created AddressCreate instance. */ - private function addressCreateFromSdk(\VRPayment\Sdk\Model\Address $address): \VRPayment\Sdk\Model\AddressCreate { + private function addressCreateFromSdk(\VRPayment\Sdk\Model\Address $address): \VRPayment\Sdk\Model\AddressCreate + { $addressCreate = new \VRPayment\Sdk\Model\AddressCreate; $addressCreate->setCity($address->getCity()); @@ -473,16 +492,17 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler } /** - * @param $amount - * @param int $precision - * - * @return float - */ - private function round($value, $precision = 2): float { + * @param $amount + * @param int $precision + * + * @return float + */ + private function round($value, $precision = 2): float + { return \round($value, $precision); } - - private function getContextToken(Request $request): string + + private function getContextToken(Request $request): ?string { $headerContextToken = $request->headers->get('sw-context-token'); if ($headerContextToken) { @@ -490,9 +510,10 @@ class VRPaymentPaymentHandler extends AbstractPaymentHandler } $sessionContextToken = $request->getSession()->get("sw-context-token"); - if (!$sessionContextToken) { + if ($sessionContextToken) { return $sessionContextToken; } - return Random::getAlphanumericString(32); + + return null; } } diff --git a/src/Core/Checkout/PaymentMethod/SalesChannel/PaymentMethodRouteDecorator.php b/src/Core/Checkout/PaymentMethod/SalesChannel/PaymentMethodRouteDecorator.php new file mode 100644 index 0000000..24f5635 --- /dev/null +++ b/src/Core/Checkout/PaymentMethod/SalesChannel/PaymentMethodRouteDecorator.php @@ -0,0 +1,103 @@ +decorated = $decorated; + $this->paymentMethodFilterService = $paymentMethodFilterService; + } + + /** + * Returns the decorated service. + * + * @return AbstractPaymentMethodRoute + */ + public function getDecorated(): AbstractPaymentMethodRoute + { + return $this->decorated; + } + + /** + * Loads the payment methods and applies the WhitelabelMachineName filter to the result. + * + * @param Request $request + * @param SalesChannelContext $context + * @param Criteria $criteria + * @return PaymentMethodRouteResponse + */ + #[Route( + path: '/store-api/payment-method', + name: 'store-api.payment.method', + methods: ['GET', 'POST'], + defaults: ['_entity' => 'payment_method'] + )] + public function load(Request $request, SalesChannelContext $context, Criteria $criteria): PaymentMethodRouteResponse + { + // Fetch the initial list of payment methods from the decorated service. + $response = $this->decorated->load($request, $context, $criteria); + + $currentRoute = $request->attributes->get('_route'); + if ($currentRoute === 'frontend.checkout.finish.page') { + return $response; + } + + $paymentMethods = $response->getPaymentMethods(); + + // Apply WhitelabelMachineName-specific filtering logic via the dedicated service. + $filteredCollection = $this->paymentMethodFilterService->filterPaymentMethods( + $paymentMethods, + $context + ); + + // Return the filtered results as a new response. + return new PaymentMethodRouteResponse( + new EntitySearchResult( + 'payment_method', + (int)$filteredCollection->count(), + $filteredCollection, + null, + $criteria, + $context->getContext() + ) + ); + } +} diff --git a/src/Core/Checkout/Service/CartRecoveryService.php b/src/Core/Checkout/Service/CartRecoveryService.php new file mode 100644 index 0000000..2abb793 --- /dev/null +++ b/src/Core/Checkout/Service/CartRecoveryService.php @@ -0,0 +1,298 @@ +cartService = $cartService; + $this->lineItemFactoryRegistry = $lineItemFactoryRegistry; + $this->orderRepository = $orderRepository; + $this->addCustomizedProductsRoute = $addCustomizedProductsRoute; + } + + /** + * Recreates a cart based on the items in an existing order. + * + * @param OrderEntity $order The source order. + * @param SalesChannelContext $salesChannelContext The current sales channel context. + * @return Cart The newly created and populated cart. + */ + public function recreateCartFromOrder(OrderEntity $order, SalesChannelContext $salesChannelContext): Cart + { + // Start with a clean slate by deleting any existing cart for the current session. + $this->cartService->deleteCart($salesChannelContext); + $cart = $this->cartService->createNew($salesChannelContext->getToken()); + + $orderItems = $order->getLineItems(); + + if ($orderItems === null) { + return $cart; + } + + // Special handling for Customized Products if the plugin logic is available. + if ($this->hasCustomProducts($orderItems) && $this->addCustomizedProductsRoute) { + $cart = $this->addCustomProducts($orderItems, $salesChannelContext, $cart); + } + + /** @var OrderLineItemEntity $orderLineItemEntity */ + foreach ($orderItems as $orderLineItemEntity) { + $type = (string)$orderLineItemEntity->getType(); + + // Skip child items and complex types that should have been handled by specialized logic. + if ($type !== CustomProductsLineItemTypes::LINE_ITEM_TYPE_PRODUCT || $orderLineItemEntity->getParentId() !== null) { + continue; + } + + // Create a standard product line item. + $lineItem = $this->lineItemFactoryRegistry->create([ + 'id' => $orderLineItemEntity->getId(), + 'quantity' => (int)$orderLineItemEntity->getQuantity(), + 'referencedId' => (string)$orderLineItemEntity->getReferencedId(), + 'type' => $type, + ], $salesChannelContext); + + // Preserve payload data to ensure product options and other metadata are carried over. + $lineItemPayload = $orderLineItemEntity->getPayload(); + if (!empty($lineItemPayload)) { + $lineItem->setPayload($lineItemPayload); + } + + // Add the item to the cart. + $cart = $this->cartService->add($cart, $lineItem, $salesChannelContext); + } + + return $cart; + } + + /** + * Checks if the order contains any line items belonging to the Customized Products plugin. + * + * @param OrderLineItemCollection $orderItems The items in the order. + * @return bool True if customized products are present. + */ + private function hasCustomProducts(OrderLineItemCollection $orderItems): bool + { + /** @var OrderLineItemEntity $orderItem */ + foreach ($orderItems as $orderItem) { + if ($orderItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) { + return true; + } + } + return false; + } + + /** + * Specialized logic to re-add customized products to the cart via the plugin's own route. + * + * @param OrderLineItemCollection $orderItems All order items. + * @param SalesChannelContext $salesChannelContext Context. + * @param Cart $cart Current cart. + * @return Cart Updated cart. + */ + private function addCustomProducts(OrderLineItemCollection $orderItems, SalesChannelContext $salesChannelContext, Cart $cart): Cart + { + if (!$this->addCustomizedProductsRoute) { + return $cart; + } + + /** @var OrderLineItemEntity $orderItem */ + foreach ($orderItems as $orderItem) { + if ($orderItem->getType() !== CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) { + continue; + } + + // Find the main product associated with this customized product container. + $product = $this->getCustomProduct($orderItems, (string)$orderItem->getId()); + if (!$product) continue; + + // Gather the chosen options and their values. + $productOptions = $this->getCustomProductOptions($orderItems, (string)$orderItem->getId()); + $optionValues = $this->getOptionValues($productOptions); + + // Prepare the data bag for the specialized add-to-cart route. + $params = new RequestDataBag([ + 'customized-products-template' => new RequestDataBag([ + 'id' => (string)$orderItem->getReferencedId(), + 'options' => new RequestDataBag($optionValues), + ]), + ]); + + $request = new Request([], [ + 'lineItems' => [ + (string)$product->getReferencedId() => [ + 'quantity' => (int)$orderItem->getQuantity(), + 'id' => (string)$product->getReferencedId(), + 'type' => CustomProductsLineItemTypes::LINE_ITEM_TYPE_PRODUCT, + 'referencedId' => (string)$product->getReferencedId(), + 'stackable' => (bool)$orderItem->getStackable(), + 'removable' => (bool)$orderItem->getRemovable(), + ] + ] + ]); + + // Call the Customized Products plugin's internal logic to add the item with its complex configuration. + $this->addCustomizedProductsRoute->add($params, $request, $salesChannelContext, $cart); + + // Re-fetch the cart to reflect changes made by the plugin route. + $cart = $this->cartService->getCart($salesChannelContext->getToken(), $salesChannelContext); + } + + return $cart; + } + + /** + * Finds the main product item within a customized product structure. + * + * @param OrderLineItemCollection $orderItems All order items. + * @param string $parentId The ID of the customized product container. + * @return OrderLineItemEntity|null The product line item entity. + */ + private function getCustomProduct(OrderLineItemCollection $orderItems, string $parentId): ?OrderLineItemEntity + { + /** @var OrderLineItemEntity $orderItem */ + foreach ($orderItems as $orderItem) { + if ($orderItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_PRODUCT && $orderItem->getParentId() === $parentId) { + return $orderItem; + } + } + return null; + } + + /** + * Gathers all option items for a customized product. + * + * @param OrderLineItemCollection $orderItems All items. + * @param string $parentId The ID of the customized product container. + * @return OrderLineItemEntity[] List of option entities. + */ + private function getCustomProductOptions(OrderLineItemCollection $orderItems, string $parentId): array + { + $options = []; + /** @var OrderLineItemEntity $orderItem */ + foreach ($orderItems as $orderItem) { + if ($orderItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS_OPTION && $orderItem->getParentId() === $parentId) { + $options[] = $orderItem; + } + } + return $options; + } + + /** + * Converts a list of options into a data structure suitable for the Customized Products logic. + * + * @param OrderLineItemEntity[] $productOptions List of option entities. + * @return array Formatted option values. + */ + private function getOptionValues(array $productOptions): array + { + $optionValues = []; + foreach ($productOptions as $productOption) { + $payload = (array)$productOption->getPayload(); + $optionType = (string)($payload['type'] ?? ''); + + switch ($optionType) { + case CustomProductsLineItemTypes::PRODUCT_OPTION_TYPE_IMAGE_UPLOAD: + case CustomProductsLineItemTypes::PRODUCT_OPTION_TYPE_FILE_UPLOAD: + $media = (array)($payload['media'] ?? []); + foreach ($media as $mediaItem) { + $optionValues[(string)$productOption->getReferencedId()] = new RequestDataBag([ + 'media' => new RequestDataBag([ + (string)$mediaItem['filename'] => new RequestDataBag([ + 'id' => (string)$mediaItem['mediaId'], + 'filename' => (string)$mediaItem['filename'], + ]), + ]), + ]); + } + break; + default: + $optionValues[(string)$productOption->getReferencedId()] = new RequestDataBag([ + 'value' => (string)($payload['value'] ?? ''), + ]); + } + } + return $optionValues; + } + + /** + * Fetches a full order entity with necessary associations for recovery or display. + * + * @param string $orderId The ID of the order. + * @param Context $context The current system context. + * @return OrderEntity The order entity. + * @throws \Exception If the order is not found. + */ + public function getOrderEntity(string $orderId, Context $context): OrderEntity + { + $criteria = (new Criteria([$orderId])) + ->addAssociation('lineItems.cover') + ->addAssociation('transactions.paymentMethod') + ->addAssociation('deliveries.shippingMethod'); + + /** @var OrderEntity|null $order */ + $order = $this->orderRepository->search($criteria, $context)->get($orderId); + + if (!$order) { + throw new \Exception('Order not found'); + } + + return $order; + } +} diff --git a/src/Core/Checkout/Service/InvoiceService.php b/src/Core/Checkout/Service/InvoiceService.php new file mode 100644 index 0000000..4fdcbc4 --- /dev/null +++ b/src/Core/Checkout/Service/InvoiceService.php @@ -0,0 +1,64 @@ +settingsService = $settingsService; + $this->transactionService = $transactionService; + } + + /** + * Fetches the invoice document metadata for a given order. + * + * @param string $orderId The Shopware order ID. + * @param SalesChannelContext $salesChannelContext The current context. + * + * @return object The invoice document metadata (instance of \VRPayment\Sdk\Model\RenderedDocument). + */ + public function getInvoiceDocument(string $orderId, SalesChannelContext $salesChannelContext): object + { + // Retrieve valid settings for the current sales channel. + $settings = $this->settingsService->getSettings($salesChannelContext->getSalesChannel()->getId()); + + // Fetch the local transaction entity associated with the order. + $transactionEntity = $this->transactionService->getByOrderId($orderId, $salesChannelContext->getContext()); + + // Perform the API call to WhitelabelMachineName to get the invoice document metadata. + return $settings->getApiClient()->getTransactionService()->getInvoiceDocument( + (int)$settings->getSpaceId(), + (int)$transactionEntity->getTransactionId() + ); + } +} diff --git a/src/Core/Checkout/Service/PaymentIntegrationService.php b/src/Core/Checkout/Service/PaymentIntegrationService.php new file mode 100644 index 0000000..5d97c53 --- /dev/null +++ b/src/Core/Checkout/Service/PaymentIntegrationService.php @@ -0,0 +1,192 @@ +transactionService = $transactionService; + $this->settingsService = $settingsService; + $this->transactionManagementService = $transactionManagementService; + $this->router = $router; + } + + /** + * Generates the payment configuration for a given transaction ID. + * This is used on the checkout confirm page before the order is created. + * + * @param int $transactionId The WhitelabelMachineName transaction ID. + * @param SalesChannelContext $salesChannelContext The context. + * @return PaymentConfigStruct The consolidated integration data. + */ + public function getConfigForTransaction( + int $transactionId, + SalesChannelContext $salesChannelContext + ): PaymentConfigStruct { + $settings = $this->settingsService->getSettings($salesChannelContext->getSalesChannel()->getId()); + + // Fetch the transaction details from WhitelabelMachineName API. + $vrpaymentTransaction = $settings->getApiClient()->getTransactionService()->read( + $settings->getSpaceId(), + $transactionId + ); + + $javascriptUrl = $this->getTransactionJavaScriptUrl($settings, $transactionId); + + $possiblePaymentMethods = $settings->getApiClient() + ->getTransactionService() + ->fetchPaymentMethods( + $settings->getSpaceId(), + $transactionId, + $settings->getIntegration() + ); + + $cartRecreateUrl = $this->router->generate( + 'frontend.checkout.cart.page', + [], + UrlGeneratorInterface::ABSOLUTE_URL + ); + + $checkoutUrl = $this->router->generate( + 'frontend.checkout.confirm.page', + [], + UrlGeneratorInterface::ABSOLUTE_URL + ); + + return (new PaymentConfigStruct()) + ->setIntegration((string)$settings->getIntegration()) + ->setJavascriptUrl($javascriptUrl) + ->setDeviceJavascriptUrl($this->getDeviceJavascriptUrl((int)$settings->getSpaceId())) + ->setTransactionPossiblePaymentMethods($possiblePaymentMethods) + ->setTransactionId($transactionId) + ->setSpaceId((int)$settings->getSpaceId()) + ->setCartRecreateUrl($cartRecreateUrl) + ->setCheckoutUrl($checkoutUrl); + } + + /** + * Generates the payment configuration for a given order. + * + * @param string $orderId The Shopware order ID. + * @param SalesChannelContext $salesChannelContext The context. + * @param string|null $cartRecreateUrl Optional override for the cart recreation URL. + * @param string|null $checkoutUrl Optional override for the checkout confirmation URL. + * @return PaymentConfigStruct The consolidated integration data. + */ + public function getPaymentConfig( + string $orderId, + SalesChannelContext $salesChannelContext, + ?string $cartRecreateUrl = null, + ?string $checkoutUrl = null + ): PaymentConfigStruct { + // Retrieve settings and the transaction entity for the order. + $settings = $this->settingsService->getSettings($salesChannelContext->getSalesChannel()->getId()); + $transactionEntity = $this->transactionService->getByOrderId($orderId, $salesChannelContext->getContext()); + + // Default to storefront URLs if no overrides are provided. + if ($cartRecreateUrl === null) { + $cartRecreateUrl = $this->router->generate( + 'frontend.vrpayment.checkout.recreate-cart', + ['orderId' => $orderId], + UrlGeneratorInterface::ABSOLUTE_URL + ); + } + + if ($checkoutUrl === null) { + $checkoutUrl = $this->router->generate( + 'frontend.checkout.confirm.page', + [], + UrlGeneratorInterface::ABSOLUTE_URL + ); + } + + return $this->getConfigForTransaction((int)$transactionEntity->getTransactionId(), $salesChannelContext) + ->setCartRecreateUrl($cartRecreateUrl) + ->setCheckoutUrl($checkoutUrl); + } + + /** + * Determines the JavaScript URL for the WhitelabelMachineName integration. + * + * @param mixed $settings The plugin settings. + * @param int $transactionId The transaction ID. + * @return string The absolute URL to the JavaScript component. + */ + private function getTransactionJavaScriptUrl($settings, int $transactionId): string + { + $javascriptUrl = ''; + switch ($settings->getIntegration()) { + case Integration::IFRAME: + $javascriptUrl = $settings->getApiClient()->getTransactionIframeService() + ->javascriptUrl($settings->getSpaceId(), $transactionId); + break; + case Integration::LIGHTBOX: + $javascriptUrl = $settings->getApiClient()->getTransactionLightboxService() + ->javascriptUrl($settings->getSpaceId(), $transactionId); + break; + } + return $javascriptUrl; + } + + /** + * Generates the device tracking JavaScript URL. + * + * @param int $spaceId The WhitelabelMachineName space ID. + * @return string The tracking URL. + */ + private function getDeviceJavascriptUrl(int $spaceId): string + { + return 'https://gateway.vr-payment.de/s/' . $spaceId . '/payment/device.js?session=' . Uuid::randomHex(); + } +} diff --git a/src/Core/Checkout/Service/PaymentMethodFilterService.php b/src/Core/Checkout/Service/PaymentMethodFilterService.php new file mode 100644 index 0000000..34d5585 --- /dev/null +++ b/src/Core/Checkout/Service/PaymentMethodFilterService.php @@ -0,0 +1,285 @@ +settingsService = $settingsService; + $this->transactionService = $transactionService; + $this->paymentMethodConfigurationService = $paymentMethodConfigurationService; + $this->paymentMethodUtil = $paymentMethodUtil; + $this->paymentMethodRepository = $paymentMethodRepository; + $this->transactionManagementService = $transactionManagementService; + $this->cartService = $cartService; + } + + /** + * @param LoggerInterface $logger + */ + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + } + + /** + * Filters the given collection of payment methods based on WhitelabelMachineName's availability logic. + * + * @param PaymentMethodCollection $paymentMethodCollection The initial collection of payment methods. + * @param SalesChannelContext $salesChannelContext The current sales channel context. + * @param mixed $event Optional event that triggered the filtering. + * @return PaymentMethodCollection The filtered collection of payment methods. + */ + public function filterPaymentMethods( + PaymentMethodCollection $paymentMethodCollection, + SalesChannelContext $salesChannelContext, + $event = null + ): PaymentMethodCollection { + // Fetch valid settings for the current sales channel. + $settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId()); + + // If settings are missing, remove all WhitelabelMachineName payment methods to prevent incorrect behavior. + if (is_null($settings)) { + return $this->removeVRPaymentPaymentMethods($paymentMethodCollection, $salesChannelContext); + } + + // If there is no customer, we cannot create a transaction or perform API-based filtering. + // This typically happens on non-checkout pages like the frontpage footer. + if ($salesChannelContext->getCustomer() === null) { + return $paymentMethodCollection; + } + + $source = $event; + if ($source === null) { + // In headless (Store API) flow, event is null. We explicitly fetch the cart to get line items. + $source = $this->cartService->getCart($salesChannelContext->getToken(), $salesChannelContext); + } + + // Ensure a pending transaction exists in WhitelabelMachineName for correct filtering, + // using the transaction management service for state consistency. + $createdTransactionId = $this->transactionManagementService->getOrCreatePendingTransaction($salesChannelContext, $source); + + // Update the temporary transaction if customer data has changed. + $this->transactionManagementService->updateTempTransactionIfNeeded($salesChannelContext, $createdTransactionId, $source); + + // Fetch available payment method IDs from WhitelabelMachineName API for this transaction. + $allowedIds = $this->fetchAvailablePaymentMethodIds($settings, $createdTransactionId, $salesChannelContext); + + // Return a new collection containing only allowed methods. + return $this->buildFilteredCollection($paymentMethodCollection, $allowedIds, $settings->getSpaceId(), $salesChannelContext); + } + + /** + * Removes all WhitelabelMachineName-related payment methods from the collection. + * + * @param PaymentMethodCollection $paymentMethodCollection The collection to clean. + * @param SalesChannelContext $salesChannelContext The context. + * @return PaymentMethodCollection The cleaned collection. + */ + private function removeVRPaymentPaymentMethods( + PaymentMethodCollection $paymentMethodCollection, + SalesChannelContext $salesChannelContext + ): PaymentMethodCollection { + $paymentMethodIds = $this->paymentMethodUtil->getVRPaymentPaymentMethodIds($salesChannelContext->getContext()); + foreach ($paymentMethodIds as $paymentMethodId) { + $paymentMethodCollection->remove($paymentMethodId); + } + return $paymentMethodCollection; + } + + /** + * Fetches the list of allowed payment method IDs from the WhitelabelMachineName API. + * + * @param mixed $settings The plugin settings. + * @param int $createdTransactionId The WhitelabelMachineName transaction ID. + * @param SalesChannelContext $salesChannelContext The context. + * @return string[] Array of allowed payment method configuration IDs. + */ + private function fetchAvailablePaymentMethodIds( + $settings, + int $createdTransactionId, + SalesChannelContext $salesChannelContext + ): array { + $transactionService = $settings->getApiClient()->getTransactionService(); + $possiblePaymentMethods = $transactionService->fetchPaymentMethods( + $settings->getSpaceId(), + $createdTransactionId, + $settings->getIntegration() + ); + + $arrayOfPossibleMethods = []; + foreach ($possiblePaymentMethods as $possiblePaymentMethod) { + $arrayOfPossibleMethods[] = (string) $possiblePaymentMethod->getId(); + } + + // Store the allowed IDs in context extension for later use. + $salesChannelContext->getContext()->addExtension( + 'possibleMethods', + new ArrayEntity(['ids' => $arrayOfPossibleMethods]) + ); + + return $arrayOfPossibleMethods; + } + + /** + * Builds a filtered PaymentMethodCollection based on allowed IDs. + * + * @param PaymentMethodCollection $paymentMethodCollection Original collection. + * @param string[] $allowedIds List of allowed configuration IDs. + * @param int $spaceId WhitelabelMachineName space ID. + * @param SalesChannelContext $salesChannelContext The context. + * @return PaymentMethodCollection The final collection. + */ + private function buildFilteredCollection( + PaymentMethodCollection $paymentMethodCollection, + array $allowedIds, + int $spaceId, + SalesChannelContext $salesChannelContext + ): PaymentMethodCollection { + $paymentIds = []; + // Extract non-WhitelabelMachineName payment methods first. + foreach ($paymentMethodCollection as $paymentMethodCollectionItem) { + $isVRPaymentPM = VRPaymentPaymentHandler::class === $paymentMethodCollectionItem->getHandlerIdentifier(); + if (!$isVRPaymentPM) { + $paymentIds[] = $paymentMethodCollectionItem->getId(); + } + } + + $allowedWLMethods = []; + // Fetch all WhitelabelMachineName payment method configurations for the space. + $paymentMethodConfigurations = $this->paymentMethodConfigurationService + ->getAllPaymentMethodConfigurations($spaceId, $salesChannelContext->getContext()); + + // Check each configuration against the list of allowed IDs from WhitelabelMachineName API. + foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) { + if ($paymentMethodConfiguration->getPaymentMethod() === null) { + continue; + } + + $pmId = $paymentMethodConfiguration->getPaymentMethod()->getId(); + $pmConfigId = (string) $paymentMethodConfiguration->getPaymentMethodConfigurationId(); + + if ( + $paymentMethodConfiguration->getSpaceId() === $spaceId + && \in_array($pmConfigId, $allowedIds, true) + ) { + $allowedWLMethods[] = $pmId; + } + } + + // Combine non-WhitelabelMachineName and allowed WhitelabelMachineName payment methods. + $allPaymentIds = array_unique(array_merge($paymentIds, $allowedWLMethods)); + $collection = new PaymentMethodCollection(); + + if (!empty($allPaymentIds)) { + $criteria = new Criteria($allPaymentIds); + $criteria->addFilter(new EqualsFilter('active', true)); + $criteria->addFilter( + new EqualsFilter('salesChannels.id', $salesChannelContext->getSalesChannelId()) + ); + $criteria->addSorting(new FieldSorting('position', FieldSorting::ASCENDING)); + + // Re-fetch the entities to ensure we have valid objects with all associations. + $result = $this->paymentMethodRepository->search($criteria, $salesChannelContext->getContext()); + /** @var \Shopware\Core\Checkout\Payment\PaymentMethodEntity $method */ + foreach ($result->getEntities() as $method) { + if (!$collection->has((string)$method->getId())) { + // Attach the configuration to the payment method as an extension for Twig access. + foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) { + if ($paymentMethodConfiguration->getPaymentMethodId() === $method->getId()) { + $method->addExtension('vrpayment_config', $paymentMethodConfiguration); + break; + } + } + $collection->add($method); + } + } + } + + return $collection; + } +} diff --git a/src/Core/Checkout/Service/TransactionManagementService.php b/src/Core/Checkout/Service/TransactionManagementService.php new file mode 100644 index 0000000..a2bad81 --- /dev/null +++ b/src/Core/Checkout/Service/TransactionManagementService.php @@ -0,0 +1,207 @@ +transactionService = $transactionService; + $this->settingsService = $settingsService; + $this->cache = $cache; + } + + /** + * Retrieves an existing pending transaction ID from the context or creates a new one if necessary. + * + * @param SalesChannelContext $salesChannelContext The current sales channel context. + * @param mixed $event Optional event context. + * @return int The WhitelabelMachineName transaction ID. + * @throws \Exception If settings are not configured. + */ + public function getOrCreatePendingTransaction(SalesChannelContext $salesChannelContext, $event = null): int + { + // Try to get the transaction ID from the current context state. + $transactionId = $this->getTransactionIdFromContext($salesChannelContext); + $settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId()); + + if (!$settings) { + throw new \Exception('Space settings not configured'); + } + + $expiredTransaction = true; + if ($transactionId) { + try { + // Verify if the transaction still exists and is in a PENDING state. + $pendingTransaction = $this->transactionService->read($transactionId, (string)$salesChannelContext->getSalesChannel()->getId()); + if ($pendingTransaction->getState() === TransactionState::PENDING) { + $expiredTransaction = false; + } + } catch (\Exception $e) { + // If the transaction cannot be read, we treat it as expired or invalid. + } + } + + // Create a new transaction if none exists or the existing one is no longer valid. + if (!$transactionId || $expiredTransaction) { + $transactionId = (int)$this->transactionService->createPendingTransaction($salesChannelContext, $event); + $this->storeTransactionIdInContext($salesChannelContext, $transactionId); + } + + return $transactionId; + } + + /** + * Updates the WhitelabelMachineName transaction if the customer context (address or currency) or line items have changed. + * + * @param SalesChannelContext $salesChannelContext The current context. + * @param int $transactionId The WhitelabelMachineName transaction ID to update. + * @param mixed $event The event that triggered this update (optional). + */ + public function updateTempTransactionIfNeeded(SalesChannelContext $salesChannelContext, int $transactionId, $event = null): void + { + $ctx = $salesChannelContext->getContext(); + + /** @var ArrayEntity|null $ext */ + $ext = $ctx->getExtension('checkoutState'); + + $oldAddressHash = $ext instanceof ArrayEntity ? (string)$ext->get('addressHash') : null; + $oldCurrency = $ext instanceof ArrayEntity ? (string)$ext->get('currency') : null; + $oldLineItemHash = $ext instanceof ArrayEntity ? (string)$ext->get('lineItemHash') : null; + + $customer = $salesChannelContext->getCustomer(); + $addressHash = $customer ? md5(json_encode((array) $customer)) : null; + $currency = (string)$salesChannelContext->getCurrency()->getIsoCode(); + + $lineItems = $this->transactionService->extractLineItems($event); + $lineItemHash = !empty($lineItems) ? md5(json_encode($lineItems)) : $oldLineItemHash; + + $needsUpdate = ($oldAddressHash !== $addressHash) + || ($oldCurrency !== $currency) + || ($oldLineItemHash !== $lineItemHash); + + if ($needsUpdate) { + // Update the transaction in WhitelabelMachineName to reflect current cart and customer data. + if ($transactionId) { + $this->transactionService->updateTempTransaction($salesChannelContext, $transactionId, $lineItems); + } + + // Clear payment method cache as options might have changed due to address/currency change. + $ctx->addExtension('possibleMethods', new ArrayEntity(['ids' => []])); + + // Persist the new state hash in the context. + $ctx->addExtension( + 'checkoutState', + new ArrayEntity([ + 'transactionId' => $transactionId, + 'addressHash' => $addressHash, + 'currency' => $currency, + 'lineItemHash' => $lineItemHash, + ]) + ); + } + } + + /** + * Retrieves the stored WhitelabelMachineName transaction ID from the context, cache, or session. + * + * @param SalesChannelContext $salesChannelContext The context. + * @return int|null The transaction ID if found, otherwise null. + */ + public function getTransactionIdFromContext(SalesChannelContext $salesChannelContext): ?int + { + /** @var ArrayEntity|null $ext */ + $ext = $salesChannelContext->getContext()->getExtension('checkoutState'); + if ($ext instanceof ArrayEntity && $ext->get('transactionId')) { + return (int) $ext->get('transactionId'); + } + + // Try to get from cache (headless support). + $customer = $salesChannelContext->getCustomer(); + if ($customer) { + $cacheKey = 'vrpn_pending_transaction_id_customer_' . $customer->getId(); + $item = $this->cache->getItem($cacheKey); + if ($item->isHit()) { + return (int) $item->get(); + } + } + + // Fallback to PHP session for traditional Storefront compatibility. + if (isset($_SESSION['transactionId'])) { + return (int) $_SESSION['transactionId']; + } + + return null; + } + + /** + * Persists the transaction ID in the context state, cache, and session. + * + * @param SalesChannelContext $salesChannelContext The context. + * @param int $transactionId The transaction ID to store. + */ + private function storeTransactionIdInContext(SalesChannelContext $salesChannelContext, int $transactionId): void + { + $ctx = $salesChannelContext->getContext(); + /** @var ArrayEntity|null $ext */ + $ext = $ctx->getExtension('checkoutState'); + + $data = $ext instanceof ArrayEntity ? $ext->all() : []; + $data['transactionId'] = $transactionId; + + // Store in context extension for stateless (headless) support within the request. + $ctx->addExtension('checkoutState', new ArrayEntity($data)); + + // Store in cache for persistent headless support. + $customer = $salesChannelContext->getCustomer(); + if ($customer) { + $cacheKey = 'vrpn_pending_transaction_id_customer_' . $customer->getId(); + $item = $this->cache->getItem($cacheKey); + $item->set($transactionId); + $item->expiresAfter(7200); + $this->cache->save($item); + } + + // Sync with PHP session for stateful Storefront support. + $_SESSION['transactionId'] = $transactionId; + } +} diff --git a/src/Core/Checkout/StoreApi/Route/CartRecoveryRoute.php b/src/Core/Checkout/StoreApi/Route/CartRecoveryRoute.php new file mode 100644 index 0000000..98f3039 --- /dev/null +++ b/src/Core/Checkout/StoreApi/Route/CartRecoveryRoute.php @@ -0,0 +1,70 @@ + ['store-api']])] +/** + * This Store API route allows headless clients to recreate a cart from an existing order. + * This is particularly useful for 'Try Again' scenarios if a payment fails. + */ +class CartRecoveryRoute +{ + /** + * @var CartRecoveryService + * Service to handle the logic of reconstructing a cart from order items. + */ + private CartRecoveryService $cartRecoveryService; + + /** + * @param CartRecoveryService $cartRecoveryService + */ + public function __construct(CartRecoveryService $cartRecoveryService) + { + $this->cartRecoveryService = $cartRecoveryService; + } + + /** + * Recreates a cart based on the provided order ID. + * + * @param string $orderId The ID of the order to recover the cart from. + * @param Request $request The incoming request. + * @param SalesChannelContext $context The current sales channel context. + * @return JsonResponse A JSON response containing either the new cart data or an error message. + */ + #[Route( + path: '/store-api/vrpayment/checkout/recreate-cart/{orderId}', + name: 'store-api.vrpayment.checkout.recreate-cart', + methods: ['POST'] + )] + public function recreate(string $orderId, Request $request, SalesChannelContext $context): JsonResponse + { + try { + // Fetch the order entity. + $order = $this->cartRecoveryService->getOrderEntity($orderId, $context->getContext()); + + // Security check: ensure the order belongs to the current sales channel. + if ($order->getSalesChannelId() !== $context->getSalesChannelId()) { + return new JsonResponse(['error' => 'Sales channel mismatch'], 403); + } + + // Perform the cart reconstruction. + $cart = $this->cartRecoveryService->recreateCartFromOrder($order, $context); + + // Return the reconstructed cart data. + return new JsonResponse($cart); + } catch (\Exception $e) { + // Handle any exceptions during the process. + return new JsonResponse(['error' => $e->getMessage()], 400); + } + } +} diff --git a/src/Core/Checkout/StoreApi/Route/InvoiceRoute.php b/src/Core/Checkout/StoreApi/Route/InvoiceRoute.php new file mode 100644 index 0000000..802c872 --- /dev/null +++ b/src/Core/Checkout/StoreApi/Route/InvoiceRoute.php @@ -0,0 +1,65 @@ + ['store-api']])] +/** + * This Store API route provides access to invoice documents for headless clients. + */ +class InvoiceRoute +{ + /** + * @var InvoiceService + * Service to handle the retrieval of invoice documents from WhitelabelMachineName. + */ + private InvoiceService $invoiceService; + + /** + * @param InvoiceService $invoiceService + */ + public function __construct(InvoiceService $invoiceService) + { + $this->invoiceService = $invoiceService; + } + + /** + * Fetches the invoice document metadata and content for a given order. + * + * @param string $orderId The ID of the order. + * @param Request $request The incoming request. + * @param SalesChannelContext $context The current sales channel context. + * @return JsonResponse A JSON response containing the invoice title, MIME type, and base64-encoded data. + */ + #[Route( + path: '/store-api/vrpayment/account/order/invoice/{orderId}', + name: 'store-api.vrpayment.account.order.invoice', + methods: ['GET'] + )] + public function load(string $orderId, Request $request, SalesChannelContext $context): JsonResponse + { + try { + // Retrieve the invoice document via the dedicated service. + $invoice = $this->invoiceService->getInvoiceDocument($orderId, $context); + + // Structure the response for headless consumption. + return new JsonResponse([ + 'title' => (string)$invoice->getTitle(), + 'mimeType' => (string)$invoice->getMimeType(), + 'data' => (string)$invoice->getData(), // Base64 encoded + ]); + } catch (\Exception $e) { + // Handle errors (e.g., order not found or API failure). + return new JsonResponse(['error' => $e->getMessage()], 400); + } + } +} diff --git a/src/Core/Checkout/StoreApi/Route/WhitelabelMachineNameTransactionInfoRoute.php b/src/Core/Checkout/StoreApi/Route/WhitelabelMachineNameTransactionInfoRoute.php new file mode 100644 index 0000000..b52c75c --- /dev/null +++ b/src/Core/Checkout/StoreApi/Route/WhitelabelMachineNameTransactionInfoRoute.php @@ -0,0 +1,63 @@ + ['store-api']])] +class WhitelabelMachineNameTransactionInfoRoute +{ + /** + * @var PaymentIntegrationService + * The service responsible for generating the unified payment configuration. + */ + private PaymentIntegrationService $paymentIntegrationService; + + /** + * @param PaymentIntegrationService $paymentIntegrationService + */ + public function __construct(PaymentIntegrationService $paymentIntegrationService) + { + $this->paymentIntegrationService = $paymentIntegrationService; + } + + /** + * Loads the payment configuration for a specific order. + * + * @param string $orderId The Shopware order ID. + * @param Request $request The incoming request object. + * @param SalesChannelContext $context The current sales channel context. + * @return JsonResponse JSON response containing the PaymentConfigStruct data. + */ + #[Route( + path: '/store-api/vrpayment/transaction/info/{orderId}', + name: 'store-api.vrpayment.transaction.info', + methods: ['GET'] + )] + public function load(string $orderId, Request $request, SalesChannelContext $context): JsonResponse + { + try { + // Retrieve the payment configuration using the common service. + // This ensures logic parity between Storefront and Store API. + $config = $this->paymentIntegrationService->getPaymentConfig($orderId, $context); + + // Return the configuration as a JSON response for the headless client. + return new JsonResponse($config); + } catch (\Exception $e) { + // In case of error, return a 400 response with the error message. + return new JsonResponse(['error' => $e->getMessage()], 400); + } + } +} diff --git a/src/Core/Checkout/Struct/PaymentConfigStruct.php b/src/Core/Checkout/Struct/PaymentConfigStruct.php new file mode 100644 index 0000000..16fb177 --- /dev/null +++ b/src/Core/Checkout/Struct/PaymentConfigStruct.php @@ -0,0 +1,205 @@ +integration; + } + + /** + * @param string $integration + * @return self + */ + public function setIntegration(string $integration): self + { + $this->integration = $integration; + return $this; + } + + /** + * @return string + */ + public function getJavascriptUrl(): string + { + return $this->javascriptUrl; + } + + /** + * @param string $javascriptUrl + * @return self + */ + public function setJavascriptUrl(string $javascriptUrl): self + { + $this->javascriptUrl = $javascriptUrl; + return $this; + } + + /** + * @return string + */ + public function getDeviceJavascriptUrl(): string + { + return $this->deviceJavascriptUrl; + } + + /** + * @param string $deviceJavascriptUrl + * @return self + */ + public function setDeviceJavascriptUrl(string $deviceJavascriptUrl): self + { + $this->deviceJavascriptUrl = $deviceJavascriptUrl; + return $this; + } + + /** + * @return array + */ + public function getTransactionPossiblePaymentMethods(): array + { + return $this->transactionPossiblePaymentMethods; + } + + /** + * @param array $transactionPossiblePaymentMethods + * @return self + */ + public function setTransactionPossiblePaymentMethods(array $transactionPossiblePaymentMethods): self + { + $this->transactionPossiblePaymentMethods = $transactionPossiblePaymentMethods; + return $this; + } + + /** + * @return int + */ + public function getTransactionId(): int + { + return $this->transactionId; + } + + /** + * @param int $transactionId + * @return self + */ + public function setTransactionId(int $transactionId): self + { + $this->transactionId = $transactionId; + return $this; + } + + /** + * @return int + */ + public function getSpaceId(): int + { + return $this->spaceId; + } + + /** + * @param int $spaceId + * @return self + */ + public function setSpaceId(int $spaceId): self + { + $this->spaceId = $spaceId; + return $this; + } + + /** + * @return string|null + */ + public function getCartRecreateUrl(): ?string + { + return $this->cartRecreateUrl; + } + + /** + * @param string|null $cartRecreateUrl + * @return self + */ + public function setCartRecreateUrl(?string $cartRecreateUrl): self + { + $this->cartRecreateUrl = $cartRecreateUrl; + return $this; + } + + /** + * @return string|null + */ + public function getCheckoutUrl(): ?string + { + return $this->checkoutUrl; + } + + /** + * @param string|null $checkoutUrl + * @return self + */ + public function setCheckoutUrl(?string $checkoutUrl): self + { + $this->checkoutUrl = $checkoutUrl; + return $this; + } +} diff --git a/src/Core/Storefront/Account/Controller/AccountOrderController.php b/src/Core/Storefront/Account/Controller/AccountOrderController.php index 0978148..d280746 100644 --- a/src/Core/Storefront/Account/Controller/AccountOrderController.php +++ b/src/Core/Storefront/Account/Controller/AccountOrderController.php @@ -1,4 +1,6 @@ - ['storefront']])] +/** + * This controller handles account-related actions for orders, specifically + * allowing customers to download their invoice documents. + */ class AccountOrderController extends StorefrontController { - /** - * @var \VRPaymentPayment\Core\Settings\Service\SettingsService - */ - protected $settingsService; - - /** - * @var \Psr\Log\LoggerInterface - */ - protected $logger; - - /** - * @var \VRPaymentPayment\Core\Api\Transaction\Service\TransactionService - */ - protected $transactionService; - - /** - * @var RequestStack - */ - protected $requestStack; - - /** - * AccountOrderController constructor. - * @param \VRPaymentPayment\Core\Settings\Service\SettingsService $settingsService - * @param \VRPaymentPayment\Core\Api\Transaction\Service\TransactionService $transactionService - * @param RequestStack $requestStack - */ - public function __construct(SettingsService $settingsService, TransactionService $transactionService, RequestStack $requestStack) - { - $this->settingsService = $settingsService; - $this->transactionService = $transactionService; - $this->requestStack = $requestStack; + /** + * @var LoggerInterface + */ + protected LoggerInterface $logger; + + /** + * @var TransactionService + * Local transaction service for order data retrieval. + */ + protected TransactionService $transactionService; + + /** + * @var RequestStack + * Symfony service to access the current request context. + */ + protected RequestStack $requestStack; + + /** + * @var InvoiceService + * Service to fetch invoice documents from WhitelabelMachineName. + */ + private InvoiceService $invoiceService; + + /** + * @param TransactionService $transactionService + * @param RequestStack $requestStack + * @param InvoiceService $invoiceService + */ + public function __construct( + TransactionService $transactionService, + RequestStack $requestStack, + InvoiceService $invoiceService + ) { + $this->transactionService = $transactionService; + $this->requestStack = $requestStack; + $this->invoiceService = $invoiceService; + } + + /** + * @param LoggerInterface $logger + */ + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + } + + /** + * Downloads an invoice document for a specific order. + * + * @param string $orderId The ID of the order. + * @param SalesChannelContext $salesChannelContext The context. + * @return Response The PDF document as a download response. + */ + #[Route( + path: "/vrpayment/account/order/download/invoice/document/{orderId}", + name: "frontend.vrpayment.account.order.download.invoice.document", + methods: ['GET'] + )] + public function downloadInvoiceDocument(string $orderId, SalesChannelContext $salesChannelContext): Response + { + try { + // Ensure the user is logged in. + $customer = $this->getLoggedInCustomer(); + + // Fetch the transaction entity to verify ownership. + $transactionEntity = $this->transactionService->getByOrderId($orderId, $salesChannelContext->getContext()); + + // Security check: ensure the document belongs to the logged-in customer. + if (strcasecmp((string)$customer->getCustomerNumber(), (string)$transactionEntity->getData()['customerId']) != 0) { + throw new AccessDeniedException(); + } + + // Retrieve the invoice document metadata and content. + /** @var object $invoiceDocument */ + $invoiceDocument = $this->invoiceService->getInvoiceDocument($orderId, $salesChannelContext); + + // Sanitize the filename for the download. + $filename = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '_', (string)$invoiceDocument->getTitle()) . '.pdf'; + $disposition = HeaderUtils::makeDisposition( + HeaderUtils::DISPOSITION_ATTACHMENT, + $filename, + $filename + ); + + // Create the response with the PDF content (base64 decoded). + $response = new Response(base64_decode((string)$invoiceDocument->getData())); + $response->headers->set('Content-Type', (string)$invoiceDocument->getMimeType()); + $response->headers->set('Content-Disposition', $disposition); + + return $response; + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + return $this->redirectToRoute('frontend.home.page'); } - - /** - * @param \Psr\Log\LoggerInterface $logger - * @internal - * @required - * - */ - public function setLogger(LoggerInterface $logger): void - { - $this->logger = $logger; + } + + /** + * Helper to retrieve the currently logged-in customer. + * + * @return CustomerEntity + * @throws CustomerNotLoggedInException + */ + protected function getLoggedInCustomer(): CustomerEntity + { + $request = $this->requestStack->getCurrentRequest(); + + if (!$request) { + throw new CustomerNotLoggedInException(); } - /** - * Download invoice document - * - * @param string $orderId - * @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext - * @return \Symfony\Component\HttpFoundation\Response - * - * @throws \VRPayment\Sdk\ApiException - * @throws \VRPayment\Sdk\Http\ConnectionException - * @throws \VRPayment\Sdk\VersioningException - */ - #[Route("/vrpayment/account/order/download/invoice/document/{orderId}", - name: "frontend.vrpayment.account.order.download.invoice.document", - methods: ['GET'])] - public function downloadInvoiceDocument(string $orderId, SalesChannelContext $salesChannelContext): Response - { - $customer = $this->getLoggedInCustomer(); - $settings = $this->settingsService->getSettings($salesChannelContext->getSalesChannel()->getId()); - $transactionEntity = $this->transactionService->getByOrderId($orderId, $salesChannelContext->getContext()); - if (strcasecmp($customer->getCustomerNumber(), $transactionEntity->getData()['customerId']) != 0) { - throw new AccessDeniedException(); - } - $invoiceDocument = $settings->getApiClient()->getTransactionService()->getInvoiceDocument($settings->getSpaceId(), $transactionEntity->getTransactionId()); - $forceDownload = true; - $filename = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '_', $invoiceDocument->getTitle()) . '.pdf'; - $disposition = HeaderUtils::makeDisposition( - $forceDownload ? HeaderUtils::DISPOSITION_ATTACHMENT : HeaderUtils::DISPOSITION_INLINE, - $filename, - $filename - ); - $response = new Response(base64_decode($invoiceDocument->getData())); - $response->headers->set('Content-Type', $invoiceDocument->getMimeType()); - $response->headers->set('Content-Disposition', $disposition); - - return $response; - } - - /** - * @return CustomerEntity - */ - protected function getLoggedInCustomer(): CustomerEntity - { - $request = $this->requestStack->getCurrentRequest(); - - if (!$request) { - throw new CustomerNotLoggedInException(); - } - - $context = $request->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT); - - if ($context && $context->getCustomer() && $context->getCustomer()->getGuest() === false) { - return $context->getCustomer(); - } - - throw new CustomerNotLoggedInException(); + /** @var SalesChannelContext|null $context */ + $context = $request->attributes->get(PlatformRequest::ATTRIBUTE_SALES_CHANNEL_CONTEXT_OBJECT); + + if ($context && $context->getCustomer() && $context->getCustomer()->getGuest() === false) { + return $context->getCustomer(); } + + throw new CustomerNotLoggedInException(); + } } diff --git a/src/Core/Storefront/Checkout/Controller/CheckoutController.php b/src/Core/Storefront/Checkout/Controller/CheckoutController.php index e356c04..366e0da 100644 --- a/src/Core/Storefront/Checkout/Controller/CheckoutController.php +++ b/src/Core/Storefront/Checkout/Controller/CheckoutController.php @@ -1,568 +1,234 @@ - ['storefront']])] -class CheckoutController extends StorefrontController { +/** + * This controller handles Storefront-specific actions for the WhitelabelMachineName integration, + * such as rendering the payment page and recreating a cart from a failed order. + */ +class CheckoutController extends StorefrontController +{ + /** + * @var GenericPageLoaderInterface + * Loader for basic Shopware page data. + */ + protected GenericPageLoaderInterface $genericLoader; - /** - * @var \Shopware\Storefront\Page\GenericPageLoader - */ - protected $genericLoader; + /** + * @var SettingsService + * Plugin settings service. + */ + protected SettingsService $settingsService; - /** - * @var \Shopware\Core\Checkout\Cart\SalesChannel\CartService - */ - protected $cartService; + /** + * @var LoggerInterface|null + * Logger for recording errors and important information. + */ + private ?LoggerInterface $logger = null; - /** - * @var \VRPaymentPayment\Core\Settings\Service\SettingsService - */ - protected $settingsService; + /** + * @var AbstractOrderRoute + * Shopware service for order retrieval. + */ + private AbstractOrderRoute $orderRoute; - /** - * @var \VRPaymentPayment\Core\Settings\Struct\Settings - */ - protected $settings; + /** + * @var CartRecoveryService + * Service to help customers recover their cart from a past order. + */ + private CartRecoveryService $cartRecoveryService; - /** - * @var \VRPaymentPayment\Core\Api\Transaction\Service\TransactionService - */ - protected $transactionService; + /** + * @var PaymentIntegrationService + * Service to provide the integration parameters (JS URL, transaction ID, etc.). + */ + private PaymentIntegrationService $paymentIntegrationService; - /** - * @var \Psr\Log\LoggerInterface - */ - private $logger; + /** + * @var TransactionService + * Service to check transaction details. + */ + private TransactionService $transactionService; - /** - * @var \Shopware\Core\Checkout\Cart\LineItemFactoryRegistry - */ - private $lineItemFactoryRegistry; + /** + * @param SettingsService $settingsService + * @param GenericPageLoaderInterface $genericLoader + * @param AbstractOrderRoute $orderRoute + * @param CartRecoveryService $cartRecoveryService + * @param PaymentIntegrationService $paymentIntegrationService + */ + public function __construct( + SettingsService $settingsService, + GenericPageLoaderInterface $genericLoader, + AbstractOrderRoute $orderRoute, + CartRecoveryService $cartRecoveryService, + PaymentIntegrationService $paymentIntegrationService, + TransactionService $transactionService + ) { + $this->genericLoader = $genericLoader; + $this->settingsService = $settingsService; + $this->orderRoute = $orderRoute; + $this->cartRecoveryService = $cartRecoveryService; + $this->paymentIntegrationService = $paymentIntegrationService; + $this->transactionService = $transactionService; + } - /** - * @var \Shopware\Core\Checkout\Order\SalesChannel\AbstractOrderRoute - */ - private $orderRoute; + /** + * @param LoggerInterface $logger + */ + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + } - /** - * PaymentController constructor. - * - * @param \Shopware\Core\Checkout\Cart\LineItemFactoryRegistry $lineItemFactoryRegistry - * @param \Shopware\Core\Checkout\Cart\SalesChannel\CartService $cartService - * @param \VRPaymentPayment\Core\Settings\Service\SettingsService $settingsService - * @param \VRPaymentPayment\Core\Api\Transaction\Service\TransactionService $transactionService - * @param \Shopware\Storefront\Page\GenericPageLoaderInterface $genericLoader - * @param \Shopware\Core\Checkout\Order\SalesChannel\AbstractOrderRoute $orderRoute - */ - public function __construct( - LineItemFactoryRegistry $lineItemFactoryRegistry, - CartService $cartService, - SettingsService $settingsService, - TransactionService $transactionService, - GenericPageLoaderInterface $genericLoader, - AbstractOrderRoute $orderRoute - ) - { - $this->cartService = $cartService; - $this->genericLoader = $genericLoader; - $this->settingsService = $settingsService; - $this->transactionService = $transactionService; - $this->lineItemFactoryRegistry = $lineItemFactoryRegistry; - $this->orderRoute = $orderRoute; - } - - /** - * @param \Psr\Log\LoggerInterface $logger - * - * @internal - * @required - * - */ - public function setLogger(LoggerInterface $logger): void - { - $this->logger = $logger; - } - - /** - * @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\Response - * @throws \VRPayment\Sdk\ApiException - * @throws \VRPayment\Sdk\Http\ConnectionException - * @throws \VRPayment\Sdk\VersioningException - * - */ + /** + * Renders the WhitelabelMachineName payment page (usually contains the iframe or lightbox script). + * + * @param SalesChannelContext $salesChannelContext The current context. + * @param Request $request The incoming request. + * @return Response The rendered payment page. + */ #[Route( path: "/vrpayment/checkout/pay", name: "frontend.vrpayment.checkout.pay", options: ["seo" => false], methods: ["GET"], )] - public function pay(SalesChannelContext $salesChannelContext, Request $request): Response - { - $orderId = $request->query->get('orderId'); + public function pay(SalesChannelContext $salesChannelContext, Request $request): Response + { + $orderId = (string)$request->query->get('orderId'); - if (empty($orderId)) { - throw new MissingRequestParameterException('orderId'); - } + if (empty($orderId)) { + throw RoutingException::missingRequestParameter('orderId'); + } - // Configuration - $this->settings = $this->settingsService->getSettings($salesChannelContext->getSalesChannel()->getId()); + try { + // Load the order with necessary associations for the product table and addresses. + $criteria = new Criteria([$orderId]); + $criteria->addAssociation('lineItems.product') + ->addAssociation('deliveries.shippingOrderAddress.country') + ->addAssociation('orderCustomer.customer') + ->addAssociation('transactions.paymentMethod'); - $transaction = $this->getTransaction($orderId, $salesChannelContext->getContext()); - $recreateCartUrl = $this->generateUrl( - 'frontend.vrpayment.checkout.recreate-cart', - ['orderId' => $orderId,], - UrlGeneratorInterface::ABSOLUTE_URL - ); + $order = $this->orderRoute->load(new Request(), $salesChannelContext, $criteria)->getOrders()->first(); - if (in_array( - $transaction->getState(), - [ - TransactionState::AUTHORIZED, - TransactionState::COMPLETED, - TransactionState::FULFILL, - ] - )) { - return $this->redirect($transaction->getSuccessUrl(), Response::HTTP_MOVED_PERMANENTLY); - } else { - if (in_array( - $transaction->getState(), - [ - TransactionState::DECLINE, - TransactionState::FAILED, - TransactionState::VOIDED, - ] - )) { - return $this->redirect($transaction->getFailedUrl(), Response::HTTP_MOVED_PERMANENTLY); - } - } + if (!$order) { + throw RoutingException::missingRequestParameter('orderId'); + } - $possiblePaymentMethods = $this->settings->getApiClient() - ->getTransactionService() - ->fetchPaymentMethods( - $this->settings->getSpaceId(), - $transaction->getId(), - $this->settings->getIntegration() - ); + // Fetch the configuration required for the frontend integration. + $paymentConfig = $this->paymentIntegrationService->getPaymentConfig($orderId, $salesChannelContext); - if (empty($possiblePaymentMethods)) { - $this->addFlash('danger', $this->trans('vrpayment.paymentMethod.notAvailable')); - return $this->redirect($recreateCartUrl, Response::HTTP_MOVED_PERMANENTLY); - } + // Load a generic Shopware page to have layout headers/footers. + $page = $this->genericLoader->load($request, $salesChannelContext); + $page->addExtension('vRPaymentData', $paymentConfig); - $javascriptUrl = $this->getTransactionJavaScriptUrl($transaction->getId()); + // Assign the order to the page so the templates can access page.order. + $page->assign(['order' => $order]); - // Set Checkout Page Data - $checkoutPageData = (new CheckoutPageData()) - ->setIntegration($this->settings->getIntegration()) - ->setJavascriptUrl($javascriptUrl) - ->setDeviceJavascriptUrl($this->settings->getSpaceId(), Uuid::randomHex()) - ->setTransactionPossiblePaymentMethods($possiblePaymentMethods) - ->setCheckoutUrl($this->generateUrl( - 'frontend.vrpayment.checkout.pay', - ['orderId' => $orderId,], - UrlGeneratorInterface::ABSOLUTE_URL - )) - ->setCartRecreateUrl($recreateCartUrl); - $page = $this->load($request, $salesChannelContext); - $page->addExtension('vRPaymentData', $checkoutPageData); + // Render the specialized Twig template for WhitelabelMachineName. + return $this->renderStorefront( + '@VRPaymentPayment/storefront/page/checkout/order/vrpayment.html.twig', + ['page' => $page] + ); + } catch (\Exception $e) { + if ($this->logger) { + $this->logger->error($e->getMessage()); + } + $this->addFlash('danger', $this->trans('vrpayment.paymentMethod.notAvailable')); + return $this->redirectToRoute('frontend.home.page'); + } + } - return $this->renderStorefront( - '@VRPaymentPayment/storefront/page/checkout/order/vrpayment.html.twig', - ['page' => $page] - ); - } - - /** - * Get transaction Javascript URL - * - * @param int $transactionId - * - * @return string - * @throws \VRPayment\Sdk\ApiException - * @throws \VRPayment\Sdk\Http\ConnectionException - * @throws \VRPayment\Sdk\VersioningException - */ - private function getTransactionJavaScriptUrl(int $transactionId): string - { - $javascriptUrl = ''; - switch ($this->settings->getIntegration()) { - case Integration::IFRAME: - $javascriptUrl = $this->settings->getApiClient()->getTransactionIframeService() - ->javascriptUrl($this->settings->getSpaceId(), $transactionId); - break; - case Integration::LIGHTBOX: - $javascriptUrl = $this->settings->getApiClient()->getTransactionLightboxService() - ->javascriptUrl($this->settings->getSpaceId(), $transactionId); - break; - default: - $this->logger->critical(strtr('invalid integration : :integration', [':integration' => $this->settings->getIntegration()])); - - } - return $javascriptUrl; - } - - /** - * @param $orderId - * @param \Shopware\Core\Framework\Context $context - * - * @return \VRPayment\Sdk\Model\Transaction - * @throws \VRPayment\Sdk\ApiException - * @throws \VRPayment\Sdk\Http\ConnectionException - * @throws \VRPayment\Sdk\VersioningException - */ - private function getTransaction($orderId, Context $context): Transaction - { - $transactionEntity = $this->transactionService->getByOrderId($orderId, $context); - return $this->settings->getApiClient()->getTransactionService()->read($this->settings->getSpaceId(), $transactionEntity->getTransactionId()); - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext - * - * @return \Shopware\Storefront\Page\Checkout\Finish\CheckoutFinishPage - */ - protected function load(Request $request, SalesChannelContext $salesChannelContext): CheckoutFinishPage - { - $page = CheckoutFinishPage::createFrom($this->genericLoader->load($request, $salesChannelContext)); - $page->setOrder($this->getOrder($request, $salesChannelContext)); - - return $page; - } - - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext - * - * @return \Shopware\Core\Checkout\Order\OrderEntity - */ - private function getOrder(Request $request, SalesChannelContext $salesChannelContext): OrderEntity - { - - $orderId = $request->get('orderId'); - if (!$orderId) { - throw new MissingRequestParameterException('orderId', '/orderId'); - } - - $criteria = (new Criteria([$orderId])) - ->addAssociation('lineItems.cover') - ->addAssociation('transactions.paymentMethod') - ->addAssociation('deliveries.shippingMethod'); - - $customer = $salesChannelContext->getCustomer(); - if ($customer !== null) { - $criteria = $criteria->addFilter(new EqualsFilter('order.orderCustomer.customerId', $customer->getId())); - } - - $criteria->getAssociation('transactions')->addSorting(new FieldSorting('createdAt')); - - try { - $searchResult = $this->orderRoute - ->load(new Request(), $salesChannelContext, $criteria) - ->getOrders(); - } catch (InvalidUuidException $e) { - throw CartException::orderNotFound($orderId); - } - - /** @var OrderEntity|null $order */ - $order = $searchResult->get($orderId); - - if (!$order) { - throw CartException::orderNotFound($orderId); - } - - return $order; - } - - /** - * Recreate Cart - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Shopware\Core\System\SalesChannel\SalesChannelContext $salesChannelContext - * - * @return \Symfony\Component\HttpFoundation\Response - * - */ + /** + * Redirects the user to a route that recreates their cart from an existing order. + * This is useful for allowing users to try payment again with different details. + * + * @param Request $request The incoming request. + * @param SalesChannelContext $salesChannelContext The context. + * @return Response Redirect to the checkout confirmation page. + */ #[Route( path: "/vrpayment/checkout/recreate-cart", name: "frontend.vrpayment.checkout.recreate-cart", options: ["seo" => false], methods: ["GET"], )] - public function recreateCart(Request $request, SalesChannelContext $salesChannelContext) - { - $orderId = $request->query->get('orderId'); + public function recreateCart(Request $request, SalesChannelContext $salesChannelContext): Response + { + $orderId = (string)$request->query->get('orderId'); - if (empty($orderId)) { - throw new MissingRequestParameterException('orderId'); - } + if (empty($orderId)) { + throw RoutingException::missingRequestParameter('orderId'); + } - // Adoption for Headless Storefronts - $orderRepo = $this->container->get('order.repository'); - $criteria = new Criteria([$orderId]); + try { + // Find the order that should be recovered. + $order = $this->cartRecoveryService->getOrderEntity($orderId, $salesChannelContext->getContext()); - $orderEntity = $orderRepo->search($criteria, $salesChannelContext->getContext())->first(); + // Security: Order must belong to the active sales channel. + if ($order->getSalesChannelId() !== $salesChannelContext->getSalesChannelId()) { + return $this->redirectToRoute('frontend.home.page'); + } - if($orderEntity->getSalesChannelId() !== $salesChannelContext->getSalesChannelId()) { - $this->settings = $this->settingsService->getSettings($orderEntity->getSalesChannelId()); - $trans = $this->getTransaction($orderId, $salesChannelContext->getContext()); - return $this->redirect($trans->getSuccessUrl()); - } - // End Adoption for Headless Storefronts + // Perform the recovery process. + $transactionEntity = $this->transactionService->getByOrderId($order->getId(), $salesChannelContext->getContext()); + if ($transactionEntity) { + $transaction = $this->transactionService->read($transactionEntity->getTransactionId(), $salesChannelContext->getSalesChannelId()); + if (in_array($transaction->getState(), [ + SdkTransactionState::AUTHORIZED, + SdkTransactionState::CONFIRMED, + SdkTransactionState::FULFILL + ])) { + return $this->redirectToRoute('frontend.checkout.finish.page', ['orderId' => $orderId]); + } - try { - $this->cartService->deleteCart($salesChannelContext); - $cart = $this->cartService->createNew($salesChannelContext->getToken()); + if ($transaction->getUserFailureMessage()) { + $this->addFlash('danger', $transaction->getUserFailureMessage()); + } + } + $this->cartRecoveryService->recreateCartFromOrder($order, $salesChannelContext); + } catch (\Exception $exception) { + $this->addFlash('danger', $this->trans('error.addToCartError')); + if ($this->logger) { + $this->logger->critical($exception->getMessage()); + } + return $this->redirectToRoute('frontend.home.page'); + } - // Configuration - $this->settings = $this->settingsService->getSettings($salesChannelContext->getSalesChannel()->getId()); - $orderEntity = $this->getOrder($request, $salesChannelContext); - $lastTransaction = $orderEntity->getTransactions()->last(); - if ($lastTransaction && !$lastTransaction->getPaymentMethod()->getAfterOrderEnabled()) { - return $this->redirectToRoute('frontend.home.page'); - } - - $transaction = $this->getTransaction($orderId, $salesChannelContext->getContext()); - if (!empty($transaction->getUserFailureMessage())) { - $this->addFlash('danger', $transaction->getUserFailureMessage()); - } - - $orderItems = $orderEntity->getLineItems(); - $hasCustomProducts = $this->hasCustomProducts($orderItems); - - if ($hasCustomProducts === true) { - $cart = $this->addCustomProducts($orderItems, $request, $salesChannelContext); - } - - foreach ($orderItems as $orderLineItemEntity) { - $type = $orderLineItemEntity->getType(); - - if ($type !== CustomProductsLineItemTypes::LINE_ITEM_TYPE_PRODUCT || $orderLineItemEntity->getParentid() !== null) { - continue; - } - - $lineItem = $this->lineItemFactoryRegistry->create([ - 'id' => $orderLineItemEntity->getId(), - 'quantity' => $orderLineItemEntity->getQuantity(), - 'referencedId' => $orderLineItemEntity->getReferencedId(), - 'type' => $type, - ], $salesChannelContext); - - $lineItemPayload = $orderLineItemEntity->getPayload(); - if (!empty($lineItemPayload)) { - $lineItem->setPayload($lineItemPayload); - } - - $cart = $this->cartService->add($cart, $lineItem, $salesChannelContext); - - } - - } catch (\Exception $exception) { - $this->addFlash('danger', $this->trans('error.addToCartError')); - $this->logger->critical($exception->getMessage()); - return $this->redirectToRoute('frontend.home.page'); - } - - return $this->redirectToRoute('frontend.checkout.confirm.page'); - } - - /** - * @param OrderLineItemCollection $orderItems - * - * @return bool - */ - private function hasCustomProducts(OrderLineItemCollection $orderItems): bool - { - foreach ($orderItems as $orderItem) { - if ($orderItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) { - return true; - } - } - - return false; - } - - /** - * @param OrderLineItemCollection $orderItems - * @param string $parentId - * - * @return OrderLineItemEntity|null - */ - private function getCustomProduct(OrderLineItemCollection $orderItems, string $parentId): ?OrderLineItemEntity - { - foreach ($orderItems as $orderItem) { - if ($orderItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_PRODUCT && $orderItem->getParentId() === $parentId) { - return $orderItem; - } - } - return null; - } - - /** - * @param OrderLineItemCollection $orderItems - * @param string $parentId - * - * @return array - */ - private function getCustomProductOptions(OrderLineItemCollection $orderItems, string $parentId): array - { - $options = []; - foreach ($orderItems as $orderItem) { - if ($orderItem->getType() === CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS_OPTION && $orderItem->getParentId() === $parentId) { - $options[] = $orderItem; - } - } - return $options; - } - - /** - * @param $orderItems - * @param $request - * @param $salesChannelContext - * - * @return Cart - */ - private function addCustomProducts(OrderLineItemCollection $orderItems, Request $request, SalesChannelContext $salesChannelContext): Cart - { - - $cart = $this->cartService->getCart($salesChannelContext->getToken(), $salesChannelContext); - if (!\class_exists('Swag\\CustomizedProducts\\Core\\Checkout\\Cart\\Route\\AddCustomizedProductsToCartRoute')) { - return $cart; - } - - $customProductsService = $this->get('Swag\CustomizedProducts\Core\Checkout\Cart\Route\AddCustomizedProductsToCartRoute'); - - foreach ($orderItems as $orderItem) { - if ($orderItem->getType() !== CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS) { - continue; - } - - $product = $this->getCustomProduct($orderItems, $orderItem->getId()); - $productOptions = $this->getCustomProductOptions($orderItems, $orderItem->getId()); - $optionValues = $this->getOptionValues($productOptions); - - $params = new RequestDataBag([ - 'customized-products-template' => new RequestDataBag([ - 'id' => $orderItem->getReferencedId(), - 'options' => new RequestDataBag($optionValues), - ]), - ]); - - $request->request->add( - [ - 'lineItems' => - [ - $product->getProductId() => - [ - 'quantity' => $orderItem->getQuantity(), - 'id' => $product->getProductId(), - 'type' => CustomProductsLineItemTypes::LINE_ITEM_TYPE_PRODUCT, - 'referencedId' => $product->getReferencedId(), - 'stackable' => $orderItem->getStackable(), - 'removable' => $orderItem->getRemovable(), - ] - ] - ] - ); - - $customProductsService->add($params, $request, $salesChannelContext, $cart); - $cart = $this->cartService->getCart($salesChannelContext->getToken(), $salesChannelContext); - } - - return $cart; - } - - /** - * @param array $productOptions - * - * @return array - */ - private function getOptionValues(array $productOptions): array - { - $optionValues = []; - foreach ($productOptions as $productOption) { - $optionType = $productOption->getPayload()['type'] ?: ''; - - switch ($optionType) { - case CustomProductsLineItemTypes::PRODUCT_OPTION_TYPE_IMAGE_UPLOAD: - case CustomProductsLineItemTypes::PRODUCT_OPTION_TYPE_FILE_UPLOAD: - $media = $productOption->getPayload()['media'] ?: []; - foreach ($media as $mediaItem) { - $optionValues[$productOption->getReferencedId()] = new RequestDataBag([ - 'media' => new RequestDataBag([ - $mediaItem['filename'] => new RequestDataBag([ - 'id' => $mediaItem['mediaId'], - 'filename' => $mediaItem['filename'], - ]), - ]), - ]); - } - break; - - default: - $optionValues[$productOption->getReferencedId()] = new RequestDataBag([ - 'value' => $productOption->getPayload()['value'] ?: '', - ]); - } - } - - return $optionValues; - } + // Send the user back to the checkout confirm page with their items restored. + return $this->redirectToRoute('frontend.checkout.confirm.page'); + } } diff --git a/src/Core/Storefront/Checkout/Subscriber/CheckoutSubscriber.php b/src/Core/Storefront/Checkout/Subscriber/CheckoutSubscriber.php index 05abe15..6636e13 100644 --- a/src/Core/Storefront/Checkout/Subscriber/CheckoutSubscriber.php +++ b/src/Core/Storefront/Checkout/Subscriber/CheckoutSubscriber.php @@ -1,106 +1,70 @@ -paymentMethodConfigurationService = $paymentMethodConfigurationService; - $this->transactionService = $transactionService; - $this->settingsService = $settingsService; - $this->paymentMethodUtil = $paymentMethodUtil; - $this->paymentMethodRepository = $paymentMethodRepository; + public function __construct( + SettingsService $settingsService, + PaymentMethodFilterService $paymentMethodFilterService, + PaymentIntegrationService $paymentIntegrationService + ) { + $this->settingsService = $settingsService; + $this->paymentMethodFilterService = $paymentMethodFilterService; + $this->paymentIntegrationService = $paymentIntegrationService; } /** - * @param \Psr\Log\LoggerInterface $logger - * - * @internal - * @required - * + * @param LoggerInterface $logger */ public function setLogger(LoggerInterface $logger): void { @@ -108,38 +72,75 @@ class CheckoutSubscriber implements EventSubscriberInterface } /** + * Register events to listen to. + * * @return array */ public static function getSubscribedEvents(): array { return [ - CheckoutConfirmPageLoadedEvent::class => 'onCheckoutConfirmLoaded', - AccountEditOrderPageLoadedEvent::class => 'onAccountOrderEditLoaded', - AccountPaymentMethodPageLoadedEvent::class => 'onAccountPaymentMethodLoaded', - "subscription." . CheckoutConfirmPageLoadedEvent::class => ['onConfirmPageLoaded', 1], + CheckoutConfirmPageLoadedEvent::class => 'onPageLoaded', + AccountEditOrderPageLoadedEvent::class => 'onPageLoaded', + AccountPaymentMethodPageLoadedEvent::class => 'onPageLoaded', + "subscription." . CheckoutConfirmPageLoadedEvent::class => ['onPageLoaded', 1], MailBeforeValidateEvent::class => ['onMailBeforeValidate', 1], ]; } /** - * Stop order emails being sent out + * Handles filtering of payment methods when a relevant page is loaded. * - * @param \Shopware\Core\Content\MailTemplate\Service\Event\MailBeforeValidateEvent $event + * @param mixed $event The page loaded event. + */ + public function onPageLoaded($event): void + { + try { + $salesChannelContext = $event->getSalesChannelContext(); + + // Access the payment methods available for the current page. + $paymentMethodCollection = $event->getPage()->getPaymentMethods(); + + // Delegate filtering to the centralized service. + $filteredCollection = $this->paymentMethodFilterService->filterPaymentMethods( + $paymentMethodCollection, + $salesChannelContext, + $event + ); + + // Update the page with the filtered list. + $event->getPage()->setPaymentMethods($filteredCollection); + + // If we are on a checkout or account page and have a pending transaction, provide integration data. + $transactionId = $salesChannelContext->getContext()->getExtension('vrpayment_transaction_id'); + if ($transactionId) { + $paymentConfig = $this->paymentIntegrationService->getConfigForTransaction( + (int) $transactionId->getVars()['value'], + $salesChannelContext + ); + $event->getPage()->addExtension('vRPaymentData', $paymentConfig); + } + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + } + } + + /** + * Handles logic before a mail is validated/sent. + * + * @param MailBeforeValidateEvent $event */ public function onMailBeforeValidate(MailBeforeValidateEvent $event): void { $templateData = $event->getTemplateData(); - /** - * @var $order \Shopware\Core\Checkout\Order\OrderEntity - */ + /** @var OrderEntity|null $order */ $order = !empty($templateData['order']) && $templateData['order'] instanceof OrderEntity ? $templateData['order'] : null; if (!empty($order) && $order->getAmountTotal() > 0) { + // Check if WhitelabelMachineName emails are enabled for this sales channel. + $isVRPaymentEmailSettingEnabled = (bool)$this->settingsService->getSettings($order->getSalesChannelId())->isEmailEnabled(); - $isVRPaymentEmailSettingEnabled = $this->settingsService->getSettings($order->getSalesChannelId())->isEmailEnabled(); - - if (!$isVRPaymentEmailSettingEnabled) { //setting is disabled + if (!$isVRPaymentEmailSettingEnabled) { return; } @@ -147,254 +148,30 @@ class CheckoutSubscriber implements EventSubscriberInterface if (!($orderTransactions instanceof OrderTransactionCollection)) { return; } + $orderTransactionLast = $orderTransactions->last(); - if (empty($orderTransactionLast) || empty($orderTransactionLast->getPaymentMethod())) { // no payment method available + if (empty($orderTransactionLast) || empty($orderTransactionLast->getPaymentMethod())) { return; } + // Check if the payment method used belongs to this plugin. $isVRPaymentPM = VRPaymentPaymentHandler::class == $orderTransactionLast->getPaymentMethod()->getHandlerIdentifier(); - if (!$isVRPaymentPM) { // not our payment method - return; - } - - $isOrderTransactionStateOpen = in_array( - $orderTransactionLast->getStateMachineState()->getTechnicalName(), [ - OrderTransactionStates::STATE_OPEN, - OrderTransactionStates::STATE_IN_PROGRESS, - ]); - - if (!$isOrderTransactionStateOpen) { // order payment status is open or in progress - return; - } - } - } - - /** - * @param CheckoutConfirmPageLoadedEvent $event - * @return void - */ - public function onCheckoutConfirmLoaded(CheckoutConfirmPageLoadedEvent $event): void - { - try { - $salesChannelContext = $event->getSalesChannelContext(); - $settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId()); - if (is_null($settings)) { - $this->logger->notice('Removing payment methods because settings are invalid'); - $this->removeVRPaymentPaymentMethodFromConfirmPage($event); - } - - $createdTransactionId = $this->transactionService->createPendingTransaction($salesChannelContext, $event); - $this->updateTempTransactionIfNeeded($salesChannelContext, $createdTransactionId); - - $this->getAvailablePaymentMethods($settings, $createdTransactionId, $salesChannelContext); - $this->setPossiblePaymentMethods($settings->getSpaceId(), $event); - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - $this->removeVRPaymentPaymentMethodFromConfirmPage($event); - } - } - - /** - * @param AccountEditOrderPageLoadedEvent $event - * @return void - */ - public function onAccountOrderEditLoaded(AccountEditOrderPageLoadedEvent $event): void - { - try { - $this->handlePaymentMethodFiltering($event); - } catch (\Throwable $e) { - $this->logger->error($e->getMessage()); - $this->removeVRPaymentPaymentMethodFromConfirmPage($event); - } - } - - /** - * @param AccountPaymentMethodPageLoadedEvent $event - * @return void - */ - public function onAccountPaymentMethodLoaded(AccountPaymentMethodPageLoadedEvent $event): void - { - try { - $this->handlePaymentMethodFiltering($event); - } catch (\Throwable $e) { - $this->logger->error($e->getMessage()); - $this->removeVRPaymentPaymentMethodFromConfirmPage($event); - } - } - - /** - * @param \Shopware\Storefront\Page\Checkout\Confirm\CheckoutConfirmPageLoadedEvent $event - */ - public function onConfirmPageLoaded(CheckoutConfirmPageLoadedEvent $event): void - { - try { - $this->handlePaymentMethodFiltering($event); - } catch (\Throwable $e) { - $this->logger->error($e->getMessage()); - $this->removeVRPaymentPaymentMethodFromConfirmPage($event); - } - } - - /** - * @param $event - * @return void - */ - private function handlePaymentMethodFiltering($event): void - { - $salesChannelContext = $event->getSalesChannelContext(); - $settings = $this->settingsService->getValidSettings($salesChannelContext->getSalesChannel()->getId()); - - if (is_null($settings)) { - $this->logger->notice('Removing payment methods because settings are invalid'); - $this->removeVRPaymentPaymentMethodFromConfirmPage($event); - return; - } - - $createdTransactionId = $this->transactionService->createPendingTransaction($salesChannelContext, $event); - $this->updateTempTransactionIfNeeded($salesChannelContext, $createdTransactionId); - - $this->getAvailablePaymentMethods($settings, $createdTransactionId, $salesChannelContext); - $this->setPossiblePaymentMethods($settings->getSpaceId(), $event); - } - - /** - * @param $event - * @return void - */ - private function removeVRPaymentPaymentMethodFromConfirmPage($event): void - { - $paymentMethodCollection = $event->getPage()->getPaymentMethods(); - $paymentMethodIds = $this->paymentMethodUtil->getVRPaymentPaymentMethodIds($event->getContext()); - foreach ($paymentMethodIds as $paymentMethodId) { - $paymentMethodCollection->remove($paymentMethodId); - } - } - - /** - * @param Settings $settings - * @param int $createdTransactionId - * @return void - */ - private function getAvailablePaymentMethods(Settings $settings, int $createdTransactionId, SalesChannelContext $salesChannelContext): void - { - $transactionService = $settings->getApiClient()->getTransactionService(); - $possiblePaymentMethods = $transactionService->fetchPaymentMethods( - $settings->getSpaceId(), - $createdTransactionId, - $settings->getIntegration() - ); - $arrayOfPossibleMethods = []; - foreach ($possiblePaymentMethods as $possiblePaymentMethod) { - $arrayOfPossibleMethods[] = $possiblePaymentMethod->getId(); - } - - $salesChannelContext->getContext()->addExtension( - 'possibleMethods', - new ArrayEntity(['ids' => $arrayOfPossibleMethods]) - ); - } - - /** - * @param int $spaceId - * @param CheckoutConfirmPageLoadedEvent $event - * @return void - */ - private function setPossiblePaymentMethods(int $spaceId, $event): void - { - $paymentIds = []; - $paymentMethodCollection = $event->getPage()->getPaymentMethods(); - - foreach ($paymentMethodCollection as $paymentMethodCollectionItem) { - $isVRPaymentPM = VRPaymentPaymentHandler::class === $paymentMethodCollectionItem->getHandlerIdentifier(); if (!$isVRPaymentPM) { - $paymentIds[] = $paymentMethodCollectionItem->getId(); - } - } - - $allowedWLMethods = []; - $paymentMethodConfigurations = $this->paymentMethodConfigurationService - ->getAllPaymentMethodConfigurations($spaceId, $event->getSalesChannelContext()->getContext()); - - foreach ($paymentMethodConfigurations as $paymentMethodConfiguration) { - if ($paymentMethodConfiguration->getPaymentMethod() === null) { - continue; + return; } - $pmId = $paymentMethodConfiguration->getPaymentMethod()->getId(); - $pmConfigId = $paymentMethodConfiguration->getPaymentMethodConfigurationId(); - $allowedIds = $this->getAllowedPaymentMethodIds($event->getSalesChannelContext()); - - if ($paymentMethodConfiguration->getSpaceId() === $spaceId - && \in_array($pmConfigId, $allowedIds, true)) { - $allowedWLMethods[] = $pmId; - } - } - - $allPaymentIds = array_unique(array_merge($paymentIds, $allowedWLMethods)); - $collection = new PaymentMethodCollection(); - if (!empty($allPaymentIds)) { - $criteria = new Criteria($allPaymentIds); - $criteria->addFilter(new EqualsFilter('active', true)); - $criteria->addFilter( - new EqualsFilter('salesChannels.id', $event->getSalesChannelContext()->getSalesChannelId()) + // Verify if the transaction is in a state where an email should be handled. + $isOrderTransactionStateOpen = in_array( + $orderTransactionLast->getStateMachineState()->getTechnicalName(), + [ + OrderTransactionStates::STATE_OPEN, + OrderTransactionStates::STATE_IN_PROGRESS, + ] ); - $criteria->addSorting(new FieldSorting('position', FieldSorting::ASCENDING)); - $result = $this->paymentMethodRepository->search($criteria, $event->getContext()); - foreach ($result->getEntities() as $method) { - if (!$collection->has($method->getId())) { - $collection->add($method); - } + if (!$isOrderTransactionStateOpen) { + return; } } - - $event->getPage()->setPaymentMethods($collection); } - - /** - * @param SalesChannelContext $salesChannelContext - * @param int $createdTransactionId - * @return void - */ - private function updateTempTransactionIfNeeded(SalesChannelContext $salesChannelContext, int $createdTransactionId): void - { - $ctx = $salesChannelContext->getContext(); - - /** @var ArrayEntity|null $ext */ - $ext = $ctx->getExtension('checkoutState'); - - $oldAddressHash = $ext instanceof ArrayEntity ? $ext->get('addressHash') : null; - $oldCurrency = $ext instanceof ArrayEntity ? $ext->get('currency') : null; - - $customer = $salesChannelContext->getCustomer(); - $addressHash = md5(json_encode((array) $customer)); - $currency = $salesChannelContext->getCurrency()->getIsoCode(); - - $needsUpdate = ($oldAddressHash !== $addressHash) || ($oldCurrency !== $currency); - - if ($needsUpdate) { - if ($createdTransactionId) { - $this->transactionService->updateTempTransaction($salesChannelContext, $createdTransactionId); - } - - $ctx->addExtension('possibleMethods', new ArrayEntity(['ids' => []])); - $ctx->addExtension( - 'checkoutState', - new ArrayEntity([ - 'addressHash' => $addressHash, - 'currency' => $currency, - ]) - ); - } - } - - /** - * @param SalesChannelContext $salesChannelContext - * @return array - */ - private function getAllowedPaymentMethodIds(SalesChannelContext $salesChannelContext): array - { - $ext = $salesChannelContext->getContext()->getExtension('possibleMethods'); - return $ext instanceof ArrayEntity ? ($ext->get('ids') ?? []) : []; - } } diff --git a/src/Core/Util/Analytics/Analytics.php b/src/Core/Util/Analytics/Analytics.php index 7e7400b..0f7e435 100644 --- a/src/Core/Util/Analytics/Analytics.php +++ b/src/Core/Util/Analytics/Analytics.php @@ -26,7 +26,7 @@ class Analytics { self::SHOP_SYSTEM => 'shopware', self::SHOP_SYSTEM_VERSION => '6', self::SHOP_SYSTEM_AND_VERSION => 'shopware-6', - self::PLUGIN_SYSTEM_VERSION => '7.2.0', + self::PLUGIN_SYSTEM_VERSION => '7.3.0', ]; } diff --git a/src/Core/Util/Payload/TransactionPayload.php b/src/Core/Util/Payload/TransactionPayload.php index f8041fc..736ead9 100644 --- a/src/Core/Util/Payload/TransactionPayload.php +++ b/src/Core/Util/Payload/TransactionPayload.php @@ -1,10 +1,13 @@ -transactionId = $transactionId; + } + /** * TransactionPayload constructor. * @@ -113,8 +129,7 @@ class TransactionPayload extends AbstractPayload SalesChannelContext $salesChannelContext, Settings $settings, PaymentTransactionStruct $transaction - ) - { + ) { $this->localeCodeProvider = $localeCodeProvider; $this->salesChannelContext = $salesChannelContext; $this->settings = $settings; @@ -135,7 +150,7 @@ class TransactionPayload extends AbstractPayload ->addAssociation('orderCustomer') ->addAssociation('transactions') ->addAssociation('currency') - ; + ; $this->order = $this->container->get('order.repository')->search($criteria, $this->salesChannelContext->getContext())->getEntities()->first(); } @@ -218,7 +233,7 @@ class TransactionPayload extends AbstractPayload } $transactionPayload = (new TransactionPending()) - ->setId($_SESSION['transactionId']) + ->setId($this->transactionId) ->setVersion($version) ->setBillingAddress($billingAddress) ->setCurrency($transactionData['currency']) @@ -243,7 +258,9 @@ class TransactionPayload extends AbstractPayload } $successUrl = $this->transaction->getReturnUrl() . '&status=paid'; - $failedUrl = $this->getFailUrl($this->order->getId()) . '&status=fail'; + // For headless clients, use the returnUrl for failure as well (they handle the status parameter). + // For Storefront, use the recreate-cart route. + $failedUrl = $this->getFailUrl($this->order->getId(), $this->transaction->getReturnUrl()) . '&status=fail'; $transactionPayload->setSuccessUrl($successUrl) ->setFailedUrl($failedUrl); @@ -295,8 +312,8 @@ class TransactionPayload extends AbstractPayload protected function shouldSkipLineItem($shopLineItem): bool { return in_array($shopLineItem->getType(), [ - CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS, - 'promotion' + CustomProductsLineItemTypes::LINE_ITEM_TYPE_CUSTOMIZED_PRODUCTS, + 'promotion' ]); } @@ -540,7 +557,6 @@ class TransactionPayload extends AbstractPayload $this->translator->trans('vrpayment.payload.taxes'), $amount ); - } else { $productAttributes = $this->getProductAttributes($shopLineItem); @@ -590,7 +606,7 @@ class TransactionPayload extends AbstractPayload throw new InvalidPayloadException('Tax payload invalid:' . json_encode($tax->listInvalidProperties())); } - $taxes [] = $tax; + $taxes[] = $tax; } return $taxes; @@ -670,7 +686,6 @@ class TransactionPayload extends AbstractPayload return $lineItem; } - } catch (\Exception $exception) { $this->logger->critical(__CLASS__ . ' : ' . __FUNCTION__ . ' : ' . $exception->getMessage()); } @@ -696,19 +711,19 @@ class TransactionPayload extends AbstractPayload } $taxRate = $taxItem->getTaxRate(); $tax = (new TaxCreate()) - ->setRate($taxRate) - ->setTitle('Tax rate: '.$taxRate); + ->setRate($taxRate) + ->setTitle('Tax rate: ' . $taxRate); $roundedAmount = self::round($amount); $name = $taxRate . '%-' . $shippingName; $lineItem = (new LineItemCreate()) - ->setAmountIncludingTax($roundedAmount) - ->setName($this->fixLength($name . ' ' . $this->translator->trans('vrpayment.payload.shipping.lineItem'), 150)) - ->setQuantity($this->order->getShippingCosts()->getQuantity() ?? 1) - ->setSku($this->fixLength($name . '-Shipping', 200)) - ->setType($isFirst ? LineItemType::SHIPPING : LineItemType::FEE) // First item as SHIPPING, rest as FEE - ->setUniqueId($this->fixLength($name . '-Shipping', 200)); + ->setAmountIncludingTax($roundedAmount) + ->setName($this->fixLength($name . ' ' . $this->translator->trans('vrpayment.payload.shipping.lineItem'), 150)) + ->setQuantity($this->order->getShippingCosts()->getQuantity() ?? 1) + ->setSku($this->fixLength($name . '-Shipping', 200)) + ->setType($isFirst ? LineItemType::SHIPPING : LineItemType::FEE) // First item as SHIPPING, rest as FEE + ->setUniqueId($this->fixLength($name . '-Shipping', 200)); if ($this->order->getTaxStatus() !== 'tax-free') { $lineItem->setTaxes([$tax]); @@ -724,7 +739,6 @@ class TransactionPayload extends AbstractPayload } return $lineItems; } - } catch (\Exception $exception) { $this->logger->critical(__CLASS__ . ' : ' . __FUNCTION__ . ' : ' . $exception->getMessage()); } @@ -767,7 +781,6 @@ class TransactionPayload extends AbstractPayload ]); $this->logger->critical($error); throw new \Exception($error); - } else { $lineItem = (new LineItemCreate()) ->setName($this->translator->trans('vrpayment.payload.adjustmentLineItem')) @@ -849,7 +862,6 @@ class TransactionPayload extends AbstractPayload } else { if (!empty($customer->getSalutation())) { $salutation = $customer->getSalutation()->getDisplayName(); - } } $salutation = !empty($salutation) ? $this->fixLength($salutation, 20) : null; @@ -914,31 +926,65 @@ class TransactionPayload extends AbstractPayload return $addressPayload; } - /** - * @param string $paymentMethodId - * @param int $spaceId - * @return PaymentMethodConfigurationEntity|null - */ - protected function getPaymentConfiguration(string $paymentMethodId, int $spaceId): ?PaymentMethodConfigurationEntity - { - $criteria = new Criteria(); - $criteria->addFilter(new EqualsFilter('paymentMethodId', $paymentMethodId)); - $criteria->addFilter(new EqualsFilter('spaceId', $spaceId)); + /** + * @param string $paymentMethodId + * @param int $spaceId + * @return PaymentMethodConfigurationEntity|null + */ + protected function getPaymentConfiguration(string $paymentMethodId, int $spaceId): ?PaymentMethodConfigurationEntity + { + $criteria = new Criteria(); + $criteria->addFilter(new EqualsFilter('paymentMethodId', $paymentMethodId)); + $criteria->addFilter(new EqualsFilter('spaceId', $spaceId)); - return $this->container->get('vrpayment_payment_method_configuration.repository') - ->search($criteria, $this->salesChannelContext->getContext()) - ->first(); - } + return $this->container->get('vrpayment_payment_method_configuration.repository') + ->search($criteria, $this->salesChannelContext->getContext()) + ->first(); + } /** - * Get failure URL + * Generates the failure URL for payment transactions. + * For headless clients (Store API), returns the client's returnUrl. + * For Storefront, returns the recreate-cart route. * - * @param string $orderId - * - * @return string + * @param string $orderId The order ID for the Storefront route. + * @param string|null $returnUrl The client's return URL (used for headless). + * @return string The failure URL. */ - protected function getFailUrl(string $orderId): string + protected function getFailUrl(string $orderId, ?string $returnUrl = null): string { + // For headless clients (Store API) or custom integrations, we use the returnUrl so the client can handle the failure. + // We detect "Standard Storefront" usage by checking if the returnUrl matches the standard Shopware 'finalize-transaction' route. + // If it DOES match, we usually redirect to 'recreate-cart' for better error handling. (Storefront / Edit Order) + // If it DOES NOT match (e.g. custom URL, headless URL), we return it as is. + + $isStandardShopwareUrl = strpos($returnUrl ?? '', 'payment/finalize-transaction') !== false; + + $request = $this->container->get('request_stack')->getCurrentRequest(); + $isJsonRequest = false; + if ($request) { + // Check for JSON preference + $format = $request->getPreferredFormat(); + $contentTypes = $request->getAcceptableContentTypes(); + $isJsonRequest = $format === 'json' || in_array('application/json', $contentTypes); + } + + if ($returnUrl) { + // Case 1: Custom URL (Headless detection part 1) + // If the URL is custom (not standard Shopware), we always respect it. + if (!$isStandardShopwareUrl) { + return $returnUrl; + } + + // Case 2: Standard URL + JSON Request (Headless detection part 2) + // If URL is standard BUT request prefers JSON, it's likely a headless app (Store API) being proxied. + if ($isStandardShopwareUrl && $isJsonRequest) { + return $returnUrl; + } + } + + // Default: Storefront (SystemSource, SalesChannelSource, or AdminSalesChannelApiSource via Edit Order/HTML) + // We generate the recreate-cart route to restore the cart and show the error. return $this->container->get('router')->generate( 'frontend.vrpayment.checkout.recreate-cart', ['orderId' => $orderId,], diff --git a/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/configuration-constants.js b/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/configuration-constants.js index 15853d1..fc215fe 100644 --- a/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/configuration-constants.js +++ b/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/configuration-constants.js @@ -10,6 +10,9 @@ export const CONFIG_USER_ID = CONFIG_DOMAIN + '.' + 'userId'; export const CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontWebhooksUpdateEnabled'; export const CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontPaymentsUpdateEnabled'; +// References vendor/shopware/core/Defaults.php::SALES_CHANNEL_TYPE_STOREFRONT +export const STOREFRONT_SALES_CHANNEL_TYPE_ID = '8a243080f92e4c719546314b577cf82b'; + export default { CONFIG_DOMAIN, CONFIG_APPLICATION_KEY, @@ -21,5 +24,6 @@ export default { CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED, CONFIG_USER_ID, CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED, - CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED -}; \ No newline at end of file + CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED, + STOREFRONT_SALES_CHANNEL_TYPE_ID +}; diff --git a/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.js b/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.js index 09f898e..b0f188a 100644 --- a/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.js +++ b/src/Resources/app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.js @@ -3,7 +3,7 @@ import template from './index.html.twig'; import constants from './configuration-constants'; -const {Component, Mixin} = Shopware; +const { Component, Mixin } = Shopware; Component.register('vrpayment-settings', { @@ -11,7 +11,8 @@ Component.register('vrpayment-settings', { inject: [ 'acl', - 'VRPaymentConfigurationService' + 'VRPaymentConfigurationService', + 'repositoryFactory' ], mixins: [ @@ -161,21 +162,93 @@ Component.register('vrpayment-settings', { }, getInheritValue(key) { - if (this.selectedSalesChannelId == null ) { + if (this.selectedSalesChannelId == null) { return this.actualConfigData[key]; } else { return this.allConfigs['null'][key]; } }, - onSave() { + async onSave() { if (!(this.spaceIdFilled && this.userIdFilled && this.applicationKeyFilled)) { this.setErrorStates(); return; } + + this.isLoading = true; + const validationError = await this.validateHeadlessIntegration(); + + if (validationError === 'HEADLESS') { + this.createNotificationError({ + title: this.$tc('vrpayment-settings.settingForm.titleError'), + message: this.$tc('vrpayment-settings.settingForm.messageHeadlessIntegrationError') + }); + this.isLoading = false; + return; + } else if (validationError === 'GLOBAL') { + this.createNotificationError({ + title: this.$tc('vrpayment-settings.settingForm.titleError'), + message: this.$tc('vrpayment-settings.settingForm.messageGlobalIframeError') + }); + this.isLoading = false; + return; + } + this.save(); }, + async validateHeadlessIntegration() { + const salesChannelId = this.$refs.configComponent.selectedSalesChannelId; + const currentIntegration = this.config[this.CONFIG_INTEGRATION]; + + // If integration is 'payment_page', it is always valid. + if (currentIntegration === 'payment_page') { + return null; + } + + const salesChannelRepo = this.repositoryFactory.create('sales_channel'); + + try { + if (salesChannelId) { + // Specific Sales Channel Check + const salesChannel = await salesChannelRepo.get(salesChannelId, Shopware.Context.api); + + const currentTypeId = salesChannel.typeId.replace(/-/g, ''); + + // REST-2: Inverted Logic + // We only allow 'iframe' integration if the Sales Channel is of type 'Storefront'. + // Any other type (Headless, Product Export, Custom, etc.) does not support Iframe injection. + const isStorefront = currentTypeId === constants.STOREFRONT_SALES_CHANNEL_TYPE_ID; + if (!isStorefront) { + return 'HEADLESS'; + } + } else { + // Global Scope ("All Sales Channels") Check + // We must check if there is ANY Sales Channel that is NOT Storefront. + // If so, we cannot allow "Iframe" globally, as it would break those channels. + const criteria = new Shopware.Data.Criteria(); + criteria.addFilter( + Shopware.Data.Criteria.not( + 'AND', + [Shopware.Data.Criteria.equals('typeId', constants.STOREFRONT_SALES_CHANNEL_TYPE_ID)] + ) + ); + criteria.setLimit(1); // We only need to know if at least one exists + + const result = await salesChannelRepo.search(criteria, Shopware.Context.api); + + if (result.total > 0) { + return 'GLOBAL'; + } + } + + return null; + } catch (e) { + console.error(e); + return null; + } + }, + save() { this.isLoading = true; @@ -210,7 +283,7 @@ Component.register('vrpayment-settings', { }); this.isLoading = false; console.error('Error:', e); - }); + }); }, synchronizePaymentMethodConfiguration() { @@ -232,10 +305,10 @@ Component.register('vrpayment-settings', { }); this.isLoading = false; console.error('Error:', e); - }); + }); }, - installOrderDeliveryStates(){ + installOrderDeliveryStates() { this.VRPaymentConfigurationService.installOrderDeliveryStates() .then(() => { this.createNotificationSuccess({ @@ -249,7 +322,7 @@ Component.register('vrpayment-settings', { message: this.$tc('vrpayment-settings.settingForm.messageOrderDeliveryStateError') }); this.isLoading = false; - }); + }); }, onSetPaymentMethodDefault() { @@ -311,7 +384,7 @@ Component.register('vrpayment-settings', { message: this.$tc('vrpayment-settings.settingForm.credentials.alert.errorMessage') }); this.isTesting = false; - }); + }); } } }); diff --git a/src/Resources/app/administration/src/module/vrpayment-settings/snippet/en-GB.json b/src/Resources/app/administration/src/module/vrpayment-settings/snippet/en-GB.json index 506d73f..6ce3cd0 100644 --- a/src/Resources/app/administration/src/module/vrpayment-settings/snippet/en-GB.json +++ b/src/Resources/app/administration/src/module/vrpayment-settings/snippet/en-GB.json @@ -1,105 +1,107 @@ { "sw-privileges": { - "permissions": { - "parents": { - "vrpayment": "VRPayment plugin" - }, - "vrpayment": { - "label": "VRPayment permissions" - } - } + "permissions": { + "parents": { + "vrpayment": "VRPayment plugin" + }, + "vrpayment": { + "label": "VRPayment permissions" + } + } }, "vrpayment-settings": { - "general": { - "descriptionTextModule": "VRPayment settings", - "mainMenuItemGeneral": "VRPayment" - }, - "header": "VRPayment", - "messageNotBlank": "This value should not be blank.", - "salesChannelCard": { - "button": { - "description": "Click this button to set VRPayment as default payment handler in the selected SalesChannel", - "label": "Set VRPayment as default payment handler" - }, - "messageDefaultPaymentError": "VRPayment as default payment could not be set.", - "messageDefaultPaymentUpdated": "VRPayment as default payment has been set." - }, - "settingForm": { - "credentials": { - "applicationKey": { - "label": "Application Key", - "tooltipText": "The Application Key is used to authenticate this plugin with the VRPayment API." - }, - "cardTitle": "Credentials", - "spaceId": { - "label": "Space ID", - "tooltipText": "The space ID is used to authenticate this plugin with the VRPayment API." - }, - "userId": { - "label": "User ID", - "tooltipText": "The user ID is used to authenticate this plugin with the VRPayment API." - }, - "button": { - "description": "Click this button to test the VRPayment API", - "label": "API connection test" - }, - "alert": { - "title": "API Test", - "successMessage": "The connection was successfully tested.", - "errorMessage": "The connection was failed. Try it again." - } - }, - "messageSaveSuccess": "VRPayment settings have been saved.", - "messageOrderDeliveryStateError": "VRPayment OrderDeliveryState could not be saved.", - "messageOrderDeliveryStateUpdated": "VRPayment OrderDeliveryState has been updated.", - "messagePaymentMethodConfigurationError": "VRPayment PaymentMethodConfiguration could not be saved. Please check your credentials.", - "messagePaymentMethodConfigurationUpdated": "VRPayment PaymentMethodConfiguration has been registered.", - "messageWebHookError": "VRPayment WebHook could not be saved. Please check your credentials.", - "messageWebHookUpdated": "VRPayment WebHook has been updated.", - "options": { - "cardTitle": "Options", - "emailEnabled": { - "label": "Send order confirmation email", - "tooltipText": "If this setting is enabled your customers will receive an email from your store when their order payment is authorised" - }, - "integration": { - "label": "Integration", - "options": { - "iframe": "Iframe", - "payment_page": "Payment Page" - }, - "tooltipText": "Integration" - }, - "lineItemConsistencyEnabled": { - "label": "Line item consistency", - "tooltipText": "If this option is enabled line item totals in VRPaymentPayment will always match Shopware order total" - }, - "spaceViewId": { - "label": "Space View ID", - "tooltipText": "Space View ID" - } - }, - "save": "Save", - "storefrontOptions": { - "cardTitle": "Storefront Options", - "invoiceDownloadEnabled": { - "label": "Invoice Download", - "tooltipText": "If this setting is enabled your customers will be able to download order invoices from VRPayment" - } - }, - "advancedOptions": { - "cardTitle": "Advanced Options", - "webhooksUpdateEnabled": { - "label": "Webhooks Update", - "tooltipText": "If this setting is enabled webhook update will be triggered when you save settings" - }, - "paymentsUpdateEnabled": { - "label": "Payments Update", - "tooltipText": "If this setting is enabled payment methods update will be triggered when you save settings" - } - }, - "titleError": "Error", - "titleSuccess": "Success" - } + "general": { + "descriptionTextModule": "VRPayment settings", + "mainMenuItemGeneral": "VRPayment" + }, + "header": "VRPayment", + "messageNotBlank": "This value should not be blank.", + "salesChannelCard": { + "button": { + "description": "Click this button to set VRPayment as default payment handler in the selected SalesChannel", + "label": "Set VRPayment as default payment handler" + }, + "messageDefaultPaymentError": "VRPayment as default payment could not be set.", + "messageDefaultPaymentUpdated": "VRPayment as default payment has been set." + }, + "settingForm": { + "credentials": { + "applicationKey": { + "label": "Application Key", + "tooltipText": "The Application Key is used to authenticate this plugin with the VRPayment API." + }, + "cardTitle": "Credentials", + "spaceId": { + "label": "Space ID", + "tooltipText": "The space ID is used to authenticate this plugin with the VRPayment API." + }, + "userId": { + "label": "User ID", + "tooltipText": "The user ID is used to authenticate this plugin with the VRPayment API." + }, + "button": { + "description": "Click this button to test the VRPayment API", + "label": "API connection test" + }, + "alert": { + "title": "API Test", + "successMessage": "The connection was successfully tested.", + "errorMessage": "The connection was failed. Try it again." + } + }, + "messageSaveSuccess": "VRPayment settings have been saved.", + "messageOrderDeliveryStateError": "VRPayment OrderDeliveryState could not be saved.", + "messageOrderDeliveryStateUpdated": "VRPayment OrderDeliveryState has been updated.", + "messagePaymentMethodConfigurationError": "VRPayment PaymentMethodConfiguration could not be saved. Please check your credentials.", + "messagePaymentMethodConfigurationUpdated": "VRPayment PaymentMethodConfiguration has been registered.", + "messageWebHookError": "VRPayment WebHook could not be saved. Please check your credentials.", + "messageWebHookUpdated": "VRPayment WebHook has been updated.", + "messageHeadlessIntegrationError": "Iframe integration is only supported for Storefront Sales Channels.", + "messageGlobalIframeError": "Iframe integration cannot be set globally because you have non-Storefront Sales Channels.", + "options": { + "cardTitle": "Options", + "emailEnabled": { + "label": "Send order confirmation email", + "tooltipText": "If this setting is enabled your customers will receive an email from your store when their order payment is authorised" + }, + "integration": { + "label": "Integration", + "options": { + "iframe": "Iframe", + "payment_page": "Payment Page" + }, + "tooltipText": "Integration" + }, + "lineItemConsistencyEnabled": { + "label": "Line item consistency", + "tooltipText": "If this option is enabled line item totals in VRPaymentPayment will always match Shopware order total" + }, + "spaceViewId": { + "label": "Space View ID", + "tooltipText": "Space View ID" + } + }, + "save": "Save", + "storefrontOptions": { + "cardTitle": "Storefront Options", + "invoiceDownloadEnabled": { + "label": "Invoice Download", + "tooltipText": "If this setting is enabled your customers will be able to download order invoices from VRPayment" + } + }, + "advancedOptions": { + "cardTitle": "Advanced Options", + "webhooksUpdateEnabled": { + "label": "Webhooks Update", + "tooltipText": "If this setting is enabled webhook update will be triggered when you save settings" + }, + "paymentsUpdateEnabled": { + "label": "Payments Update", + "tooltipText": "If this setting is enabled payment methods update will be triggered when you save settings" + } + }, + "titleError": "Error", + "titleSuccess": "Success" + } } } \ No newline at end of file diff --git a/src/Resources/app/storefront/dist/storefront/js/v-r-payment-payment/v-r-payment-payment.js b/src/Resources/app/storefront/dist/storefront/js/v-r-payment-payment/v-r-payment-payment.js index 872b878..d215d73 100644 --- a/src/Resources/app/storefront/dist/storefront/js/v-r-payment-payment/v-r-payment-payment.js +++ b/src/Resources/app/storefront/dist/storefront/js/v-r-payment-payment/v-r-payment-payment.js @@ -1 +1,8 @@ -(()=>{"use strict";var e={156:e=>{var t=function(e){var t;return!!e&&"object"==typeof e&&"[object RegExp]"!==(t=Object.prototype.toString.call(e))&&"[object Date]"!==t&&e.$$typeof!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?o(Array.isArray(e)?[]:{},e,t):e}function i(e,t,r){return e.concat(t).map(function(e){return n(e,r)})}function s(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[])}function a(e,t){try{return t in e}catch(e){return!1}}function o(e,r,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var u,c,h=Array.isArray(r);return h!==Array.isArray(e)?n(r,l):h?l.arrayMerge(e,r,l):(c={},(u=l).isMergeableObject(e)&&s(e).forEach(function(t){c[t]=n(e[t],u)}),s(r).forEach(function(t){(!a(e,t)||Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))&&(a(e,t)&&u.isMergeableObject(r[t])?c[t]=(function(e,t){if(!t.customMerge)return o;var r=t.customMerge(e);return"function"==typeof r?r:o})(t,u)(e[t],r[t],u):c[t]=n(r[t],u))}),c)}o.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,r){return o(e,r,t)},{})},e.exports=o}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n=r(156),i=r.n(n);class s{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,t){let r=s.toUpperCamelCase(e,t);return s.lcFirst(r)}static toUpperCamelCase(e,t){return t?e.split(t).map(e=>s.ucFirst(e.toLowerCase())).join(""):s.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(t){return e.toString()}}}class a{constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}publish(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=new CustomEvent(e,{detail:t,cancelable:r});return this.el.dispatchEvent(n),n}subscribe(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this,i=e.split("."),s=r.scope?t.bind(r.scope):t;if(r.once&&!0===r.once){let t=s;s=function(r){n.unsubscribe(e),t(r)}}return this.el.addEventListener(i[0],s),this.listeners.push({splitEventName:i,opts:r,cb:s}),!0}unsubscribe(e){let t=e.split(".");return this.listeners=this.listeners.reduce((e,r)=>([...r.splitEventName].sort().toString()===t.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):e.push(r),e),[]),!0}reset(){return this.listeners.forEach(e=>{this.el.removeEventListener(e.splitEventName[0],e.cb)}),this.listeners=[],!0}get el(){return this._el}set el(e){this._el=e}get listeners(){return this._listeners}set listeners(e){this._listeners=e}}class o{constructor(e,t={},r=!1){if(!(e instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${r}".`);return}this.el=e,this.$emitter=new a(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(t),this._initialized=!1,this._registerInstance(),this._init()}init(){console.warn(`The "init" method for the plugin "${this._pluginName}" is not defined. The plugin will not be initialized.`)}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){let t=[this.constructor.options,this.options,e];return t.push(this._getConfigFromDataAttribute()),t.push(this._getOptionsFromDataAttribute()),i().all(t.filter(e=>e instanceof Object&&!(e instanceof Array)).map(e=>e||{}))}_getConfigFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=s.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${t}-config`);return r?window.PluginConfigManager.get(this._pluginName,r):e}_getOptionsFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let t=s.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${t}-options`);if(r)try{return JSON.parse(r)}catch(e){console.error(`The data attribute "data-${t}-options" could not be parsed to json: ${e.message}`)}return e}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(e){return e||(e=this.constructor.name),e}}class l{constructor(){this._request=null,this._errorHandlingInternal=!1}get(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",n=this._createPreparedRequest("GET",e,r);return this._sendRequest(n,null,t)}post(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";n=this._getContentType(t,n);let i=this._createPreparedRequest("POST",e,n);return this._sendRequest(i,t,r)}delete(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";n=this._getContentType(t,n);let i=this._createPreparedRequest("DELETE",e,n);return this._sendRequest(i,t,r)}patch(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";n=this._getContentType(t,n);let i=this._createPreparedRequest("PATCH",e,n);return this._sendRequest(i,t,r)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(e){this._errorHandlingInternal=e}_registerOnLoaded(e,t){t&&(!0===this._errorHandlingInternal?(e.addEventListener("load",()=>{t(e.responseText,e)}),e.addEventListener("abort",()=>{console.warn(`the request to ${e.responseURL} was aborted`)}),e.addEventListener("error",()=>{console.warn(`the request to ${e.responseURL} failed with status ${e.status}`)}),e.addEventListener("timeout",()=>{console.warn(`the request to ${e.responseURL} timed out`)})):e.addEventListener("loadend",()=>{t(e.responseText,e)}))}_sendRequest(e,t,r){return this._registerOnLoaded(e,r),e.send(t),e}_getContentType(e,t){return e instanceof FormData&&(t=!1),t}_createPreparedRequest(e,t,r){return this._request=new XMLHttpRequest,this._request.open(e,t),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&this._request.setRequestHeader("Content-type",r),this._request}}class u extends o{static #e=this.options={payment_method_tabs:"ul.vrpayment-payment-panel li",payment_method_iframe_prefix:"iframe_payment_method_",payment_method_iframe_class:".vrpayment-payment-iframe",payment_method_handler_name:"vrpayment_payment_handler",payment_method_handler_prefix:"vrpayment_handler_",payment_method_handler_status:'input[name="vrpayment_payment_handler_validation_status"]',payment_form:"confirmOrderForm"};init(){this._client=new l(window.accessKey)}}window.PluginManager.register("VRPaymentCheckoutPlugin",u,"[data-vrpayment-checkout-plugin]")})(); \ No newline at end of file +(()=>{"use strict";var t={156:t=>{var e=function(t){var e;return!!t&&"object"==typeof t&&"[object RegExp]"!==(e=Object.prototype.toString.call(t))&&"[object Date]"!==e&&t.$$typeof!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(t,e){return!1!==e.clone&&e.isMergeableObject(t)?o(Array.isArray(t)?[]:{},t,e):t}function n(t,e,r){return t.concat(e).map(function(t){return i(t,r)})}function s(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function a(t,e){try{return e in t}catch(t){return!1}}function o(t,r,l){(l=l||{}).arrayMerge=l.arrayMerge||n,l.isMergeableObject=l.isMergeableObject||e,l.cloneUnlessOtherwiseSpecified=i;var u,h,c=Array.isArray(r);return c!==Array.isArray(t)?i(r,l):c?l.arrayMerge(t,r,l):(h={},(u=l).isMergeableObject(t)&&s(t).forEach(function(e){h[e]=i(t[e],u)}),s(r).forEach(function(e){(!a(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(a(t,e)&&u.isMergeableObject(r[e])?h[e]=(function(t,e){if(!e.customMerge)return o;var r=e.customMerge(t);return"function"==typeof r?r:o})(e,u)(t[e],r[e],u):h[e]=i(r[e],u))}),h)}o.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,r){return o(t,r,e)},{})},t.exports=o}},e={};function r(i){var n=e[i];if(void 0!==n)return n.exports;var s=e[i]={exports:{}};return t[i](s,s.exports,r),s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i=r(156),n=r.n(i);class s{static ucFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}static lcFirst(t){return t.charAt(0).toLowerCase()+t.slice(1)}static toDashCase(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,e){let r=s.toUpperCamelCase(t,e);return s.lcFirst(r)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>s.ucFirst(t.toLowerCase())).join(""):s.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}class a{constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new CustomEvent(t,{detail:e,cancelable:r});return this.el.dispatchEvent(i),i}subscribe(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this,n=t.split("."),s=r.scope?e.bind(r.scope):e;if(r.once&&!0===r.once){let e=s;s=function(r){i.unsubscribe(t),e(r)}}return this.el.addEventListener(n[0],s),this.listeners.push({splitEventName:n,opts:r,cb:s}),!0}unsubscribe(t){let e=t.split(".");return this.listeners=this.listeners.reduce((t,r)=>([...r.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):t.push(r),t),[]),!0}reset(){return this.listeners.forEach(t=>{this.el.removeEventListener(t.splitEventName[0],t.cb)}),this.listeners=[],!0}get el(){return this._el}set el(t){this._el=t}get listeners(){return this._listeners}set listeners(t){this._listeners=t}}class o{constructor(t,e={},r=!1){if(!(t instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${r}".`);return}this.el=t,this.$emitter=new a(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(e),this._initialized=!1,this._registerInstance(),this._init()}init(){console.warn(`The "init" method for the plugin "${this._pluginName}" is not defined. The plugin will not be initialized.`)}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(t){let e=[this.constructor.options,this.options,t];return e.push(this._getConfigFromDataAttribute()),e.push(this._getOptionsFromDataAttribute()),n().all(e.filter(t=>t instanceof Object&&!(t instanceof Array)).map(t=>t||{}))}_getConfigFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=s.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${e}-config`);return r?window.PluginConfigManager.get(this._pluginName,r):t}_getOptionsFromDataAttribute(){let t={};if("function"!=typeof this.el.getAttribute)return t;let e=s.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${e}-options`);if(r)try{return JSON.parse(r)}catch(t){console.error(`The data attribute "data-${e}-options" could not be parsed to json: ${t.message}`)}return t}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(t){return t||(t=this.constructor.name),t}}class l{static isNode(t){return"object"==typeof t&&null!==t&&(t===document||t===window||t instanceof Node)}static hasAttribute(t,e){if(!l.isNode(t))throw Error("The element must be a valid HTML Node!");return"function"==typeof t.hasAttribute&&t.hasAttribute(e)}static getAttribute(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!1===l.hasAttribute(t,e))throw Error(`The required property "${e}" does not exist!`);if("function"!=typeof t.getAttribute){if(r)throw Error("This node doesn't support the getAttribute function!");return}return t.getAttribute(e)}static getDataAttribute(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=e.replace(/^data(|-)/,""),n=s.toLowerCamelCase(i,"-");if(!l.isNode(t)){if(r)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===t.dataset){if(r)throw Error("This node doesn't support the dataset attribute!");return}let a=t.dataset[n];if(void 0===a){if(r)throw Error(`The required data attribute "${e}" does not exist on ${t}!`);return a}return s.parsePrimitive(a)}static querySelector(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!l.isNode(t))throw Error("The parent node is not a valid HTML Node!");let i=t.querySelector(e)||!1;if(r&&!1===i)throw Error(`The required element "${e}" does not exist in parent node!`);return i}static querySelectorAll(t,e){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(r&&!l.isNode(t))throw Error("The parent node is not a valid HTML Node!");let i=t.querySelectorAll(e);if(0===i.length&&(i=!1),r&&!1===i)throw Error(`At least one item of "${e}" must exist in parent node!`);return i}static getFocusableElements(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body,e=` + input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]), + select:not([tabindex^="-"]):not([disabled]), + textarea:not([tabindex^="-"]):not([disabled]), + button:not([tabindex^="-"]):not([disabled]), + a[href]:not([tabindex^="-"]):not([disabled]), + [tabindex]:not([tabindex^="-"]):not([disabled]) + `;return t.querySelectorAll(e)}static getFirstFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(t)[0]}static getLastFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=this.getFocusableElements(t);return e[e.length-1]}}class u extends o{static #t=this.options={payment_panel_id:"vrpayment-payment-panel",payment_method_iframe_id:"vrpayment-payment-iframe",payment_method_handler_status:'input[name="vrpayment_payment_handler_validation_status"]',payment_form_id:"confirmOrderForm",loader_id:"vrpaymentLoader",checkout_url_id:"checkoutUrl",cart_recreate_url_id:"cartRecreateUrl"};init(){try{this._initVariables(),this._registerEvents(),this._getIframe()}catch(t){}}_initVariables(){this.checkoutUrl=l.getElement(document,`#${this.options.checkout_url_id}`).value,this.cartRecreateUrl=l.getElement(document,`#${this.options.cart_recreate_url_id}`).value,this.paymentForm=l.getElement(document,`#${this.options.payment_form_id}`),this.paymentPanel=this.el,this.iframeContainer=l.getElement(this.paymentPanel,`#${this.options.payment_method_iframe_id}`),this.handler=null}_registerEvents(){this.paymentForm.addEventListener("submit",this._submitPayment.bind(this),!1),window.addEventListener("popstate",this._onPopstate.bind(this),!1),window.history.pushState({},document.title,this.cartRecreateUrl),window.history.pushState({},document.title,this.checkoutUrl)}_onPopstate(){null!=window.history.state&&(window.location.href=this.cartRecreateUrl)}_submitPayment(t){if(this._activateLoader(!0),this.handler)return this.handler.validate(),t.preventDefault(),!1}_getIframe(){let t=this.paymentPanel.dataset.id;this.handler||"function"!=typeof window.IframeCheckoutHandler||(this.handler=window.IframeCheckoutHandler(t),this.handler.setValidationCallback(this._validationCallBack.bind(this)),this.handler.setInitializeCallback(this._hideLoader.bind(this)),this.handler.setHeightChangeCallback(t=>{t<1&&this.handler.submit()}),this.handler.create(this.iframeContainer),setTimeout(this._hideLoader.bind(this),1e4))}_validationCallBack(t){let e=document.querySelectorAll(this.options.payment_method_handler_status);t.success?(e.forEach(t=>{t.value="true"}),this.handler.submit()):(e.forEach(t=>{t.value="false"}),this._activateLoader(!1),t.errors&&this._showErrors(t.errors))}_activateLoader(t){document.querySelectorAll("button").forEach(e=>{e.disabled=t})}_hideLoader(){let t=document.getElementById(this.options.loader_id);t&&t.parentNode&&t.parentNode.removeChild(t),this._activateLoader(!1)}_showErrors(t){alert(t.join("\n"))}}window.PluginManager.register("VRPaymentCheckoutPlugin",u,"[data-vrpayment-checkout-plugin]")})(); \ No newline at end of file diff --git a/src/Resources/app/storefront/src/vrpayment-checkout-plugin/vrpayment-checkout-plugin.plugin.js b/src/Resources/app/storefront/src/vrpayment-checkout-plugin/vrpayment-checkout-plugin.plugin.js index 5c0c033..c2dd436 100644 --- a/src/Resources/app/storefront/src/vrpayment-checkout-plugin/vrpayment-checkout-plugin.plugin.js +++ b/src/Resources/app/storefront/src/vrpayment-checkout-plugin/vrpayment-checkout-plugin.plugin.js @@ -3,25 +3,170 @@ // noinspection NpmUsedModulesInstalled import Plugin from 'src/plugin-system/plugin.class'; import HttpClient from 'src/service/http-client.service'; +import DomAccess from 'src/helper/dom-access.helper'; - +/** + * VRPaymentCheckoutPlugin + * + * This plugin handles the initialization and lifecycle of the WhitelabelMachineName payment iframe + * within the Shopware 6 checkout confirm page. + */ class VRPaymentCheckoutPlugin extends Plugin { static options = { - payment_method_tabs: 'ul.vrpayment-payment-panel li', - payment_method_iframe_prefix: 'iframe_payment_method_', - payment_method_iframe_class: '.vrpayment-payment-iframe', - payment_method_handler_name: 'vrpayment_payment_handler', - payment_method_handler_prefix: 'vrpayment_handler_', + payment_panel_id: 'vrpayment-payment-panel', + payment_method_iframe_id: 'vrpayment-payment-iframe', payment_method_handler_status: 'input[name="vrpayment_payment_handler_validation_status"]', - payment_form: 'confirmOrderForm', + payment_form_id: 'confirmOrderForm', + loader_id: 'vrpaymentLoader', + checkout_url_id: 'checkoutUrl', + cart_recreate_url_id: 'cartRecreateUrl', }; + /** + * Initializes the plugin, variables, and events. + */ init() { - // @TODO Move JS to Plugin - this._client = new HttpClient(window.accessKey); + try { + this._initVariables(); + this._registerEvents(); + this._getIframe(); + } catch (e) { + // Silently fail if elements are not found; this allows the plugin to be loaded on pages where it might be conditionally absent. + } } + /** + * Finds and stores references to relevant DOM elements. + * @private + */ + _initVariables() { + this.checkoutUrl = DomAccess.getElement(document, `#${this.options.checkout_url_id}`).value; + this.cartRecreateUrl = DomAccess.getElement(document, `#${this.options.cart_recreate_url_id}`).value; + this.paymentForm = DomAccess.getElement(document, `#${this.options.payment_form_id}`); + this.paymentPanel = this.el; + this.iframeContainer = DomAccess.getElement(this.paymentPanel, `#${this.options.payment_method_iframe_id}`); + this.handler = null; + } + + /** + * Registers event listeners for the payment form and browser history. + * @private + */ + _registerEvents() { + this.paymentForm.addEventListener('submit', this._submitPayment.bind(this), false); + + // Handle back button/popstate to ensure cart consistency + window.addEventListener('popstate', this._onPopstate.bind(this), false); + window.history.pushState({}, document.title, this.cartRecreateUrl); + window.history.pushState({}, document.title, this.checkoutUrl); + } + + /** + * Handles browser back button activity. + * @private + */ + _onPopstate() { + if (window.history.state == null) { + return; + } + window.location.href = this.cartRecreateUrl; + } + + /** + * Intercepts the form submission to validate the iframe content first. + * @param {Event} event + * @private + */ + _submitPayment(event) { + this._activateLoader(true); + if (this.handler) { + this.handler.validate(); + event.preventDefault(); + return false; + } + } + + /** + * Initializes the WhitelabelMachineName Iframe handler and creates the iframe. + * @private + */ + _getIframe() { + const paymentMethodConfigurationId = this.paymentPanel.dataset.id; + + if (!this.handler) { + // IframeCheckoutHandler is expected to be global from the SDK script + if (typeof window.IframeCheckoutHandler === 'function') { + this.handler = window.IframeCheckoutHandler(paymentMethodConfigurationId); + this.handler.setValidationCallback(this._validationCallBack.bind(this)); + this.handler.setInitializeCallback(this._hideLoader.bind(this)); + this.handler.setHeightChangeCallback((height) => { + if (height < 1) { + this.handler.submit(); + } + }); + this.handler.create(this.iframeContainer); + setTimeout(this._hideLoader.bind(this), 10000); + } + } + } + + /** + * Callback for iframe validation results. + * @param {Object} validationResult + * @private + */ + _validationCallBack(validationResult) { + const statusInputs = document.querySelectorAll(this.options.payment_method_handler_status); + if (validationResult.success) { + statusInputs.forEach(input => { + input.value = 'true'; + }); + this.handler.submit(); + } else { + statusInputs.forEach(input => { + input.value = 'false'; + }); + this._activateLoader(false); + if (validationResult.errors) { + this._showErrors(validationResult.errors); + } + } + } + + /** + * Enables or disables buttons on the page to indicate loading. + * @param {boolean} activate + * @private + */ + _activateLoader(activate) { + const buttons = document.querySelectorAll('button'); + buttons.forEach(button => { + button.disabled = activate; + }); + } + + /** + * Hides the loader overlay once the iframe is ready. + * @private + */ + _hideLoader() { + const loader = document.getElementById(this.options.loader_id); + if (loader && loader.parentNode) { + loader.parentNode.removeChild(loader); + } + this._activateLoader(false); + } + + /** + * Displays validation errors to the user. + * @param {Array} errors + * @private + */ + _showErrors(errors) { + // Fallback to alert if no native Shopware mechanism is easily accessible here + alert(errors.join('\n')); + } } -export default VRPaymentCheckoutPlugin; \ No newline at end of file +export default VRPaymentCheckoutPlugin; diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index b0ce66c..54b1ad8 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -13,9 +13,11 @@ + + - \ No newline at end of file + diff --git a/src/Resources/config/services/core/api/transaction.xml b/src/Resources/config/services/core/api/transaction.xml index 1ab8f77..af18008 100644 --- a/src/Resources/config/services/core/api/transaction.xml +++ b/src/Resources/config/services/core/api/transaction.xml @@ -58,6 +58,8 @@ + + diff --git a/src/Resources/config/services/core/checkout_services.xml b/src/Resources/config/services/core/checkout_services.xml new file mode 100644 index 0000000..6f92d4b --- /dev/null +++ b/src/Resources/config/services/core/checkout_services.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Resources/config/services/core/store_api.xml b/src/Resources/config/services/core/store_api.xml new file mode 100644 index 0000000..f804de0 --- /dev/null +++ b/src/Resources/config/services/core/store_api.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Resources/config/services/core/storefront/account.xml b/src/Resources/config/services/core/storefront/account.xml index 11447b3..8b9de04 100644 --- a/src/Resources/config/services/core/storefront/account.xml +++ b/src/Resources/config/services/core/storefront/account.xml @@ -7,9 +7,9 @@ - + diff --git a/src/Resources/config/services/core/storefront/checkout.xml b/src/Resources/config/services/core/storefront/checkout.xml index 695ddd7..ce271ca 100644 --- a/src/Resources/config/services/core/storefront/checkout.xml +++ b/src/Resources/config/services/core/storefront/checkout.xml @@ -7,31 +7,25 @@ - - - + + + - - - - - - + + diff --git a/src/Resources/public/administration/.vite/entrypoints.json b/src/Resources/public/administration/.vite/entrypoints.json index be037e1..5cae68b 100644 --- a/src/Resources/public/administration/.vite/entrypoints.json +++ b/src/Resources/public/administration/.vite/entrypoints.json @@ -7,7 +7,7 @@ ], "dynamic": [], "js": [ - "/bundles/vrpaymentpayment/administration/assets/v-r-payment-payment-Cp2eQSV_.js" + "/bundles/vrpaymentpayment/administration/assets/v-r-payment-payment-BV391wJu.js" ], "legacy": false, "preload": [] diff --git a/src/Resources/public/administration/.vite/manifest.json b/src/Resources/public/administration/.vite/manifest.json index 94de841..826152a 100644 --- a/src/Resources/public/administration/.vite/manifest.json +++ b/src/Resources/public/administration/.vite/manifest.json @@ -1,6 +1,6 @@ { "main.js": { - "file": "assets/v-r-payment-payment-Cp2eQSV_.js", + "file": "assets/v-r-payment-payment-BV391wJu.js", "name": "v-r-payment-payment", "src": "main.js", "isEntry": true, diff --git a/src/Resources/public/administration/assets/v-r-payment-payment-BV391wJu.js b/src/Resources/public/administration/assets/v-r-payment-payment-BV391wJu.js new file mode 100644 index 0000000..80569f4 --- /dev/null +++ b/src/Resources/public/administration/assets/v-r-payment-payment-BV391wJu.js @@ -0,0 +1,2 @@ +const A=`{% block sw_order_detail_content_tabs_general %} {% parent %} {# sw-tabs-item will dissappear. See: https://github.com/shopware/shopware/blob/trunk/UPGRADE-6.7.md#sw-tabs-is-removed #} {{ $tc('vrpayment-order.header') }} {% endblock %} {% block sw_order_detail_actions_slot_smart_bar_actions %} {% endblock %}`,{Component:T,Context:g}=Shopware,P=Shopware.Data.Criteria,D="handler_vrpaymentpayment_vrpaymentpaymenthandler";T.override("sw-order-detail",{template:A,data(){return{isVRPaymentPayment:!1}},computed:{isEditable(){return!this.isVRPaymentPayment||this.$route.name!=="vrpayment.order.detail"},showTabs(){return!0}},watch:{orderId:{deep:!0,handler(){if(!this.orderId){this.setIsVRPaymentPayment(null);return}const e=this.repositoryFactory.create("order"),t=new P(1,1);t.addAssociation("transactions"),e.get(this.orderId,g.api,t).then(a=>{if(a.amountTotal<=0||a.transactions.length<=0||!a.transactions[0].paymentMethodId){this.setIsVRPaymentPayment(null);return}const n=a.transactions[0].paymentMethodId;n!=null&&this.setIsVRPaymentPayment(n)})},immediate:!0}},methods:{setIsVRPaymentPayment(e){if(!e)return;this.repositoryFactory.create("payment_method").get(e,g.api).then(a=>{this.isVRPaymentPayment=a.formattedHandlerIdentifier===D})}}});const N=`{% block vrpayment_order_action_completion %} {% block vrpayment_order_action_completion_amount %} {% endblock %} {% block vrpayment_order_action_completion_confirm_button %} {% endblock %} {% endblock %}`,{Component:R,Mixin:k,Filter:$,Utils:f}=Shopware;R.register("vrpayment-order-action-completion",{template:N,inject:["VRPaymentTransactionCompletionService"],mixins:[k.getByName("notification")],props:{transactionData:{type:Object,required:!0}},data(){return{isLoading:!0,isCompletion:!1}},computed:{dateFilter(){return $.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1},completion(){this.isCompletion&&(this.isLoading=!0,this.VRPaymentTransactionCompletionService.createTransactionCompletion(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.captureAction.successTitle"),message:this.$tc("vrpayment-order.captureAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${f.createId()}`)})}).catch(e=>{try{this.createNotificationError({title:e.response.data.errors[0].title,message:e.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${f.createId()}`)})}}))}}});const O=`{% block vrpayment_order_action_refund %} {% block vrpayment_order_action_refund_amount %}
    {{ $tc('vrpayment-order.refundAction.maxAvailableItemsToRefund') }}: {{ this.$parent.$parent.itemRefundableQuantity }}
    {% endblock %} {% block vrpayment_order_action_refund_confirm_button %} {% endblock %}
    {% endblock %}`,{Component:x,Mixin:F,Filter:V,Utils:y}=Shopware;x.register("vrpayment-order-action-refund",{template:O,inject:["VRPaymentRefundService"],mixins:[F.getByName("notification")],props:{transactionData:{type:Object,required:!0},orderId:{type:String,required:!0}},data(){return{refundQuantity:0,isLoading:!0,currentLineItem:""}},computed:{dateFilter(){return V.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.refundQuantity=1},refund(){this.isLoading=!0,this.VRPaymentRefundService.createRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,this.refundQuantity,this.$parent.$parent.currentLineItem).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${y.createId()}`)})}).catch(e=>{var n,i,o,s;try{var t=((s=(o=(i=(n=e==null?void 0:e.response)==null?void 0:n.data)==null?void 0:i.errors)==null?void 0:o[0])==null?void 0:s.title)??this.$tc("vrpayment-order.refundAction.refundCreateError.errorTitle"),a;switch(e.response.data){case"refundQuantityZero":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundQuantityIsZero");break;case"refundExceedsQuantity":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundQuantityExceedsAvailableBalance");break;default:a=e.response.data.errors[0].detail}this.createNotificationError({title:t,message:a,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${y.createId()}`)})}})}}});const L=`{% block vrpayment_order_action_refund_partial %} {% block vrpayment_order_action_refund_amount_partial %}
    {{ $tc('vrpayment-order.refundAction.maxAvailableAmountToRefund') }}: {{ this.$parent.$parent.itemRefundableAmount }}
    {% endblock %} {% block vrpayment_order_action_refund_confirm_button_partial %} {% endblock %}
    {% endblock %}`,{Component:M,Mixin:B,Filter:z,Utils:b}=Shopware;M.register("vrpayment-order-action-refund-partial",{template:L,inject:["VRPaymentRefundService"],mixins:[B.getByName("notification")],props:{transactionData:{type:Object,required:!0},orderId:{type:String,required:!0}},data(){return{isLoading:!0,currency:this.transactionData.transactions[0].currency,refundAmount:0}},computed:{dateFilter(){return z.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundAmount||(this.refundAmount=this.$parent.$parent.itemRefundableAmount)},createPartialRefund(e){this.isLoading=!0,this.VRPaymentRefundService.createPartialRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,this.refundAmount,e).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${b.createId()}`)})}).catch(t=>{try{this.createNotificationError({title:t.response.data.errors[0].title,message:t.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:t.title,message:t.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${b.createId()}`)})}})}},watch:{refundAmount(e){e!==null&&(this.refundAmount=Math.round(e*100)/100)}}});const G=`{% block vrpayment_order_action_refund_by_amount %} {% block vrpayment_order_action_refund_amount_by_amount %} {% endblock %} {% block vrpayment_order_action_refund_confirm_button_by_amount %} {% endblock %} {% endblock %}`,{Component:q,Mixin:U,Filter:H,Utils:v}=Shopware;q.register("vrpayment-order-action-refund-by-amount",{template:G,inject:["VRPaymentRefundService"],mixins:[U.getByName("notification")],props:{transactionData:{type:Object,required:!0},orderId:{type:String,required:!0}},data(){return{isLoading:!0,currency:this.transactionData.transactions[0].currency,refundAmount:0,refundableAmount:0}},computed:{dateFilter(){return H.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundAmount=Number(this.transactionData.transactions[0].amountIncludingTax),this.refundableAmount=Number(this.transactionData.transactions[0].amountIncludingTax)},refundByAmount(){this.isLoading=!0,this.VRPaymentRefundService.createRefundByAmount(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,this.refundAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${v.createId()}`)})}).catch(e=>{var n,i,o,s;try{var t=((s=(o=(i=(n=e==null?void 0:e.response)==null?void 0:n.data)==null?void 0:i.errors)==null?void 0:o[0])==null?void 0:s.title)??this.$tc("vrpayment-order.refundAction.refundCreateError.errorTitle"),a;switch(e.response.data){case"refundAmountZero":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundAmountIsZero");break;case"refundExceedsAmount":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundAmountExceedsAvailableBalance");break;default:a=e.response.data.errors[0].detail}this.createNotificationError({title:t,message:a,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${v.createId()}`)})}})}}});const W=`{% block vrpayment_order_action_void %} {% block vrpayment_order_action_void_amount %} {# Review if this v-model:checked="isVoid" needs to change to checked #} {% endblock %} {% block vrpayment_order_action_void_confirm_button %} {% endblock %} {% endblock %}`,{Component:K,Mixin:Q,Filter:Y,Utils:_}=Shopware;K.register("vrpayment-order-action-void",{template:W,inject:["VRPaymentTransactionVoidService"],mixins:[Q.getByName("notification")],props:{transactionData:{type:Object,required:!0}},data(){return{isLoading:!0,isVoid:!1}},computed:{dateFilter(){return Y.getByName("date")},lineItemColumns(){return[{property:"uniqueId",label:this.$tc("vrpayment-order.refund.types.uniqueId"),rawData:!1,allowResize:!0,primary:!0,width:"auto"},{property:"name",label:this.$tc("vrpayment-order.refund.types.name"),rawData:!0,allowResize:!0,sortable:!0,width:"auto"},{property:"quantity",label:this.$tc("vrpayment-order.refund.types.quantity"),rawData:!0,allowResize:!0,width:"auto"},{property:"amountIncludingTax",label:this.$tc("vrpayment-order.refund.types.amountIncludingTax"),rawData:!0,allowResize:!0,inlineEdit:"string",width:"auto"},{property:"type",label:this.$tc("vrpayment-order.refund.types.type"),rawData:!0,allowResize:!0,sortable:!0,width:"auto"},{property:"taxAmount",label:this.$tc("vrpayment-order.refund.types.taxAmount"),rawData:!0,allowResize:!0,width:"auto"}]}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundableAmount=this.transactionData.transactions[0].amountIncludingTax,this.refundAmount=this.transactionData.transactions[0].amountIncludingTax},voidPayment(){this.isVoid&&(this.isLoading=!0,this.VRPaymentTransactionVoidService.createTransactionVoid(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.voidAction.successTitle"),message:this.$tc("vrpayment-order.voidAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${_.createId()}`)})}).catch(e=>{try{this.createNotificationError({title:e.response.data.errors[0].title,message:e.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${_.createId()}`)})}}))}}});const j=`{% block vrpayment_order_detail %}
    {% block vrpayment_order_transaction_history_card %} {% endblock %} {% block vrpayment_order_transaction_line_items_card %} {% endblock %} {% block vrpayment_order_transaction_refunds_card %} {% endblock %} {% block vrpayment_order_actions_modal_refund_partial %} {% endblock %} {% block vrpayment_order_actions_modal_refund %} {% endblock %} {% block vrpayment_order_actions_modal_refund_by_amount %} {% endblock %} {% block vrpayment_order_actions_modal_completion%} {% endblock %} {% block vrpayment_order_actions_modal_void %} {% endblock %}
    {% endblock %}`,{Component:Z,Mixin:J,Filter:X,Context:ee,Utils:u}=Shopware,I=Shopware.Data.Criteria;Z.register("vrpayment-order-detail",{template:j,inject:["VRPaymentTransactionService","VRPaymentRefundService","repositoryFactory"],mixins:[J.getByName("notification")],data(){return{transactionData:{transactions:[],refunds:[]},transaction:{},lineItems:[],refundableQuantity:0,itemRefundableQuantity:0,isLoading:!0,orderId:"",currency:"",modalType:"",refundAmount:0,refundableAmount:0,itemRefundedAmount:0,itemRefundedQuantity:0,itemRefundableAmount:0,currentLineItem:"",refundLineItemQuantity:[],refundLineItemAmount:[],selectedItems:[]}},metaInfo(){return{title:this.$tc("vrpayment-order.header")}},computed:{dateFilter(){return X.getByName("date")},relatedResourceColumns(){return[{property:"paymentMethodName",label:this.$tc("vrpayment-order.transactionHistory.types.payment_method"),rawData:!0},{property:"state",label:this.$tc("vrpayment-order.transactionHistory.types.state"),rawData:!0},{property:"currency",label:this.$tc("vrpayment-order.transactionHistory.types.currency"),rawData:!0},{property:"authorized_amount",label:this.$tc("vrpayment-order.transactionHistory.types.authorized_amount"),rawData:!0},{property:"id",label:this.$tc("vrpayment-order.transactionHistory.types.transaction"),rawData:!0},{property:"customerId",label:this.$tc("vrpayment-order.transactionHistory.types.customer"),rawData:!0}]},lineItemColumns(){return[{property:"id",rawData:!0,visible:!1,primary:!0},{property:"uniqueId",label:this.$tc("vrpayment-order.lineItem.types.uniqueId"),rawData:!0,visible:!1,primary:!0},{property:"name",label:this.$tc("vrpayment-order.lineItem.types.name"),rawData:!0},{property:"quantity",label:this.$tc("vrpayment-order.lineItem.types.quantity"),rawData:!0},{property:"amountIncludingTax",label:this.$tc("vrpayment-order.lineItem.types.amountIncludingTax"),rawData:!0},{property:"type",label:this.$tc("vrpayment-order.lineItem.types.type"),rawData:!0},{property:"taxAmount",label:this.$tc("vrpayment-order.lineItem.types.taxAmount"),rawData:!0},{property:"refundableQuantity",rawData:!0,visible:!1}]},refundColumns(){return[{property:"id",label:this.$tc("vrpayment-order.refund.types.id"),rawData:!0,visible:!0,primary:!0},{property:"amount",label:this.$tc("vrpayment-order.refund.types.amount"),rawData:!0},{property:"state",label:this.$tc("vrpayment-order.refund.types.state"),rawData:!0},{property:"createdOn",label:this.$tc("vrpayment-order.refund.types.createdOn"),rawData:!0}]}},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},created(){this.createdComponent()},methods:{createdComponent(){this.orderId=this.$route.params.id;const e=this.repositoryFactory.create("order"),t=new I(1,1);t.addAssociation("transactions"),t.getAssociation("transactions").addSorting(I.sort("createdAt","DESC")),e.get(this.orderId,ee.api,t).then(a=>{this.order=a,this.isLoading=!1;var n=0,i=0;const o=a.transactions[0].customFields.vrpayment_transaction_id;this.VRPaymentTransactionService.getTransactionData(a.salesChannelId,o).then(s=>{this.currency=s.transactions[0].currency,s.transactions[0].authorized_amount=u.format.currency(s.transactions[0].authorizationAmount,this.currency),s.refunds.forEach(r=>{i=parseFloat(parseFloat(i)+parseFloat(r.amount)),r.amount=u.format.currency(r.amount,this.currency),r.reductions.forEach(l=>{l.quantityReduction>0&&(this.refundLineItemQuantity[l.lineItemUniqueId]===void 0?this.refundLineItemQuantity[l.lineItemUniqueId]=l.quantityReduction:this.refundLineItemQuantity[l.lineItemUniqueId]+=l.quantityReduction),l.unitPriceReduction>0&&(this.refundLineItemAmount[l.lineItemUniqueId]===void 0?this.refundLineItemAmount[l.lineItemUniqueId]=l.unitPriceReduction:this.refundLineItemAmount[l.lineItemUniqueId]+=l.unitPriceReduction)})}),s.transactions[0].lineItems.forEach(r=>{r.id||(r.id=r.uniqueId),r.itemRefundedAmount=parseFloat(this.refundLineItemAmount[r.uniqueId]||0)*parseInt(r.quantity),r.amountIncludingTax=parseFloat(r.amountIncludingTax)||0,r.itemRefundedQuantity=parseInt(this.refundLineItemQuantity[r.uniqueId])||0,r.refundableAmount=parseFloat((r.amountIncludingTax-r.itemRefundedAmount).toFixed(2)),r.amountIncludingTax=u.format.currency(r.amountIncludingTax,this.currency),r.taxAmount=u.format.currency(r.taxAmount,this.currency),n=parseFloat(parseFloat(n)+parseFloat(r.unitPriceIncludingTax*r.quantity)),r.refundableQuantity=parseInt(parseInt(r.quantity)-parseInt(this.refundLineItemQuantity[r.uniqueId]||0))}),this.lineItems=s.transactions[0].lineItems,this.transactionData=s,this.transaction=this.transactionData.transactions[0],this.refundAmount=Number(this.transactionData.transactions[0].amountIncludingTax),this.refundableAmount=parseFloat(parseFloat(n)-parseFloat(i))}).catch(s=>{try{this.createNotificationError({title:this.$tc("vrpayment-order.paymentDetails.error.title"),message:s.message,autoClose:!1})}catch{this.createNotificationError({title:this.$tc("vrpayment-order.paymentDetails.error.title"),message:s.message,autoClose:!1})}finally{this.isLoading=!1}})})},downloadPackingSlip(){window.open(this.VRPaymentTransactionService.getPackingSlip(this.transaction.metaData.salesChannelId,this.transaction.id),"_blank")},downloadInvoice(){window.open(this.VRPaymentTransactionService.getInvoiceDocument(this.transaction.metaData.salesChannelId,this.transaction.id),"_blank")},resetDataAttributes(){this.transactionData={transactions:[],refunds:[]},this.lineItems=[],this.refundLineItemQuantity=[],this.refundLineItemAmount=[],this.isLoading=!0},spawnModal(e,t,a,n){this.modalType=e,this.currentLineItem=t,this.itemRefundableQuantity=a,this.itemRefundableAmount=isNaN(n)?0:Math.round(n*100)/100},closeModal(){this.modalType=""},lineItemRefund(e){this.isLoading=!0,this.VRPaymentRefundService.createRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,0,e).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${u.createId()}`)})}).catch(t=>{try{this.createNotificationError({title:t.response.data.errors[0].title,message:t.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:t.title,message:t.response.data,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${u.createId()}`)})}})},isSelectable(e){return e.refundableQuantity>0&&e.refundableAmount>0&&e.itemRefundedAmount==0&&e.itemRefundedQuantity==0},onSelectionChanged(e){this.selectedItems=Object.values(e)},onPerformBulkAction(){this.selectedItems.length&&(this.isLoading=!0,this.$nextTick(()=>{const e=this.selectedItems.map(t=>this.lineItemRefundBulk(t.uniqueId));Promise.all(e).then(()=>{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${u.createId()}`)})}).catch(t=>{this.createNotificationError({title:"Error",message:"Something went wrong with the refunds",autoClose:!1}),this.isLoading=!1})}))},lineItemRefundBulk(e){return new Promise((t,a)=>{this.VRPaymentRefundService.createRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,0,e).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),t()}).catch(n=>{try{this.createNotificationError({title:n.response.data.errors[0].title,message:n.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:n.title,message:n.response.data,autoClose:!1})}finally{a()}})})}}});const te={"vrpayment-order":{buttons:{label:{completion:"Abschluss","download-invoice":"Rechnung herunterladen","download-packing-slip":"Packzettel herunterladen",refund:"Eine neue Rückerstattung erstellen",void:"Genehmigung annullieren","refund-whole-line-item":"Gesamte Werbebuchung erstatten","refund-line-item-by-quantity":"Rückerstattung nach Menge","refund-line-item-selected":"Rückerstattung auswählen","refund-line-item-parial":"Teilweise Rückerstattung"}},captureAction:{button:{text:"Zahlung erfassen"},currentAmount:"Betrag",isFinal:"Dies ist die endgültige Verbuchung",maxAmount:"Maximaler Betrag",successMessage:"Ihre Verbuchung war erfolgreich",successTitle:"Erfolg"},general:{title:"Bestellungen"},header:"VRPayment Payment",lineItem:{cardTitle:"Einzelposten",types:{amountIncludingTax:"Betrag",name:"Name",quantity:"Anzahl",taxAmount:"Steuern",type:"Typ",uniqueId:"Eindeutige ID"}},modal:{title:{capture:"Erfassen",refund:"Neue Gutschrift",void:"Autorisierung aufheben"}},paymentDetails:{cardTitle:"Zahlung",error:{title:"Fehler beim Abrufen von Zahlungsdetails von VRPayment"}},refund:{cardTitle:"Gutschriften",refundAmount:{label:"Gutschriftsbetrag"},refundQuantity:{label:"Refund Menge"},types:{amount:"Betrag",createdOn:"Erstellt am",id:"ID",state:"Staat"}},refundAction:{confirmButton:{text:"Ausführen"},refundAmount:{label:"Betrag",placeholder:"Einen Betrag eingeben"},successMessage:"Ihre Rückerstattung war erfolgreich",successTitle:"Erfolg",maxAvailableItemsToRefund:"Maximal Verfügbare Artikel zum Erstatten",maxAvailableAmountToRefund:"Maximal verfügbarer Erstattungsbetrag",refundCreateError:{errorTitle:"Fehler beim Erstellen der Rückerstattung.",messageRefundAmountExceedsAvailableBalance:"Der Rückerstattungsbetrag übersteigt das verfügbare Guthaben.",messageRefundAmountIsZero:"Der Rückerstattungsbetrag muss größer als 0 sein.",messageRefundQuantityExceedsAvailableBalance:"Rückerstattung nach Menge überschreitet die maximal verfügbare Anzahl an Artikeln zur Rückerstattung.",messageRefundQuantityIsZero:"Rückerstattung nach Menge muss größer als 0 sein."}},transactionHistory:{cardTitle:"Einzelheiten",types:{authorized_amount:"Autorisierter Betrag",currency:"Währung",customer:"Kunde",payment_method:"Zahlungsweise",state:"Staat",transaction:"Transaktion"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Kreditkarteninhaber",paymentMethod:"Zahlungsart",paymentMethodBrand:"Marke der Zahlungsmethode",PseudoCreditCardNumber:"Pseudo-Kreditkartennummer",CardExpire:"Karte verfällt"},voidAction:{confirm:{button:{cancel:"Nein",confirm:"Autorisierung aufheben"},message:"Wollen Sie diese Zahlung wirklich stornieren?"},successMessage:"Die Zahlung wurde erfolgreich annulliert",successTitle:"Erfolg"}}},ae={"vrpayment-order":{buttons:{label:{completion:"Complete","download-invoice":"Download Invoice","download-packing-slip":"Download Packing Slip",refund:"Create a new refund",void:"Cancel authorization","refund-whole-line-item":"Refund whole line item","refund-line-item-by-quantity":"Refund by quantity","refund-line-item-selected":"Refund selected","refund-line-item-parial":"Partial refund"}},captureAction:{button:{text:"Capture payment"},currentAmount:"Amount",isFinal:"This is final capture",maxAmount:"Maximum amount",successMessage:"Your capture was successful.",successTitle:"Success"},general:{title:"Orders"},header:"VRPayment Payment",lineItem:{cardTitle:"Line Items",types:{amountIncludingTax:"Amount",name:"Name",quantity:"Quantity",taxAmount:"Taxes",type:"Type",uniqueId:"Unique ID"}},modal:{title:{capture:"Capture",refund:"New refund",void:"Cancel authorization"}},paymentDetails:{cardTitle:"Payment",error:{title:"Error fetching payment details from VRPayment"}},refund:{cardTitle:"Refunds",refundAmount:{label:"Refund Amount"},refundQuantity:{label:"Refund Quantity"},types:{amount:"Amount",createdOn:"Created On",id:"ID",state:"State"}},refundAction:{confirmButton:{text:"Execute"},refundAmount:{label:"Amount",placeholder:"Enter a amount"},successMessage:"Your refund was successful.",successTitle:"Success",maxAvailableItemsToRefund:"Maximum available items to refund",maxAvailableAmountToRefund:"Maximum available amount to refund",refundCreateError:{errorTitle:"Error while creating the refund.",messageRefundAmountExceedsAvailableBalance:"Refund amount exceeds available balance.",messageRefundAmountIsZero:"Refund amount must be greater than 0.",messageRefundQuantityExceedsAvailableBalance:"Refund by quantity exceeds maximum available items to refund.",messageRefundQuantityIsZero:"Refund by quantity must be greater than 0."}},transactionHistory:{cardTitle:"Details",types:{authorized_amount:"Authorized Amount",currency:"Currency",customer:"Customer",payment_method:"Payment Method",state:"State",transaction:"Transaction"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Credit Card Holder",paymentMethod:"Payment Method",paymentMethodBrand:"Payment Method Brand",PseudoCreditCardNumber:"Pseudo Credit Card Number",CardExpire:"Card Expire"},voidAction:{confirm:{button:{cancel:"No",confirm:"Cancel authorization"},message:"Do you really want to cancel this payment?"},successMessage:"The payment was successfully voided.",successTitle:"Success"}}},ne={"vrpayment-order":{buttons:{label:{completion:"Terminée","download-invoice":"Télécharger la facture","download-packing-slip":"Télécharger le bordereau d'expédition",refund:"Créer un nouveau remboursement",void:"Annulez l'autorisation","refund-whole-line-item":"Remboursement de la ligne entière","refund-line-item-by-quantity":"Remboursement par quantité","refund-line-item-selected":"Rembourser sélectionnés","refund-line-item-parial":"Remboursement partiel"}},captureAction:{button:{text:"Capture du paiement"},currentAmount:"Montant",isFinal:"C'est la capture finale",maxAmount:"Montant maximal",successMessage:"Votre capture a été réussie.",successTitle:"Succès"},general:{title:"Commandes"},header:"VRPayment Paiement",lineItem:{cardTitle:"Articles de ligne",types:{amountIncludingTax:"Montant",name:"Nom",quantity:"Quantité",taxAmount:"Taxes",type:"Type",uniqueId:"ID unique"}},modal:{title:{capture:"Capture",refund:"Nouveau remboursement",void:"Annulez l'autorisation"}},paymentDetails:{cardTitle:"Paiement",error:{title:"Erreur dans la récupération des détails du paiement à partir de VRPayment"}},refund:{cardTitle:"Remboursements",refundAmount:{label:"Montant du remboursement"},refundQuantity:{label:"Quantité à rembourser"},types:{amount:"Montant",createdOn:"Créé le",id:"ID",state:"État"}},refundAction:{confirmButton:{text:"Exécutez"},refundAmount:{label:"Montant",placeholder:"Entrez un montant"},successMessage:"Votre remboursement a été effectué avec succès.",successTitle:"Succès",maxAvailableItemsToRefund:"Nombre maximum d'articles disponibles pour le remboursement",maxAvailableAmountToRefund:"Montant maximal disponible pour le remboursement",refundCreateError:{errorTitle:"Erreur lors de la création du remboursement.",messageRefundAmountExceedsAvailableBalance:"Le montant du remboursement dépasse le solde disponible.",messageRefundAmountIsZero:"Le montant du remboursement doit être supérieur à 0.",messageRefundQuantityExceedsAvailableBalance:"Le remboursement par quantité dépasse le nombre maximal d’articles remboursables.",messageRefundQuantityIsZero:"Le remboursement par quantité doit être supérieur à 0."}},transactionHistory:{cardTitle:"Détails",types:{authorized_amount:"Montant autorisé",currency:"Monnaie",customer:"Client",payment_method:"Mode de paiement",state:"État",transaction:"Transaction"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Titulaire de la carte de crédit",paymentMethod:"Mode de paiement",paymentMethodBrand:"Marque du mode de paiement",PseudoCreditCardNumber:"Pseudo numéro de carte de crédit",CardExpire:"La carte expire"},voidAction:{confirm:{button:{cancel:"Non",confirm:"Annulez l'autorisation"},message:"Voulez-vous vraiment annuler ce paiement?"},successMessage:"Le paiement a été annulé avec succès.",successTitle:"Succès"}}},ie={"vrpayment-order":{buttons:{label:{completion:"Completato","download-invoice":"Scarica fattura","download-packing-slip":"Scarica distinta di imballaggio",refund:"Crea un nuovo rimborso",void:"Annulla autorizzazione","refund-whole-line-item":"Rimborso intera riga","refund-line-item-by-quantity":"Rimborso per quantità","refund-line-item-selected":"Rimborso selezionati","refund-line-item-parial":"Rimborso parziale"}},captureAction:{button:{text:"Cattura pagamento"},currentAmount:"Importo",isFinal:"Questa è la cattura finale",maxAmount:"Importo massimo",successMessage:"La tua cattura ha avuto successo.",successTitle:"Successo"},general:{title:"Ordini"},header:"Pagamento VRPayment",lineItem:{cardTitle:"Articoli di linea",types:{amountIncludingTax:"Importo",name:"Nome",quantity:"Quantità",taxAmount:"Tasse",type:"Tipo",uniqueId:"ID unico"}},modal:{title:{capture:"Cattura",refund:"Nuovo rimborso",void:"Annulla autorizzazione"}},paymentDetails:{cardTitle:"Pagamento",error:{title:"Errore nel recupero dei dettagli del pagamento da VRPayment"}},refund:{cardTitle:"Rimborsi",refundAmount:{label:"Importo del rimborso"},refundQuantity:{label:"Quantità di rimborso"},types:{amount:"Importo",createdOn:"Creato il",id:"ID",state:"Stato"}},refundAction:{confirmButton:{text:"Esegui"},refundAmount:{label:"Importo",placeholder:"Inserisci un importo"},successMessage:"Il tuo rimborso è andato a buon fine.",successTitle:"Successo",maxAvailableItemsToRefund:"Numero massimo di articoli disponibili da rimborsare",maxAvailableAmountToRefund:"Importo massimo disponibile per il rimborso",refundCreateError:{errorTitle:"Errore durante la creazione del rimborso.",messageRefundAmountExceedsAvailableBalance:"LL'importo del rimborso supera il saldo disponibile.",messageRefundAmountIsZero:"L'importo del rimborso deve essere superiore a 0.",messageRefundQuantityExceedsAvailableBalance:"Il rimborso per quantità supera il numero massimo di articoli rimborsabili.",messageRefundQuantityIsZero:"Il rimborso per quantità deve essere maggiore di 0."}},transactionHistory:{cardTitle:"Dettagli",types:{authorized_amount:"Importo autorizzato",currency:"Valuta",customer:"Cliente",payment_method:"Metodo di pagamento",state:"Stato",transaction:"Transazione"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Proprietario della carta di credito",paymentMethod:"Metodo di pagamento",paymentMethodBrand:"Metodo di pagamento Marca",PseudoCreditCardNumber:"Numero di carta di credito pseudo",CardExpire:"La carta scade"},voidAction:{confirm:{button:{cancel:"No",confirm:"Annulla autorizzazione"},message:"Vuoi davvero annullare questo pagamento?"},successMessage:"Il pagamento è stato annullato con successo.",successTitle:"Successo"}}},{Module:re}=Shopware;re.register("vrpayment-order",{type:"plugin",name:"VRPayment",title:"vrpayment-order.general.title",description:"vrpayment-order.general.descriptionTextModule",version:"1.0.1",targetVersion:"1.0.1",color:"#2b52ff",snippets:{"de-DE":te,"en-GB":ae,"fr-FR":ne,"it-IT":ie},routeMiddleware(e,t){t.name==="sw.order.detail"&&t.children.push({component:"vrpayment-order-detail",name:"vrpayment.order.detail",isChildren:!0,path:"/sw/order/vrpayment/detail/:id"}),e(t)}});Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:"vrpayment",key:"vrpayment",roles:{viewer:{privileges:["sales_channel:read","sales_channel_payment_method:read","system_config:read"],dependencies:[]},editor:{privileges:["sales_channel:update","sales_channel_payment_method:create","sales_channel_payment_method:update","system_config:update","system_config:create","system_config:delete"],dependencies:["vrpayment.viewer"]}}});Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:null,key:"sales_channel",roles:{viewer:{privileges:["sales_channel_payment_method:read"]},editor:{privileges:["payment_method:update"]},creator:{privileges:["payment_method:create","shipping_method:create","delivery_time:create"]},deleter:{privileges:["payment_method:delete"]}}});const se=`{% block vrpayment_settings %} {% block vrpayment_settings_header %} {% endblock %} {% block vrpayment_settings_actions %} {% endblock %} {% block vrpayment_settings_content %} {% endblock %} {% endblock %}`,c="VRPaymentPayment.config",oe=c+".applicationKey",le=c+".emailEnabled",ce=c+".integration",de=c+".lineItemConsistencyEnabled",me=c+".spaceId",ue=c+".spaceViewId",pe=c+".storefrontInvoiceDownloadEnabled",he=c+".userId",ge=c+".storefrontWebhooksUpdateEnabled",fe=c+".storefrontPaymentsUpdateEnabled",ye="8a243080f92e4c719546314b577cf82b",d={CONFIG_DOMAIN:c,CONFIG_APPLICATION_KEY:oe,CONFIG_EMAIL_ENABLED:le,CONFIG_INTEGRATION:ce,CONFIG_LINE_ITEM_CONSISTENCY_ENABLED:de,CONFIG_SPACE_ID:me,CONFIG_SPACE_VIEW_ID:ue,CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED:pe,CONFIG_USER_ID:he,CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED:ge,CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED:fe,STOREFRONT_SALES_CHANNEL_TYPE_ID:ye},{Component:be,Mixin:C}=Shopware;be.register("vrpayment-settings",{template:se,inject:["acl","VRPaymentConfigurationService","repositoryFactory"],mixins:[C.getByName("notification"),C.getByName("sw-inline-snippet")],data(){return{config:{},isLoading:!1,isTesting:!1,isSaveSuccessful:!1,applicationKeyFilled:!1,applicationKeyErrorState:!1,spaceIdFilled:!1,spaceIdErrorState:!1,userIdFilled:!1,userIdErrorState:!1,isSetDefaultPaymentSuccessful:!1,isSettingDefaultPaymentMethods:!1,configIntegrationDefaultValue:"payment_page",configEmailEnabledDefaultValue:!0,configLineItemConsistencyEnabledDefaultValue:!0,configStorefrontInvoiceDownloadEnabledEnabledDefaultValue:!0,configStorefrontWebhooksUpdateEnabledDefaultValue:!0,configStorefrontPaymentsUpdateEnabledDefaultValue:!0,...d}},props:{isLoading:{type:Boolean,required:!0}},metaInfo(){return{title:this.$createTitle()}},watch:{config:{handler(e){const t=(this.$refs.configComponent.allConfigs||{}).null||{};this.$refs.configComponent.selectedSalesChannelId===null?(this.applicationKeyFilled=!!this.config[this.CONFIG_APPLICATION_KEY],this.spaceIdFilled=!!this.config[this.CONFIG_SPACE_ID],this.userIdFilled=!!this.config[this.CONFIG_USER_ID],this.CONFIG_INTEGRATION in this.config||(this.config[this.CONFIG_INTEGRATION]=this.configIntegrationDefaultValue),this.CONFIG_EMAIL_ENABLED in this.config||(this.config[this.CONFIG_EMAIL_ENABLED]=this.configEmailEnabledDefaultValue),this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config||(this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED]=this.configLineItemConsistencyEnabledDefaultValue),this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config||(this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED]=this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue),this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config||(this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED]=this.configStorefrontWebhooksUpdateEnabledDefaultValue),this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config||(this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED]=this.configStorefrontPaymentsUpdateEnabledDefaultValue)):(this.applicationKeyFilled=!!this.config[this.CONFIG_APPLICATION_KEY]||!!t[this.CONFIG_APPLICATION_KEY],this.spaceIdFilled=!!this.config[this.CONFIG_SPACE_ID]||!!t[this.CONFIG_SPACE_ID],this.userIdFilled=!!this.config[this.CONFIG_USER_ID]||!!t[this.CONFIG_USER_ID],(!(this.CONFIG_INTEGRATION in this.config)||!(this.CONFIG_INTEGRATION in t))&&(this.config[this.CONFIG_INTEGRATION]=this.configIntegrationDefaultValue),(!(this.CONFIG_EMAIL_ENABLED in this.config)||!(this.CONFIG_EMAIL_ENABLED in t))&&(this.config[this.CONFIG_EMAIL_ENABLED]=this.configEmailEnabledDefaultValue),(!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config)||!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in t))&&(this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED]=this.configLineItemConsistencyEnabledDefaultValue),(!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config)||!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in t))&&(this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED]=this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue),(!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config)||!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in t))&&(this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED]=this.configStorefrontWebhooksUpdateEnabledDefaultValue),(!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config)||!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in t))&&(this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED]=this.configStorefrontPaymentsUpdateEnabledDefaultValue)),this.$emit("salesChannelChanged"),this.$emit("update:value",e)},deep:!0}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"},getInheritValue(e){return this.selectedSalesChannelId==null?this.actualConfigData[e]:this.allConfigs.null[e]},async onSave(){if(!(this.spaceIdFilled&&this.userIdFilled&&this.applicationKeyFilled)){this.setErrorStates();return}this.isLoading=!0;const e=await this.validateHeadlessIntegration();if(e==="HEADLESS"){this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messageHeadlessIntegrationError")}),this.isLoading=!1;return}else if(e==="GLOBAL"){this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messageGlobalIframeError")}),this.isLoading=!1;return}this.save()},async validateHeadlessIntegration(){const e=this.$refs.configComponent.selectedSalesChannelId;if(this.config[this.CONFIG_INTEGRATION]==="payment_page")return null;const a=this.repositoryFactory.create("sales_channel");try{if(e){if(!((await a.get(e,Shopware.Context.api)).typeId.replace(/-/g,"")===d.STOREFRONT_SALES_CHANNEL_TYPE_ID))return"HEADLESS"}else{const n=new Shopware.Data.Criteria;if(n.addFilter(Shopware.Data.Criteria.not("AND",[Shopware.Data.Criteria.equals("typeId",d.STOREFRONT_SALES_CHANNEL_TYPE_ID)])),n.setLimit(1),(await a.search(n,Shopware.Context.api)).total>0)return"GLOBAL"}return null}catch(n){return console.error(n),null}},save(){this.isLoading=!0,this.$refs.configComponent.save().then(e=>{e&&(this.config=e),this.registerWebHooks(),this.synchronizePaymentMethodConfiguration(),this.installOrderDeliveryStates()}).catch(e=>{console.error("Error:",e),this.isLoading=!1})},registerWebHooks(){if(this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED]===!1)return!1;this.VRPaymentConfigurationService.registerWebHooks(this.$refs.configComponent.selectedSalesChannelId).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.settingForm.messageWebHookUpdated")})}).catch(e=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messageWebHookError")}),this.isLoading=!1,console.error("Error:",e)})},synchronizePaymentMethodConfiguration(){if(this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED]===!1)return!1;this.VRPaymentConfigurationService.synchronizePaymentMethodConfiguration(this.$refs.configComponent.selectedSalesChannelId).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.settingForm.messagePaymentMethodConfigurationUpdated")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messagePaymentMethodConfigurationError")}),this.isLoading=!1,console.error("Error:",e)})},installOrderDeliveryStates(){this.VRPaymentConfigurationService.installOrderDeliveryStates().then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.settingForm.messageOrderDeliveryStateUpdated")}),this.isLoading=!1}).catch(()=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messageOrderDeliveryStateError")}),this.isLoading=!1})},onSetPaymentMethodDefault(){this.isSettingDefaultPaymentMethods=!0,this.VRPaymentConfigurationService.setVRPaymentAsSalesChannelPaymentDefault(this.$refs.configComponent.selectedSalesChannelId).then(()=>{this.isSettingDefaultPaymentMethods=!1,this.isSetDefaultPaymentSuccessful=!0,this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.salesChannelCard.messageDefaultPaymentUpdated")})})},setErrorStates(){const e={code:1,detail:this.$tc("vrpayment-settings.messageNotBlank")};this.spaceIdFilled||(this.spaceIdErrorState=e),this.userIdFilled||(this.userIdErrorState=e),this.applicationKeyFilled||(this.applicationKeyErrorState=e)},onCheckApiConnection(e){const{spaceId:t,userId:a,applicationKey:n}=e;this.isTesting=!0,this.VRPaymentConfigurationService.checkApiConnection(t,a,n).then(i=>{i.result===200?this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.credentials.alert.title"),message:this.$tc("vrpayment-settings.settingForm.credentials.alert.successMessage")}):this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.credentials.alert.title"),message:this.$tc("vrpayment-settings.settingForm.credentials.alert.errorMessage")}),this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.credentials.alert.title"),message:this.$tc("vrpayment-settings.settingForm.credentials.alert.errorMessage")}),this.isTesting=!1})}}});const ve=`{% block vrpayment_settings_content_card_channel_config_credentials %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}
    {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_id %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_user_id %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_application_key %} {% endblock %}
    {% endblock %} {% verbatim %} {{ $tc('vrpayment-settings.settingForm.credentials.button.label') }} {% endverbatim %}
    {% endblock %}
    {% endblock %}`,{Component:_e,Mixin:Ie}=Shopware;_e.register("sw-vrpayment-credentials",{template:ve,name:"VRPaymentCredentials",inject:["acl"],mixins:[Ie.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{type:[String,null],required:!1,default:null},spaceIdFilled:{type:Boolean,required:!0},spaceIdErrorState:{required:!0},userIdFilled:{type:Boolean,required:!0},userIdErrorState:{required:!0},applicationKeyFilled:{type:Boolean,required:!0},applicationKeyErrorState:{required:!0},isLoading:{type:Boolean,required:!0},isTesting:{type:Boolean,required:!1}},data(){return{...d}},computed:{currentConfig(){return this.selectedSalesChannelId&&this.allConfigs[this.selectedSalesChannelId]?this.allConfigs[this.selectedSalesChannelId]:this.allConfigs.null||{}}},methods:{checkTextFieldInheritance(e){return!e||e.length<=0},checkNumberFieldInheritance(e){return e==null||e===""},checkBoolFieldInheritance(e){return typeof e!="boolean"},emitCheckApiConnectionEvent(){const e={spaceId:this.currentConfig[d.CONFIG_SPACE_ID],userId:this.currentConfig[d.CONFIG_USER_ID],applicationKey:this.currentConfig[d.CONFIG_APPLICATION_KEY]};this.$emit("check-api-connection-event",e)},getInheritedValue(e){var t;return((t=this.allConfigs.null)==null?void 0:t[e])??null}}});const Ce=`{% block vrpayment_settings_content_card_channel_config_options %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}
    {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_view_id %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_integration %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_line_item_consistency_enabled %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_email_enabled %} {% endblock %}
    {% endblock %}
    {% endblock %}
    {% endblock %}`,{Component:Ee,Mixin:Se}=Shopware;Ee.register("sw-vrpayment-options",{template:Ce,name:"VRPaymentOptions",mixins:[Se.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data(){return{...d}},computed:{integrationOptions(){return[{id:"payment_page",name:this.$tc("vrpayment-settings.settingForm.options.integration.options.payment_page")},{id:"iframe",name:this.$tc("vrpayment-settings.settingForm.options.integration.options.iframe")}]}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"}}});const we='{% block vrpayment_settings_icon %} {% endblock %}',{Component:Ae}=Shopware;Ae.register("sw-vrpayment-settings-icon",{template:we});const Te=`
    `,{Component:Pe,Mixin:De}=Shopware;Pe.register("sw-vrpayment-storefront-options",{template:Te,name:"VRPaymentStorefrontOptions",mixins:[De.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data(){return{...d}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"}}});const Ne=`
    `,{Component:Re,Mixin:ke}=Shopware;Re.register("sw-vrpayment-advanced-options",{template:Ne,name:"VRPaymentAdvancedOptions",inject:["acl"],mixins:[ke.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data(){return{...d}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"}}});const $e={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment plugin"},vrpayment:{label:"VRPayment berechtigungen"}}},"vrpayment-settings":{general:{descriptionTextModule:"VRPayment-Einstellungen",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"Dieser Wert sollte nicht leer sein.",salesChannelCard:{button:{description:"Klicken Sie auf diese Schaltfläche, um VRPayment als Standard-Zahlungsabwickler im ausgewählten Vertriebskanal festzulegen",label:"VRPayment als Standard-Zahlungsabwickler festlegen"},messageDefaultPaymentError:"VRPayment als Standard-Zahlungsabwickler konnte nicht festgelegt werden..",messageDefaultPaymentUpdated:"VRPayment als Standard-Zahlungsabwickler wurde festgelegt."},settingForm:{credentials:{applicationKey:{label:"Application Key",tooltipText:"Der Anwendungsschlüssel wird verwendet, um dieses Plugin mit der API VRPayment zu authentifizieren."},cardTitle:"Anmeldedaten",spaceId:{label:"Space ID",tooltipText:"Die Space ID wird verwendet, um dieses Plugin mit der API VRPayment zu authentifizieren."},userId:{label:"User ID",tooltipText:"Die Benutzer-ID wird verwendet, um dieses Plugin mit der VRPayment-API zu authentifizieren."},button:{description:"Klicken Sie auf diese Schaltfläche, um die VRPayment API zu testen",label:"API Verbindung testen"},alert:{title:"API-Test",successMessage:"Die Verbindung wurde erfolgreich getestet.",errorMessage:"Die Verbindung ist fehlgeschlagen. Versuchen Sie es erneut."}},messageSaveSuccess:"VRPayment-Einstellungen wurden gespeichert.",messageOrderDeliveryStateError:"VRPayment OrderDeliveryState konnte nicht gespeichert werden.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState wurde aktualisiert.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration konnte nicht gespeichert werden. Bitte überprüfen Sie Ihre Anmeldedaten.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration wurde registriert.",messageWebHookError:"VRPayment WebHook konnte nicht gespeichert werden. Bitte überprüfen Sie Ihre Zugangsdaten.",messageWebHookUpdated:"VRPayment WebHook wurde aktualisiert.",options:{cardTitle:"Optionen",emailEnabled:{label:"Auftragsbestätigung per E-Mail senden",tooltipText:"Wenn diese Einstellung aktiviert ist, erhalten Ihre Kunden eine E-Mail von Ihrem Geschäft, wenn die Zahlung ihrer Bestellung autorisiert ist."},integration:{label:"Integration",options:{iframe:"Iframe",payment_page:"Payment Page"},tooltipText:"Integration"},lineItemConsistencyEnabled:{label:"Konsistenz der Einzelposten",tooltipText:"Wenn diese Option aktiviert ist, stimmen die Summen der Einzelposten in VRPaymentPayment immer mit der Shopware-Bestellsumme überein."},spaceViewId:{label:"Space View ID",tooltipText:"Space View ID"}},save:"Speichern",storefrontOptions:{cardTitle:"Storefront-Optionen",invoiceDownloadEnabled:{label:"Rechnung Download",tooltipText:"Wenn diese Einstellung aktiviert ist, können Ihre Kunden Auftragsrechnungen von VRPayment herunterladen."}},advancedOptions:{cardTitle:"Erweiterte-Optionen",webhooksUpdateEnabled:{label:"Webhooks-Update",tooltipText:"Wenn diese Einstellung aktiviert ist, wird das Webhook-Update ausgelöst, wenn Sie die Einstellungen speichern"},paymentsUpdateEnabled:{label:"Payments-Update",tooltipText:"Wenn diese Einstellung aktiviert ist, wird die Aktualisierung der Zahlungsmethoden ausgelöst, wenn Sie die Einstellungen speichern"}},titleError:"Fehler",titleSuccess:"Erfolg"}}},Oe={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment plugin"},vrpayment:{label:"VRPayment permissions"}}},"vrpayment-settings":{general:{descriptionTextModule:"VRPayment settings",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"This value should not be blank.",salesChannelCard:{button:{description:"Click this button to set VRPayment as default payment handler in the selected SalesChannel",label:"Set VRPayment as default payment handler"},messageDefaultPaymentError:"VRPayment as default payment could not be set.",messageDefaultPaymentUpdated:"VRPayment as default payment has been set."},settingForm:{credentials:{applicationKey:{label:"Application Key",tooltipText:"The Application Key is used to authenticate this plugin with the VRPayment API."},cardTitle:"Credentials",spaceId:{label:"Space ID",tooltipText:"The space ID is used to authenticate this plugin with the VRPayment API."},userId:{label:"User ID",tooltipText:"The user ID is used to authenticate this plugin with the VRPayment API."},button:{description:"Click this button to test the VRPayment API",label:"API connection test"},alert:{title:"API Test",successMessage:"The connection was successfully tested.",errorMessage:"The connection was failed. Try it again."}},messageSaveSuccess:"VRPayment settings have been saved.",messageOrderDeliveryStateError:"VRPayment OrderDeliveryState could not be saved.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState has been updated.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration could not be saved. Please check your credentials.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration has been registered.",messageWebHookError:"VRPayment WebHook could not be saved. Please check your credentials.",messageWebHookUpdated:"VRPayment WebHook has been updated.",messageHeadlessIntegrationError:"Iframe integration is only supported for Storefront Sales Channels.",messageGlobalIframeError:"Iframe integration cannot be set globally because you have non-Storefront Sales Channels.",options:{cardTitle:"Options",emailEnabled:{label:"Send order confirmation email",tooltipText:"If this setting is enabled your customers will receive an email from your store when their order payment is authorised"},integration:{label:"Integration",options:{iframe:"Iframe",payment_page:"Payment Page"},tooltipText:"Integration"},lineItemConsistencyEnabled:{label:"Line item consistency",tooltipText:"If this option is enabled line item totals in VRPaymentPayment will always match Shopware order total"},spaceViewId:{label:"Space View ID",tooltipText:"Space View ID"}},save:"Save",storefrontOptions:{cardTitle:"Storefront Options",invoiceDownloadEnabled:{label:"Invoice Download",tooltipText:"If this setting is enabled your customers will be able to download order invoices from VRPayment"}},advancedOptions:{cardTitle:"Advanced Options",webhooksUpdateEnabled:{label:"Webhooks Update",tooltipText:"If this setting is enabled webhook update will be triggered when you save settings"},paymentsUpdateEnabled:{label:"Payments Update",tooltipText:"If this setting is enabled payment methods update will be triggered when you save settings"}},titleError:"Error",titleSuccess:"Success"}}},xe={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment brancher"},vrpayment:{label:"VRPayment autorisations"}}},"vrpayment-settings":{general:{descriptionTextModule:"Paramètres de VRPayment",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"Cette valeur ne doit pas être vide.",salesChannelCard:{button:{description:"Cliquez sur ce bouton pour définir VRPayment comme gestionnaire de paiement par défaut dans le canal de vente sélectionné.",label:"Définir VRPayment comme gestionnaire de paiement par défaut"},messageDefaultPaymentError:"VRPayment comme paiement par défaut n'a pas pu être défini.",messageDefaultPaymentUpdated:"VRPayment comme paiement par défaut a été défini."},settingForm:{credentials:{applicationKey:{label:"Application Key",tooltipText:"La clé d'application est utilisée pour authentifier ce plugin avec l'API."},cardTitle:"Références",spaceId:{label:"Space ID",tooltipText:"L'ID de l'espace est utilisé pour authentifier ce plugin avec l'API VRPayment.."},userId:{label:"User ID",tooltipText:"L'ID utilisateur est utilisé pour authentifier ce plugin avec l'API VRPayment."},button:{description:"Cliquez sur ce bouton pour tester l'API VRPayment.",label:"Test de connexion à l'API"},alert:{title:"Test API",successMessage:"La connexion a été testée avec succès.",errorMessage:"La connexion a échoué. Réessayez."}},messageSaveSuccess:"Les paramètres de VRPayment ont été enregistrés.",messageOrderDeliveryStateError:"Les paramètres de VRPayment OrderDeliveryState n'ont pas pu être enregistrés.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState a été mis à jour.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration n'a pas pu être enregistré. Veuillez vérifier vos informations d'identification.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration a été enregistré.",messageWebHookError:"VRPayment WebHook n'a pas pu être enregistré. Veuillez vérifier vos informations d'identification.",messageWebHookUpdated:"VRPayment WebHook a été mis à jour.",options:{cardTitle:"Options",emailEnabled:{label:"Envoyer un e-mail de confirmation de commande",tooltipText:"If this setting is enabled your customers will receive an email from your store when their order payment is authorised"},integration:{label:"Integration",options:{iframe:"Iframe",payment_page:"Page de paiement"},tooltipText:"Integration"},lineItemConsistencyEnabled:{label:"Cohérence des postes de ligne",tooltipText:"Si cette option est activée, les totaux des articles dans VRPaymentPayment correspondront toujours au total de la commande Shopware."},spaceViewId:{label:"Space View ID",tooltipText:"Space View ID"}},save:"Enregistrer",storefrontOptions:{cardTitle:"Storefront Options",invoiceDownloadEnabled:{label:"Téléchargement de facture",tooltipText:"Si ce paramètre est activé, vos clients pourront télécharger les factures de commande depuis VRPayment"}},advancedOptions:{cardTitle:"Options avancées",webhooksUpdateEnabled:{label:"Mise à jour des webhooks",tooltipText:"Si ce paramètre est activé, la mise à jour des webhooks sera déclenchée lorsque vous enregistrerez les paramètres."},paymentsUpdateEnabled:{label:"Mise à jour des paiements",tooltipText:"Si ce paramètre est activé, la mise à jour des méthodes de paiement sera déclenchée lorsque vous enregistrez les paramètres."}},titleError:"Erreur",titleSuccess:"Succès"}}},Fe={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment brancher"},vrpayment:{label:"VRPayment autorisations"}}},"vrpayment-settings":{general:{descriptionTextModule:"Impostazioni VRPayment",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"Questo valore non dovrebbe essere vuoto.",salesChannelCard:{button:{description:"Fai clic su questo pulsante per impostare VRPayment come gestore di pagamento predefinito nel SalesChannel selezionato",label:"Imposta VRPayment come gestore di pagamento predefinito"},messageDefaultPaymentError:"Non è stato possibile impostare VRPayment come pagamento predefinito.",messageDefaultPaymentUpdated:"VRPayment come pagamento predefinito è stato impostato."},settingForm:{credentials:{applicationKey:{label:"Chiave di applicazione",tooltipText:"La chiave dell'applicazione è usata per autenticare questo plugin con l'API VRPayment."},cardTitle:"Credenziali",spaceId:{label:"ID spazio",tooltipText:"L'ID dello spazio è usato per autenticare questo plugin con l'API VRPayment."},userId:{label:"ID utente",tooltipText:"L'ID utente è usato per autenticare questo plugin con l'API VRPayment."},button:{description:"Fare clic su questo pulsante per testare l'API VRPayment.",label:"Test di connessione API"},alert:{title:"Test API",successMessage:"La connessione è stata testata con successo.",errorMessage:"La connessione è fallita. Riprovare."}},messageSaveSuccess:"Le impostazioni di VRPayment sono state salvate.",messageOrderDeliveryStateError:"VRPayment OrderDeliveryState non può essere salvato.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState è stato aggiornato.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration non può essere salvato. Per favore controlla le tue credenziali.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration è stato registrato.",messageWebHookError:"VRPayment WebHook non può essere salvato. Per favore controlla le tue credenziali.",messageWebHookUpdated:"VRPayment WebHook è stato aggiornato.",options:{cardTitle:"Opzioni",emailEnabled:{label:"Invia email di conferma dell'ordine",tooltipText:"Se questa impostazione è abilitata i tuoi clienti riceveranno un'email dal tuo negozio quando il pagamento del loro ordine sarà autorizzato"},integration:{label:"Integrazione",options:{iframe:"Iframe",payment_page:"Pagina di pagamento"},tooltipText:"Integrazione"},lineItemConsistencyEnabled:{label:"Coerenza dell'elemento linea",tooltipText:"Se questa opzione è abilitata i totali degli articoli in VRPaymentPayment corrisponderanno sempre al totale dell'ordine Shopware"},spaceViewId:{label:"ID della vista spazio",tooltipText:"ID della vista spaziale"}},save:"Salva",storefrontOptions:{cardTitle:"Opzioni vetrina",invoiceDownloadEnabled:{label:"Scaricamento fattura",tooltipText:"Se questa impostazione è abilitata i tuoi clienti potranno scaricare le fatture degli ordini da VRPayment"}},advancedOptions:{cardTitle:"Opzioni avanzate",webhooksUpdateEnabled:{label:"Aggiornamento webhooks",tooltipText:"Se questa impostazione è abilitata l'aggiornamento dei webhook sarà attivato quando si salvano le impostazioni"},paymentsUpdateEnabled:{label:"Aggiornamento pagamenti",tooltipText:"Se questa impostazione è abilitata l'aggiornamento dei metodi di pagamento verrà attivato quando si salvano le impostazioni"}},titleError:"Errore",titleSuccess:"Successo"}}},{Module:Ve}=Shopware;Ve.register("vrpayment-settings",{type:"plugin",name:"VRPayment",title:"vrpayment-settings.general.descriptionTextModule",description:"vrpayment-settings.general.descriptionTextModule",color:"#28d8ff",icon:"default-action-settings",version:"1.0.1",targetVersion:"1.0.1",snippets:{"de-DE":$e,"en-GB":Oe,"fr-FR":xe,"it-IT":Fe},routes:{index:{component:"vrpayment-settings",path:"index",meta:{parentPath:"sw.settings.index",privilege:"vrpayment.viewer"},props:{default:e=>({hash:e.params.hash})}}},settingsItem:{group:"plugins",to:"vrpayment.settings.index",iconComponent:"sw-vrpayment-settings-icon",backgroundEnabled:!0,privilege:"vrpayment.viewer"}});const p=Shopware.Classes.ApiService;class Le extends p{constructor(t,a,n="vrpayment"){super(t,a,n)}registerWebHooks(t=null){const a=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/register-web-hooks`;return this.httpClient.post(n,{salesChannelId:t},{headers:a}).then(i=>p.handleResponse(i))}checkApiConnection(t=null,a=null,n=null){const i=this.getBasicHeaders(),o=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/check-api-connection`;return this.httpClient.post(o,{spaceId:t,userId:a,applicationId:n},{headers:i}).then(s=>p.handleResponse(s))}setVRPaymentAsSalesChannelPaymentDefault(t=null){const a=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/set-vrpayment-as-sales-channel-payment-default`;return this.httpClient.post(n,{salesChannelId:t},{headers:a}).then(i=>p.handleResponse(i))}synchronizePaymentMethodConfiguration(t=null){const a=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/synchronize-payment-method-configuration`;return this.httpClient.post(n,{salesChannelId:t},{headers:a}).then(i=>p.handleResponse(i))}installOrderDeliveryStates(){const t=this.getBasicHeaders(),a=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/install-order-delivery-states`;return this.httpClient.post(a,{},{headers:t}).then(n=>p.handleResponse(n))}}const h=Shopware.Classes.ApiService;class Me extends h{constructor(t,a,n="vrpayment"){super(t,a,n)}createRefund(t,a,n,i){const o=this.getBasicHeaders(),s=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund/`;return this.httpClient.post(s,{salesChannelId:t,transactionId:a,quantity:n,lineItemId:i},{headers:o}).then(r=>h.handleResponse(r))}createRefundByAmount(t,a,n){const i=this.getBasicHeaders(),o=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund-by-amount/`;return this.httpClient.post(o,{salesChannelId:t,transactionId:a,refundableAmount:n},{headers:i}).then(s=>h.handleResponse(s))}createPartialRefund(t,a,n,i){const o=this.getBasicHeaders(),s=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-partial-refund/`;return this.httpClient.post(s,{salesChannelId:t,transactionId:a,refundableAmount:n,lineItemId:i},{headers:o}).then(r=>h.handleResponse(r))}}const E=Shopware.Classes.ApiService;class Be extends E{constructor(t,a,n="vrpayment"){super(t,a,n)}getTransactionData(t,a){const n=this.getBasicHeaders(),i=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-transaction-data/`;return this.httpClient.post(i,{salesChannelId:t,transactionId:a},{headers:n}).then(o=>E.handleResponse(o))}getInvoiceDocument(t,a){return`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-invoice-document/${t}/${a}`}getPackingSlip(t,a){return`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-packing-slip/${t}/${a}`}}const S=Shopware.Classes.ApiService;class ze extends S{constructor(t,a,n="vrpayment"){super(t,a,n)}createTransactionCompletion(t,a){const n=this.getBasicHeaders(),i=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-completion/create-transaction-completion/`;return this.httpClient.post(i,{salesChannelId:t,transactionId:a},{headers:n}).then(o=>S.handleResponse(o))}}const w=Shopware.Classes.ApiService;class Ge extends w{constructor(t,a,n="vrpayment"){super(t,a,n)}createTransactionVoid(t,a){const n=this.getBasicHeaders(),i=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-void/create-transaction-void/`;return this.httpClient.post(i,{salesChannelId:t,transactionId:a},{headers:n}).then(o=>w.handleResponse(o))}}const{Application:m}=Shopware;m.addServiceProvider("VRPaymentConfigurationService",e=>{const t=m.getContainer("init");return new Le(t.httpClient,e.loginService)});m.addServiceProvider("VRPaymentRefundService",e=>{const t=m.getContainer("init");return new Me(t.httpClient,e.loginService)});m.addServiceProvider("VRPaymentTransactionService",e=>{const t=m.getContainer("init");return new Be(t.httpClient,e.loginService)});m.addServiceProvider("VRPaymentTransactionCompletionService",e=>{const t=m.getContainer("init");return new ze(t.httpClient,e.loginService)});m.addServiceProvider("VRPaymentTransactionVoidService",e=>{const t=m.getContainer("init");return new Ge(t.httpClient,e.loginService)}); +//# sourceMappingURL=v-r-payment-payment-BV391wJu.js.map diff --git a/src/Resources/public/administration/assets/v-r-payment-payment-BV391wJu.js.map b/src/Resources/public/administration/assets/v-r-payment-payment-BV391wJu.js.map new file mode 100644 index 0000000..91514d4 --- /dev/null +++ b/src/Resources/public/administration/assets/v-r-payment-payment-BV391wJu.js.map @@ -0,0 +1 @@ +{"version":3,"file":"v-r-payment-payment-BV391wJu.js","sources":["../../../app/administration/src/module/vrpayment-order/extension/sw-order/sw-order.html.twig","../../../app/administration/src/module/vrpayment-order/extension/sw-order/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-completion/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-completion/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-partial/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-partial/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-void/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-void/index.js","../../../app/administration/src/module/vrpayment-order/page/vrpayment-order-detail/index.html.twig","../../../app/administration/src/module/vrpayment-order/page/vrpayment-order-detail/index.js","../../../app/administration/src/module/vrpayment-order/index.js","../../../app/administration/src/module/vrpayment-settings/acl/index.js","../../../app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.html.twig","../../../app/administration/src/module/vrpayment-settings/page/vrpayment-settings/configuration-constants.js","../../../app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-credentials/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-credentials/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-options/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-options/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-settings-icon/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-settings-icon/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-storefront-options/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-storefront-options/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-advanced-options/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-advanced-options/index.js","../../../app/administration/src/module/vrpayment-settings/index.js","../../../app/administration/src/core/service/api/vrpayment-configuration.service.js","../../../app/administration/src/core/service/api/vrpayment-refund.service.js","../../../app/administration/src/core/service/api/vrpayment-transaction.service.js","../../../app/administration/src/core/service/api/vrpayment-transaction-completion.service.js","../../../app/administration/src/core/service/api/vrpayment-transaction-void.service.js","../../../app/administration/src/init/api-service.init.js"],"sourcesContent":["{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n{# sw-tabs-item will dissappear. See: https://github.com/shopware/shopware/blob/trunk/UPGRADE-6.7.md#sw-tabs-is-removed #}\n\n\t{{ $tc('vrpayment-order.header') }}\n\n{% endblock %}\n\n{% block sw_order_detail_actions_slot_smart_bar_actions %}\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './sw-order.html.twig';\nimport './sw-order.scss';\n\nconst {Component, Context} = Shopware;\nconst Criteria = Shopware.Data.Criteria;\n\nconst vrpaymentFormattedHandlerIdentifier = 'handler_vrpaymentpayment_vrpaymentpaymenthandler';\n\nComponent.override('sw-order-detail', {\n\ttemplate,\n\n\tdata() {\n\t\treturn {\n\t\t\tisVRPaymentPayment: false\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tisEditable() {\n\t\t\treturn !this.isVRPaymentPayment || this.$route.name !== 'vrpayment.order.detail';\n\t\t},\n\t\tshowTabs() {\n\t\t\treturn true;\n\t\t}\n\t},\n\n\twatch: {\n\t\torderId: {\n\t\t\tdeep: true,\n\t\t\thandler() {\n\t\t\t\tif (!this.orderId) {\n\t\t\t\t\tthis.setIsVRPaymentPayment(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst orderRepository = this.repositoryFactory.create('order');\n\t\t\t\tconst orderCriteria = new Criteria(1, 1);\n\t\t\t\torderCriteria.addAssociation('transactions');\n\n\t\t\t\torderRepository.get(this.orderId, Context.api, orderCriteria).then((order) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(order.amountTotal <= 0) ||\n\t\t\t\t\t\t(order.transactions.length <= 0) ||\n\t\t\t\t\t\t!order.transactions[0].paymentMethodId\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.setIsVRPaymentPayment(null);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst paymentMethodId = order.transactions[0].paymentMethodId;\n\t\t\t\t\tif (paymentMethodId !== undefined && paymentMethodId !== null) {\n\t\t\t\t\t\tthis.setIsVRPaymentPayment(paymentMethodId);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\timmediate: true\n\t\t}\n\t},\n\n\tmethods: {\n\t\tsetIsVRPaymentPayment(paymentMethodId) {\n\t\t\tif (!paymentMethodId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst paymentMethodRepository = this.repositoryFactory.create('payment_method');\n\t\t\tpaymentMethodRepository.get(paymentMethodId, Context.api).then(\n\t\t\t\t(paymentMethod) => {\n\t\t\t\t\tthis.isVRPaymentPayment = (paymentMethod.formattedHandlerIdentifier === vrpaymentFormattedHandlerIdentifier);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_completion %}\n\n\n\t{% block vrpayment_order_action_completion_amount %}\n\t\t\n \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_completion_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-completion', {\n\n\ttemplate: template,\n\n\tinject: ['VRPaymentTransactionCompletionService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tisCompletion: false\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t},\n\n\t\tcompletion() {\n\t\t\tif (this.isCompletion) {\n\t\t\t\tthis.isLoading = true;\n\t\t\t\tthis.VRPaymentTransactionCompletionService.createTransactionCompletion(\n\t\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\t\tthis.transactionData.transactions[0].id\n\t\t\t\t).then(() => {\n\t\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.captureAction.successTitle'),\n\t\t\t\t\t\tmessage: this.$tc('vrpayment-order.captureAction.successMessage')\n\t\t\t\t\t});\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}).catch((errorResponse) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_refund %}\n\n\n\t{% block vrpayment_order_action_refund_amount %}\n\n\t\t\n\t\t\n\n\t\t
    \n\t\t\t{{ $tc('vrpayment-order.refundAction.maxAvailableItemsToRefund') }}:\n\t\t\t{{ this.$parent.$parent.itemRefundableQuantity }}\n\t\t
    \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_refund_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n
    \n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-refund', {\n\ttemplate,\n\n\tinject: ['VRPaymentRefundService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\n\t\torderId: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\trefundQuantity: 0,\n\t\t\tisLoading: true,\n\t\t\tcurrentLineItem: '',\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t\tthis.refundQuantity = 1;\n\t\t},\n\n\t\trefund() {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createRefund(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\tthis.refundQuantity,\n\t\t\t\tthis.$parent.$parent.currentLineItem\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tthis.$emit('modal-close');\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t});\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tvar errorTitle = errorResponse?.response?.data?.errors?.[0]?.title ?? this.$tc('vrpayment-order.refundAction.refundCreateError.errorTitle')\n\t\t\t\t\tvar errorMessage;\n\t\t\t\t\tswitch(errorResponse.response.data) {\n\t\t\t\t\t\tcase 'refundQuantityZero':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundQuantityIsZero');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'refundExceedsQuantity':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundQuantityExceedsAvailableBalance');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\terrorMessage = errorResponse.response.data.errors[0].detail;\n\t\t\t\t\t}\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorTitle,\n\t\t\t\t\t\tmessage: errorMessage,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_refund_partial %}\n\n\n\t{% block vrpayment_order_action_refund_amount_partial %}\n\t\t\n\t\t\n\n\t\t
    \n\t\t\t{{ $tc('vrpayment-order.refundAction.maxAvailableAmountToRefund') }}:\n\t\t\t{{ this.$parent.$parent.itemRefundableAmount }}\n\t\t
    \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_refund_confirm_button_partial %}\n\t\n\t{% endblock %}\n\n\t\n
    \n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-refund-partial', {\n\ttemplate,\n\n\tinject: ['VRPaymentRefundService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\n\t\torderId: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tcurrency: this.transactionData.transactions[0].currency,\n\t\t\trefundAmount: 0.00,\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n createdComponent() {\n this.isLoading = false;\n this.currency = this.transactionData.transactions[0].currency;\n if (!this.refundAmount) {\n this.refundAmount = this.$parent.$parent.itemRefundableAmount;\n }\n },\n\n\t\tcreatePartialRefund(itemUniqueId) {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createPartialRefund(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\tthis.refundAmount,\n\t\t\t\titemUniqueId\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tthis.$emit('modal-close');\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t});\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t},\n\n watch: {\n refundAmount(newValue) {\n if (newValue !== null) {\n this.refundAmount = Math.round(newValue * 100) / 100;\n }\n }\n }\n});\n","{% block vrpayment_order_action_refund_by_amount %}\n\n\n\t{% block vrpayment_order_action_refund_amount_by_amount %}\n\t\t\n\t\t\n\t{% endblock %}\n\n\t{% block vrpayment_order_action_refund_confirm_button_by_amount %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-refund-by-amount', {\n\ttemplate,\n\n\tinject: ['VRPaymentRefundService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\n\t\torderId: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tcurrency: this.transactionData.transactions[0].currency,\n\t\t\trefundAmount: 0,\n\t\t\trefundableAmount: 0,\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t\tthis.currency = this.transactionData.transactions[0].currency;\n\t\t\tthis.refundAmount = Number(this.transactionData.transactions[0].amountIncludingTax);\n\t\t\tthis.refundableAmount = Number(this.transactionData.transactions[0].amountIncludingTax);\n\t\t},\n\n\t\trefundByAmount() {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createRefundByAmount(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\tthis.refundAmount\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tthis.$emit('modal-close');\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t});\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tvar errorTitle = errorResponse?.response?.data?.errors?.[0]?.title ?? this.$tc('vrpayment-order.refundAction.refundCreateError.errorTitle')\n\t\t\t\t\tvar errorMessage;\n\t\t\t\t\tswitch(errorResponse.response.data) {\n\t\t\t\t\t\tcase 'refundAmountZero':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundAmountIsZero');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'refundExceedsAmount':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundAmountExceedsAvailableBalance');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\terrorMessage = errorResponse.response.data.errors[0].detail;\n\t\t\t\t\t}\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorTitle,\n\t\t\t\t\t\tmessage: errorMessage,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_void %}\n\n\n\t{% block vrpayment_order_action_void_amount %}\n {# Review if this v-model:checked=\"isVoid\" needs to change to checked #}\n\t\t\n \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_void_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-void', {\n\ttemplate,\n\n\tinject: ['VRPaymentTransactionVoidService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tisVoid: false\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t},\n\t\tlineItemColumns() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tproperty: 'uniqueId',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.uniqueId'),\n\t\t\t\t\trawData: false,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tprimary: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'name',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.name'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'quantity',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.quantity'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'amountIncludingTax',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.amountIncludingTax'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tinlineEdit: 'string',\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'type',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.type'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'taxAmount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.taxAmount'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t}\n\t\t\t];\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t\tthis.currency = this.transactionData.transactions[0].currency;\n\t\t\tthis.refundableAmount = this.transactionData.transactions[0].amountIncludingTax;\n\t\t\tthis.refundAmount = this.transactionData.transactions[0].amountIncludingTax;\n\t\t},\n\n\t\tvoidPayment() {\n\t\t\tif (this.isVoid) {\n\t\t\t\tthis.isLoading = true;\n\t\t\t\tthis.VRPaymentTransactionVoidService.createTransactionVoid(\n\t\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\t\tthis.transactionData.transactions[0].id\n\t\t\t\t).then(() => {\n\t\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.voidAction.successTitle'),\n\t\t\t\t\t\tmessage: this.$tc('vrpayment-order.voidAction.successMessage')\n\t\t\t\t\t});\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}).catch((errorResponse) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n});\n","{% block vrpayment_order_detail %}\n
    \n\t
    \n\t\t\n\t\t\t\n\t\t\n\t\t{% block vrpayment_order_transaction_history_card %}\n\t\t\n\t\t\t\n\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_transaction_line_items_card %}\n \n \n \n\t\t{% endblock %}\n\t\t{% block vrpayment_order_transaction_refunds_card %}\n\t\t 0\">\n\t\t\t\n\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_refund_partial %}\n\t\t\t\n\t\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_refund %}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_refund_by_amount %}\n\t\t\t\n\t\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_completion%}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_void %}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t
    \n\t\n
    \n{% endblock %}\n","/* global Shopware */\n\nimport '../../component/vrpayment-order-action-completion';\nimport '../../component/vrpayment-order-action-refund';\nimport '../../component/vrpayment-order-action-refund-partial';\nimport '../../component/vrpayment-order-action-refund-by-amount';\nimport '../../component/vrpayment-order-action-void';\nimport template from './index.html.twig';\nimport './index.scss';\n\nconst {Component, Mixin, Filter, Context, Utils} = Shopware;\nconst Criteria = Shopware.Data.Criteria;\n\nComponent.register('vrpayment-order-detail', {\n\ttemplate,\n\n\tinject: [\n\t\t'VRPaymentTransactionService',\n\t\t'VRPaymentRefundService',\n\t\t'repositoryFactory'\n\t],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\ttransactionData: {\n\t\t\t\ttransactions: [],\n\t\t\t\trefunds: []\n\t\t\t},\n\t\t\ttransaction: {},\n\t\t\tlineItems: [],\n\t\t\trefundableQuantity: 0,\n\t\t\titemRefundableQuantity: 0,\n\t\t\tisLoading: true,\n\t\t\torderId: '',\n\t\t\tcurrency: '',\n\t\t\tmodalType: '',\n\t\t\trefundAmount: 0.00,\n\t\t\trefundableAmount: 0.00,\n\t\t\titemRefundedAmount: 0.00,\n\t\t\titemRefundedQuantity: 0,\n\t\t\titemRefundableAmount: 0.00,\n\t\t\tcurrentLineItem: '',\n\t\t\trefundLineItemQuantity: [],\n\t\t\trefundLineItemAmount: [],\n\t\t\tselectedItems: []\n\t\t};\n\t},\n\n\tmetaInfo() {\n\t\treturn {\n\t\t\ttitle: this.$tc('vrpayment-order.header')\n\t\t};\n\t},\n\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t},\n\n\t\trelatedResourceColumns() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tproperty: 'paymentMethodName',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.payment_method'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'state',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.state'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'currency',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.currency'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'authorized_amount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.authorized_amount'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'id',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.transaction'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'customerId',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.customer'),\n\t\t\t\t\trawData: true\n\t\t\t\t}\n\t\t\t];\n\t\t},\n\n\t\tlineItemColumns() {\n\t\t\treturn [\n\t\t\t // It must be set in order to have correctly working checkbox mechanism\n\t\t\t\t{\n\t\t\t\t\tproperty: 'id',\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tprimary: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'uniqueId',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.uniqueId'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tprimary: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'name',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.name'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'quantity',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.quantity'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'amountIncludingTax',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.amountIncludingTax'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'type',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.type'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'taxAmount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.taxAmount'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'refundableQuantity',\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: false,\n\t\t\t\t},\n\t\t\t];\n\t\t},\n\n\t\trefundColumns() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tproperty: 'id',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.id'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: true,\n\t\t\t\t\tprimary: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'amount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.amount'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'state',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.state'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'createdOn',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.createdOn'),\n\t\t\t\t\trawData: true\n\t\t\t\t}\n\t\t\t];\n\t\t}\n\t},\n\n\twatch: {\n\t\t'$route'() {\n\t\t\tthis.resetDataAttributes();\n\t\t\tthis.createdComponent();\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.orderId = this.$route.params.id;\n\t\t\tconst orderRepository = this.repositoryFactory.create('order');\n\t\t\tconst orderCriteria = new Criteria(1, 1);\n\t\t\torderCriteria.addAssociation('transactions');\n\t\t\torderCriteria.getAssociation('transactions').addSorting(Criteria.sort('createdAt', 'DESC'));\n\n\t\t\torderRepository.get(this.orderId, Context.api, orderCriteria).then((order) => {\n\t\t\t\tthis.order = order;\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tvar totalAmountTemp = 0;\n\t\t\t\tvar refundsAmountTemp = 0;\n\t\t\t\tconst vrpaymentTransactionId = order.transactions[0].customFields.vrpayment_transaction_id;\n\t\t\t\tthis.VRPaymentTransactionService.getTransactionData(order.salesChannelId, vrpaymentTransactionId)\n\t\t\t\t\t.then((VRPaymentTransaction) => {\n\t\t\t\t\t\tthis.currency = VRPaymentTransaction.transactions[0].currency;\n\n\t\t\t\t\t\tVRPaymentTransaction.transactions[0].authorized_amount = Utils.format.currency(\n\t\t\t\t\t\t\tVRPaymentTransaction.transactions[0].authorizationAmount,\n\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tVRPaymentTransaction.refunds.forEach((refund) => {\n\t\t\t\t\t\t\trefundsAmountTemp = parseFloat(parseFloat(refundsAmountTemp) + parseFloat(refund.amount));\n\t\t\t\t\t\t\trefund.amount = Utils.format.currency(\n\t\t\t\t\t\t\t\trefund.amount,\n\t\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\trefund.reductions.forEach((reduction) => {\n\t\t\t\t\t\t\t if (reduction.quantityReduction > 0) {\n if (this.refundLineItemQuantity[reduction.lineItemUniqueId] === undefined) {\n this.refundLineItemQuantity[reduction.lineItemUniqueId] = reduction.quantityReduction;\n } else {\n this.refundLineItemQuantity[reduction.lineItemUniqueId] += reduction.quantityReduction;\n }\n\t\t\t\t\t\t\t }\n if (reduction.unitPriceReduction > 0) {\n if (this.refundLineItemAmount[reduction.lineItemUniqueId] === undefined) {\n this.refundLineItemAmount[reduction.lineItemUniqueId] = reduction.unitPriceReduction;\n } else {\n this.refundLineItemAmount[reduction.lineItemUniqueId] += reduction.unitPriceReduction;\n }\n }\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tVRPaymentTransaction.transactions[0].lineItems.forEach((lineItem) => {\n\t\t\t\t\t\t\tif (!lineItem.id) {\n\t\t\t\t\t\t\t\tlineItem.id = lineItem.uniqueId;\n }\n\n lineItem.itemRefundedAmount = parseFloat(this.refundLineItemAmount[lineItem.uniqueId] || 0) * parseInt(lineItem.quantity);\n lineItem.amountIncludingTax = parseFloat(lineItem.amountIncludingTax) || 0;\n\n lineItem.itemRefundedQuantity = parseInt(this.refundLineItemQuantity[lineItem.uniqueId]) || 0;\n lineItem.refundableAmount = parseFloat(\n (lineItem.amountIncludingTax - lineItem.itemRefundedAmount).toFixed(2)\n );\n\n\t\t\t\t\t\t\tlineItem.amountIncludingTax = Utils.format.currency(\n\t\t\t\t\t\t\t\tlineItem.amountIncludingTax,\n\t\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tlineItem.taxAmount = Utils.format.currency(\n\t\t\t\t\t\t\t\tlineItem.taxAmount,\n\t\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\ttotalAmountTemp = parseFloat(parseFloat(totalAmountTemp) + parseFloat(lineItem.unitPriceIncludingTax * lineItem.quantity));\n\n\t\t\t\t\t\t\tlineItem.refundableQuantity = parseInt(\n\t\t\t\t\t\t\t\tparseInt(lineItem.quantity) - parseInt(this.refundLineItemQuantity[lineItem.uniqueId] || 0)\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tthis.lineItems = VRPaymentTransaction.transactions[0].lineItems;\n\t\t\t\t\t\tthis.transactionData = VRPaymentTransaction;\n\t\t\t\t\t\tthis.transaction = this.transactionData.transactions[0];\n\t\t\t\t\t\tthis.refundAmount = Number(this.transactionData.transactions[0].amountIncludingTax);\n\t\t\t\t\t\tthis.refundableAmount = parseFloat(parseFloat(totalAmountTemp) - parseFloat(refundsAmountTemp));\n\n\t\t\t\t\t}).catch((errorResponse) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.paymentDetails.error.title'),\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.paymentDetails.error.title'),\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t\tdownloadPackingSlip() {\n\t\t\twindow.open(\n\t\t\t\tthis.VRPaymentTransactionService.getPackingSlip(\n\t\t\t\t\tthis.transaction.metaData.salesChannelId,\n\t\t\t\t\tthis.transaction.id\n\t\t\t\t),\n\t\t\t\t'_blank'\n\t\t\t);\n\t\t},\n\n\t\tdownloadInvoice() {\n\t\t\twindow.open(\n\t\t\t\tthis.VRPaymentTransactionService.getInvoiceDocument(\n\t\t\t\t\tthis.transaction.metaData.salesChannelId,\n\t\t\t\t\tthis.transaction.id\n\t\t\t\t),\n\t\t\t\t'_blank'\n\t\t\t);\n\t\t},\n\n\t\tresetDataAttributes() {\n\t\t\tthis.transactionData = {\n\t\t\t\ttransactions: [],\n\t\t\t\trefunds: []\n\t\t\t};\n\t\t\tthis.lineItems = [];\n\t\t\tthis.refundLineItemQuantity = [];\n\t\t\tthis.refundLineItemAmount = [];\n\t\t\tthis.isLoading = true;\n\t\t},\n\n\t\tspawnModal(modalType, lineItemId, refundableQuantity, itemRefundableAmount) {\n\t\t\tthis.modalType = modalType;\n\t\t\tthis.currentLineItem = lineItemId;\n\t\t\tthis.itemRefundableQuantity = refundableQuantity;\n this.itemRefundableAmount = !isNaN(itemRefundableAmount) ? Math.round(itemRefundableAmount * 100) / 100 : 0;\n\t\t},\n\n\t\tcloseModal() {\n\t\t\tthis.modalType = '';\n\t\t},\n\n\t\tlineItemRefund(lineItemId) {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createRefund(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\t0,\n\t\t\t\tlineItemId\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n this.isLoading = false;\n this.$emit('modal-close');\n this.$nextTick(() => {\n this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n });\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.response.data,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n this.isLoading = false;\n this.$emit('modal-close');\n this.$nextTick(() => {\n this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n });\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tisSelectable(item) {\n\t\t\treturn item.refundableQuantity > 0 && item.refundableAmount > 0 && item.itemRefundedAmount == 0 && item.itemRefundedQuantity == 0;\n\t\t},\n\t\tonSelectionChanged(selection) {\n\t\t\tthis.selectedItems = Object.values(selection);\n\t\t},\n onPerformBulkAction() {\n if (this.selectedItems.length) {\n // Set isLoading to true to show the loader\n this.isLoading = true;\n\n // Force the DOM to update before proceeding with the asynchronous operations\n this.$nextTick(() => {\n const refundPromises = this.selectedItems.map((item) => {\n return this.lineItemRefundBulk(item.uniqueId); // Simulated refund action with delay\n });\n\n // Wait for all refund promises to complete\n Promise.all(refundPromises)\n .then(() => {\n // Once all promises are resolved, hide the loader and close the modal\n this.isLoading = false;\n this.$emit('modal-close');\n this.$nextTick(() => {\n this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n });\n })\n .catch((error) => {\n // Handle any errors during the refund process\n this.createNotificationError({\n title: 'Error',\n message: 'Something went wrong with the refunds',\n autoClose: false\n });\n this.isLoading = false; // Ensure the loader is hidden even on error\n });\n });\n }\n },\n lineItemRefundBulk(lineItemId) {\n return new Promise((resolve, reject) => {\n this.VRPaymentRefundService.createRefund(\n this.transactionData.transactions[0].metaData.salesChannelId,\n this.transactionData.transactions[0].id,\n 0,\n lineItemId\n )\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-order.refundAction.successTitle'),\n message: this.$tc('vrpayment-order.refundAction.successMessage')\n });\n resolve();\n })\n .catch((errorResponse) => {\n try {\n this.createNotificationError({\n title: errorResponse.response.data.errors[0].title,\n message: errorResponse.response.data.errors[0].detail,\n autoClose: false\n });\n } catch (e) {\n this.createNotificationError({\n title: errorResponse.title,\n message: errorResponse.response.data,\n autoClose: false\n });\n } finally {\n reject();\n }\n });\n });\n },\n\t}\n});\n","/* global Shopware */\n\nimport './extension/sw-order';\nimport './page/vrpayment-order-detail';\n\nimport deDE from './snippet/de-DE.json';\nimport enGB from './snippet/en-GB.json';\nimport frFR from './snippet/fr-FR.json';\nimport itIT from './snippet/it-IT.json';\n\nconst {Module} = Shopware;\n\nModule.register('vrpayment-order', {\n\ttype: 'plugin',\n\tname: 'VRPayment',\n\ttitle: 'vrpayment-order.general.title',\n\tdescription: 'vrpayment-order.general.descriptionTextModule',\n\tversion: '1.0.1',\n\ttargetVersion: '1.0.1',\n\tcolor: '#2b52ff',\n\n\tsnippets: {\n\t\t'de-DE': deDE,\n\t\t'en-GB': enGB,\n\t\t'fr-FR': frFR,\n\t\t'it-IT': itIT\n\t},\n\n\trouteMiddleware(next, currentRoute) {\n\t\tif (currentRoute.name === 'sw.order.detail') {\n\t\t\tcurrentRoute.children.push({\n\t\t\t\tcomponent: 'vrpayment-order-detail',\n\t\t\t\tname: 'vrpayment.order.detail',\n\t\t\t\tisChildren: true,\n\t\t\t\tpath: '/sw/order/vrpayment/detail/:id'\n\t\t\t});\n\t\t}\n\t\tnext(currentRoute);\n\t}\n});\n","Shopware.Service('privileges').addPrivilegeMappingEntry({\n category: 'permissions',\n parent: 'vrpayment',\n key: 'vrpayment',\n roles: {\n viewer: {\n privileges: [\n 'sales_channel:read',\n 'sales_channel_payment_method:read',\n 'system_config:read'\n ],\n dependencies: []\n },\n editor: {\n privileges: [\n 'sales_channel:update',\n 'sales_channel_payment_method:create',\n 'sales_channel_payment_method:update',\n 'system_config:update',\n 'system_config:create',\n 'system_config:delete'\n ],\n dependencies: [\n 'vrpayment.viewer'\n ]\n }\n }\n});\n\nShopware.Service('privileges').addPrivilegeMappingEntry({\n category: 'permissions',\n parent: null,\n key: 'sales_channel',\n roles: {\n viewer: {\n privileges: [\n 'sales_channel_payment_method:read'\n ]\n },\n editor: {\n privileges: [\n 'payment_method:update'\n ]\n },\n creator: {\n privileges: [\n 'payment_method:create',\n 'shipping_method:create',\n 'delivery_time:create'\n ]\n },\n deleter: {\n privileges: [\n 'payment_method:delete'\n ]\n }\n }\n});\n","{% block vrpayment_settings %}\n \n\n {% block vrpayment_settings_header %}\n \n {% endblock %}\n\n {% block vrpayment_settings_actions %}\n \n {% endblock %}\n\n {% block vrpayment_settings_content %}\n \n {% endblock %}\n \n{% endblock %}\n","export const CONFIG_DOMAIN = 'VRPaymentPayment.config';\nexport const CONFIG_APPLICATION_KEY = CONFIG_DOMAIN + '.' + 'applicationKey';\nexport const CONFIG_EMAIL_ENABLED = CONFIG_DOMAIN + '.' + 'emailEnabled';\nexport const CONFIG_INTEGRATION = CONFIG_DOMAIN + '.' + 'integration';\nexport const CONFIG_LINE_ITEM_CONSISTENCY_ENABLED = CONFIG_DOMAIN + '.' + 'lineItemConsistencyEnabled';\nexport const CONFIG_SPACE_ID = CONFIG_DOMAIN + '.' + 'spaceId';\nexport const CONFIG_SPACE_VIEW_ID = CONFIG_DOMAIN + '.' + 'spaceViewId';\nexport const CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontInvoiceDownloadEnabled';\nexport const CONFIG_USER_ID = CONFIG_DOMAIN + '.' + 'userId';\nexport const CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontWebhooksUpdateEnabled';\nexport const CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontPaymentsUpdateEnabled';\n\n// References vendor/shopware/core/Defaults.php::SALES_CHANNEL_TYPE_STOREFRONT\nexport const STOREFRONT_SALES_CHANNEL_TYPE_ID = '8a243080f92e4c719546314b577cf82b';\n\nexport default {\n CONFIG_DOMAIN,\n CONFIG_APPLICATION_KEY,\n CONFIG_EMAIL_ENABLED,\n CONFIG_INTEGRATION,\n CONFIG_LINE_ITEM_CONSISTENCY_ENABLED,\n CONFIG_SPACE_ID,\n CONFIG_SPACE_VIEW_ID,\n CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED,\n CONFIG_USER_ID,\n CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED,\n CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED,\n STOREFRONT_SALES_CHANNEL_TYPE_ID\n};\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from './configuration-constants';\n\nconst { Component, Mixin } = Shopware;\n\nComponent.register('vrpayment-settings', {\n\n template: template,\n\n inject: [\n 'acl',\n 'VRPaymentConfigurationService',\n 'repositoryFactory'\n ],\n\n mixins: [\n Mixin.getByName('notification'),\n Mixin.getByName('sw-inline-snippet')\n ],\n\n data() {\n return {\n\n config: {},\n\n isLoading: false,\n isTesting: false,\n\n isSaveSuccessful: false,\n\n applicationKeyFilled: false,\n applicationKeyErrorState: false,\n\n spaceIdFilled: false,\n spaceIdErrorState: false,\n\n userIdFilled: false,\n userIdErrorState: false,\n\n isSetDefaultPaymentSuccessful: false,\n isSettingDefaultPaymentMethods: false,\n\n configIntegrationDefaultValue: 'payment_page',\n configEmailEnabledDefaultValue: true,\n configLineItemConsistencyEnabledDefaultValue: true,\n configStorefrontInvoiceDownloadEnabledEnabledDefaultValue: true,\n configStorefrontWebhooksUpdateEnabledDefaultValue: true,\n configStorefrontPaymentsUpdateEnabledDefaultValue: true,\n\n ...constants\n };\n },\n\n props: {\n isLoading: {\n type: Boolean,\n required: true\n }\n },\n\n metaInfo() {\n return {\n title: this.$createTitle()\n };\n },\n\n watch: {\n config: {\n handler(configData) {\n const defaultConfig = (this.$refs.configComponent.allConfigs || {}).null || {};\n const salesChannelId = this.$refs.configComponent.selectedSalesChannelId;\n if (salesChannelId === null) {\n\n this.applicationKeyFilled = !!this.config[this.CONFIG_APPLICATION_KEY];\n this.spaceIdFilled = !!this.config[this.CONFIG_SPACE_ID];\n this.userIdFilled = !!this.config[this.CONFIG_USER_ID];\n\n if (!(this.CONFIG_INTEGRATION in this.config)) {\n this.config[this.CONFIG_INTEGRATION] = this.configIntegrationDefaultValue;\n }\n\n if (!(this.CONFIG_EMAIL_ENABLED in this.config)) {\n this.config[this.CONFIG_EMAIL_ENABLED] = this.configEmailEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config)) {\n this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED] = this.configLineItemConsistencyEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config)) {\n this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED] = this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config)) {\n this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED] = this.configStorefrontWebhooksUpdateEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config)) {\n this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED] = this.configStorefrontPaymentsUpdateEnabledDefaultValue;\n }\n\n } else {\n\n this.applicationKeyFilled = !!this.config[this.CONFIG_APPLICATION_KEY] || !!defaultConfig[this.CONFIG_APPLICATION_KEY];\n this.spaceIdFilled = !!this.config[this.CONFIG_SPACE_ID] || !!defaultConfig[this.CONFIG_SPACE_ID];\n this.userIdFilled = !!this.config[this.CONFIG_USER_ID] || !!defaultConfig[this.CONFIG_USER_ID];\n\n\n if (!(this.CONFIG_INTEGRATION in this.config) || !(this.CONFIG_INTEGRATION in defaultConfig)) {\n this.config[this.CONFIG_INTEGRATION] = this.configIntegrationDefaultValue;\n }\n\n if (!(this.CONFIG_EMAIL_ENABLED in this.config) || !(this.CONFIG_EMAIL_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_EMAIL_ENABLED] = this.configEmailEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config) || !(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED] = this.configLineItemConsistencyEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config) || !(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED] = this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config) || !(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED] = this.configStorefrontWebhooksUpdateEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config) || !(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED] = this.configStorefrontPaymentsUpdateEnabledDefaultValue;\n }\n }\n\n this.$emit('salesChannelChanged');\n this.$emit('update:value', configData);\n },\n deep: true\n }\n },\n\n methods: {\n checkTextFieldInheritance(value) {\n if (typeof value !== 'string') {\n return true;\n }\n\n return value.length <= 0;\n },\n\n checkNumberFieldInheritance(value) {\n if (typeof value !== 'number') {\n return true;\n }\n\n return value.length <= 0;\n },\n\n checkBoolFieldInheritance(value) {\n return typeof value !== 'boolean';\n },\n\n getInheritValue(key) {\n if (this.selectedSalesChannelId == null) {\n return this.actualConfigData[key];\n } else {\n return this.allConfigs['null'][key];\n }\n },\n\n async onSave() {\n if (!(this.spaceIdFilled && this.userIdFilled && this.applicationKeyFilled)) {\n this.setErrorStates();\n return;\n }\n\n this.isLoading = true;\n const validationError = await this.validateHeadlessIntegration();\n\n if (validationError === 'HEADLESS') {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messageHeadlessIntegrationError')\n });\n this.isLoading = false;\n return;\n } else if (validationError === 'GLOBAL') {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messageGlobalIframeError')\n });\n this.isLoading = false;\n return;\n }\n\n this.save();\n },\n\n async validateHeadlessIntegration() {\n const salesChannelId = this.$refs.configComponent.selectedSalesChannelId;\n const currentIntegration = this.config[this.CONFIG_INTEGRATION];\n\n // If integration is 'payment_page', it is always valid.\n if (currentIntegration === 'payment_page') {\n return null;\n }\n\n const salesChannelRepo = this.repositoryFactory.create('sales_channel');\n\n try {\n if (salesChannelId) {\n // Specific Sales Channel Check\n const salesChannel = await salesChannelRepo.get(salesChannelId, Shopware.Context.api);\n\n const currentTypeId = salesChannel.typeId.replace(/-/g, '');\n\n // REST-2: Inverted Logic\n // We only allow 'iframe' integration if the Sales Channel is of type 'Storefront'.\n // Any other type (Headless, Product Export, Custom, etc.) does not support Iframe injection.\n const isStorefront = currentTypeId === constants.STOREFRONT_SALES_CHANNEL_TYPE_ID;\n if (!isStorefront) {\n return 'HEADLESS';\n }\n } else {\n // Global Scope (\"All Sales Channels\") Check\n // We must check if there is ANY Sales Channel that is NOT Storefront.\n // If so, we cannot allow \"Iframe\" globally, as it would break those channels.\n const criteria = new Shopware.Data.Criteria();\n criteria.addFilter(\n Shopware.Data.Criteria.not(\n 'AND',\n [Shopware.Data.Criteria.equals('typeId', constants.STOREFRONT_SALES_CHANNEL_TYPE_ID)]\n )\n );\n criteria.setLimit(1); // We only need to know if at least one exists\n\n const result = await salesChannelRepo.search(criteria, Shopware.Context.api);\n\n if (result.total > 0) {\n return 'GLOBAL';\n }\n }\n\n return null;\n } catch (e) {\n console.error(e);\n return null;\n }\n },\n\n save() {\n this.isLoading = true;\n\n this.$refs.configComponent.save().then((res) => {\n if (res) {\n this.config = res;\n }\n this.registerWebHooks();\n this.synchronizePaymentMethodConfiguration();\n this.installOrderDeliveryStates();\n }).catch((e) => {\n console.error('Error:', e);\n this.isLoading = false;\n });\n },\n\n registerWebHooks() {\n if (this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED] === false) {\n return false;\n }\n\n this.VRPaymentConfigurationService.registerWebHooks(this.$refs.configComponent.selectedSalesChannelId)\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.settingForm.messageWebHookUpdated')\n });\n }).catch((e) => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messageWebHookError')\n });\n this.isLoading = false;\n console.error('Error:', e);\n });\n },\n\n synchronizePaymentMethodConfiguration() {\n if (this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED] === false) {\n return false;\n }\n\n this.VRPaymentConfigurationService.synchronizePaymentMethodConfiguration(this.$refs.configComponent.selectedSalesChannelId)\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.settingForm.messagePaymentMethodConfigurationUpdated')\n });\n this.isLoading = false;\n }).catch((e) => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messagePaymentMethodConfigurationError')\n });\n this.isLoading = false;\n console.error('Error:', e);\n });\n },\n\n installOrderDeliveryStates() {\n this.VRPaymentConfigurationService.installOrderDeliveryStates()\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.settingForm.messageOrderDeliveryStateUpdated')\n });\n this.isLoading = false;\n }).catch(() => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messageOrderDeliveryStateError')\n });\n this.isLoading = false;\n });\n },\n\n onSetPaymentMethodDefault() {\n this.isSettingDefaultPaymentMethods = true;\n this.VRPaymentConfigurationService.setVRPaymentAsSalesChannelPaymentDefault(\n this.$refs.configComponent.selectedSalesChannelId\n ).then(() => {\n this.isSettingDefaultPaymentMethods = false;\n this.isSetDefaultPaymentSuccessful = true;\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.salesChannelCard.messageDefaultPaymentUpdated')\n });\n });\n },\n\n setErrorStates() {\n const messageNotBlankErrorState = {\n code: 1,\n detail: this.$tc('vrpayment-settings.messageNotBlank')\n };\n\n if (!this.spaceIdFilled) {\n this.spaceIdErrorState = messageNotBlankErrorState;\n }\n\n if (!this.userIdFilled) {\n this.userIdErrorState = messageNotBlankErrorState;\n }\n\n if (!this.applicationKeyFilled) {\n this.applicationKeyErrorState = messageNotBlankErrorState;\n }\n },\n\n // Handles the 'check-api-connection-event'.\n // Uses the provided apiConnectionData to perform API connection checks.\n onCheckApiConnection(apiConnectionData) {\n const { spaceId, userId, applicationKey } = apiConnectionData;\n this.isTesting = true;\n\n this.VRPaymentConfigurationService.checkApiConnection(spaceId, userId, applicationKey)\n .then((res) => {\n if (res.result === 200) {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.credentials.alert.title'),\n message: this.$tc('vrpayment-settings.settingForm.credentials.alert.successMessage')\n });\n } else {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.credentials.alert.title'),\n message: this.$tc('vrpayment-settings.settingForm.credentials.alert.errorMessage')\n });\n }\n this.isTesting = false;\n }).catch(() => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.credentials.alert.title'),\n message: this.$tc('vrpayment-settings.settingForm.credentials.alert.errorMessage')\n });\n this.isTesting = false;\n });\n }\n }\n});\n","{% block vrpayment_settings_content_card_channel_config_credentials %}\n\t\n\n\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container %}\n\t\t\t\n\n\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}\n\t\t\t\t\t
    \n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_user_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_application_key %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\t\t\t\t\t
    \n\t\t\t\t{% endblock %}\n\n\t\t\t\t{% verbatim %}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{{ $tc('vrpayment-settings.settingForm.credentials.button.label') }}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{% endverbatim %}\n\n\t\t\t
    \n\t\t{% endblock %}\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-credentials', {\n template,\n\n name: 'VRPaymentCredentials',\n\n inject: [\n 'acl'\n ],\n\n mixins: [\n Mixin.getByName('notification')\n ],\n\n props: {\n actualConfigData: {\n type: Object,\n required: true\n },\n allConfigs: {\n type: Object,\n required: true\n },\n\n selectedSalesChannelId: {\n type: [String, null],\n required: false,\n default: null\n },\n spaceIdFilled: {\n type: Boolean,\n required: true\n },\n spaceIdErrorState: {\n required: true\n },\n userIdFilled: {\n type: Boolean,\n required: true\n },\n userIdErrorState: {\n required: true\n },\n applicationKeyFilled: {\n type: Boolean,\n required: true\n },\n applicationKeyErrorState: {\n required: true\n },\n isLoading: {\n type: Boolean,\n required: true\n },\n isTesting: {\n type: Boolean,\n required: false\n }\n },\n\n data() {\n return {\n ...constants\n };\n },\n\n computed: {\n currentConfig() {\n if (this.selectedSalesChannelId && this.allConfigs[this.selectedSalesChannelId]) {\n return this.allConfigs[this.selectedSalesChannelId];\n }\n return this.allConfigs['null'] || {};\n }\n },\n\n methods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t return !value || value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t return value == null || value === '';\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t return typeof value !== 'boolean';\n\t\t},\n\n // Emits the 'check-api-connection-event' with the current API connection parameters.\n // Used to trigger API connection testing from this component.\n emitCheckApiConnectionEvent() {\n const apiConnectionParams = {\n spaceId: this.currentConfig[constants.CONFIG_SPACE_ID],\n userId: this.currentConfig[constants.CONFIG_USER_ID],\n applicationKey: this.currentConfig[constants.CONFIG_APPLICATION_KEY]\n };\n\n this.$emit('check-api-connection-event', apiConnectionParams);\n },\n\n getInheritedValue(key) {\n return this.allConfigs['null']?.[key] ?? null;\n }\n }\n});\n","{% block vrpayment_settings_content_card_channel_config_options %}\n\t\n\n\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container %}\n\t\t\t\n\n\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}\n\t\t\t\t\t
    \n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_view_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_integration %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_line_item_consistency_enabled %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_email_enabled %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\t\t\t\t\t
    \n\t\t\t\t{% endblock %}\n\t\t\t
    \n\t\t{% endblock %}\n\t
    \n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-options', {\n\ttemplate: template,\n\n\tname: 'VRPaymentOptions',\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\tactualConfigData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tallConfigs: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tselectedSalesChannelId: {\n\t\t\trequired: true\n\t\t},\n\t\tisLoading: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t...constants\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tintegrationOptions() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: 'payment_page',\n\t\t\t\t\tname: this.$tc('vrpayment-settings.settingForm.options.integration.options.payment_page')\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'iframe',\n\t\t\t\t\tname: this.$tc('vrpayment-settings.settingForm.options.integration.options.iframe')\n\t\t\t\t}\n\t\t\t];\n\t\t}\n\t},\n\n\tmethods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t\tif (typeof value !== 'string') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t\tif (typeof value !== 'number') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t\treturn typeof value !== 'boolean';\n\t\t}\n\t}\n});\n","{% block vrpayment_settings_icon %}\n \n \n\n\n\t\n\n\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\n\n\n \n{% endblock %}\n","import template from './index.html.twig';\n\nconst { Component } = Shopware;\n\nComponent.register('sw-vrpayment-settings-icon', {\n template\n});\n","\n\t\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
    \n\t
    \n
    \n\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-storefront-options', {\n\ttemplate: template,\n\n\tname: 'VRPaymentStorefrontOptions',\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\tactualConfigData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tallConfigs: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tselectedSalesChannelId: {\n\t\t\trequired: true\n\t\t},\n\t\tisLoading: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t...constants\n\t\t};\n\t},\n\n\tmethods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t\tif (typeof value !== 'string') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t\tif (typeof value !== 'number') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t\treturn typeof value !== 'boolean';\n\t\t}\n\t}\n});\n","\n\t\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
    \n\t
    \n
    \n\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-advanced-options', {\n\ttemplate: template,\n\n\tname: 'VRPaymentAdvancedOptions',\n\n\tinject: [\n\t\t'acl'\n\t],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\tactualConfigData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tallConfigs: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tselectedSalesChannelId: {\n\t\t\trequired: true\n\t\t},\n\t\tisLoading: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t...constants\n\t\t};\n\t},\n\n\tmethods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t\tif (typeof value !== 'string') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t\tif (typeof value !== 'number') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t\treturn typeof value !== 'boolean';\n\t\t}\n\t}\n});\n","/* global Shopware */\n\nimport './acl';\nimport './page/vrpayment-settings';\nimport './component/sw-vrpayment-credentials';\nimport './component/sw-vrpayment-options';\nimport './component/sw-vrpayment-settings-icon';\nimport './component/sw-vrpayment-storefront-options';\nimport './component/sw-vrpayment-advanced-options';\n\nimport deDE from './snippet/de-DE.json';\nimport enGB from './snippet/en-GB.json';\nimport frFR from './snippet/fr-FR.json';\nimport itIT from './snippet/it-IT.json';\n\nconst {Module} = Shopware;\n\nModule.register('vrpayment-settings', {\n\ttype: 'plugin',\n\tname: 'VRPayment',\n\ttitle: 'vrpayment-settings.general.descriptionTextModule',\n\tdescription: 'vrpayment-settings.general.descriptionTextModule',\n\tcolor: '#28d8ff',\n\ticon: 'default-action-settings',\n\tversion: '1.0.1',\n\ttargetVersion: '1.0.1',\n\n snippets: {\n 'de-DE': deDE,\n 'en-GB': enGB,\n 'fr-FR': frFR,\n 'it-IT': itIT,\n },\n\n\troutes: {\n\t\tindex: {\n\t\t\tcomponent: 'vrpayment-settings',\n\t\t\tpath: 'index',\n\t\t\tmeta: {\n\t\t\t\tparentPath: 'sw.settings.index',\n\t\t\t\tprivilege: 'vrpayment.viewer'\n\t\t\t},\n\t\t\tprops: {\n default: (route) => {\n return {\n hash: route.params.hash,\n };\n },\n },\n\t\t}\n\t},\n\n\tsettingsItem: {\n\t\tgroup: 'plugins',\n\t\tto: 'vrpayment.settings.index',\n\t\ticonComponent: 'sw-vrpayment-settings-icon',\n\t\tbackgroundEnabled: true,\n\t\tprivilege: 'vrpayment.viewer'\n\t}\n\n});\n","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Config\\Controller\\ConfigurationController\n */\nclass VRPaymentConfigurationService extends ApiService {\n\n\t/**\n\t * VRPaymentConfigurationService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Register web hooks\n\t *\n\t * @param {String|null} salesChannelId\n\t * @return {*}\n\t */\n\tregisterWebHooks(salesChannelId = null) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/register-web-hooks`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Test API connection\n\t *\n\t * @param {int|null} spaceId\n\t * @param {int|null} userId\n\t * @param {String|null} applicationId\n\t * @return {*}\n\t */\n\tcheckApiConnection(spaceId = null, userId = null, applicationId = null) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/check-api-connection`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tspaceId: spaceId,\n\t\t\t\tuserId: userId,\n\t\t\t\tapplicationId: applicationId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Set's the default payment method to VRPayment for the given salesChannel id.\n\t *\n\t * @param {String|null} salesChannelId\n\t *\n\t * @returns {Promise}\n\t */\n\tsetVRPaymentAsSalesChannelPaymentDefault(salesChannelId = null) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/set-vrpayment-as-sales-channel-payment-default`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * @param salesChannelId\n\t * @return {Promise}\n\t */\n\tsynchronizePaymentMethodConfiguration(salesChannelId = null) {\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/synchronize-payment-method-configuration`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * @return {*}\n\t */\n\tinstallOrderDeliveryStates() {\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/install-order-delivery-states`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentConfigurationService;\n","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\RefundController\n */\nclass VRPaymentRefundService extends ApiService {\n\n\t/**\n\t * VRPaymentRefundService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Refund a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @param {int} quantity\n\t * @param {int} lineItemId\n\t * @return {*}\n\t */\n\tcreateRefund(salesChannelId, transactionId, quantity, lineItemId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId,\n\t\t\t\tquantity: quantity,\n\t\t\t\tlineItemId: lineItemId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Refund a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @param {float} refundableAmount\n\t * @return {*}\n\t */\n\tcreateRefundByAmount(salesChannelId, transactionId, refundableAmount) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund-by-amount/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId,\n\t\t\t\trefundableAmount: refundableAmount\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Refund a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @param {float} refundableAmount\n\t * @param {String} lineItemId\n\t * @return {*}\n\t */\n\tcreatePartialRefund(salesChannelId, transactionId, refundableAmount, lineItemId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-partial-refund/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId,\n\t\t\t\trefundableAmount: refundableAmount,\n\t\t\t\tlineItemId: lineItemId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentRefundService;\n","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\TransactionController\n */\nclass VRPaymentTransactionService extends ApiService {\n\n\t/**\n\t * VRPaymentTransactionService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Get transaction data\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @return {*}\n\t */\n\tgetTransactionData(salesChannelId, transactionId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-transaction-data/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Download Invoice Document\n\t *\n\t * @param context\n\t * @param salesChannelId\n\t * @param transactionId\n\t * @return {string}\n\t */\n\tgetInvoiceDocument(salesChannelId, transactionId) {\n\t\treturn `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-invoice-document/${salesChannelId}/${transactionId}`;\n\t}\n\n\t/**\n\t * Download Packing slip\n\t *\n\t * @param salesChannelId\n\t * @param transactionId\n\t * @return {string}\n\t */\n\tgetPackingSlip(salesChannelId, transactionId) {\n\t\treturn `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-packing-slip/${salesChannelId}/${transactionId}`;\n\t}\n}\n\nexport default VRPaymentTransactionService;","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\TransactionCompletionController\n */\nclass VRPaymentTransactionCompletionService extends ApiService {\n\n\t/**\n\t * VRPaymentTransactionCompletionService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Complete a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @return {*}\n\t */\n\tcreateTransactionCompletion(salesChannelId, transactionId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-completion/create-transaction-completion/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentTransactionCompletionService;","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\TransactionVoidController\n */\nclass VRPaymentTransactionVoidService extends ApiService {\n\n\t/**\n\t * VRPaymentTransactionVoidService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Void a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @return {*}\n\t */\n\tcreateTransactionVoid(salesChannelId, transactionId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-void/create-transaction-void/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentTransactionVoidService;","/* global Shopware */\n\nimport VRPaymentConfigurationService from '../core/service/api/vrpayment-configuration.service';\nimport VRPaymentRefundService from '../core/service/api/vrpayment-refund.service';\nimport VRPaymentTransactionService from '../core/service/api/vrpayment-transaction.service';\nimport VRPaymentTransactionCompletionService\n\tfrom '../core/service/api/vrpayment-transaction-completion.service';\nimport VRPaymentTransactionVoidService\n\tfrom '../core/service/api/vrpayment-transaction-void.service';\n\n\nconst {Application} = Shopware;\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentConfigurationService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentConfigurationService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentRefundService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentRefundService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentTransactionService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentTransactionService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentTransactionCompletionService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentTransactionCompletionService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentTransactionVoidService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentTransactionVoidService(initContainer.httpClient, container.loginService);\n});"],"names":["template$c","Component","Context","Criteria","vrpaymentFormattedHandlerIdentifier","template","orderRepository","orderCriteria","order","paymentMethodId","paymentMethod","template$b","Mixin","Filter","Utils","errorResponse","template$a","_a","_b","_c","_d","errorTitle","errorMessage","template$9","itemUniqueId","newValue","template$8","template$7","template$6","totalAmountTemp","refundsAmountTemp","vrpaymentTransactionId","VRPaymentTransaction","refund","reduction","lineItem","modalType","lineItemId","refundableQuantity","itemRefundableAmount","item","selection","refundPromises","error","resolve","reject","Module","deDE","enGB","frFR","itIT","next","currentRoute","template$5","CONFIG_DOMAIN","CONFIG_APPLICATION_KEY","CONFIG_EMAIL_ENABLED","CONFIG_INTEGRATION","CONFIG_LINE_ITEM_CONSISTENCY_ENABLED","CONFIG_SPACE_ID","CONFIG_SPACE_VIEW_ID","CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED","CONFIG_USER_ID","CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED","CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED","STOREFRONT_SALES_CHANNEL_TYPE_ID","constants","configData","defaultConfig","value","key","validationError","salesChannelId","salesChannelRepo","criteria","e","res","messageNotBlankErrorState","apiConnectionData","spaceId","userId","applicationKey","template$4","apiConnectionParams","template$3","template$2","template$1","route","ApiService","VRPaymentConfigurationService","httpClient","loginService","apiEndpoint","headers","apiRoute","response","applicationId","VRPaymentRefundService","transactionId","quantity","refundableAmount","VRPaymentTransactionService","VRPaymentTransactionCompletionService","VRPaymentTransactionVoidService","Application","container","initContainer"],"mappings":"AAAA,MAAAA,EAAe,4hBCKT,WAACC,EAAS,QAAEC,CAAO,EAAI,SACvBC,EAAW,SAAS,KAAK,SAEzBC,EAAsC,mDAE5CH,EAAU,SAAS,kBAAmB,CACtC,SAACI,EAEA,MAAO,CACN,MAAO,CACN,mBAAoB,EACvB,CACA,EAEC,SAAU,CACT,YAAa,CACZ,MAAO,CAAC,KAAK,oBAAsB,KAAK,OAAO,OAAS,wBAC3D,EACE,UAAW,CACV,MAAO,EACV,CACA,EAEC,MAAO,CACN,QAAS,CACR,KAAM,GACN,SAAU,CACT,GAAI,CAAC,KAAK,QAAS,CAClB,KAAK,sBAAsB,IAAI,EAC/B,MACL,CAEI,MAAMC,EAAkB,KAAK,kBAAkB,OAAO,OAAO,EACvDC,EAAgB,IAAIJ,EAAS,EAAG,CAAC,EACvCI,EAAc,eAAe,cAAc,EAE3CD,EAAgB,IAAI,KAAK,QAASJ,EAAQ,IAAKK,CAAa,EAAE,KAAMC,GAAU,CAC7E,GACEA,EAAM,aAAe,GACrBA,EAAM,aAAa,QAAU,GAC9B,CAACA,EAAM,aAAa,CAAC,EAAE,gBACtB,CACD,KAAK,sBAAsB,IAAI,EAC/B,MACN,CAEK,MAAMC,EAAkBD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,EACrD,OAAO,IAAIP,GAAuBS,EAAc,WAAYD,EAAU,YAAY,CACnF,CAAC,EAGDD,EAAY,mBAAmB,8BAAgCC,GAAc,CAC5E,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAIH,GAA4BK,EAAc,WAAYD,EAAU,YAAY,CACxF,CAAC,EAGDD,EAAY,mBAAmB,wCAA0CC,GAAc,CACtF,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAIF,GAAsCI,EAAc,WAAYD,EAAU,YAAY,CAClG,CAAC,EAGDD,EAAY,mBAAmB,kCAAoCC,GAAc,CAChF,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAID,GAAgCG,EAAc,WAAYD,EAAU,YAAY,CAC5F,CAAC"} \ No newline at end of file diff --git a/src/Resources/public/administration/assets/v-r-payment-payment-Cp2eQSV_.js b/src/Resources/public/administration/assets/v-r-payment-payment-Cp2eQSV_.js deleted file mode 100644 index 7f4d934..0000000 --- a/src/Resources/public/administration/assets/v-r-payment-payment-Cp2eQSV_.js +++ /dev/null @@ -1,2 +0,0 @@ -const A=`{% block sw_order_detail_content_tabs_general %} {% parent %} {# sw-tabs-item will dissappear. See: https://github.com/shopware/shopware/blob/trunk/UPGRADE-6.7.md#sw-tabs-is-removed #} {{ $tc('vrpayment-order.header') }} {% endblock %} {% block sw_order_detail_actions_slot_smart_bar_actions %} {% endblock %}`,{Component:T,Context:g}=Shopware,P=Shopware.Data.Criteria,D="handler_vrpaymentpayment_vrpaymentpaymenthandler";T.override("sw-order-detail",{template:A,data(){return{isVRPaymentPayment:!1}},computed:{isEditable(){return!this.isVRPaymentPayment||this.$route.name!=="vrpayment.order.detail"},showTabs(){return!0}},watch:{orderId:{deep:!0,handler(){if(!this.orderId){this.setIsVRPaymentPayment(null);return}const e=this.repositoryFactory.create("order"),t=new P(1,1);t.addAssociation("transactions"),e.get(this.orderId,g.api,t).then(a=>{if(a.amountTotal<=0||a.transactions.length<=0||!a.transactions[0].paymentMethodId){this.setIsVRPaymentPayment(null);return}const n=a.transactions[0].paymentMethodId;n!=null&&this.setIsVRPaymentPayment(n)})},immediate:!0}},methods:{setIsVRPaymentPayment(e){if(!e)return;this.repositoryFactory.create("payment_method").get(e,g.api).then(a=>{this.isVRPaymentPayment=a.formattedHandlerIdentifier===D})}}});const N=`{% block vrpayment_order_action_completion %} {% block vrpayment_order_action_completion_amount %} {% endblock %} {% block vrpayment_order_action_completion_confirm_button %} {% endblock %} {% endblock %}`,{Component:R,Mixin:k,Filter:$,Utils:y}=Shopware;R.register("vrpayment-order-action-completion",{template:N,inject:["VRPaymentTransactionCompletionService"],mixins:[k.getByName("notification")],props:{transactionData:{type:Object,required:!0}},data(){return{isLoading:!0,isCompletion:!1}},computed:{dateFilter(){return $.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1},completion(){this.isCompletion&&(this.isLoading=!0,this.VRPaymentTransactionCompletionService.createTransactionCompletion(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.captureAction.successTitle"),message:this.$tc("vrpayment-order.captureAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${y.createId()}`)})}).catch(e=>{try{this.createNotificationError({title:e.response.data.errors[0].title,message:e.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${y.createId()}`)})}}))}}});const x=`{% block vrpayment_order_action_refund %} {% block vrpayment_order_action_refund_amount %}
    {{ $tc('vrpayment-order.refundAction.maxAvailableItemsToRefund') }}: {{ this.$parent.$parent.itemRefundableQuantity }}
    {% endblock %} {% block vrpayment_order_action_refund_confirm_button %} {% endblock %}
    {% endblock %}`,{Component:O,Mixin:F,Filter:V,Utils:f}=Shopware;O.register("vrpayment-order-action-refund",{template:x,inject:["VRPaymentRefundService"],mixins:[F.getByName("notification")],props:{transactionData:{type:Object,required:!0},orderId:{type:String,required:!0}},data(){return{refundQuantity:0,isLoading:!0,currentLineItem:""}},computed:{dateFilter(){return V.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.refundQuantity=1},refund(){this.isLoading=!0,this.VRPaymentRefundService.createRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,this.refundQuantity,this.$parent.$parent.currentLineItem).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${f.createId()}`)})}).catch(e=>{var n,r,o,s;try{var t=((s=(o=(r=(n=e==null?void 0:e.response)==null?void 0:n.data)==null?void 0:r.errors)==null?void 0:o[0])==null?void 0:s.title)??this.$tc("vrpayment-order.refundAction.refundCreateError.errorTitle"),a;switch(e.response.data){case"refundQuantityZero":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundQuantityIsZero");break;case"refundExceedsQuantity":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundQuantityExceedsAvailableBalance");break;default:a=e.response.data.errors[0].detail}this.createNotificationError({title:t,message:a,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${f.createId()}`)})}})}}});const L=`{% block vrpayment_order_action_refund_partial %} {% block vrpayment_order_action_refund_amount_partial %}
    {{ $tc('vrpayment-order.refundAction.maxAvailableAmountToRefund') }}: {{ this.$parent.$parent.itemRefundableAmount }}
    {% endblock %} {% block vrpayment_order_action_refund_confirm_button_partial %} {% endblock %}
    {% endblock %}`,{Component:M,Mixin:B,Filter:z,Utils:b}=Shopware;M.register("vrpayment-order-action-refund-partial",{template:L,inject:["VRPaymentRefundService"],mixins:[B.getByName("notification")],props:{transactionData:{type:Object,required:!0},orderId:{type:String,required:!0}},data(){return{isLoading:!0,currency:this.transactionData.transactions[0].currency,refundAmount:0}},computed:{dateFilter(){return z.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundAmount||(this.refundAmount=this.$parent.$parent.itemRefundableAmount)},createPartialRefund(e){this.isLoading=!0,this.VRPaymentRefundService.createPartialRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,this.refundAmount,e).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${b.createId()}`)})}).catch(t=>{try{this.createNotificationError({title:t.response.data.errors[0].title,message:t.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:t.title,message:t.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${b.createId()}`)})}})}},watch:{refundAmount(e){e!==null&&(this.refundAmount=Math.round(e*100)/100)}}});const G=`{% block vrpayment_order_action_refund_by_amount %} {% block vrpayment_order_action_refund_amount_by_amount %} {% endblock %} {% block vrpayment_order_action_refund_confirm_button_by_amount %} {% endblock %} {% endblock %}`,{Component:q,Mixin:U,Filter:H,Utils:v}=Shopware;q.register("vrpayment-order-action-refund-by-amount",{template:G,inject:["VRPaymentRefundService"],mixins:[U.getByName("notification")],props:{transactionData:{type:Object,required:!0},orderId:{type:String,required:!0}},data(){return{isLoading:!0,currency:this.transactionData.transactions[0].currency,refundAmount:0,refundableAmount:0}},computed:{dateFilter(){return H.getByName("date")}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundAmount=Number(this.transactionData.transactions[0].amountIncludingTax),this.refundableAmount=Number(this.transactionData.transactions[0].amountIncludingTax)},refundByAmount(){this.isLoading=!0,this.VRPaymentRefundService.createRefundByAmount(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,this.refundAmount).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${v.createId()}`)})}).catch(e=>{var n,r,o,s;try{var t=((s=(o=(r=(n=e==null?void 0:e.response)==null?void 0:n.data)==null?void 0:r.errors)==null?void 0:o[0])==null?void 0:s.title)??this.$tc("vrpayment-order.refundAction.refundCreateError.errorTitle"),a;switch(e.response.data){case"refundAmountZero":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundAmountIsZero");break;case"refundExceedsAmount":a=this.$tc("vrpayment-order.refundAction.refundCreateError.messageRefundAmountExceedsAvailableBalance");break;default:a=e.response.data.errors[0].detail}this.createNotificationError({title:t,message:a,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${v.createId()}`)})}})}}});const W=`{% block vrpayment_order_action_void %} {% block vrpayment_order_action_void_amount %} {# Review if this v-model:checked="isVoid" needs to change to checked #} {% endblock %} {% block vrpayment_order_action_void_confirm_button %} {% endblock %} {% endblock %}`,{Component:K,Mixin:Q,Filter:Y,Utils:_}=Shopware;K.register("vrpayment-order-action-void",{template:W,inject:["VRPaymentTransactionVoidService"],mixins:[Q.getByName("notification")],props:{transactionData:{type:Object,required:!0}},data(){return{isLoading:!0,isVoid:!1}},computed:{dateFilter(){return Y.getByName("date")},lineItemColumns(){return[{property:"uniqueId",label:this.$tc("vrpayment-order.refund.types.uniqueId"),rawData:!1,allowResize:!0,primary:!0,width:"auto"},{property:"name",label:this.$tc("vrpayment-order.refund.types.name"),rawData:!0,allowResize:!0,sortable:!0,width:"auto"},{property:"quantity",label:this.$tc("vrpayment-order.refund.types.quantity"),rawData:!0,allowResize:!0,width:"auto"},{property:"amountIncludingTax",label:this.$tc("vrpayment-order.refund.types.amountIncludingTax"),rawData:!0,allowResize:!0,inlineEdit:"string",width:"auto"},{property:"type",label:this.$tc("vrpayment-order.refund.types.type"),rawData:!0,allowResize:!0,sortable:!0,width:"auto"},{property:"taxAmount",label:this.$tc("vrpayment-order.refund.types.taxAmount"),rawData:!0,allowResize:!0,width:"auto"}]}},created(){this.createdComponent()},methods:{createdComponent(){this.isLoading=!1,this.currency=this.transactionData.transactions[0].currency,this.refundableAmount=this.transactionData.transactions[0].amountIncludingTax,this.refundAmount=this.transactionData.transactions[0].amountIncludingTax},voidPayment(){this.isVoid&&(this.isLoading=!0,this.VRPaymentTransactionVoidService.createTransactionVoid(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.voidAction.successTitle"),message:this.$tc("vrpayment-order.voidAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${_.createId()}`)})}).catch(e=>{try{this.createNotificationError({title:e.response.data.errors[0].title,message:e.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:e.title,message:e.message,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${_.createId()}`)})}}))}}});const j=`{% block vrpayment_order_detail %}
    {% block vrpayment_order_transaction_history_card %} {% endblock %} {% block vrpayment_order_transaction_line_items_card %} {% endblock %} {% block vrpayment_order_transaction_refunds_card %} {% endblock %} {% block vrpayment_order_actions_modal_refund_partial %} {% endblock %} {% block vrpayment_order_actions_modal_refund %} {% endblock %} {% block vrpayment_order_actions_modal_refund_by_amount %} {% endblock %} {% block vrpayment_order_actions_modal_completion%} {% endblock %} {% block vrpayment_order_actions_modal_void %} {% endblock %}
    {% endblock %}`,{Component:Z,Mixin:J,Filter:X,Context:ee,Utils:u}=Shopware,I=Shopware.Data.Criteria;Z.register("vrpayment-order-detail",{template:j,inject:["VRPaymentTransactionService","VRPaymentRefundService","repositoryFactory"],mixins:[J.getByName("notification")],data(){return{transactionData:{transactions:[],refunds:[]},transaction:{},lineItems:[],refundableQuantity:0,itemRefundableQuantity:0,isLoading:!0,orderId:"",currency:"",modalType:"",refundAmount:0,refundableAmount:0,itemRefundedAmount:0,itemRefundedQuantity:0,itemRefundableAmount:0,currentLineItem:"",refundLineItemQuantity:[],refundLineItemAmount:[],selectedItems:[]}},metaInfo(){return{title:this.$tc("vrpayment-order.header")}},computed:{dateFilter(){return X.getByName("date")},relatedResourceColumns(){return[{property:"paymentMethodName",label:this.$tc("vrpayment-order.transactionHistory.types.payment_method"),rawData:!0},{property:"state",label:this.$tc("vrpayment-order.transactionHistory.types.state"),rawData:!0},{property:"currency",label:this.$tc("vrpayment-order.transactionHistory.types.currency"),rawData:!0},{property:"authorized_amount",label:this.$tc("vrpayment-order.transactionHistory.types.authorized_amount"),rawData:!0},{property:"id",label:this.$tc("vrpayment-order.transactionHistory.types.transaction"),rawData:!0},{property:"customerId",label:this.$tc("vrpayment-order.transactionHistory.types.customer"),rawData:!0}]},lineItemColumns(){return[{property:"id",rawData:!0,visible:!1,primary:!0},{property:"uniqueId",label:this.$tc("vrpayment-order.lineItem.types.uniqueId"),rawData:!0,visible:!1,primary:!0},{property:"name",label:this.$tc("vrpayment-order.lineItem.types.name"),rawData:!0},{property:"quantity",label:this.$tc("vrpayment-order.lineItem.types.quantity"),rawData:!0},{property:"amountIncludingTax",label:this.$tc("vrpayment-order.lineItem.types.amountIncludingTax"),rawData:!0},{property:"type",label:this.$tc("vrpayment-order.lineItem.types.type"),rawData:!0},{property:"taxAmount",label:this.$tc("vrpayment-order.lineItem.types.taxAmount"),rawData:!0},{property:"refundableQuantity",rawData:!0,visible:!1}]},refundColumns(){return[{property:"id",label:this.$tc("vrpayment-order.refund.types.id"),rawData:!0,visible:!0,primary:!0},{property:"amount",label:this.$tc("vrpayment-order.refund.types.amount"),rawData:!0},{property:"state",label:this.$tc("vrpayment-order.refund.types.state"),rawData:!0},{property:"createdOn",label:this.$tc("vrpayment-order.refund.types.createdOn"),rawData:!0}]}},watch:{$route(){this.resetDataAttributes(),this.createdComponent()}},created(){this.createdComponent()},methods:{createdComponent(){this.orderId=this.$route.params.id;const e=this.repositoryFactory.create("order"),t=new I(1,1);t.addAssociation("transactions"),t.getAssociation("transactions").addSorting(I.sort("createdAt","DESC")),e.get(this.orderId,ee.api,t).then(a=>{this.order=a,this.isLoading=!1;var n=0,r=0;const o=a.transactions[0].customFields.vrpayment_transaction_id;this.VRPaymentTransactionService.getTransactionData(a.salesChannelId,o).then(s=>{this.currency=s.transactions[0].currency,s.transactions[0].authorized_amount=u.format.currency(s.transactions[0].authorizationAmount,this.currency),s.refunds.forEach(i=>{r=parseFloat(parseFloat(r)+parseFloat(i.amount)),i.amount=u.format.currency(i.amount,this.currency),i.reductions.forEach(l=>{l.quantityReduction>0&&(this.refundLineItemQuantity[l.lineItemUniqueId]===void 0?this.refundLineItemQuantity[l.lineItemUniqueId]=l.quantityReduction:this.refundLineItemQuantity[l.lineItemUniqueId]+=l.quantityReduction),l.unitPriceReduction>0&&(this.refundLineItemAmount[l.lineItemUniqueId]===void 0?this.refundLineItemAmount[l.lineItemUniqueId]=l.unitPriceReduction:this.refundLineItemAmount[l.lineItemUniqueId]+=l.unitPriceReduction)})}),s.transactions[0].lineItems.forEach(i=>{i.id||(i.id=i.uniqueId),i.itemRefundedAmount=parseFloat(this.refundLineItemAmount[i.uniqueId]||0)*parseInt(i.quantity),i.amountIncludingTax=parseFloat(i.amountIncludingTax)||0,i.itemRefundedQuantity=parseInt(this.refundLineItemQuantity[i.uniqueId])||0,i.refundableAmount=parseFloat((i.amountIncludingTax-i.itemRefundedAmount).toFixed(2)),i.amountIncludingTax=u.format.currency(i.amountIncludingTax,this.currency),i.taxAmount=u.format.currency(i.taxAmount,this.currency),n=parseFloat(parseFloat(n)+parseFloat(i.unitPriceIncludingTax*i.quantity)),i.refundableQuantity=parseInt(parseInt(i.quantity)-parseInt(this.refundLineItemQuantity[i.uniqueId]||0))}),this.lineItems=s.transactions[0].lineItems,this.transactionData=s,this.transaction=this.transactionData.transactions[0],this.refundAmount=Number(this.transactionData.transactions[0].amountIncludingTax),this.refundableAmount=parseFloat(parseFloat(n)-parseFloat(r))}).catch(s=>{try{this.createNotificationError({title:this.$tc("vrpayment-order.paymentDetails.error.title"),message:s.message,autoClose:!1})}catch{this.createNotificationError({title:this.$tc("vrpayment-order.paymentDetails.error.title"),message:s.message,autoClose:!1})}finally{this.isLoading=!1}})})},downloadPackingSlip(){window.open(this.VRPaymentTransactionService.getPackingSlip(this.transaction.metaData.salesChannelId,this.transaction.id),"_blank")},downloadInvoice(){window.open(this.VRPaymentTransactionService.getInvoiceDocument(this.transaction.metaData.salesChannelId,this.transaction.id),"_blank")},resetDataAttributes(){this.transactionData={transactions:[],refunds:[]},this.lineItems=[],this.refundLineItemQuantity=[],this.refundLineItemAmount=[],this.isLoading=!0},spawnModal(e,t,a,n){this.modalType=e,this.currentLineItem=t,this.itemRefundableQuantity=a,this.itemRefundableAmount=isNaN(n)?0:Math.round(n*100)/100},closeModal(){this.modalType=""},lineItemRefund(e){this.isLoading=!0,this.VRPaymentRefundService.createRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,0,e).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${u.createId()}`)})}).catch(t=>{try{this.createNotificationError({title:t.response.data.errors[0].title,message:t.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:t.title,message:t.response.data,autoClose:!1})}finally{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${u.createId()}`)})}})},isSelectable(e){return e.refundableQuantity>0&&e.refundableAmount>0&&e.itemRefundedAmount==0&&e.itemRefundedQuantity==0},onSelectionChanged(e){this.selectedItems=Object.values(e)},onPerformBulkAction(){this.selectedItems.length&&(this.isLoading=!0,this.$nextTick(()=>{const e=this.selectedItems.map(t=>this.lineItemRefundBulk(t.uniqueId));Promise.all(e).then(()=>{this.isLoading=!1,this.$emit("modal-close"),this.$nextTick(()=>{this.$router.replace(`${this.$route.path}?hash=${u.createId()}`)})}).catch(t=>{this.createNotificationError({title:"Error",message:"Something went wrong with the refunds",autoClose:!1}),this.isLoading=!1})}))},lineItemRefundBulk(e){return new Promise((t,a)=>{this.VRPaymentRefundService.createRefund(this.transactionData.transactions[0].metaData.salesChannelId,this.transactionData.transactions[0].id,0,e).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-order.refundAction.successTitle"),message:this.$tc("vrpayment-order.refundAction.successMessage")}),t()}).catch(n=>{try{this.createNotificationError({title:n.response.data.errors[0].title,message:n.response.data.errors[0].detail,autoClose:!1})}catch{this.createNotificationError({title:n.title,message:n.response.data,autoClose:!1})}finally{a()}})})}}});const te={"vrpayment-order":{buttons:{label:{completion:"Abschluss","download-invoice":"Rechnung herunterladen","download-packing-slip":"Packzettel herunterladen",refund:"Eine neue Rückerstattung erstellen",void:"Genehmigung annullieren","refund-whole-line-item":"Gesamte Werbebuchung erstatten","refund-line-item-by-quantity":"Rückerstattung nach Menge","refund-line-item-selected":"Rückerstattung auswählen","refund-line-item-parial":"Teilweise Rückerstattung"}},captureAction:{button:{text:"Zahlung erfassen"},currentAmount:"Betrag",isFinal:"Dies ist die endgültige Verbuchung",maxAmount:"Maximaler Betrag",successMessage:"Ihre Verbuchung war erfolgreich",successTitle:"Erfolg"},general:{title:"Bestellungen"},header:"VRPayment Payment",lineItem:{cardTitle:"Einzelposten",types:{amountIncludingTax:"Betrag",name:"Name",quantity:"Anzahl",taxAmount:"Steuern",type:"Typ",uniqueId:"Eindeutige ID"}},modal:{title:{capture:"Erfassen",refund:"Neue Gutschrift",void:"Autorisierung aufheben"}},paymentDetails:{cardTitle:"Zahlung",error:{title:"Fehler beim Abrufen von Zahlungsdetails von VRPayment"}},refund:{cardTitle:"Gutschriften",refundAmount:{label:"Gutschriftsbetrag"},refundQuantity:{label:"Refund Menge"},types:{amount:"Betrag",createdOn:"Erstellt am",id:"ID",state:"Staat"}},refundAction:{confirmButton:{text:"Ausführen"},refundAmount:{label:"Betrag",placeholder:"Einen Betrag eingeben"},successMessage:"Ihre Rückerstattung war erfolgreich",successTitle:"Erfolg",maxAvailableItemsToRefund:"Maximal Verfügbare Artikel zum Erstatten",maxAvailableAmountToRefund:"Maximal verfügbarer Erstattungsbetrag",refundCreateError:{errorTitle:"Fehler beim Erstellen der Rückerstattung.",messageRefundAmountExceedsAvailableBalance:"Der Rückerstattungsbetrag übersteigt das verfügbare Guthaben.",messageRefundAmountIsZero:"Der Rückerstattungsbetrag muss größer als 0 sein.",messageRefundQuantityExceedsAvailableBalance:"Rückerstattung nach Menge überschreitet die maximal verfügbare Anzahl an Artikeln zur Rückerstattung.",messageRefundQuantityIsZero:"Rückerstattung nach Menge muss größer als 0 sein."}},transactionHistory:{cardTitle:"Einzelheiten",types:{authorized_amount:"Autorisierter Betrag",currency:"Währung",customer:"Kunde",payment_method:"Zahlungsweise",state:"Staat",transaction:"Transaktion"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Kreditkarteninhaber",paymentMethod:"Zahlungsart",paymentMethodBrand:"Marke der Zahlungsmethode",PseudoCreditCardNumber:"Pseudo-Kreditkartennummer",CardExpire:"Karte verfällt"},voidAction:{confirm:{button:{cancel:"Nein",confirm:"Autorisierung aufheben"},message:"Wollen Sie diese Zahlung wirklich stornieren?"},successMessage:"Die Zahlung wurde erfolgreich annulliert",successTitle:"Erfolg"}}},ae={"vrpayment-order":{buttons:{label:{completion:"Complete","download-invoice":"Download Invoice","download-packing-slip":"Download Packing Slip",refund:"Create a new refund",void:"Cancel authorization","refund-whole-line-item":"Refund whole line item","refund-line-item-by-quantity":"Refund by quantity","refund-line-item-selected":"Refund selected","refund-line-item-parial":"Partial refund"}},captureAction:{button:{text:"Capture payment"},currentAmount:"Amount",isFinal:"This is final capture",maxAmount:"Maximum amount",successMessage:"Your capture was successful.",successTitle:"Success"},general:{title:"Orders"},header:"VRPayment Payment",lineItem:{cardTitle:"Line Items",types:{amountIncludingTax:"Amount",name:"Name",quantity:"Quantity",taxAmount:"Taxes",type:"Type",uniqueId:"Unique ID"}},modal:{title:{capture:"Capture",refund:"New refund",void:"Cancel authorization"}},paymentDetails:{cardTitle:"Payment",error:{title:"Error fetching payment details from VRPayment"}},refund:{cardTitle:"Refunds",refundAmount:{label:"Refund Amount"},refundQuantity:{label:"Refund Quantity"},types:{amount:"Amount",createdOn:"Created On",id:"ID",state:"State"}},refundAction:{confirmButton:{text:"Execute"},refundAmount:{label:"Amount",placeholder:"Enter a amount"},successMessage:"Your refund was successful.",successTitle:"Success",maxAvailableItemsToRefund:"Maximum available items to refund",maxAvailableAmountToRefund:"Maximum available amount to refund",refundCreateError:{errorTitle:"Error while creating the refund.",messageRefundAmountExceedsAvailableBalance:"Refund amount exceeds available balance.",messageRefundAmountIsZero:"Refund amount must be greater than 0.",messageRefundQuantityExceedsAvailableBalance:"Refund by quantity exceeds maximum available items to refund.",messageRefundQuantityIsZero:"Refund by quantity must be greater than 0."}},transactionHistory:{cardTitle:"Details",types:{authorized_amount:"Authorized Amount",currency:"Currency",customer:"Customer",payment_method:"Payment Method",state:"State",transaction:"Transaction"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Credit Card Holder",paymentMethod:"Payment Method",paymentMethodBrand:"Payment Method Brand",PseudoCreditCardNumber:"Pseudo Credit Card Number",CardExpire:"Card Expire"},voidAction:{confirm:{button:{cancel:"No",confirm:"Cancel authorization"},message:"Do you really want to cancel this payment?"},successMessage:"The payment was successfully voided.",successTitle:"Success"}}},ne={"vrpayment-order":{buttons:{label:{completion:"Terminée","download-invoice":"Télécharger la facture","download-packing-slip":"Télécharger le bordereau d'expédition",refund:"Créer un nouveau remboursement",void:"Annulez l'autorisation","refund-whole-line-item":"Remboursement de la ligne entière","refund-line-item-by-quantity":"Remboursement par quantité","refund-line-item-selected":"Rembourser sélectionnés","refund-line-item-parial":"Remboursement partiel"}},captureAction:{button:{text:"Capture du paiement"},currentAmount:"Montant",isFinal:"C'est la capture finale",maxAmount:"Montant maximal",successMessage:"Votre capture a été réussie.",successTitle:"Succès"},general:{title:"Commandes"},header:"VRPayment Paiement",lineItem:{cardTitle:"Articles de ligne",types:{amountIncludingTax:"Montant",name:"Nom",quantity:"Quantité",taxAmount:"Taxes",type:"Type",uniqueId:"ID unique"}},modal:{title:{capture:"Capture",refund:"Nouveau remboursement",void:"Annulez l'autorisation"}},paymentDetails:{cardTitle:"Paiement",error:{title:"Erreur dans la récupération des détails du paiement à partir de VRPayment"}},refund:{cardTitle:"Remboursements",refundAmount:{label:"Montant du remboursement"},refundQuantity:{label:"Quantité à rembourser"},types:{amount:"Montant",createdOn:"Créé le",id:"ID",state:"État"}},refundAction:{confirmButton:{text:"Exécutez"},refundAmount:{label:"Montant",placeholder:"Entrez un montant"},successMessage:"Votre remboursement a été effectué avec succès.",successTitle:"Succès",maxAvailableItemsToRefund:"Nombre maximum d'articles disponibles pour le remboursement",maxAvailableAmountToRefund:"Montant maximal disponible pour le remboursement",refundCreateError:{errorTitle:"Erreur lors de la création du remboursement.",messageRefundAmountExceedsAvailableBalance:"Le montant du remboursement dépasse le solde disponible.",messageRefundAmountIsZero:"Le montant du remboursement doit être supérieur à 0.",messageRefundQuantityExceedsAvailableBalance:"Le remboursement par quantité dépasse le nombre maximal d’articles remboursables.",messageRefundQuantityIsZero:"Le remboursement par quantité doit être supérieur à 0."}},transactionHistory:{cardTitle:"Détails",types:{authorized_amount:"Montant autorisé",currency:"Monnaie",customer:"Client",payment_method:"Mode de paiement",state:"État",transaction:"Transaction"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Titulaire de la carte de crédit",paymentMethod:"Mode de paiement",paymentMethodBrand:"Marque du mode de paiement",PseudoCreditCardNumber:"Pseudo numéro de carte de crédit",CardExpire:"La carte expire"},voidAction:{confirm:{button:{cancel:"Non",confirm:"Annulez l'autorisation"},message:"Voulez-vous vraiment annuler ce paiement?"},successMessage:"Le paiement a été annulé avec succès.",successTitle:"Succès"}}},ie={"vrpayment-order":{buttons:{label:{completion:"Completato","download-invoice":"Scarica fattura","download-packing-slip":"Scarica distinta di imballaggio",refund:"Crea un nuovo rimborso",void:"Annulla autorizzazione","refund-whole-line-item":"Rimborso intera riga","refund-line-item-by-quantity":"Rimborso per quantità","refund-line-item-selected":"Rimborso selezionati","refund-line-item-parial":"Rimborso parziale"}},captureAction:{button:{text:"Cattura pagamento"},currentAmount:"Importo",isFinal:"Questa è la cattura finale",maxAmount:"Importo massimo",successMessage:"La tua cattura ha avuto successo.",successTitle:"Successo"},general:{title:"Ordini"},header:"Pagamento VRPayment",lineItem:{cardTitle:"Articoli di linea",types:{amountIncludingTax:"Importo",name:"Nome",quantity:"Quantità",taxAmount:"Tasse",type:"Tipo",uniqueId:"ID unico"}},modal:{title:{capture:"Cattura",refund:"Nuovo rimborso",void:"Annulla autorizzazione"}},paymentDetails:{cardTitle:"Pagamento",error:{title:"Errore nel recupero dei dettagli del pagamento da VRPayment"}},refund:{cardTitle:"Rimborsi",refundAmount:{label:"Importo del rimborso"},refundQuantity:{label:"Quantità di rimborso"},types:{amount:"Importo",createdOn:"Creato il",id:"ID",state:"Stato"}},refundAction:{confirmButton:{text:"Esegui"},refundAmount:{label:"Importo",placeholder:"Inserisci un importo"},successMessage:"Il tuo rimborso è andato a buon fine.",successTitle:"Successo",maxAvailableItemsToRefund:"Numero massimo di articoli disponibili da rimborsare",maxAvailableAmountToRefund:"Importo massimo disponibile per il rimborso",refundCreateError:{errorTitle:"Errore durante la creazione del rimborso.",messageRefundAmountExceedsAvailableBalance:"LL'importo del rimborso supera il saldo disponibile.",messageRefundAmountIsZero:"L'importo del rimborso deve essere superiore a 0.",messageRefundQuantityExceedsAvailableBalance:"Il rimborso per quantità supera il numero massimo di articoli rimborsabili.",messageRefundQuantityIsZero:"Il rimborso per quantità deve essere maggiore di 0."}},transactionHistory:{cardTitle:"Dettagli",types:{authorized_amount:"Importo autorizzato",currency:"Valuta",customer:"Cliente",payment_method:"Metodo di pagamento",state:"Stato",transaction:"Transazione"},customerId:"Customer ID",customerName:"Customer Name",creditCardHolder:"Proprietario della carta di credito",paymentMethod:"Metodo di pagamento",paymentMethodBrand:"Metodo di pagamento Marca",PseudoCreditCardNumber:"Numero di carta di credito pseudo",CardExpire:"La carta scade"},voidAction:{confirm:{button:{cancel:"No",confirm:"Annulla autorizzazione"},message:"Vuoi davvero annullare questo pagamento?"},successMessage:"Il pagamento è stato annullato con successo.",successTitle:"Successo"}}},{Module:re}=Shopware;re.register("vrpayment-order",{type:"plugin",name:"VRPayment",title:"vrpayment-order.general.title",description:"vrpayment-order.general.descriptionTextModule",version:"1.0.1",targetVersion:"1.0.1",color:"#2b52ff",snippets:{"de-DE":te,"en-GB":ae,"fr-FR":ne,"it-IT":ie},routeMiddleware(e,t){t.name==="sw.order.detail"&&t.children.push({component:"vrpayment-order-detail",name:"vrpayment.order.detail",isChildren:!0,path:"/sw/order/vrpayment/detail/:id"}),e(t)}});Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:"vrpayment",key:"vrpayment",roles:{viewer:{privileges:["sales_channel:read","sales_channel_payment_method:read","system_config:read"],dependencies:[]},editor:{privileges:["sales_channel:update","sales_channel_payment_method:create","sales_channel_payment_method:update","system_config:update","system_config:create","system_config:delete"],dependencies:["vrpayment.viewer"]}}});Shopware.Service("privileges").addPrivilegeMappingEntry({category:"permissions",parent:null,key:"sales_channel",roles:{viewer:{privileges:["sales_channel_payment_method:read"]},editor:{privileges:["payment_method:update"]},creator:{privileges:["payment_method:create","shipping_method:create","delivery_time:create"]},deleter:{privileges:["payment_method:delete"]}}});const se=`{% block vrpayment_settings %} {% block vrpayment_settings_header %} {% endblock %} {% block vrpayment_settings_actions %} {% endblock %} {% block vrpayment_settings_content %} {% endblock %} {% endblock %}`,c="VRPaymentPayment.config",oe=c+".applicationKey",le=c+".emailEnabled",ce=c+".integration",de=c+".lineItemConsistencyEnabled",me=c+".spaceId",ue=c+".spaceViewId",pe=c+".storefrontInvoiceDownloadEnabled",he=c+".userId",ge=c+".storefrontWebhooksUpdateEnabled",ye=c+".storefrontPaymentsUpdateEnabled",m={CONFIG_DOMAIN:c,CONFIG_APPLICATION_KEY:oe,CONFIG_EMAIL_ENABLED:le,CONFIG_INTEGRATION:ce,CONFIG_LINE_ITEM_CONSISTENCY_ENABLED:de,CONFIG_SPACE_ID:me,CONFIG_SPACE_VIEW_ID:ue,CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED:pe,CONFIG_USER_ID:he,CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED:ge,CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED:ye},{Component:fe,Mixin:C}=Shopware;fe.register("vrpayment-settings",{template:se,inject:["acl","VRPaymentConfigurationService"],mixins:[C.getByName("notification"),C.getByName("sw-inline-snippet")],data(){return{config:{},isLoading:!1,isTesting:!1,isSaveSuccessful:!1,applicationKeyFilled:!1,applicationKeyErrorState:!1,spaceIdFilled:!1,spaceIdErrorState:!1,userIdFilled:!1,userIdErrorState:!1,isSetDefaultPaymentSuccessful:!1,isSettingDefaultPaymentMethods:!1,configIntegrationDefaultValue:"payment_page",configEmailEnabledDefaultValue:!0,configLineItemConsistencyEnabledDefaultValue:!0,configStorefrontInvoiceDownloadEnabledEnabledDefaultValue:!0,configStorefrontWebhooksUpdateEnabledDefaultValue:!0,configStorefrontPaymentsUpdateEnabledDefaultValue:!0,...m}},props:{isLoading:{type:Boolean,required:!0}},metaInfo(){return{title:this.$createTitle()}},watch:{config:{handler(e){const t=(this.$refs.configComponent.allConfigs||{}).null||{};this.$refs.configComponent.selectedSalesChannelId===null?(this.applicationKeyFilled=!!this.config[this.CONFIG_APPLICATION_KEY],this.spaceIdFilled=!!this.config[this.CONFIG_SPACE_ID],this.userIdFilled=!!this.config[this.CONFIG_USER_ID],this.CONFIG_INTEGRATION in this.config||(this.config[this.CONFIG_INTEGRATION]=this.configIntegrationDefaultValue),this.CONFIG_EMAIL_ENABLED in this.config||(this.config[this.CONFIG_EMAIL_ENABLED]=this.configEmailEnabledDefaultValue),this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config||(this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED]=this.configLineItemConsistencyEnabledDefaultValue),this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config||(this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED]=this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue),this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config||(this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED]=this.configStorefrontWebhooksUpdateEnabledDefaultValue),this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config||(this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED]=this.configStorefrontPaymentsUpdateEnabledDefaultValue)):(this.applicationKeyFilled=!!this.config[this.CONFIG_APPLICATION_KEY]||!!t[this.CONFIG_APPLICATION_KEY],this.spaceIdFilled=!!this.config[this.CONFIG_SPACE_ID]||!!t[this.CONFIG_SPACE_ID],this.userIdFilled=!!this.config[this.CONFIG_USER_ID]||!!t[this.CONFIG_USER_ID],(!(this.CONFIG_INTEGRATION in this.config)||!(this.CONFIG_INTEGRATION in t))&&(this.config[this.CONFIG_INTEGRATION]=this.configIntegrationDefaultValue),(!(this.CONFIG_EMAIL_ENABLED in this.config)||!(this.CONFIG_EMAIL_ENABLED in t))&&(this.config[this.CONFIG_EMAIL_ENABLED]=this.configEmailEnabledDefaultValue),(!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config)||!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in t))&&(this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED]=this.configLineItemConsistencyEnabledDefaultValue),(!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config)||!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in t))&&(this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED]=this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue),(!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config)||!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in t))&&(this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED]=this.configStorefrontWebhooksUpdateEnabledDefaultValue),(!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config)||!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in t))&&(this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED]=this.configStorefrontPaymentsUpdateEnabledDefaultValue)),this.$emit("salesChannelChanged"),this.$emit("update:value",e)},deep:!0}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"},getInheritValue(e){return this.selectedSalesChannelId==null?this.actualConfigData[e]:this.allConfigs.null[e]},onSave(){if(!(this.spaceIdFilled&&this.userIdFilled&&this.applicationKeyFilled)){this.setErrorStates();return}this.save()},save(){this.isLoading=!0,this.$refs.configComponent.save().then(e=>{e&&(this.config=e),this.registerWebHooks(),this.synchronizePaymentMethodConfiguration(),this.installOrderDeliveryStates()}).catch(e=>{console.error("Error:",e),this.isLoading=!1})},registerWebHooks(){if(this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED]===!1)return!1;this.VRPaymentConfigurationService.registerWebHooks(this.$refs.configComponent.selectedSalesChannelId).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.settingForm.messageWebHookUpdated")})}).catch(e=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messageWebHookError")}),this.isLoading=!1,console.error("Error:",e)})},synchronizePaymentMethodConfiguration(){if(this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED]===!1)return!1;this.VRPaymentConfigurationService.synchronizePaymentMethodConfiguration(this.$refs.configComponent.selectedSalesChannelId).then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.settingForm.messagePaymentMethodConfigurationUpdated")}),this.isLoading=!1}).catch(e=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messagePaymentMethodConfigurationError")}),this.isLoading=!1,console.error("Error:",e)})},installOrderDeliveryStates(){this.VRPaymentConfigurationService.installOrderDeliveryStates().then(()=>{this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.settingForm.messageOrderDeliveryStateUpdated")}),this.isLoading=!1}).catch(()=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.titleError"),message:this.$tc("vrpayment-settings.settingForm.messageOrderDeliveryStateError")}),this.isLoading=!1})},onSetPaymentMethodDefault(){this.isSettingDefaultPaymentMethods=!0,this.VRPaymentConfigurationService.setVRPaymentAsSalesChannelPaymentDefault(this.$refs.configComponent.selectedSalesChannelId).then(()=>{this.isSettingDefaultPaymentMethods=!1,this.isSetDefaultPaymentSuccessful=!0,this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.titleSuccess"),message:this.$tc("vrpayment-settings.salesChannelCard.messageDefaultPaymentUpdated")})})},setErrorStates(){const e={code:1,detail:this.$tc("vrpayment-settings.messageNotBlank")};this.spaceIdFilled||(this.spaceIdErrorState=e),this.userIdFilled||(this.userIdErrorState=e),this.applicationKeyFilled||(this.applicationKeyErrorState=e)},onCheckApiConnection(e){const{spaceId:t,userId:a,applicationKey:n}=e;this.isTesting=!0,this.VRPaymentConfigurationService.checkApiConnection(t,a,n).then(r=>{r.result===200?this.createNotificationSuccess({title:this.$tc("vrpayment-settings.settingForm.credentials.alert.title"),message:this.$tc("vrpayment-settings.settingForm.credentials.alert.successMessage")}):this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.credentials.alert.title"),message:this.$tc("vrpayment-settings.settingForm.credentials.alert.errorMessage")}),this.isTesting=!1}).catch(()=>{this.createNotificationError({title:this.$tc("vrpayment-settings.settingForm.credentials.alert.title"),message:this.$tc("vrpayment-settings.settingForm.credentials.alert.errorMessage")}),this.isTesting=!1})}}});const be=`{% block vrpayment_settings_content_card_channel_config_credentials %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}
    {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_id %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_user_id %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_application_key %} {% endblock %}
    {% endblock %} {% verbatim %} {{ $tc('vrpayment-settings.settingForm.credentials.button.label') }} {% endverbatim %}
    {% endblock %}
    {% endblock %}`,{Component:ve,Mixin:_e}=Shopware;ve.register("sw-vrpayment-credentials",{template:be,name:"VRPaymentCredentials",inject:["acl"],mixins:[_e.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{type:[String,null],required:!1,default:null},spaceIdFilled:{type:Boolean,required:!0},spaceIdErrorState:{required:!0},userIdFilled:{type:Boolean,required:!0},userIdErrorState:{required:!0},applicationKeyFilled:{type:Boolean,required:!0},applicationKeyErrorState:{required:!0},isLoading:{type:Boolean,required:!0},isTesting:{type:Boolean,required:!1}},data(){return{...m}},computed:{currentConfig(){return this.selectedSalesChannelId&&this.allConfigs[this.selectedSalesChannelId]?this.allConfigs[this.selectedSalesChannelId]:this.allConfigs.null||{}}},methods:{checkTextFieldInheritance(e){return!e||e.length<=0},checkNumberFieldInheritance(e){return e==null||e===""},checkBoolFieldInheritance(e){return typeof e!="boolean"},emitCheckApiConnectionEvent(){const e={spaceId:this.currentConfig[m.CONFIG_SPACE_ID],userId:this.currentConfig[m.CONFIG_USER_ID],applicationKey:this.currentConfig[m.CONFIG_APPLICATION_KEY]};this.$emit("check-api-connection-event",e)},getInheritedValue(e){var t;return((t=this.allConfigs.null)==null?void 0:t[e])??null}}});const Ie=`{% block vrpayment_settings_content_card_channel_config_options %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}
    {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_view_id %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_integration %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_line_item_consistency_enabled %} {% endblock %} {% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_email_enabled %} {% endblock %}
    {% endblock %}
    {% endblock %}
    {% endblock %}`,{Component:Ce,Mixin:Ee}=Shopware;Ce.register("sw-vrpayment-options",{template:Ie,name:"VRPaymentOptions",mixins:[Ee.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data(){return{...m}},computed:{integrationOptions(){return[{id:"payment_page",name:this.$tc("vrpayment-settings.settingForm.options.integration.options.payment_page")},{id:"iframe",name:this.$tc("vrpayment-settings.settingForm.options.integration.options.iframe")}]}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"}}});const we='{% block vrpayment_settings_icon %} {% endblock %}',{Component:Se}=Shopware;Se.register("sw-vrpayment-settings-icon",{template:we});const Ae=`
    `,{Component:Te,Mixin:Pe}=Shopware;Te.register("sw-vrpayment-storefront-options",{template:Ae,name:"VRPaymentStorefrontOptions",mixins:[Pe.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data(){return{...m}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"}}});const De=`
    `,{Component:Ne,Mixin:Re}=Shopware;Ne.register("sw-vrpayment-advanced-options",{template:De,name:"VRPaymentAdvancedOptions",inject:["acl"],mixins:[Re.getByName("notification")],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{required:!0},isLoading:{type:Boolean,required:!0}},data(){return{...m}},methods:{checkTextFieldInheritance(e){return typeof e!="string"?!0:e.length<=0},checkNumberFieldInheritance(e){return typeof e!="number"?!0:e.length<=0},checkBoolFieldInheritance(e){return typeof e!="boolean"}}});const ke={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment plugin"},vrpayment:{label:"VRPayment berechtigungen"}}},"vrpayment-settings":{general:{descriptionTextModule:"VRPayment-Einstellungen",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"Dieser Wert sollte nicht leer sein.",salesChannelCard:{button:{description:"Klicken Sie auf diese Schaltfläche, um VRPayment als Standard-Zahlungsabwickler im ausgewählten Vertriebskanal festzulegen",label:"VRPayment als Standard-Zahlungsabwickler festlegen"},messageDefaultPaymentError:"VRPayment als Standard-Zahlungsabwickler konnte nicht festgelegt werden..",messageDefaultPaymentUpdated:"VRPayment als Standard-Zahlungsabwickler wurde festgelegt."},settingForm:{credentials:{applicationKey:{label:"Application Key",tooltipText:"Der Anwendungsschlüssel wird verwendet, um dieses Plugin mit der API VRPayment zu authentifizieren."},cardTitle:"Anmeldedaten",spaceId:{label:"Space ID",tooltipText:"Die Space ID wird verwendet, um dieses Plugin mit der API VRPayment zu authentifizieren."},userId:{label:"User ID",tooltipText:"Die Benutzer-ID wird verwendet, um dieses Plugin mit der VRPayment-API zu authentifizieren."},button:{description:"Klicken Sie auf diese Schaltfläche, um die VRPayment API zu testen",label:"API Verbindung testen"},alert:{title:"API-Test",successMessage:"Die Verbindung wurde erfolgreich getestet.",errorMessage:"Die Verbindung ist fehlgeschlagen. Versuchen Sie es erneut."}},messageSaveSuccess:"VRPayment-Einstellungen wurden gespeichert.",messageOrderDeliveryStateError:"VRPayment OrderDeliveryState konnte nicht gespeichert werden.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState wurde aktualisiert.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration konnte nicht gespeichert werden. Bitte überprüfen Sie Ihre Anmeldedaten.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration wurde registriert.",messageWebHookError:"VRPayment WebHook konnte nicht gespeichert werden. Bitte überprüfen Sie Ihre Zugangsdaten.",messageWebHookUpdated:"VRPayment WebHook wurde aktualisiert.",options:{cardTitle:"Optionen",emailEnabled:{label:"Auftragsbestätigung per E-Mail senden",tooltipText:"Wenn diese Einstellung aktiviert ist, erhalten Ihre Kunden eine E-Mail von Ihrem Geschäft, wenn die Zahlung ihrer Bestellung autorisiert ist."},integration:{label:"Integration",options:{iframe:"Iframe",payment_page:"Payment Page"},tooltipText:"Integration"},lineItemConsistencyEnabled:{label:"Konsistenz der Einzelposten",tooltipText:"Wenn diese Option aktiviert ist, stimmen die Summen der Einzelposten in VRPaymentPayment immer mit der Shopware-Bestellsumme überein."},spaceViewId:{label:"Space View ID",tooltipText:"Space View ID"}},save:"Speichern",storefrontOptions:{cardTitle:"Storefront-Optionen",invoiceDownloadEnabled:{label:"Rechnung Download",tooltipText:"Wenn diese Einstellung aktiviert ist, können Ihre Kunden Auftragsrechnungen von VRPayment herunterladen."}},advancedOptions:{cardTitle:"Erweiterte-Optionen",webhooksUpdateEnabled:{label:"Webhooks-Update",tooltipText:"Wenn diese Einstellung aktiviert ist, wird das Webhook-Update ausgelöst, wenn Sie die Einstellungen speichern"},paymentsUpdateEnabled:{label:"Payments-Update",tooltipText:"Wenn diese Einstellung aktiviert ist, wird die Aktualisierung der Zahlungsmethoden ausgelöst, wenn Sie die Einstellungen speichern"}},titleError:"Fehler",titleSuccess:"Erfolg"}}},$e={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment plugin"},vrpayment:{label:"VRPayment permissions"}}},"vrpayment-settings":{general:{descriptionTextModule:"VRPayment settings",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"This value should not be blank.",salesChannelCard:{button:{description:"Click this button to set VRPayment as default payment handler in the selected SalesChannel",label:"Set VRPayment as default payment handler"},messageDefaultPaymentError:"VRPayment as default payment could not be set.",messageDefaultPaymentUpdated:"VRPayment as default payment has been set."},settingForm:{credentials:{applicationKey:{label:"Application Key",tooltipText:"The Application Key is used to authenticate this plugin with the VRPayment API."},cardTitle:"Credentials",spaceId:{label:"Space ID",tooltipText:"The space ID is used to authenticate this plugin with the VRPayment API."},userId:{label:"User ID",tooltipText:"The user ID is used to authenticate this plugin with the VRPayment API."},button:{description:"Click this button to test the VRPayment API",label:"API connection test"},alert:{title:"API Test",successMessage:"The connection was successfully tested.",errorMessage:"The connection was failed. Try it again."}},messageSaveSuccess:"VRPayment settings have been saved.",messageOrderDeliveryStateError:"VRPayment OrderDeliveryState could not be saved.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState has been updated.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration could not be saved. Please check your credentials.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration has been registered.",messageWebHookError:"VRPayment WebHook could not be saved. Please check your credentials.",messageWebHookUpdated:"VRPayment WebHook has been updated.",options:{cardTitle:"Options",emailEnabled:{label:"Send order confirmation email",tooltipText:"If this setting is enabled your customers will receive an email from your store when their order payment is authorised"},integration:{label:"Integration",options:{iframe:"Iframe",payment_page:"Payment Page"},tooltipText:"Integration"},lineItemConsistencyEnabled:{label:"Line item consistency",tooltipText:"If this option is enabled line item totals in VRPaymentPayment will always match Shopware order total"},spaceViewId:{label:"Space View ID",tooltipText:"Space View ID"}},save:"Save",storefrontOptions:{cardTitle:"Storefront Options",invoiceDownloadEnabled:{label:"Invoice Download",tooltipText:"If this setting is enabled your customers will be able to download order invoices from VRPayment"}},advancedOptions:{cardTitle:"Advanced Options",webhooksUpdateEnabled:{label:"Webhooks Update",tooltipText:"If this setting is enabled webhook update will be triggered when you save settings"},paymentsUpdateEnabled:{label:"Payments Update",tooltipText:"If this setting is enabled payment methods update will be triggered when you save settings"}},titleError:"Error",titleSuccess:"Success"}}},xe={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment brancher"},vrpayment:{label:"VRPayment autorisations"}}},"vrpayment-settings":{general:{descriptionTextModule:"Paramètres de VRPayment",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"Cette valeur ne doit pas être vide.",salesChannelCard:{button:{description:"Cliquez sur ce bouton pour définir VRPayment comme gestionnaire de paiement par défaut dans le canal de vente sélectionné.",label:"Définir VRPayment comme gestionnaire de paiement par défaut"},messageDefaultPaymentError:"VRPayment comme paiement par défaut n'a pas pu être défini.",messageDefaultPaymentUpdated:"VRPayment comme paiement par défaut a été défini."},settingForm:{credentials:{applicationKey:{label:"Application Key",tooltipText:"La clé d'application est utilisée pour authentifier ce plugin avec l'API."},cardTitle:"Références",spaceId:{label:"Space ID",tooltipText:"L'ID de l'espace est utilisé pour authentifier ce plugin avec l'API VRPayment.."},userId:{label:"User ID",tooltipText:"L'ID utilisateur est utilisé pour authentifier ce plugin avec l'API VRPayment."},button:{description:"Cliquez sur ce bouton pour tester l'API VRPayment.",label:"Test de connexion à l'API"},alert:{title:"Test API",successMessage:"La connexion a été testée avec succès.",errorMessage:"La connexion a échoué. Réessayez."}},messageSaveSuccess:"Les paramètres de VRPayment ont été enregistrés.",messageOrderDeliveryStateError:"Les paramètres de VRPayment OrderDeliveryState n'ont pas pu être enregistrés.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState a été mis à jour.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration n'a pas pu être enregistré. Veuillez vérifier vos informations d'identification.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration a été enregistré.",messageWebHookError:"VRPayment WebHook n'a pas pu être enregistré. Veuillez vérifier vos informations d'identification.",messageWebHookUpdated:"VRPayment WebHook a été mis à jour.",options:{cardTitle:"Options",emailEnabled:{label:"Envoyer un e-mail de confirmation de commande",tooltipText:"If this setting is enabled your customers will receive an email from your store when their order payment is authorised"},integration:{label:"Integration",options:{iframe:"Iframe",payment_page:"Page de paiement"},tooltipText:"Integration"},lineItemConsistencyEnabled:{label:"Cohérence des postes de ligne",tooltipText:"Si cette option est activée, les totaux des articles dans VRPaymentPayment correspondront toujours au total de la commande Shopware."},spaceViewId:{label:"Space View ID",tooltipText:"Space View ID"}},save:"Enregistrer",storefrontOptions:{cardTitle:"Storefront Options",invoiceDownloadEnabled:{label:"Téléchargement de facture",tooltipText:"Si ce paramètre est activé, vos clients pourront télécharger les factures de commande depuis VRPayment"}},advancedOptions:{cardTitle:"Options avancées",webhooksUpdateEnabled:{label:"Mise à jour des webhooks",tooltipText:"Si ce paramètre est activé, la mise à jour des webhooks sera déclenchée lorsque vous enregistrerez les paramètres."},paymentsUpdateEnabled:{label:"Mise à jour des paiements",tooltipText:"Si ce paramètre est activé, la mise à jour des méthodes de paiement sera déclenchée lorsque vous enregistrez les paramètres."}},titleError:"Erreur",titleSuccess:"Succès"}}},Oe={"sw-privileges":{permissions:{parents:{vrpayment:"VRPayment brancher"},vrpayment:{label:"VRPayment autorisations"}}},"vrpayment-settings":{general:{descriptionTextModule:"Impostazioni VRPayment",mainMenuItemGeneral:"VRPayment"},header:"VRPayment",messageNotBlank:"Questo valore non dovrebbe essere vuoto.",salesChannelCard:{button:{description:"Fai clic su questo pulsante per impostare VRPayment come gestore di pagamento predefinito nel SalesChannel selezionato",label:"Imposta VRPayment come gestore di pagamento predefinito"},messageDefaultPaymentError:"Non è stato possibile impostare VRPayment come pagamento predefinito.",messageDefaultPaymentUpdated:"VRPayment come pagamento predefinito è stato impostato."},settingForm:{credentials:{applicationKey:{label:"Chiave di applicazione",tooltipText:"La chiave dell'applicazione è usata per autenticare questo plugin con l'API VRPayment."},cardTitle:"Credenziali",spaceId:{label:"ID spazio",tooltipText:"L'ID dello spazio è usato per autenticare questo plugin con l'API VRPayment."},userId:{label:"ID utente",tooltipText:"L'ID utente è usato per autenticare questo plugin con l'API VRPayment."},button:{description:"Fare clic su questo pulsante per testare l'API VRPayment.",label:"Test di connessione API"},alert:{title:"Test API",successMessage:"La connessione è stata testata con successo.",errorMessage:"La connessione è fallita. Riprovare."}},messageSaveSuccess:"Le impostazioni di VRPayment sono state salvate.",messageOrderDeliveryStateError:"VRPayment OrderDeliveryState non può essere salvato.",messageOrderDeliveryStateUpdated:"VRPayment OrderDeliveryState è stato aggiornato.",messagePaymentMethodConfigurationError:"VRPayment PaymentMethodConfiguration non può essere salvato. Per favore controlla le tue credenziali.",messagePaymentMethodConfigurationUpdated:"VRPayment PaymentMethodConfiguration è stato registrato.",messageWebHookError:"VRPayment WebHook non può essere salvato. Per favore controlla le tue credenziali.",messageWebHookUpdated:"VRPayment WebHook è stato aggiornato.",options:{cardTitle:"Opzioni",emailEnabled:{label:"Invia email di conferma dell'ordine",tooltipText:"Se questa impostazione è abilitata i tuoi clienti riceveranno un'email dal tuo negozio quando il pagamento del loro ordine sarà autorizzato"},integration:{label:"Integrazione",options:{iframe:"Iframe",payment_page:"Pagina di pagamento"},tooltipText:"Integrazione"},lineItemConsistencyEnabled:{label:"Coerenza dell'elemento linea",tooltipText:"Se questa opzione è abilitata i totali degli articoli in VRPaymentPayment corrisponderanno sempre al totale dell'ordine Shopware"},spaceViewId:{label:"ID della vista spazio",tooltipText:"ID della vista spaziale"}},save:"Salva",storefrontOptions:{cardTitle:"Opzioni vetrina",invoiceDownloadEnabled:{label:"Scaricamento fattura",tooltipText:"Se questa impostazione è abilitata i tuoi clienti potranno scaricare le fatture degli ordini da VRPayment"}},advancedOptions:{cardTitle:"Opzioni avanzate",webhooksUpdateEnabled:{label:"Aggiornamento webhooks",tooltipText:"Se questa impostazione è abilitata l'aggiornamento dei webhook sarà attivato quando si salvano le impostazioni"},paymentsUpdateEnabled:{label:"Aggiornamento pagamenti",tooltipText:"Se questa impostazione è abilitata l'aggiornamento dei metodi di pagamento verrà attivato quando si salvano le impostazioni"}},titleError:"Errore",titleSuccess:"Successo"}}},{Module:Fe}=Shopware;Fe.register("vrpayment-settings",{type:"plugin",name:"VRPayment",title:"vrpayment-settings.general.descriptionTextModule",description:"vrpayment-settings.general.descriptionTextModule",color:"#28d8ff",icon:"default-action-settings",version:"1.0.1",targetVersion:"1.0.1",snippets:{"de-DE":ke,"en-GB":$e,"fr-FR":xe,"it-IT":Oe},routes:{index:{component:"vrpayment-settings",path:"index",meta:{parentPath:"sw.settings.index",privilege:"vrpayment.viewer"},props:{default:e=>({hash:e.params.hash})}}},settingsItem:{group:"plugins",to:"vrpayment.settings.index",iconComponent:"sw-vrpayment-settings-icon",backgroundEnabled:!0,privilege:"vrpayment.viewer"}});const p=Shopware.Classes.ApiService;class Ve extends p{constructor(t,a,n="vrpayment"){super(t,a,n)}registerWebHooks(t=null){const a=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/register-web-hooks`;return this.httpClient.post(n,{salesChannelId:t},{headers:a}).then(r=>p.handleResponse(r))}checkApiConnection(t=null,a=null,n=null){const r=this.getBasicHeaders(),o=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/check-api-connection`;return this.httpClient.post(o,{spaceId:t,userId:a,applicationId:n},{headers:r}).then(s=>p.handleResponse(s))}setVRPaymentAsSalesChannelPaymentDefault(t=null){const a=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/set-vrpayment-as-sales-channel-payment-default`;return this.httpClient.post(n,{salesChannelId:t},{headers:a}).then(r=>p.handleResponse(r))}synchronizePaymentMethodConfiguration(t=null){const a=this.getBasicHeaders(),n=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/synchronize-payment-method-configuration`;return this.httpClient.post(n,{salesChannelId:t},{headers:a}).then(r=>p.handleResponse(r))}installOrderDeliveryStates(){const t=this.getBasicHeaders(),a=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/install-order-delivery-states`;return this.httpClient.post(a,{},{headers:t}).then(n=>p.handleResponse(n))}}const h=Shopware.Classes.ApiService;class Le extends h{constructor(t,a,n="vrpayment"){super(t,a,n)}createRefund(t,a,n,r){const o=this.getBasicHeaders(),s=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund/`;return this.httpClient.post(s,{salesChannelId:t,transactionId:a,quantity:n,lineItemId:r},{headers:o}).then(i=>h.handleResponse(i))}createRefundByAmount(t,a,n){const r=this.getBasicHeaders(),o=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund-by-amount/`;return this.httpClient.post(o,{salesChannelId:t,transactionId:a,refundableAmount:n},{headers:r}).then(s=>h.handleResponse(s))}createPartialRefund(t,a,n,r){const o=this.getBasicHeaders(),s=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-partial-refund/`;return this.httpClient.post(s,{salesChannelId:t,transactionId:a,refundableAmount:n,lineItemId:r},{headers:o}).then(i=>h.handleResponse(i))}}const E=Shopware.Classes.ApiService;class Me extends E{constructor(t,a,n="vrpayment"){super(t,a,n)}getTransactionData(t,a){const n=this.getBasicHeaders(),r=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-transaction-data/`;return this.httpClient.post(r,{salesChannelId:t,transactionId:a},{headers:n}).then(o=>E.handleResponse(o))}getInvoiceDocument(t,a){return`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-invoice-document/${t}/${a}`}getPackingSlip(t,a){return`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-packing-slip/${t}/${a}`}}const w=Shopware.Classes.ApiService;class Be extends w{constructor(t,a,n="vrpayment"){super(t,a,n)}createTransactionCompletion(t,a){const n=this.getBasicHeaders(),r=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-completion/create-transaction-completion/`;return this.httpClient.post(r,{salesChannelId:t,transactionId:a},{headers:n}).then(o=>w.handleResponse(o))}}const S=Shopware.Classes.ApiService;class ze extends S{constructor(t,a,n="vrpayment"){super(t,a,n)}createTransactionVoid(t,a){const n=this.getBasicHeaders(),r=`${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-void/create-transaction-void/`;return this.httpClient.post(r,{salesChannelId:t,transactionId:a},{headers:n}).then(o=>S.handleResponse(o))}}const{Application:d}=Shopware;d.addServiceProvider("VRPaymentConfigurationService",e=>{const t=d.getContainer("init");return new Ve(t.httpClient,e.loginService)});d.addServiceProvider("VRPaymentRefundService",e=>{const t=d.getContainer("init");return new Le(t.httpClient,e.loginService)});d.addServiceProvider("VRPaymentTransactionService",e=>{const t=d.getContainer("init");return new Me(t.httpClient,e.loginService)});d.addServiceProvider("VRPaymentTransactionCompletionService",e=>{const t=d.getContainer("init");return new Be(t.httpClient,e.loginService)});d.addServiceProvider("VRPaymentTransactionVoidService",e=>{const t=d.getContainer("init");return new ze(t.httpClient,e.loginService)}); -//# sourceMappingURL=v-r-payment-payment-Cp2eQSV_.js.map diff --git a/src/Resources/public/administration/assets/v-r-payment-payment-Cp2eQSV_.js.map b/src/Resources/public/administration/assets/v-r-payment-payment-Cp2eQSV_.js.map deleted file mode 100644 index 64dc811..0000000 --- a/src/Resources/public/administration/assets/v-r-payment-payment-Cp2eQSV_.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"v-r-payment-payment-Cp2eQSV_.js","sources":["../../../app/administration/src/module/vrpayment-order/extension/sw-order/sw-order.html.twig","../../../app/administration/src/module/vrpayment-order/extension/sw-order/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-completion/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-completion/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-partial/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-partial/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-refund-by-amount/index.js","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-void/index.html.twig","../../../app/administration/src/module/vrpayment-order/component/vrpayment-order-action-void/index.js","../../../app/administration/src/module/vrpayment-order/page/vrpayment-order-detail/index.html.twig","../../../app/administration/src/module/vrpayment-order/page/vrpayment-order-detail/index.js","../../../app/administration/src/module/vrpayment-order/index.js","../../../app/administration/src/module/vrpayment-settings/acl/index.js","../../../app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.html.twig","../../../app/administration/src/module/vrpayment-settings/page/vrpayment-settings/configuration-constants.js","../../../app/administration/src/module/vrpayment-settings/page/vrpayment-settings/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-credentials/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-credentials/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-options/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-options/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-settings-icon/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-settings-icon/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-storefront-options/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-storefront-options/index.js","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-advanced-options/index.html.twig","../../../app/administration/src/module/vrpayment-settings/component/sw-vrpayment-advanced-options/index.js","../../../app/administration/src/module/vrpayment-settings/index.js","../../../app/administration/src/core/service/api/vrpayment-configuration.service.js","../../../app/administration/src/core/service/api/vrpayment-refund.service.js","../../../app/administration/src/core/service/api/vrpayment-transaction.service.js","../../../app/administration/src/core/service/api/vrpayment-transaction-completion.service.js","../../../app/administration/src/core/service/api/vrpayment-transaction-void.service.js","../../../app/administration/src/init/api-service.init.js"],"sourcesContent":["{% block sw_order_detail_content_tabs_general %}\n {% parent %}\n\n{# sw-tabs-item will dissappear. See: https://github.com/shopware/shopware/blob/trunk/UPGRADE-6.7.md#sw-tabs-is-removed #}\n\n\t{{ $tc('vrpayment-order.header') }}\n\n{% endblock %}\n\n{% block sw_order_detail_actions_slot_smart_bar_actions %}\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './sw-order.html.twig';\nimport './sw-order.scss';\n\nconst {Component, Context} = Shopware;\nconst Criteria = Shopware.Data.Criteria;\n\nconst vrpaymentFormattedHandlerIdentifier = 'handler_vrpaymentpayment_vrpaymentpaymenthandler';\n\nComponent.override('sw-order-detail', {\n\ttemplate,\n\n\tdata() {\n\t\treturn {\n\t\t\tisVRPaymentPayment: false\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tisEditable() {\n\t\t\treturn !this.isVRPaymentPayment || this.$route.name !== 'vrpayment.order.detail';\n\t\t},\n\t\tshowTabs() {\n\t\t\treturn true;\n\t\t}\n\t},\n\n\twatch: {\n\t\torderId: {\n\t\t\tdeep: true,\n\t\t\thandler() {\n\t\t\t\tif (!this.orderId) {\n\t\t\t\t\tthis.setIsVRPaymentPayment(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst orderRepository = this.repositoryFactory.create('order');\n\t\t\t\tconst orderCriteria = new Criteria(1, 1);\n\t\t\t\torderCriteria.addAssociation('transactions');\n\n\t\t\t\torderRepository.get(this.orderId, Context.api, orderCriteria).then((order) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(order.amountTotal <= 0) ||\n\t\t\t\t\t\t(order.transactions.length <= 0) ||\n\t\t\t\t\t\t!order.transactions[0].paymentMethodId\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.setIsVRPaymentPayment(null);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst paymentMethodId = order.transactions[0].paymentMethodId;\n\t\t\t\t\tif (paymentMethodId !== undefined && paymentMethodId !== null) {\n\t\t\t\t\t\tthis.setIsVRPaymentPayment(paymentMethodId);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\timmediate: true\n\t\t}\n\t},\n\n\tmethods: {\n\t\tsetIsVRPaymentPayment(paymentMethodId) {\n\t\t\tif (!paymentMethodId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst paymentMethodRepository = this.repositoryFactory.create('payment_method');\n\t\t\tpaymentMethodRepository.get(paymentMethodId, Context.api).then(\n\t\t\t\t(paymentMethod) => {\n\t\t\t\t\tthis.isVRPaymentPayment = (paymentMethod.formattedHandlerIdentifier === vrpaymentFormattedHandlerIdentifier);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_completion %}\n\n\n\t{% block vrpayment_order_action_completion_amount %}\n\t\t\n \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_completion_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-completion', {\n\n\ttemplate: template,\n\n\tinject: ['VRPaymentTransactionCompletionService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tisCompletion: false\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t},\n\n\t\tcompletion() {\n\t\t\tif (this.isCompletion) {\n\t\t\t\tthis.isLoading = true;\n\t\t\t\tthis.VRPaymentTransactionCompletionService.createTransactionCompletion(\n\t\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\t\tthis.transactionData.transactions[0].id\n\t\t\t\t).then(() => {\n\t\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.captureAction.successTitle'),\n\t\t\t\t\t\tmessage: this.$tc('vrpayment-order.captureAction.successMessage')\n\t\t\t\t\t});\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}).catch((errorResponse) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_refund %}\n\n\n\t{% block vrpayment_order_action_refund_amount %}\n\n\t\t\n\t\t\n\n\t\t
    \n\t\t\t{{ $tc('vrpayment-order.refundAction.maxAvailableItemsToRefund') }}:\n\t\t\t{{ this.$parent.$parent.itemRefundableQuantity }}\n\t\t
    \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_refund_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n
    \n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-refund', {\n\ttemplate,\n\n\tinject: ['VRPaymentRefundService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\n\t\torderId: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\trefundQuantity: 0,\n\t\t\tisLoading: true,\n\t\t\tcurrentLineItem: '',\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t\tthis.refundQuantity = 1;\n\t\t},\n\n\t\trefund() {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createRefund(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\tthis.refundQuantity,\n\t\t\t\tthis.$parent.$parent.currentLineItem\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tthis.$emit('modal-close');\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t});\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tvar errorTitle = errorResponse?.response?.data?.errors?.[0]?.title ?? this.$tc('vrpayment-order.refundAction.refundCreateError.errorTitle')\n\t\t\t\t\tvar errorMessage;\n\t\t\t\t\tswitch(errorResponse.response.data) {\n\t\t\t\t\t\tcase 'refundQuantityZero':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundQuantityIsZero');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'refundExceedsQuantity':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundQuantityExceedsAvailableBalance');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\terrorMessage = errorResponse.response.data.errors[0].detail;\n\t\t\t\t\t}\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorTitle,\n\t\t\t\t\t\tmessage: errorMessage,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_refund_partial %}\n\n\n\t{% block vrpayment_order_action_refund_amount_partial %}\n\t\t\n\t\t\n\n\t\t
    \n\t\t\t{{ $tc('vrpayment-order.refundAction.maxAvailableAmountToRefund') }}:\n\t\t\t{{ this.$parent.$parent.itemRefundableAmount }}\n\t\t
    \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_refund_confirm_button_partial %}\n\t\n\t{% endblock %}\n\n\t\n
    \n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-refund-partial', {\n\ttemplate,\n\n\tinject: ['VRPaymentRefundService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\n\t\torderId: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tcurrency: this.transactionData.transactions[0].currency,\n\t\t\trefundAmount: 0.00,\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n createdComponent() {\n this.isLoading = false;\n this.currency = this.transactionData.transactions[0].currency;\n if (!this.refundAmount) {\n this.refundAmount = this.$parent.$parent.itemRefundableAmount;\n }\n },\n\n\t\tcreatePartialRefund(itemUniqueId) {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createPartialRefund(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\tthis.refundAmount,\n\t\t\t\titemUniqueId\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tthis.$emit('modal-close');\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t});\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t},\n\n watch: {\n refundAmount(newValue) {\n if (newValue !== null) {\n this.refundAmount = Math.round(newValue * 100) / 100;\n }\n }\n }\n});\n","{% block vrpayment_order_action_refund_by_amount %}\n\n\n\t{% block vrpayment_order_action_refund_amount_by_amount %}\n\t\t\n\t\t\n\t{% endblock %}\n\n\t{% block vrpayment_order_action_refund_confirm_button_by_amount %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-refund-by-amount', {\n\ttemplate,\n\n\tinject: ['VRPaymentRefundService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\n\t\torderId: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tcurrency: this.transactionData.transactions[0].currency,\n\t\t\trefundAmount: 0,\n\t\t\trefundableAmount: 0,\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t\tthis.currency = this.transactionData.transactions[0].currency;\n\t\t\tthis.refundAmount = Number(this.transactionData.transactions[0].amountIncludingTax);\n\t\t\tthis.refundableAmount = Number(this.transactionData.transactions[0].amountIncludingTax);\n\t\t},\n\n\t\trefundByAmount() {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createRefundByAmount(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\tthis.refundAmount\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tthis.$emit('modal-close');\n\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t});\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tvar errorTitle = errorResponse?.response?.data?.errors?.[0]?.title ?? this.$tc('vrpayment-order.refundAction.refundCreateError.errorTitle')\n\t\t\t\t\tvar errorMessage;\n\t\t\t\t\tswitch(errorResponse.response.data) {\n\t\t\t\t\t\tcase 'refundAmountZero':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundAmountIsZero');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'refundExceedsAmount':\n\t\t\t\t\t\t\terrorMessage = this.$tc('vrpayment-order.refundAction.refundCreateError.messageRefundAmountExceedsAvailableBalance');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\terrorMessage = errorResponse.response.data.errors[0].detail;\n\t\t\t\t\t}\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorTitle,\n\t\t\t\t\t\tmessage: errorMessage,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n});\n","{% block vrpayment_order_action_void %}\n\n\n\t{% block vrpayment_order_action_void_amount %}\n {# Review if this v-model:checked=\"isVoid\" needs to change to checked #}\n\t\t\n \n\t{% endblock %}\n\n\t{% block vrpayment_order_action_void_confirm_button %}\n\t\n\t{% endblock %}\n\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\n\nconst {Component, Mixin, Filter, Utils} = Shopware;\n\nComponent.register('vrpayment-order-action-void', {\n\ttemplate,\n\n\tinject: ['VRPaymentTransactionVoidService'],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\ttransactionData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisLoading: true,\n\t\t\tisVoid: false\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t},\n\t\tlineItemColumns() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tproperty: 'uniqueId',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.uniqueId'),\n\t\t\t\t\trawData: false,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tprimary: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'name',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.name'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'quantity',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.quantity'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'amountIncludingTax',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.amountIncludingTax'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tinlineEdit: 'string',\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'type',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.type'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\tsortable: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'taxAmount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.taxAmount'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tallowResize: true,\n\t\t\t\t\twidth: 'auto'\n\t\t\t\t}\n\t\t\t];\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.isLoading = false;\n\t\t\tthis.currency = this.transactionData.transactions[0].currency;\n\t\t\tthis.refundableAmount = this.transactionData.transactions[0].amountIncludingTax;\n\t\t\tthis.refundAmount = this.transactionData.transactions[0].amountIncludingTax;\n\t\t},\n\n\t\tvoidPayment() {\n\t\t\tif (this.isVoid) {\n\t\t\t\tthis.isLoading = true;\n\t\t\t\tthis.VRPaymentTransactionVoidService.createTransactionVoid(\n\t\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\t\tthis.transactionData.transactions[0].id\n\t\t\t\t).then(() => {\n\t\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.voidAction.successTitle'),\n\t\t\t\t\t\tmessage: this.$tc('vrpayment-order.voidAction.successMessage')\n\t\t\t\t\t});\n\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t});\n\t\t\t\t}).catch((errorResponse) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\t\tthis.$emit('modal-close');\n\t\t\t\t\t\tthis.$nextTick(() => {\n\t\t\t\t\t\t\tthis.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n});\n","{% block vrpayment_order_detail %}\n
    \n\t
    \n\t\t\n\t\t\t\n\t\t\n\t\t{% block vrpayment_order_transaction_history_card %}\n\t\t\n\t\t\t\n\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_transaction_line_items_card %}\n \n \n \n\t\t{% endblock %}\n\t\t{% block vrpayment_order_transaction_refunds_card %}\n\t\t 0\">\n\t\t\t\n\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_refund_partial %}\n\t\t\t\n\t\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_refund %}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_refund_by_amount %}\n\t\t\t\n\t\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_completion%}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t\t{% block vrpayment_order_actions_modal_void %}\n\t\t\n\t\t\n\t\t{% endblock %}\n\t
    \n\t\n
    \n{% endblock %}\n","/* global Shopware */\n\nimport '../../component/vrpayment-order-action-completion';\nimport '../../component/vrpayment-order-action-refund';\nimport '../../component/vrpayment-order-action-refund-partial';\nimport '../../component/vrpayment-order-action-refund-by-amount';\nimport '../../component/vrpayment-order-action-void';\nimport template from './index.html.twig';\nimport './index.scss';\n\nconst {Component, Mixin, Filter, Context, Utils} = Shopware;\nconst Criteria = Shopware.Data.Criteria;\n\nComponent.register('vrpayment-order-detail', {\n\ttemplate,\n\n\tinject: [\n\t\t'VRPaymentTransactionService',\n\t\t'VRPaymentRefundService',\n\t\t'repositoryFactory'\n\t],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\ttransactionData: {\n\t\t\t\ttransactions: [],\n\t\t\t\trefunds: []\n\t\t\t},\n\t\t\ttransaction: {},\n\t\t\tlineItems: [],\n\t\t\trefundableQuantity: 0,\n\t\t\titemRefundableQuantity: 0,\n\t\t\tisLoading: true,\n\t\t\torderId: '',\n\t\t\tcurrency: '',\n\t\t\tmodalType: '',\n\t\t\trefundAmount: 0.00,\n\t\t\trefundableAmount: 0.00,\n\t\t\titemRefundedAmount: 0.00,\n\t\t\titemRefundedQuantity: 0,\n\t\t\titemRefundableAmount: 0.00,\n\t\t\tcurrentLineItem: '',\n\t\t\trefundLineItemQuantity: [],\n\t\t\trefundLineItemAmount: [],\n\t\t\tselectedItems: []\n\t\t};\n\t},\n\n\tmetaInfo() {\n\t\treturn {\n\t\t\ttitle: this.$tc('vrpayment-order.header')\n\t\t};\n\t},\n\n\n\tcomputed: {\n\t\tdateFilter() {\n\t\t\treturn Filter.getByName('date');\n\t\t},\n\n\t\trelatedResourceColumns() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tproperty: 'paymentMethodName',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.payment_method'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'state',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.state'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'currency',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.currency'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'authorized_amount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.authorized_amount'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'id',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.transaction'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'customerId',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.transactionHistory.types.customer'),\n\t\t\t\t\trawData: true\n\t\t\t\t}\n\t\t\t];\n\t\t},\n\n\t\tlineItemColumns() {\n\t\t\treturn [\n\t\t\t // It must be set in order to have correctly working checkbox mechanism\n\t\t\t\t{\n\t\t\t\t\tproperty: 'id',\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tprimary: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'uniqueId',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.uniqueId'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: false,\n\t\t\t\t\tprimary: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'name',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.name'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'quantity',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.quantity'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'amountIncludingTax',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.amountIncludingTax'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'type',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.type'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'taxAmount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.lineItem.types.taxAmount'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'refundableQuantity',\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: false,\n\t\t\t\t},\n\t\t\t];\n\t\t},\n\n\t\trefundColumns() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tproperty: 'id',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.id'),\n\t\t\t\t\trawData: true,\n\t\t\t\t\tvisible: true,\n\t\t\t\t\tprimary: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'amount',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.amount'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'state',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.state'),\n\t\t\t\t\trawData: true\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tproperty: 'createdOn',\n\t\t\t\t\tlabel: this.$tc('vrpayment-order.refund.types.createdOn'),\n\t\t\t\t\trawData: true\n\t\t\t\t}\n\t\t\t];\n\t\t}\n\t},\n\n\twatch: {\n\t\t'$route'() {\n\t\t\tthis.resetDataAttributes();\n\t\t\tthis.createdComponent();\n\t\t}\n\t},\n\n\tcreated() {\n\t\tthis.createdComponent();\n\t},\n\n\tmethods: {\n\t\tcreatedComponent() {\n\t\t\tthis.orderId = this.$route.params.id;\n\t\t\tconst orderRepository = this.repositoryFactory.create('order');\n\t\t\tconst orderCriteria = new Criteria(1, 1);\n\t\t\torderCriteria.addAssociation('transactions');\n\t\t\torderCriteria.getAssociation('transactions').addSorting(Criteria.sort('createdAt', 'DESC'));\n\n\t\t\torderRepository.get(this.orderId, Context.api, orderCriteria).then((order) => {\n\t\t\t\tthis.order = order;\n\t\t\t\tthis.isLoading = false;\n\t\t\t\tvar totalAmountTemp = 0;\n\t\t\t\tvar refundsAmountTemp = 0;\n\t\t\t\tconst vrpaymentTransactionId = order.transactions[0].customFields.vrpayment_transaction_id;\n\t\t\t\tthis.VRPaymentTransactionService.getTransactionData(order.salesChannelId, vrpaymentTransactionId)\n\t\t\t\t\t.then((VRPaymentTransaction) => {\n\t\t\t\t\t\tthis.currency = VRPaymentTransaction.transactions[0].currency;\n\n\t\t\t\t\t\tVRPaymentTransaction.transactions[0].authorized_amount = Utils.format.currency(\n\t\t\t\t\t\t\tVRPaymentTransaction.transactions[0].authorizationAmount,\n\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tVRPaymentTransaction.refunds.forEach((refund) => {\n\t\t\t\t\t\t\trefundsAmountTemp = parseFloat(parseFloat(refundsAmountTemp) + parseFloat(refund.amount));\n\t\t\t\t\t\t\trefund.amount = Utils.format.currency(\n\t\t\t\t\t\t\t\trefund.amount,\n\t\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\trefund.reductions.forEach((reduction) => {\n\t\t\t\t\t\t\t if (reduction.quantityReduction > 0) {\n if (this.refundLineItemQuantity[reduction.lineItemUniqueId] === undefined) {\n this.refundLineItemQuantity[reduction.lineItemUniqueId] = reduction.quantityReduction;\n } else {\n this.refundLineItemQuantity[reduction.lineItemUniqueId] += reduction.quantityReduction;\n }\n\t\t\t\t\t\t\t }\n if (reduction.unitPriceReduction > 0) {\n if (this.refundLineItemAmount[reduction.lineItemUniqueId] === undefined) {\n this.refundLineItemAmount[reduction.lineItemUniqueId] = reduction.unitPriceReduction;\n } else {\n this.refundLineItemAmount[reduction.lineItemUniqueId] += reduction.unitPriceReduction;\n }\n }\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tVRPaymentTransaction.transactions[0].lineItems.forEach((lineItem) => {\n\t\t\t\t\t\t\tif (!lineItem.id) {\n\t\t\t\t\t\t\t\tlineItem.id = lineItem.uniqueId;\n }\n\n lineItem.itemRefundedAmount = parseFloat(this.refundLineItemAmount[lineItem.uniqueId] || 0) * parseInt(lineItem.quantity);\n lineItem.amountIncludingTax = parseFloat(lineItem.amountIncludingTax) || 0;\n\n lineItem.itemRefundedQuantity = parseInt(this.refundLineItemQuantity[lineItem.uniqueId]) || 0;\n lineItem.refundableAmount = parseFloat(\n (lineItem.amountIncludingTax - lineItem.itemRefundedAmount).toFixed(2)\n );\n\n\t\t\t\t\t\t\tlineItem.amountIncludingTax = Utils.format.currency(\n\t\t\t\t\t\t\t\tlineItem.amountIncludingTax,\n\t\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tlineItem.taxAmount = Utils.format.currency(\n\t\t\t\t\t\t\t\tlineItem.taxAmount,\n\t\t\t\t\t\t\t\tthis.currency\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\ttotalAmountTemp = parseFloat(parseFloat(totalAmountTemp) + parseFloat(lineItem.unitPriceIncludingTax * lineItem.quantity));\n\n\t\t\t\t\t\t\tlineItem.refundableQuantity = parseInt(\n\t\t\t\t\t\t\t\tparseInt(lineItem.quantity) - parseInt(this.refundLineItemQuantity[lineItem.uniqueId] || 0)\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tthis.lineItems = VRPaymentTransaction.transactions[0].lineItems;\n\t\t\t\t\t\tthis.transactionData = VRPaymentTransaction;\n\t\t\t\t\t\tthis.transaction = this.transactionData.transactions[0];\n\t\t\t\t\t\tthis.refundAmount = Number(this.transactionData.transactions[0].amountIncludingTax);\n\t\t\t\t\t\tthis.refundableAmount = parseFloat(parseFloat(totalAmountTemp) - parseFloat(refundsAmountTemp));\n\n\t\t\t\t\t}).catch((errorResponse) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.paymentDetails.error.title'),\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\t\ttitle: this.$tc('vrpayment-order.paymentDetails.error.title'),\n\t\t\t\t\t\t\tmessage: errorResponse.message,\n\t\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.isLoading = false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t},\n\t\tdownloadPackingSlip() {\n\t\t\twindow.open(\n\t\t\t\tthis.VRPaymentTransactionService.getPackingSlip(\n\t\t\t\t\tthis.transaction.metaData.salesChannelId,\n\t\t\t\t\tthis.transaction.id\n\t\t\t\t),\n\t\t\t\t'_blank'\n\t\t\t);\n\t\t},\n\n\t\tdownloadInvoice() {\n\t\t\twindow.open(\n\t\t\t\tthis.VRPaymentTransactionService.getInvoiceDocument(\n\t\t\t\t\tthis.transaction.metaData.salesChannelId,\n\t\t\t\t\tthis.transaction.id\n\t\t\t\t),\n\t\t\t\t'_blank'\n\t\t\t);\n\t\t},\n\n\t\tresetDataAttributes() {\n\t\t\tthis.transactionData = {\n\t\t\t\ttransactions: [],\n\t\t\t\trefunds: []\n\t\t\t};\n\t\t\tthis.lineItems = [];\n\t\t\tthis.refundLineItemQuantity = [];\n\t\t\tthis.refundLineItemAmount = [];\n\t\t\tthis.isLoading = true;\n\t\t},\n\n\t\tspawnModal(modalType, lineItemId, refundableQuantity, itemRefundableAmount) {\n\t\t\tthis.modalType = modalType;\n\t\t\tthis.currentLineItem = lineItemId;\n\t\t\tthis.itemRefundableQuantity = refundableQuantity;\n this.itemRefundableAmount = !isNaN(itemRefundableAmount) ? Math.round(itemRefundableAmount * 100) / 100 : 0;\n\t\t},\n\n\t\tcloseModal() {\n\t\t\tthis.modalType = '';\n\t\t},\n\n\t\tlineItemRefund(lineItemId) {\n\t\t\tthis.isLoading = true;\n\t\t\tthis.VRPaymentRefundService.createRefund(\n\t\t\t\tthis.transactionData.transactions[0].metaData.salesChannelId,\n\t\t\t\tthis.transactionData.transactions[0].id,\n\t\t\t\t0,\n\t\t\t\tlineItemId\n\t\t\t).then(() => {\n\t\t\t\tthis.createNotificationSuccess({\n\t\t\t\t\ttitle: this.$tc('vrpayment-order.refundAction.successTitle'),\n\t\t\t\t\tmessage: this.$tc('vrpayment-order.refundAction.successMessage')\n\t\t\t\t});\n this.isLoading = false;\n this.$emit('modal-close');\n this.$nextTick(() => {\n this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n });\n\t\t\t}).catch((errorResponse) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.response.data.errors[0].title,\n\t\t\t\t\t\tmessage: errorResponse.response.data.errors[0].detail,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} catch (e) {\n\t\t\t\t\tthis.createNotificationError({\n\t\t\t\t\t\ttitle: errorResponse.title,\n\t\t\t\t\t\tmessage: errorResponse.response.data,\n\t\t\t\t\t\tautoClose: false\n\t\t\t\t\t});\n\t\t\t\t} finally {\n this.isLoading = false;\n this.$emit('modal-close');\n this.$nextTick(() => {\n this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n });\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tisSelectable(item) {\n\t\t\treturn item.refundableQuantity > 0 && item.refundableAmount > 0 && item.itemRefundedAmount == 0 && item.itemRefundedQuantity == 0;\n\t\t},\n\t\tonSelectionChanged(selection) {\n\t\t\tthis.selectedItems = Object.values(selection);\n\t\t},\n onPerformBulkAction() {\n if (this.selectedItems.length) {\n // Set isLoading to true to show the loader\n this.isLoading = true;\n\n // Force the DOM to update before proceeding with the asynchronous operations\n this.$nextTick(() => {\n const refundPromises = this.selectedItems.map((item) => {\n return this.lineItemRefundBulk(item.uniqueId); // Simulated refund action with delay\n });\n\n // Wait for all refund promises to complete\n Promise.all(refundPromises)\n .then(() => {\n // Once all promises are resolved, hide the loader and close the modal\n this.isLoading = false;\n this.$emit('modal-close');\n this.$nextTick(() => {\n this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`);\n });\n })\n .catch((error) => {\n // Handle any errors during the refund process\n this.createNotificationError({\n title: 'Error',\n message: 'Something went wrong with the refunds',\n autoClose: false\n });\n this.isLoading = false; // Ensure the loader is hidden even on error\n });\n });\n }\n },\n lineItemRefundBulk(lineItemId) {\n return new Promise((resolve, reject) => {\n this.VRPaymentRefundService.createRefund(\n this.transactionData.transactions[0].metaData.salesChannelId,\n this.transactionData.transactions[0].id,\n 0,\n lineItemId\n )\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-order.refundAction.successTitle'),\n message: this.$tc('vrpayment-order.refundAction.successMessage')\n });\n resolve();\n })\n .catch((errorResponse) => {\n try {\n this.createNotificationError({\n title: errorResponse.response.data.errors[0].title,\n message: errorResponse.response.data.errors[0].detail,\n autoClose: false\n });\n } catch (e) {\n this.createNotificationError({\n title: errorResponse.title,\n message: errorResponse.response.data,\n autoClose: false\n });\n } finally {\n reject();\n }\n });\n });\n },\n\t}\n});\n","/* global Shopware */\n\nimport './extension/sw-order';\nimport './page/vrpayment-order-detail';\n\nimport deDE from './snippet/de-DE.json';\nimport enGB from './snippet/en-GB.json';\nimport frFR from './snippet/fr-FR.json';\nimport itIT from './snippet/it-IT.json';\n\nconst {Module} = Shopware;\n\nModule.register('vrpayment-order', {\n\ttype: 'plugin',\n\tname: 'VRPayment',\n\ttitle: 'vrpayment-order.general.title',\n\tdescription: 'vrpayment-order.general.descriptionTextModule',\n\tversion: '1.0.1',\n\ttargetVersion: '1.0.1',\n\tcolor: '#2b52ff',\n\n\tsnippets: {\n\t\t'de-DE': deDE,\n\t\t'en-GB': enGB,\n\t\t'fr-FR': frFR,\n\t\t'it-IT': itIT\n\t},\n\n\trouteMiddleware(next, currentRoute) {\n\t\tif (currentRoute.name === 'sw.order.detail') {\n\t\t\tcurrentRoute.children.push({\n\t\t\t\tcomponent: 'vrpayment-order-detail',\n\t\t\t\tname: 'vrpayment.order.detail',\n\t\t\t\tisChildren: true,\n\t\t\t\tpath: '/sw/order/vrpayment/detail/:id'\n\t\t\t});\n\t\t}\n\t\tnext(currentRoute);\n\t}\n});\n","Shopware.Service('privileges').addPrivilegeMappingEntry({\n category: 'permissions',\n parent: 'vrpayment',\n key: 'vrpayment',\n roles: {\n viewer: {\n privileges: [\n 'sales_channel:read',\n 'sales_channel_payment_method:read',\n 'system_config:read'\n ],\n dependencies: []\n },\n editor: {\n privileges: [\n 'sales_channel:update',\n 'sales_channel_payment_method:create',\n 'sales_channel_payment_method:update',\n 'system_config:update',\n 'system_config:create',\n 'system_config:delete'\n ],\n dependencies: [\n 'vrpayment.viewer'\n ]\n }\n }\n});\n\nShopware.Service('privileges').addPrivilegeMappingEntry({\n category: 'permissions',\n parent: null,\n key: 'sales_channel',\n roles: {\n viewer: {\n privileges: [\n 'sales_channel_payment_method:read'\n ]\n },\n editor: {\n privileges: [\n 'payment_method:update'\n ]\n },\n creator: {\n privileges: [\n 'payment_method:create',\n 'shipping_method:create',\n 'delivery_time:create'\n ]\n },\n deleter: {\n privileges: [\n 'payment_method:delete'\n ]\n }\n }\n});\n","{% block vrpayment_settings %}\n \n\n {% block vrpayment_settings_header %}\n \n {% endblock %}\n\n {% block vrpayment_settings_actions %}\n \n {% endblock %}\n\n {% block vrpayment_settings_content %}\n \n {% endblock %}\n \n{% endblock %}\n","export const CONFIG_DOMAIN = 'VRPaymentPayment.config';\nexport const CONFIG_APPLICATION_KEY = CONFIG_DOMAIN + '.' + 'applicationKey';\nexport const CONFIG_EMAIL_ENABLED = CONFIG_DOMAIN + '.' + 'emailEnabled';\nexport const CONFIG_INTEGRATION = CONFIG_DOMAIN + '.' + 'integration';\nexport const CONFIG_LINE_ITEM_CONSISTENCY_ENABLED = CONFIG_DOMAIN + '.' + 'lineItemConsistencyEnabled';\nexport const CONFIG_SPACE_ID = CONFIG_DOMAIN + '.' + 'spaceId';\nexport const CONFIG_SPACE_VIEW_ID = CONFIG_DOMAIN + '.' + 'spaceViewId';\nexport const CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontInvoiceDownloadEnabled';\nexport const CONFIG_USER_ID = CONFIG_DOMAIN + '.' + 'userId';\nexport const CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontWebhooksUpdateEnabled';\nexport const CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED = CONFIG_DOMAIN + '.' + 'storefrontPaymentsUpdateEnabled';\n\nexport default {\n CONFIG_DOMAIN,\n CONFIG_APPLICATION_KEY,\n CONFIG_EMAIL_ENABLED,\n CONFIG_INTEGRATION,\n CONFIG_LINE_ITEM_CONSISTENCY_ENABLED,\n CONFIG_SPACE_ID,\n CONFIG_SPACE_VIEW_ID,\n CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED,\n CONFIG_USER_ID,\n CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED,\n CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED\n};","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from './configuration-constants';\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('vrpayment-settings', {\n\n template: template,\n\n inject: [\n 'acl',\n 'VRPaymentConfigurationService'\n ],\n\n mixins: [\n Mixin.getByName('notification'),\n Mixin.getByName('sw-inline-snippet')\n ],\n\n data() {\n return {\n\n config: {},\n\n isLoading: false,\n isTesting: false,\n\n isSaveSuccessful: false,\n\n applicationKeyFilled: false,\n applicationKeyErrorState: false,\n\n spaceIdFilled: false,\n spaceIdErrorState: false,\n\n userIdFilled: false,\n userIdErrorState: false,\n\n isSetDefaultPaymentSuccessful: false,\n isSettingDefaultPaymentMethods: false,\n\n configIntegrationDefaultValue: 'payment_page',\n configEmailEnabledDefaultValue: true,\n configLineItemConsistencyEnabledDefaultValue: true,\n configStorefrontInvoiceDownloadEnabledEnabledDefaultValue: true,\n configStorefrontWebhooksUpdateEnabledDefaultValue: true,\n configStorefrontPaymentsUpdateEnabledDefaultValue: true,\n\n ...constants\n };\n },\n\n props: {\n isLoading: {\n type: Boolean,\n required: true\n }\n },\n\n metaInfo() {\n return {\n title: this.$createTitle()\n };\n },\n\n watch: {\n config: {\n handler(configData) {\n const defaultConfig = (this.$refs.configComponent.allConfigs || {}).null || {};\n const salesChannelId = this.$refs.configComponent.selectedSalesChannelId;\n if (salesChannelId === null) {\n\n this.applicationKeyFilled = !!this.config[this.CONFIG_APPLICATION_KEY];\n this.spaceIdFilled = !!this.config[this.CONFIG_SPACE_ID];\n this.userIdFilled = !!this.config[this.CONFIG_USER_ID];\n\n if (!(this.CONFIG_INTEGRATION in this.config)) {\n this.config[this.CONFIG_INTEGRATION] = this.configIntegrationDefaultValue;\n }\n\n if (!(this.CONFIG_EMAIL_ENABLED in this.config)) {\n this.config[this.CONFIG_EMAIL_ENABLED] = this.configEmailEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config)) {\n this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED] = this.configLineItemConsistencyEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config)) {\n this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED] = this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config)) {\n this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED] = this.configStorefrontWebhooksUpdateEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config)) {\n this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED] = this.configStorefrontPaymentsUpdateEnabledDefaultValue;\n }\n\n } else {\n\n this.applicationKeyFilled = !!this.config[this.CONFIG_APPLICATION_KEY] || !!defaultConfig[this.CONFIG_APPLICATION_KEY];\n this.spaceIdFilled = !!this.config[this.CONFIG_SPACE_ID] || !!defaultConfig[this.CONFIG_SPACE_ID];\n this.userIdFilled = !!this.config[this.CONFIG_USER_ID] || !!defaultConfig[this.CONFIG_USER_ID];\n\n\n if (!(this.CONFIG_INTEGRATION in this.config) || !(this.CONFIG_INTEGRATION in defaultConfig)) {\n this.config[this.CONFIG_INTEGRATION] = this.configIntegrationDefaultValue;\n }\n\n if (!(this.CONFIG_EMAIL_ENABLED in this.config) || !(this.CONFIG_EMAIL_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_EMAIL_ENABLED] = this.configEmailEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in this.config) || !(this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_LINE_ITEM_CONSISTENCY_ENABLED] = this.configLineItemConsistencyEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in this.config) || !(this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED] = this.configStorefrontInvoiceDownloadEnabledEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in this.config) || !(this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED] = this.configStorefrontWebhooksUpdateEnabledDefaultValue;\n }\n\n if (!(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in this.config) || !(this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED in defaultConfig)) {\n this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED] = this.configStorefrontPaymentsUpdateEnabledDefaultValue;\n }\n }\n\n this.$emit('salesChannelChanged');\n this.$emit('update:value', configData);\n },\n deep: true\n }\n },\n\n methods: {\n checkTextFieldInheritance(value) {\n if (typeof value !== 'string') {\n return true;\n }\n\n return value.length <= 0;\n },\n\n checkNumberFieldInheritance(value) {\n if (typeof value !== 'number') {\n return true;\n }\n\n return value.length <= 0;\n },\n\n checkBoolFieldInheritance(value) {\n return typeof value !== 'boolean';\n },\n\n getInheritValue(key) {\n if (this.selectedSalesChannelId == null ) {\n return this.actualConfigData[key];\n } else {\n return this.allConfigs['null'][key];\n }\n },\n\n onSave() {\n if (!(this.spaceIdFilled && this.userIdFilled && this.applicationKeyFilled)) {\n this.setErrorStates();\n return;\n }\n this.save();\n },\n\n save() {\n this.isLoading = true;\n\n this.$refs.configComponent.save().then((res) => {\n if (res) {\n this.config = res;\n }\n this.registerWebHooks();\n this.synchronizePaymentMethodConfiguration();\n this.installOrderDeliveryStates();\n }).catch((e) => {\n console.error('Error:', e);\n this.isLoading = false;\n });\n },\n\n registerWebHooks() {\n if (this.config[this.CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED] === false) {\n return false;\n }\n\n this.VRPaymentConfigurationService.registerWebHooks(this.$refs.configComponent.selectedSalesChannelId)\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.settingForm.messageWebHookUpdated')\n });\n }).catch((e) => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messageWebHookError')\n });\n this.isLoading = false;\n console.error('Error:', e);\n });\n },\n\n synchronizePaymentMethodConfiguration() {\n if (this.config[this.CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED] === false) {\n return false;\n }\n\n this.VRPaymentConfigurationService.synchronizePaymentMethodConfiguration(this.$refs.configComponent.selectedSalesChannelId)\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.settingForm.messagePaymentMethodConfigurationUpdated')\n });\n this.isLoading = false;\n }).catch((e) => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messagePaymentMethodConfigurationError')\n });\n this.isLoading = false;\n console.error('Error:', e);\n });\n },\n\n installOrderDeliveryStates(){\n this.VRPaymentConfigurationService.installOrderDeliveryStates()\n .then(() => {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.settingForm.messageOrderDeliveryStateUpdated')\n });\n this.isLoading = false;\n }).catch(() => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.titleError'),\n message: this.$tc('vrpayment-settings.settingForm.messageOrderDeliveryStateError')\n });\n this.isLoading = false;\n });\n },\n\n onSetPaymentMethodDefault() {\n this.isSettingDefaultPaymentMethods = true;\n this.VRPaymentConfigurationService.setVRPaymentAsSalesChannelPaymentDefault(\n this.$refs.configComponent.selectedSalesChannelId\n ).then(() => {\n this.isSettingDefaultPaymentMethods = false;\n this.isSetDefaultPaymentSuccessful = true;\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.titleSuccess'),\n message: this.$tc('vrpayment-settings.salesChannelCard.messageDefaultPaymentUpdated')\n });\n });\n },\n\n setErrorStates() {\n const messageNotBlankErrorState = {\n code: 1,\n detail: this.$tc('vrpayment-settings.messageNotBlank')\n };\n\n if (!this.spaceIdFilled) {\n this.spaceIdErrorState = messageNotBlankErrorState;\n }\n\n if (!this.userIdFilled) {\n this.userIdErrorState = messageNotBlankErrorState;\n }\n\n if (!this.applicationKeyFilled) {\n this.applicationKeyErrorState = messageNotBlankErrorState;\n }\n },\n\n // Handles the 'check-api-connection-event'.\n // Uses the provided apiConnectionData to perform API connection checks.\n onCheckApiConnection(apiConnectionData) {\n const { spaceId, userId, applicationKey } = apiConnectionData;\n this.isTesting = true;\n\n this.VRPaymentConfigurationService.checkApiConnection(spaceId, userId, applicationKey)\n .then((res) => {\n if (res.result === 200) {\n this.createNotificationSuccess({\n title: this.$tc('vrpayment-settings.settingForm.credentials.alert.title'),\n message: this.$tc('vrpayment-settings.settingForm.credentials.alert.successMessage')\n });\n } else {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.credentials.alert.title'),\n message: this.$tc('vrpayment-settings.settingForm.credentials.alert.errorMessage')\n });\n }\n this.isTesting = false;\n }).catch(() => {\n this.createNotificationError({\n title: this.$tc('vrpayment-settings.settingForm.credentials.alert.title'),\n message: this.$tc('vrpayment-settings.settingForm.credentials.alert.errorMessage')\n });\n this.isTesting = false;\n });\n }\n }\n});\n","{% block vrpayment_settings_content_card_channel_config_credentials %}\n\t\n\n\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container %}\n\t\t\t\n\n\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}\n\t\t\t\t\t
    \n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_user_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_application_key %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\t\t\t\t\t
    \n\t\t\t\t{% endblock %}\n\n\t\t\t\t{% verbatim %}\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t{{ $tc('vrpayment-settings.settingForm.credentials.button.label') }}\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t{% endverbatim %}\n\n\t\t\t
    \n\t\t{% endblock %}\n\t\n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-credentials', {\n template,\n\n name: 'VRPaymentCredentials',\n\n inject: [\n 'acl'\n ],\n\n mixins: [\n Mixin.getByName('notification')\n ],\n\n props: {\n actualConfigData: {\n type: Object,\n required: true\n },\n allConfigs: {\n type: Object,\n required: true\n },\n\n selectedSalesChannelId: {\n type: [String, null],\n required: false,\n default: null\n },\n spaceIdFilled: {\n type: Boolean,\n required: true\n },\n spaceIdErrorState: {\n required: true\n },\n userIdFilled: {\n type: Boolean,\n required: true\n },\n userIdErrorState: {\n required: true\n },\n applicationKeyFilled: {\n type: Boolean,\n required: true\n },\n applicationKeyErrorState: {\n required: true\n },\n isLoading: {\n type: Boolean,\n required: true\n },\n isTesting: {\n type: Boolean,\n required: false\n }\n },\n\n data() {\n return {\n ...constants\n };\n },\n\n computed: {\n currentConfig() {\n if (this.selectedSalesChannelId && this.allConfigs[this.selectedSalesChannelId]) {\n return this.allConfigs[this.selectedSalesChannelId];\n }\n return this.allConfigs['null'] || {};\n }\n },\n\n methods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t return !value || value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t return value == null || value === '';\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t return typeof value !== 'boolean';\n\t\t},\n\n // Emits the 'check-api-connection-event' with the current API connection parameters.\n // Used to trigger API connection testing from this component.\n emitCheckApiConnectionEvent() {\n const apiConnectionParams = {\n spaceId: this.currentConfig[constants.CONFIG_SPACE_ID],\n userId: this.currentConfig[constants.CONFIG_USER_ID],\n applicationKey: this.currentConfig[constants.CONFIG_APPLICATION_KEY]\n };\n\n this.$emit('check-api-connection-event', apiConnectionParams);\n },\n\n getInheritedValue(key) {\n return this.allConfigs['null']?.[key] ?? null;\n }\n }\n});\n","{% block vrpayment_settings_content_card_channel_config_options %}\n\t\n\n\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container %}\n\t\t\t\n\n\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings %}\n\t\t\t\t\t
    \n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_space_view_id %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_integration %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_line_item_consistency_enabled %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\n\t\t\t\t\t\t{% block vrpayment_settings_content_card_channel_config_credentials_card_container_settings_email_enabled %}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t{% endblock %}\n\t\t\t\t\t
    \n\t\t\t\t{% endblock %}\n\t\t\t
    \n\t\t{% endblock %}\n\t
    \n\n{% endblock %}\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-options', {\n\ttemplate: template,\n\n\tname: 'VRPaymentOptions',\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\tactualConfigData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tallConfigs: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tselectedSalesChannelId: {\n\t\t\trequired: true\n\t\t},\n\t\tisLoading: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t...constants\n\t\t};\n\t},\n\n\tcomputed: {\n\t\tintegrationOptions() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: 'payment_page',\n\t\t\t\t\tname: this.$tc('vrpayment-settings.settingForm.options.integration.options.payment_page')\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: 'iframe',\n\t\t\t\t\tname: this.$tc('vrpayment-settings.settingForm.options.integration.options.iframe')\n\t\t\t\t}\n\t\t\t];\n\t\t}\n\t},\n\n\tmethods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t\tif (typeof value !== 'string') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t\tif (typeof value !== 'number') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t\treturn typeof value !== 'boolean';\n\t\t}\n\t}\n});\n","{% block vrpayment_settings_icon %}\n \n \n\n\n\t\n\n\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\n\n\n \n{% endblock %}\n","import template from './index.html.twig';\n\nconst { Component } = Shopware;\n\nComponent.register('sw-vrpayment-settings-icon', {\n template\n});\n","\n\t\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
    \n\t
    \n
    \n\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-storefront-options', {\n\ttemplate: template,\n\n\tname: 'VRPaymentStorefrontOptions',\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\tactualConfigData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tallConfigs: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tselectedSalesChannelId: {\n\t\t\trequired: true\n\t\t},\n\t\tisLoading: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t...constants\n\t\t};\n\t},\n\n\tmethods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t\tif (typeof value !== 'string') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t\tif (typeof value !== 'number') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t\treturn typeof value !== 'boolean';\n\t\t}\n\t}\n});\n","\n\t\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
    \n\t
    \n
    \n\n","/* global Shopware */\n\nimport template from './index.html.twig';\nimport constants from '../../page/vrpayment-settings/configuration-constants'\n\nconst {Component, Mixin} = Shopware;\n\nComponent.register('sw-vrpayment-advanced-options', {\n\ttemplate: template,\n\n\tname: 'VRPaymentAdvancedOptions',\n\n\tinject: [\n\t\t'acl'\n\t],\n\n\tmixins: [\n\t\tMixin.getByName('notification')\n\t],\n\n\tprops: {\n\t\tactualConfigData: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tallConfigs: {\n\t\t\ttype: Object,\n\t\t\trequired: true\n\t\t},\n\t\tselectedSalesChannelId: {\n\t\t\trequired: true\n\t\t},\n\t\tisLoading: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t...constants\n\t\t};\n\t},\n\n\tmethods: {\n\t\tcheckTextFieldInheritance(value) {\n\t\t\tif (typeof value !== 'string') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckNumberFieldInheritance(value) {\n\t\t\tif (typeof value !== 'number') {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn value.length <= 0;\n\t\t},\n\n\t\tcheckBoolFieldInheritance(value) {\n\t\t\treturn typeof value !== 'boolean';\n\t\t}\n\t}\n});\n","/* global Shopware */\n\nimport './acl';\nimport './page/vrpayment-settings';\nimport './component/sw-vrpayment-credentials';\nimport './component/sw-vrpayment-options';\nimport './component/sw-vrpayment-settings-icon';\nimport './component/sw-vrpayment-storefront-options';\nimport './component/sw-vrpayment-advanced-options';\n\nimport deDE from './snippet/de-DE.json';\nimport enGB from './snippet/en-GB.json';\nimport frFR from './snippet/fr-FR.json';\nimport itIT from './snippet/it-IT.json';\n\nconst {Module} = Shopware;\n\nModule.register('vrpayment-settings', {\n\ttype: 'plugin',\n\tname: 'VRPayment',\n\ttitle: 'vrpayment-settings.general.descriptionTextModule',\n\tdescription: 'vrpayment-settings.general.descriptionTextModule',\n\tcolor: '#28d8ff',\n\ticon: 'default-action-settings',\n\tversion: '1.0.1',\n\ttargetVersion: '1.0.1',\n\n snippets: {\n 'de-DE': deDE,\n 'en-GB': enGB,\n 'fr-FR': frFR,\n 'it-IT': itIT,\n },\n\n\troutes: {\n\t\tindex: {\n\t\t\tcomponent: 'vrpayment-settings',\n\t\t\tpath: 'index',\n\t\t\tmeta: {\n\t\t\t\tparentPath: 'sw.settings.index',\n\t\t\t\tprivilege: 'vrpayment.viewer'\n\t\t\t},\n\t\t\tprops: {\n default: (route) => {\n return {\n hash: route.params.hash,\n };\n },\n },\n\t\t}\n\t},\n\n\tsettingsItem: {\n\t\tgroup: 'plugins',\n\t\tto: 'vrpayment.settings.index',\n\t\ticonComponent: 'sw-vrpayment-settings-icon',\n\t\tbackgroundEnabled: true,\n\t\tprivilege: 'vrpayment.viewer'\n\t}\n\n});\n","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Config\\Controller\\ConfigurationController\n */\nclass VRPaymentConfigurationService extends ApiService {\n\n\t/**\n\t * VRPaymentConfigurationService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Register web hooks\n\t *\n\t * @param {String|null} salesChannelId\n\t * @return {*}\n\t */\n\tregisterWebHooks(salesChannelId = null) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/register-web-hooks`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Test API connection\n\t *\n\t * @param {int|null} spaceId\n\t * @param {int|null} userId\n\t * @param {String|null} applicationId\n\t * @return {*}\n\t */\n\tcheckApiConnection(spaceId = null, userId = null, applicationId = null) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/check-api-connection`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tspaceId: spaceId,\n\t\t\t\tuserId: userId,\n\t\t\t\tapplicationId: applicationId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Set's the default payment method to VRPayment for the given salesChannel id.\n\t *\n\t * @param {String|null} salesChannelId\n\t *\n\t * @returns {Promise}\n\t */\n\tsetVRPaymentAsSalesChannelPaymentDefault(salesChannelId = null) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/set-vrpayment-as-sales-channel-payment-default`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * @param salesChannelId\n\t * @return {Promise}\n\t */\n\tsynchronizePaymentMethodConfiguration(salesChannelId = null) {\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/synchronize-payment-method-configuration`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t *\n\t * @return {*}\n\t */\n\tinstallOrderDeliveryStates() {\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/configuration/install-order-delivery-states`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentConfigurationService;\n","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\RefundController\n */\nclass VRPaymentRefundService extends ApiService {\n\n\t/**\n\t * VRPaymentRefundService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Refund a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @param {int} quantity\n\t * @param {int} lineItemId\n\t * @return {*}\n\t */\n\tcreateRefund(salesChannelId, transactionId, quantity, lineItemId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId,\n\t\t\t\tquantity: quantity,\n\t\t\t\tlineItemId: lineItemId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Refund a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @param {float} refundableAmount\n\t * @return {*}\n\t */\n\tcreateRefundByAmount(salesChannelId, transactionId, refundableAmount) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-refund-by-amount/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId,\n\t\t\t\trefundableAmount: refundableAmount\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Refund a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @param {float} refundableAmount\n\t * @param {String} lineItemId\n\t * @return {*}\n\t */\n\tcreatePartialRefund(salesChannelId, transactionId, refundableAmount, lineItemId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/refund/create-partial-refund/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId,\n\t\t\t\trefundableAmount: refundableAmount,\n\t\t\t\tlineItemId: lineItemId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentRefundService;\n","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\TransactionController\n */\nclass VRPaymentTransactionService extends ApiService {\n\n\t/**\n\t * VRPaymentTransactionService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Get transaction data\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @return {*}\n\t */\n\tgetTransactionData(salesChannelId, transactionId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-transaction-data/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n\n\t/**\n\t * Download Invoice Document\n\t *\n\t * @param context\n\t * @param salesChannelId\n\t * @param transactionId\n\t * @return {string}\n\t */\n\tgetInvoiceDocument(salesChannelId, transactionId) {\n\t\treturn `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-invoice-document/${salesChannelId}/${transactionId}`;\n\t}\n\n\t/**\n\t * Download Packing slip\n\t *\n\t * @param salesChannelId\n\t * @param transactionId\n\t * @return {string}\n\t */\n\tgetPackingSlip(salesChannelId, transactionId) {\n\t\treturn `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction/get-packing-slip/${salesChannelId}/${transactionId}`;\n\t}\n}\n\nexport default VRPaymentTransactionService;","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\TransactionCompletionController\n */\nclass VRPaymentTransactionCompletionService extends ApiService {\n\n\t/**\n\t * VRPaymentTransactionCompletionService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Complete a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @return {*}\n\t */\n\tcreateTransactionCompletion(salesChannelId, transactionId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-completion/create-transaction-completion/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentTransactionCompletionService;","/* global Shopware */\n\nconst ApiService = Shopware.Classes.ApiService;\n\n/**\n * @class VRPaymentPayment\\Core\\Api\\Transaction\\Controller\\TransactionVoidController\n */\nclass VRPaymentTransactionVoidService extends ApiService {\n\n\t/**\n\t * VRPaymentTransactionVoidService constructor\n\t *\n\t * @param httpClient\n\t * @param loginService\n\t * @param apiEndpoint\n\t */\n\tconstructor(httpClient, loginService, apiEndpoint = 'vrpayment') {\n\t\tsuper(httpClient, loginService, apiEndpoint);\n\t}\n\n\t/**\n\t * Void a transaction\n\t *\n\t * @param {String} salesChannelId\n\t * @param {int} transactionId\n\t * @return {*}\n\t */\n\tcreateTransactionVoid(salesChannelId, transactionId) {\n\n\t\tconst headers = this.getBasicHeaders();\n\t\tconst apiRoute = `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/transaction-void/create-transaction-void/`;\n\n\t\treturn this.httpClient.post(\n\t\t\tapiRoute,\n\t\t\t{\n\t\t\t\tsalesChannelId: salesChannelId,\n\t\t\t\ttransactionId: transactionId\n\t\t\t},\n\t\t\t{\n\t\t\t\theaders: headers\n\t\t\t}\n\t\t).then((response) => {\n\t\t\treturn ApiService.handleResponse(response);\n\t\t});\n\t}\n}\n\nexport default VRPaymentTransactionVoidService;","/* global Shopware */\n\nimport VRPaymentConfigurationService from '../core/service/api/vrpayment-configuration.service';\nimport VRPaymentRefundService from '../core/service/api/vrpayment-refund.service';\nimport VRPaymentTransactionService from '../core/service/api/vrpayment-transaction.service';\nimport VRPaymentTransactionCompletionService\n\tfrom '../core/service/api/vrpayment-transaction-completion.service';\nimport VRPaymentTransactionVoidService\n\tfrom '../core/service/api/vrpayment-transaction-void.service';\n\n\nconst {Application} = Shopware;\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentConfigurationService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentConfigurationService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentRefundService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentRefundService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentTransactionService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentTransactionService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentTransactionCompletionService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentTransactionCompletionService(initContainer.httpClient, container.loginService);\n});\n\n// noinspection JSUnresolvedFunction\nApplication.addServiceProvider('VRPaymentTransactionVoidService', (container) => {\n\tconst initContainer = Application.getContainer('init');\n\treturn new VRPaymentTransactionVoidService(initContainer.httpClient, container.loginService);\n});"],"names":["template$c","Component","Context","Criteria","vrpaymentFormattedHandlerIdentifier","template","orderRepository","orderCriteria","order","paymentMethodId","paymentMethod","template$b","Mixin","Filter","Utils","errorResponse","template$a","_a","_b","_c","_d","errorTitle","errorMessage","template$9","itemUniqueId","newValue","template$8","template$7","template$6","totalAmountTemp","refundsAmountTemp","vrpaymentTransactionId","VRPaymentTransaction","refund","reduction","lineItem","modalType","lineItemId","refundableQuantity","itemRefundableAmount","item","selection","refundPromises","error","resolve","reject","Module","deDE","enGB","frFR","itIT","next","currentRoute","template$5","CONFIG_DOMAIN","CONFIG_APPLICATION_KEY","CONFIG_EMAIL_ENABLED","CONFIG_INTEGRATION","CONFIG_LINE_ITEM_CONSISTENCY_ENABLED","CONFIG_SPACE_ID","CONFIG_SPACE_VIEW_ID","CONFIG_STOREFRONT_INVOICE_DOWNLOAD_ENABLED","CONFIG_USER_ID","CONFIG_STOREFRONT_WEBHOOKS_UPDATE_ENABLED","CONFIG_STOREFRONT_PAYMENTS_UPDATE_ENABLED","constants","configData","defaultConfig","value","key","res","messageNotBlankErrorState","apiConnectionData","spaceId","userId","applicationKey","template$4","apiConnectionParams","template$3","template$2","template$1","route","ApiService","VRPaymentConfigurationService","httpClient","loginService","apiEndpoint","salesChannelId","headers","apiRoute","response","applicationId","VRPaymentRefundService","transactionId","quantity","refundableAmount","VRPaymentTransactionService","VRPaymentTransactionCompletionService","VRPaymentTransactionVoidService","Application","container","initContainer"],"mappings":"AAAA,MAAAA,EAAe,4hBCKT,WAACC,EAAS,QAAEC,CAAO,EAAI,SACvBC,EAAW,SAAS,KAAK,SAEzBC,EAAsC,mDAE5CH,EAAU,SAAS,kBAAmB,CACtC,SAACI,EAEA,MAAO,CACN,MAAO,CACN,mBAAoB,EACvB,CACA,EAEC,SAAU,CACT,YAAa,CACZ,MAAO,CAAC,KAAK,oBAAsB,KAAK,OAAO,OAAS,wBAC3D,EACE,UAAW,CACV,MAAO,EACV,CACA,EAEC,MAAO,CACN,QAAS,CACR,KAAM,GACN,SAAU,CACT,GAAI,CAAC,KAAK,QAAS,CAClB,KAAK,sBAAsB,IAAI,EAC/B,MACL,CAEI,MAAMC,EAAkB,KAAK,kBAAkB,OAAO,OAAO,EACvDC,EAAgB,IAAIJ,EAAS,EAAG,CAAC,EACvCI,EAAc,eAAe,cAAc,EAE3CD,EAAgB,IAAI,KAAK,QAASJ,EAAQ,IAAKK,CAAa,EAAE,KAAMC,GAAU,CAC7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M,CAAC,YAAAS,CAAW,EAAI,SAGtBA,EAAY,mBAAmB,gCAAkCC,GAAc,CAC9E,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAIhB,GAA8BkB,EAAc,WAAYD,EAAU,YAAY,CAC1F,CAAC,EAGDD,EAAY,mBAAmB,yBAA2BC,GAAc,CACvE,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAIP,GAAuBS,EAAc,WAAYD,EAAU,YAAY,CACnF,CAAC,EAGDD,EAAY,mBAAmB,8BAAgCC,GAAc,CAC5E,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAIH,GAA4BK,EAAc,WAAYD,EAAU,YAAY,CACxF,CAAC,EAGDD,EAAY,mBAAmB,wCAA0CC,GAAc,CACtF,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAIF,GAAsCI,EAAc,WAAYD,EAAU,YAAY,CAClG,CAAC,EAGDD,EAAY,mBAAmB,kCAAoCC,GAAc,CAChF,MAAMC,EAAgBF,EAAY,aAAa,MAAM,EACrD,OAAO,IAAID,GAAgCG,EAAc,WAAYD,EAAU,YAAY,CAC5F,CAAC"} \ No newline at end of file diff --git a/src/Resources/views/storefront/component/payment/payment-method.html.twig b/src/Resources/views/storefront/component/payment/payment-method.html.twig new file mode 100644 index 0000000..e489f22 --- /dev/null +++ b/src/Resources/views/storefront/component/payment/payment-method.html.twig @@ -0,0 +1,20 @@ +{% sw_extends '@Storefront/storefront/component/payment/payment-method.html.twig' %} + +{% block component_payment_method_description %} + {{ parent() }} + + {# Check if the payment method handler belongs to WhitelabelMachineName #} + {% if payment.handlerIdentifier == 'VRPaymentPayment\\Core\\Checkout\\PaymentHandler\\VRPaymentPaymentHandler' %} + {# Retrieve the runtime-attached configuration from the extension #} + {% set vrpConfig = payment.extensions.vrpayment_config %} + + {% if vrpConfig %} + {% set paymentMethodConfigurationId = vrpConfig.paymentMethodConfigurationId %} + + {# Include the iframe container template #} + {% sw_include '@VRPaymentPayment/storefront/component/payment/vrpayment_iframe.html.twig' with { + 'paymentMethodConfigurationId': paymentMethodConfigurationId + } %} + {% endif %} + {% endif %} +{% endblock %} diff --git a/src/Resources/views/storefront/component/payment/vrpayment_iframe.html.twig b/src/Resources/views/storefront/component/payment/vrpayment_iframe.html.twig new file mode 100644 index 0000000..3112854 --- /dev/null +++ b/src/Resources/views/storefront/component/payment/vrpayment_iframe.html.twig @@ -0,0 +1,10 @@ +
    +
    + +
    +
    diff --git a/src/Resources/views/storefront/page/checkout/confirm/index.html.twig b/src/Resources/views/storefront/page/checkout/confirm/index.html.twig new file mode 100644 index 0000000..a8c132e --- /dev/null +++ b/src/Resources/views/storefront/page/checkout/confirm/index.html.twig @@ -0,0 +1,26 @@ +{% sw_extends '@Storefront/storefront/page/checkout/confirm/index.html.twig' %} + +{% block base_body_script %} + {{ parent() }} + + {# Provide WhitelabelMachineName integration data if available in page extensions #} + {% if page.extensions.vRPaymentData %} + {% set vrpData = page.extensions.vRPaymentData %} + + {# Hidden inputs required by the JS components #} + + + + {# Load WhitelabelMachineName SDK scripts #} + {% if vrpData.deviceJavascriptUrl %} + + {% endif %} + {% if vrpData.javascriptUrl %} + + {% endif %} + + {# We don't need app.js if we use the modern plugin, but we might keep it for now if other pages depend on it. + However, for the confirm page, the modern plugin registered in main.js will take over + whenever it finds [data-vrpayment-checkout-plugin]. #} + {% endif %} +{% endblock %}