diff --git a/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php new file mode 100644 index 000000000..639f215d4 --- /dev/null +++ b/src/Components/Hydrator/LineItemHydrator/LineItemHydrator.php @@ -0,0 +1,141 @@ +get($orderLine['id']); + + if ($lineItem === null) { + continue; + } + + if ($this->isCustomizedProduct($lineItem)) { + continue; + } + + $taxes = $lineItem->getPrice() ? $lineItem->getPrice()->getCalculatedTaxes() : null; + + if (null === $taxes || null === $taxes->first()) { + continue; + } + + $requestLineItems = array_merge( + $requestLineItems, + $this->getLineItemRequest( + ++$counter, + $lineItem, + $currency, + $taxes, + $orderLine['quantity'] + ) + ); + } + + return $requestLineItems; + } + + public function mapOrderLines(CurrencyEntity $currency, OrderLineItemCollection $lineItemCollection): array + { + $requestLineItems = []; + $counter = 0; + + /** @var OrderLineItemEntity $lineItem */ + foreach ($lineItemCollection as $lineItem) { + if ($this->isCustomizedProduct($lineItem)) { + continue; + } + + $taxes = $lineItem->getPrice() ? $lineItem->getPrice()->getCalculatedTaxes() : null; + + if (null === $taxes || null === $taxes->first()) { + continue; + } + + $requestLineItems = array_merge( + $requestLineItems, + $this->getLineItemRequest( + ++$counter, + $lineItem, + $currency, + $taxes, + $lineItem->getQuantity() + ) + ); + } + + return $requestLineItems; + } + + protected function mapItemType(?string $itemType): string + { + if ($itemType === LineItem::CREDIT_LINE_ITEM_TYPE) { + return self::TYPE_VOUCHER; + } + + if ($itemType === PromotionProcessor::LINE_ITEM_TYPE) { + return self::TYPE_VOUCHER; + } + + return self::TYPE_GOODS; + } + + private function isCustomizedProduct(OrderLineItemEntity $lineItemEntity): bool + { + try { + /** @phpstan-ignore-next-line */ + if (class_exists('Swag\CustomizedProducts\Core\Checkout\CustomizedProductsCartDataCollector') && + CustomizedProductsCartDataCollector::CUSTOMIZED_PRODUCTS_TEMPLATE_LINE_ITEM_TYPE === $lineItemEntity->getType( + ) && + null === $lineItemEntity->getParentId()) { + return true; + } + } catch (Exception $exception) { + // Catch class not found if SwagCustomizedProducts plugin is not installed + } + + return false; + } + + private function getLineItemRequest(int $index, OrderLineItemEntity $lineItemEntity, CurrencyEntity $currencyEntity, CalculatedTaxCollection $taxCollection, int $quantity): array + { + $productNumber = is_array($lineItemEntity->getPayload()) && array_key_exists('productNumber', $lineItemEntity->getPayload()) + ? $lineItemEntity->getPayload()['productNumber'] + : $lineItemEntity->getIdentifier(); + + return [ + 'it[' . $index . ']' => $this->mapItemType($lineItemEntity->getType()), + 'id[' . $index . ']' => $productNumber, + 'pr[' . $index . ']' => (int) round($lineItemEntity->getUnitPrice() * (10 ** $currencyEntity->getDecimalPrecision())), + 'no[' . $index . ']' => $quantity, + 'de[' . $index . ']' => $lineItemEntity->getLabel(), + 'va[' . $index . ']' => (int) round($taxCollection->first()->getTaxRate() * (10 ** $currencyEntity->getDecimalPrecision())), + ]; + } +} diff --git a/src/Components/Hydrator/LineItemHydrator/LineItemHydratorInterface.php b/src/Components/Hydrator/LineItemHydrator/LineItemHydratorInterface.php new file mode 100644 index 000000000..1bb23de36 --- /dev/null +++ b/src/Components/Hydrator/LineItemHydrator/LineItemHydratorInterface.php @@ -0,0 +1,19 @@ +getType() && - null === $lineItem->getParentId()) { - continue; - } - } catch (Exception $exception) { - // Catch class not found if SwagCustomizedProducts plugin is not installed - } - - $taxes = $lineItem->getPrice() ? $lineItem->getPrice()->getCalculatedTaxes() : null; - - if (null === $taxes || null === $taxes->first()) { - continue; - } - - if ($lineItem->getId() !== $orderLine['id']) { - continue; - } - - $requestLineItems['it[' . $counter . ']'] = $this->mapItemType($lineItem->getType()); - $requestLineItems['id[' . $counter . ']'] = $lineItem->getIdentifier(); - $requestLineItems['pr[' . $counter . ']'] = (int) round(($lineItem->getUnitPrice() * (10 ** $currency->getDecimalPrecision()))); - $requestLineItems['no[' . $counter . ']'] = $orderLine['quantity']; - $requestLineItems['de[' . $counter . ']'] = $lineItem->getLabel(); - $requestLineItems['va[' . $counter . ']'] = (int) round(($taxes->first()->getTaxRate() * (10 ** $currency->getDecimalPrecision()))); - ++$counter; - } - } - - return $requestLineItems; + $this->lineItemHydrator = $lineItemHydrator; } - protected function mapItemType(?string $itemType): string - { - if ($itemType === LineItem::CREDIT_LINE_ITEM_TYPE) { - return self::TYPE_VOUCHER; - } - - if ($itemType === PromotionProcessor::LINE_ITEM_TYPE) { - return self::TYPE_VOUCHER; - } + abstract public function supports(string $paymentMethodId): bool; - return self::TYPE_GOODS; - } + abstract public function getAdditionalRequestParameters( + PaymentTransaction $transaction, + Context $context, + ParameterBag $parameterBag + ): array; } diff --git a/src/Components/RequestBuilder/PayolutionDebitRequestBuilder.php b/src/Components/RequestBuilder/PayolutionDebitRequestBuilder.php index 5eb615365..353d13a46 100644 --- a/src/Components/RequestBuilder/PayolutionDebitRequestBuilder.php +++ b/src/Components/RequestBuilder/PayolutionDebitRequestBuilder.php @@ -25,6 +25,6 @@ public function getAdditionalRequestParameters(PaymentTransaction $transaction, return []; } - return $this->mapPayoneOrderLines($currency, $transaction->getOrder()->getLineItems(), $orderLines); + return $this->lineItemHydrator->mapPayoneOrderLinesByRequest($currency, $transaction->getOrder()->getLineItems(), $orderLines); } } diff --git a/src/Components/RequestBuilder/PayolutionInstallmentRequestBuilder.php b/src/Components/RequestBuilder/PayolutionInstallmentRequestBuilder.php index 9d4c68e6a..ab2c8d309 100644 --- a/src/Components/RequestBuilder/PayolutionInstallmentRequestBuilder.php +++ b/src/Components/RequestBuilder/PayolutionInstallmentRequestBuilder.php @@ -25,6 +25,6 @@ public function getAdditionalRequestParameters(PaymentTransaction $transaction, return []; } - return $this->mapPayoneOrderLines($currency, $transaction->getOrder()->getLineItems(), $orderLines); + return $this->lineItemHydrator->mapPayoneOrderLinesByRequest($currency, $transaction->getOrder()->getLineItems(), $orderLines); } } diff --git a/src/Components/RequestBuilder/PayolutionInvoicingRequestBuilder.php b/src/Components/RequestBuilder/PayolutionInvoicingRequestBuilder.php index 088252b32..9e0ffe421 100644 --- a/src/Components/RequestBuilder/PayolutionInvoicingRequestBuilder.php +++ b/src/Components/RequestBuilder/PayolutionInvoicingRequestBuilder.php @@ -25,6 +25,6 @@ public function getAdditionalRequestParameters(PaymentTransaction $transaction, return []; } - return $this->mapPayoneOrderLines($currency, $transaction->getOrder()->getLineItems(), $orderLines); + return $this->lineItemHydrator->mapPayoneOrderLinesByRequest($currency, $transaction->getOrder()->getLineItems(), $orderLines); } } diff --git a/src/Components/RequestBuilder/SecureInvoiceRequestBuilder.php b/src/Components/RequestBuilder/SecureInvoiceRequestBuilder.php new file mode 100644 index 000000000..79dc11902 --- /dev/null +++ b/src/Components/RequestBuilder/SecureInvoiceRequestBuilder.php @@ -0,0 +1,30 @@ +getOrder()->getCurrency(); + $orderLines = $parameterBag->get('orderLines', []); + + if ($currency === null || empty($orderLines) || empty($transaction->getOrder()->getLineItems())) { + return []; + } + + return $this->lineItemHydrator->mapPayoneOrderLinesByRequest($currency, $transaction->getOrder()->getLineItems(), $orderLines); + } +} diff --git a/src/Components/Validator/BirthdayValidator.php b/src/Components/Validator/BirthdayValidator.php index 2414f594b..9a59ced88 100644 --- a/src/Components/Validator/BirthdayValidator.php +++ b/src/Components/Validator/BirthdayValidator.php @@ -18,6 +18,10 @@ class BirthdayValidator extends AbstractComparisonValidator */ protected function compareValues($value1, $value2) { + if (empty($value1)) { + return false; + } + $birthday = DateTime::createFromFormat('Y-m-d', $value1); return $birthday < $value2; diff --git a/src/Configuration/ConfigurationPrefixes.php b/src/Configuration/ConfigurationPrefixes.php index ee1d09534..331b68dac 100644 --- a/src/Configuration/ConfigurationPrefixes.php +++ b/src/Configuration/ConfigurationPrefixes.php @@ -20,6 +20,7 @@ interface ConfigurationPrefixes public const CONFIGURATION_PREFIX_IDEAL = 'iDeal'; public const CONFIGURATION_PREFIX_PAYDIREKT = 'paydirekt'; public const CONFIGURATION_PREFIX_PREPAYMENT = 'prepayment'; + public const CONFIGURATION_PREFIX_SECURE_INVOICE = 'secureInvoice'; public const CONFIGURATION_PREFIXES = [ Handler\PayoneCreditCardPaymentHandler::class => self::CONFIGURATION_PREFIX_CREDITCARD, @@ -34,5 +35,6 @@ interface ConfigurationPrefixes Handler\PayoneIDealPaymentHandler::class => self::CONFIGURATION_PREFIX_IDEAL, Handler\PayonePaydirektPaymentHandler::class => self::CONFIGURATION_PREFIX_PAYDIREKT, Handler\PayonePrepaymentPaymentHandler::class => self::CONFIGURATION_PREFIX_PREPAYMENT, + Handler\PayoneSecureInvoicePaymentHandler::class => self::CONFIGURATION_PREFIX_SECURE_INVOICE, ]; } diff --git a/src/Controller/SettingsController.php b/src/Controller/SettingsController.php index 8e1540412..2d0bbf137 100644 --- a/src/Controller/SettingsController.php +++ b/src/Controller/SettingsController.php @@ -17,6 +17,7 @@ use PayonePayment\PaymentHandler\PayonePaypalExpressPaymentHandler; use PayonePayment\PaymentHandler\PayonePaypalPaymentHandler; use PayonePayment\PaymentHandler\PayonePrepaymentPaymentHandler; +use PayonePayment\PaymentHandler\PayoneSecureInvoicePaymentHandler; use PayonePayment\PaymentHandler\PayoneSofortBankingPaymentHandler; use PayonePayment\Payone\Client\Exception\PayoneRequestException; use PayonePayment\Payone\Client\PayoneClientInterface; @@ -327,6 +328,28 @@ private function getPaymentParameters(string $paymentClass): array ]; break; + case PayoneSecureInvoicePaymentHandler::class: + return [ + 'request' => 'preauthorization', + 'clearingtype' => 'rec', + 'financingtype' => 'POV', + 'amount' => 10000, + 'currency' => 'EUR', + 'reference' => sprintf('%s%d', self::REFERENCE_PREFIX_TEST, random_int(1000000000000, 9999999999999)), + 'birthday' => '19900505', + 'firstname' => 'Test', + 'lastname' => 'Test', + 'country' => 'DE', + 'email' => 'test@example.com', + 'street' => 'teststreet 2', + 'zip' => '12345', + 'city' => 'Test', + 'ip' => '127.0.0.1', + 'businessrelation' => 'b2c', + ]; + + break; + default: $this->logger->error(sprintf('There is no test data defined for payment class %s', $paymentClass)); throw new RuntimeException(sprintf('There is no test data defined for payment class %s', $paymentClass)); diff --git a/src/DependencyInjection/handler/payment_handler.xml b/src/DependencyInjection/handler/payment_handler.xml index 653d09859..3143d2d15 100644 --- a/src/DependencyInjection/handler/payment_handler.xml +++ b/src/DependencyInjection/handler/payment_handler.xml @@ -167,5 +167,19 @@ + + + + + + + + + + + + + + diff --git a/src/DependencyInjection/handler/request_handler.xml b/src/DependencyInjection/handler/request_handler.xml index 52f2b2ae4..7145261c1 100644 --- a/src/DependencyInjection/handler/request_handler.xml +++ b/src/DependencyInjection/handler/request_handler.xml @@ -8,50 +8,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DependencyInjection/hydrator.xml b/src/DependencyInjection/hydrator.xml new file mode 100644 index 000000000..db155d188 --- /dev/null +++ b/src/DependencyInjection/hydrator.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/DependencyInjection/requests.xml b/src/DependencyInjection/requests.xml index 0a004ae1f..4fb293348 100644 --- a/src/DependencyInjection/requests.xml +++ b/src/DependencyInjection/requests.xml @@ -372,5 +372,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DependencyInjection/services.xml b/src/DependencyInjection/services.xml index 8cdc00b83..8fc284b5f 100644 --- a/src/DependencyInjection/services.xml +++ b/src/DependencyInjection/services.xml @@ -10,6 +10,7 @@ + diff --git a/src/EventListener/OrderValidationEventListener.php b/src/EventListener/OrderValidationEventListener.php index e7417271a..d6c050eff 100644 --- a/src/EventListener/OrderValidationEventListener.php +++ b/src/EventListener/OrderValidationEventListener.php @@ -11,6 +11,7 @@ use PayonePayment\Components\Validator\PaymentMethod; use PayonePayment\PaymentMethod\PayonePayolutionInstallment; use PayonePayment\PaymentMethod\PayonePayolutionInvoicing; +use PayonePayment\PaymentMethod\PayoneSecureInvoice; use Shopware\Core\Framework\Validation\BuildValidationEvent; use Shopware\Core\PlatformRequest; use Shopware\Core\System\SalesChannel\SalesChannelContext; @@ -51,6 +52,19 @@ public function validateOrderData(BuildValidationEvent $event): void // TODO: can be removed when https://github.com/shopware/platform/pull/226 is merged $context = $this->getContextFromRequest($request); + $customer = $context->getCustomer(); + + if ($this->isSecureInvoicePayment($context) && $customer !== null) { + $activeBilling = $customer->getActiveBillingAddress(); + + if ($activeBilling !== null && empty($activeBilling->getCompany())) { + $event->getDefinition()->add( + 'secureInvoiceBirthday', + new Birthday(['value' => $this->getMinimumDate()]) + ); + } + } + if ($this->isPayonePayolutionInstallment($context) || $this->isPayonePayolutionInvoicing($context)) { $event->getDefinition()->add( 'payolutionConsent', @@ -102,6 +116,11 @@ private function isPayonePayolutionInvoicing(SalesChannelContext $context): bool return $context->getPaymentMethod()->getId() === PayonePayolutionInvoicing::UUID; } + private function isSecureInvoicePayment(SalesChannelContext $context): bool + { + return $context->getPaymentMethod()->getId() === PayoneSecureInvoice::UUID; + } + private function customerHasCompanyAddress(SalesChannelContext $context): bool { $customer = $context->getCustomer(); diff --git a/src/Installer/ConfigInstaller.php b/src/Installer/ConfigInstaller.php index 303e4eec7..4656d6a69 100644 --- a/src/Installer/ConfigInstaller.php +++ b/src/Installer/ConfigInstaller.php @@ -28,6 +28,7 @@ class ConfigInstaller implements InstallerInterface 'paypalAuthorizationMethod' => 'preauthorization', 'paypalExpressAuthorizationMethod' => 'preauthorization', 'sofortAuthorizationMethod' => 'authorization', + 'secureInvoiceAuthorizationMethod' => 'preauthorization', // Default payment status mapping 'paymentStatusAppointed' => StateMachineTransitionActions::ACTION_REOPEN, diff --git a/src/Installer/PaymentMethodInstaller.php b/src/Installer/PaymentMethodInstaller.php index 816db5783..650dfb1fb 100644 --- a/src/Installer/PaymentMethodInstaller.php +++ b/src/Installer/PaymentMethodInstaller.php @@ -17,12 +17,14 @@ use PayonePayment\PaymentMethod\PayonePaypal; use PayonePayment\PaymentMethod\PayonePaypalExpress; use PayonePayment\PaymentMethod\PayonePrepayment; +use PayonePayment\PaymentMethod\PayoneSecureInvoice; use PayonePayment\PaymentMethod\PayoneSofortBanking; use PayonePayment\PayonePayment; use Shopware\Core\Checkout\Payment\PaymentMethodEntity; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface; use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria; +use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter; use Shopware\Core\Framework\Plugin\Context\ActivateContext; use Shopware\Core\Framework\Plugin\Context\DeactivateContext; use Shopware\Core\Framework\Plugin\Context\InstallContext; @@ -46,6 +48,7 @@ class PaymentMethodInstaller implements InstallerInterface PayoneIDeal::class, PayonePaydirekt::class, PayonePrepayment::class, + PayoneSecureInvoice::class, ]; public const AFTER_ORDER_PAYMENT_METHODS = [ @@ -214,9 +217,33 @@ private function deactivatePaymentMethod(PaymentMethodInterface $paymentMethod, 'active' => false, ]; + $paymentMethodExists = $this->paymentMethodExists($data, $context); + + if ($paymentMethodExists === false) { + return; + } + $this->paymentMethodRepository->update([$data], $context); } + private function paymentMethodExists(array $data, Context $context): bool + { + if (empty($data['id'])) { + return false; + } + + $criteria = new Criteria(); + $criteria->addFilter(new EqualsFilter('id', $data['id'])); + + $result = $this->paymentMethodRepository->search($criteria, $context); + + if ($result->getTotal() === 0) { + return false; + } + + return true; + } + private function fixMissingCustomFieldsForTranslations(PaymentMethodInterface $paymentMethod, PaymentMethodEntity $paymentMethodEntity): void { $customFields = $paymentMethodEntity->getCustomFields() ?? []; diff --git a/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php new file mode 100644 index 000000000..89c3ba283 --- /dev/null +++ b/src/Installer/RuleInstaller/RuleInstallerSecureInvoice.php @@ -0,0 +1,165 @@ +ruleRepository = $container->get('rule.repository'); + $this->countryRepository = $container->get('country.repository'); + $this->currencyRepository = $container->get('currency.repository'); + } + + public function install(InstallContext $context): void + { + $this->upsertAvailabilityRule($context->getContext()); + } + + public function update(UpdateContext $context): void + { + $this->upsertAvailabilityRule($context->getContext()); + } + + public function uninstall(UninstallContext $context): void + { + $this->removeAvailabilityRule($context->getContext()); + } + + public function activate(ActivateContext $context): void + { + } + + public function deactivate(DeactivateContext $context): void + { + } + + private function upsertAvailabilityRule(Context $context): void + { + $data = [ + 'id' => self::RULE_ID, + 'name' => 'Payone secure invoice', + 'priority' => 1, + 'description' => 'Determines whether or not Payone secure invoice payment is available.', + 'conditions' => [ + [ + 'id' => self::CONDITION_ID_AND, + 'type' => (new AndRule())->getName(), + 'children' => [ + [ + 'id' => self::CONDITION_ID_COUNTRY, + 'type' => (new BillingCountryRule())->getName(), + 'value' => [ + 'operator' => BillingCountryRule::OPERATOR_EQ, + 'countryIds' => array_values($this->getCountries($context)), + ], + ], + [ + 'id' => self::CONDITION_ID_CURRENCY, + 'type' => (new CurrencyRule())->getName(), + 'value' => [ + 'operator' => CurrencyRule::OPERATOR_EQ, + 'currencyIds' => array_values($this->getCurrencyIds($context)), + ], + ], + [ + 'id' => self::CONDITION_ID_DIFFERENT_ADDRESSES, + 'type' => (new DifferentAddressesRule())->getName(), + 'value' => [ + 'isDifferent' => false, + ], + ], + ], + ], + ], + 'paymentMethods' => [ + ['id' => PayoneSecureInvoice::UUID], + ], + ]; + + $context->scope( + Context::SYSTEM_SCOPE, + function (Context $context) use ($data): void { + $this->ruleRepository->upsert([$data], $context); + } + ); + } + + private function removeAvailabilityRule(Context $context): void + { + $deletion = [ + 'id' => self::RULE_ID, + ]; + + $context->scope( + Context::SYSTEM_SCOPE, + function (Context $context) use ($deletion): void { + $this->ruleRepository->delete([$deletion], $context); + } + ); + } + + private function getCountries(Context $context): array + { + $criteria = new Criteria(); + $criteria->addFilter( + new EqualsAnyFilter('iso', self::VALID_COUNTRIES) + ); + + return $this->countryRepository->search($criteria, $context)->getIds(); + } + + private function getCurrencyIds(Context $context): array + { + $criteria = new Criteria(); + $criteria->addFilter( + new EqualsAnyFilter('isoCode', self::CURRENCIES) + ); + + return $this->currencyRepository->search($criteria, $context)->getIds(); + } +} diff --git a/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php b/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php new file mode 100644 index 000000000..d948c5fd2 --- /dev/null +++ b/src/PaymentHandler/PayoneSecureInvoicePaymentHandler.php @@ -0,0 +1,150 @@ +preAuthRequestFactory = $preAuthRequestFactory; + $this->authRequestFactory = $authRequestFactory; + $this->client = $client; + $this->translator = $translator; + $this->dataHandler = $dataHandler; + } + + /** + * {@inheritdoc} + */ + public function pay(SyncPaymentTransactionStruct $transaction, RequestDataBag $dataBag, SalesChannelContext $salesChannelContext): void + { + $requestData = $this->fetchRequestData(); + + // Get configured authorization method + $authorizationMethod = $this->getAuthorizationMethod( + $transaction->getOrder()->getSalesChannelId(), + 'secureInvoiceAuthorizationMethod', + 'preauthorization' + ); + + $paymentTransaction = PaymentTransaction::fromSyncPaymentTransactionStruct($transaction, $transaction->getOrder()); + + // Select request factory based on configured authorization method + $factory = $authorizationMethod === 'preauthorization' + ? $this->preAuthRequestFactory + : $this->authRequestFactory; + + $request = $factory->getRequestParameters( + $paymentTransaction, + $requestData, + $salesChannelContext + ); + + try { + $response = $this->client->request($request); + } catch (PayoneRequestException $exception) { + throw new SyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $exception->getResponse()['error']['CustomerMessage'] + ); + } catch (Throwable $exception) { + throw new SyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + if (empty($response['status']) || $response['status'] === 'ERROR') { + throw new SyncPaymentProcessException( + $transaction->getOrderTransaction()->getId(), + $this->translator->trans('PayonePayment.errorMessages.genericError') + ); + } + + $data = $this->prepareTransactionCustomFields($request, $response, array_merge( + $this->getBaseCustomFields($response['status']), + [ + CustomFieldInstaller::CAPTURE_MODE => AbstractPayonePaymentHandler::PAYONE_STATE_COMPLETED, + CustomFieldInstaller::CLEARING_TYPE => AbstractPayonePaymentHandler::PAYONE_CLEARING_FNC, + CustomFieldInstaller::FINANCING_TYPE => AbstractPayonePaymentHandler::PAYONE_FINANCING_PYV, + ] + )); + + $this->dataHandler->saveTransactionData($paymentTransaction, $salesChannelContext->getContext(), $data); + $this->dataHandler->logResponse($paymentTransaction, $salesChannelContext->getContext(), ['request' => $request, 'response' => $response]); + } + + /** + * {@inheritdoc} + */ + public static function isCapturable(array $transactionData, array $customFields): bool + { + if (!array_key_exists(CustomFieldInstaller::AUTHORIZATION_TYPE, $customFields)) { + return false; + } + + if ($customFields[CustomFieldInstaller::AUTHORIZATION_TYPE] !== TransactionStatusService::AUTHORIZATION_TYPE_PREAUTHORIZATION) { + return false; + } + + return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_APPOINTED + && strtolower($transactionData['transaction_status']) === TransactionStatusService::STATUS_COMPLETED; + } + + /** + * {@inheritdoc} + */ + public static function isRefundable(array $transactionData, array $customFields): bool + { + if (strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_CAPTURE && (float) $transactionData['receivable'] !== 0.0) { + return true; + } + + return strtolower($transactionData['txaction']) === TransactionStatusService::ACTION_PAID; + } +} diff --git a/src/PaymentMethod/PayoneCreditCard.php b/src/PaymentMethod/PayoneCreditCard.php index c38a2a6c0..00b4116c2 100644 --- a/src/PaymentMethod/PayoneCreditCard.php +++ b/src/PaymentMethod/PayoneCreditCard.php @@ -6,24 +6,27 @@ use PayonePayment\PaymentHandler\PayoneCreditCardPaymentHandler; -class PayoneCreditCard implements PaymentMethodInterface +class PayoneCreditCard extends AbstractPaymentMethod { public const UUID = '37f90a48d9194762977c9e6db36334e0'; /** @var string */ - private $name = 'Payone Credit Card'; + protected $id = self::UUID; /** @var string */ - private $description = 'Use your credit card to safely pay through our PCI DSS certified payment provider. After your order, you may be redirected to your bank to authorize the payment.'; + protected $name = 'Payone Credit Card'; /** @var string */ - private $paymentHandler = PayoneCreditCardPaymentHandler::class; + protected $description = 'Use your credit card to safely pay through our PCI DSS certified payment provider. After your order, you may be redirected to your bank to authorize the payment.'; + + /** @var string */ + protected $paymentHandler = PayoneCreditCardPaymentHandler::class; /** @var null|string */ - private $template = '@Storefront/storefront/payone/credit-card/credit-card-form.html.twig'; + protected $template = '@Storefront/storefront/payone/credit-card/credit-card-form.html.twig'; /** @var array */ - private $translations = [ + protected $translations = [ 'de-DE' => [ 'name' => 'Payone Kreditkarte', 'description' => 'Zahlen Sie sicher mit Ihrer Kreditkarte über unseren PCI DSS zertifizierten Zahlungsprovider. Nach der Bestellung werden Sie ggf. auf eine Seite Ihrer Bank weitergeleitet, um die Zahlung zu autorisieren.', @@ -35,40 +38,5 @@ class PayoneCreditCard implements PaymentMethodInterface ]; /** @var int */ - private $position = 100; - - public function getId(): string - { - return self::UUID; - } - - public function getName(): string - { - return $this->name; - } - - public function getDescription(): string - { - return $this->description; - } - - public function getPaymentHandler(): string - { - return $this->paymentHandler; - } - - public function getTemplate(): ?string - { - return $this->template; - } - - public function getTranslations(): array - { - return $this->translations; - } - - public function getPosition(): int - { - return $this->position; - } + protected $position = 100; } diff --git a/src/PaymentMethod/PayoneDebit.php b/src/PaymentMethod/PayoneDebit.php index b0e576b19..a31d4c436 100644 --- a/src/PaymentMethod/PayoneDebit.php +++ b/src/PaymentMethod/PayoneDebit.php @@ -6,24 +6,27 @@ use PayonePayment\PaymentHandler\PayoneDebitPaymentHandler; -class PayoneDebit implements PaymentMethodInterface +class PayoneDebit extends AbstractPaymentMethod { public const UUID = '1b017bef157b4222b734659361d996fd'; /** @var string */ - private $name = 'Payone SEPA Lastschrift'; + protected $id = self::UUID; /** @var string */ - private $description = 'We\'ll automatically debit the amount from your bank account.'; + protected $name = 'Payone SEPA Lastschrift'; /** @var string */ - private $paymentHandler = PayoneDebitPaymentHandler::class; + protected $description = 'We\'ll automatically debit the amount from your bank account.'; + + /** @var string */ + protected $paymentHandler = PayoneDebitPaymentHandler::class; /** @var null|string */ - private $template = '@Storefront/storefront/payone/debit/debit-form.html.twig'; + protected $template = '@Storefront/storefront/payone/debit/debit-form.html.twig'; /** @var array */ - private $translations = [ + protected $translations = [ 'de-DE' => [ 'name' => 'Payone SEPA Lastschrift', 'description' => 'Wir ziehen den Betrag bequem und automatisch von Ihrem Bankkonto ein.', @@ -35,40 +38,5 @@ class PayoneDebit implements PaymentMethodInterface ]; /** @var int */ - private $position = 101; - - public function getId(): string - { - return self::UUID; - } - - public function getName(): string - { - return $this->name; - } - - public function getDescription(): string - { - return $this->description; - } - - public function getPaymentHandler(): string - { - return $this->paymentHandler; - } - - public function getTemplate(): ?string - { - return $this->template; - } - - public function getTranslations(): array - { - return $this->translations; - } - - public function getPosition(): int - { - return $this->position; - } + protected $position = 101; } diff --git a/src/PaymentMethod/PayonePaypal.php b/src/PaymentMethod/PayonePaypal.php index 7361d3bfb..036fe14c8 100644 --- a/src/PaymentMethod/PayonePaypal.php +++ b/src/PaymentMethod/PayonePaypal.php @@ -6,24 +6,27 @@ use PayonePayment\PaymentHandler\PayonePaypalPaymentHandler; -class PayonePaypal implements PaymentMethodInterface +class PayonePaypal extends AbstractPaymentMethod { public const UUID = '21e157163fdb4aa4862a2109abcd7522'; /** @var string */ - private $name = 'Payone PayPal'; + protected $id = self::UUID; /** @var string */ - private $description = 'Pay easily and secure with PayPal.'; + protected $name = 'Payone PayPal'; /** @var string */ - private $paymentHandler = PayonePaypalPaymentHandler::class; + protected $description = 'Pay easily and secure with PayPal.'; + + /** @var string */ + protected $paymentHandler = PayonePaypalPaymentHandler::class; /** @var null|string */ - private $template; + protected $template; /** @var array */ - private $translations = [ + protected $translations = [ 'de-DE' => [ 'name' => 'Payone PayPal', 'description' => 'Zahlen Sie sicher und bequem mit PayPal.', @@ -35,40 +38,5 @@ class PayonePaypal implements PaymentMethodInterface ]; /** @var int */ - private $position = 102; - - public function getId(): string - { - return self::UUID; - } - - public function getName(): string - { - return $this->name; - } - - public function getDescription(): string - { - return $this->description; - } - - public function getPaymentHandler(): string - { - return $this->paymentHandler; - } - - public function getTemplate(): ?string - { - return $this->template; - } - - public function getTranslations(): array - { - return $this->translations; - } - - public function getPosition(): int - { - return $this->position; - } + protected $position = 102; } diff --git a/src/PaymentMethod/PayonePaypalExpress.php b/src/PaymentMethod/PayonePaypalExpress.php index f65593582..473a3076f 100644 --- a/src/PaymentMethod/PayonePaypalExpress.php +++ b/src/PaymentMethod/PayonePaypalExpress.php @@ -6,24 +6,27 @@ use PayonePayment\PaymentHandler\PayonePaypalExpressPaymentHandler; -class PayonePaypalExpress implements PaymentMethodInterface +class PayonePaypalExpress extends AbstractPaymentMethod { public const UUID = '5ddf648859a84396a98c97a1a92c107f'; /** @var string */ - private $name = 'Payone Paypal Express'; + protected $id = self::UUID; /** @var string */ - private $description = 'Pay easily and secure with PayPal Express.'; + protected $name = 'Payone Paypal Express'; /** @var string */ - private $paymentHandler = PayonePaypalExpressPaymentHandler::class; + protected $description = 'Pay easily and secure with PayPal Express.'; + + /** @var string */ + protected $paymentHandler = PayonePaypalExpressPaymentHandler::class; /** @var null|string */ - private $template; + protected $template; /** @var array */ - private $translations = [ + protected $translations = [ 'de-DE' => [ 'name' => 'Payone PayPal Express', 'description' => 'Zahlen Sie sicher und bequem mit PayPal Express.', @@ -35,40 +38,5 @@ class PayonePaypalExpress implements PaymentMethodInterface ]; /** @var int */ - private $position = 103; - - public function getId(): string - { - return self::UUID; - } - - public function getName(): string - { - return $this->name; - } - - public function getDescription(): string - { - return $this->description; - } - - public function getPaymentHandler(): string - { - return $this->paymentHandler; - } - - public function getTemplate(): ?string - { - return $this->template; - } - - public function getTranslations(): array - { - return $this->translations; - } - - public function getPosition(): int - { - return $this->position; - } + protected $position = 103; } diff --git a/src/PaymentMethod/PayoneSecureInvoice.php b/src/PaymentMethod/PayoneSecureInvoice.php new file mode 100644 index 000000000..9ee4d6d97 --- /dev/null +++ b/src/PaymentMethod/PayoneSecureInvoice.php @@ -0,0 +1,44 @@ + [ + 'name' => 'Payone gesicherter Rechnungskauf', + 'description' => 'Abgesichert bezahlen per Rechnung.', + ], + 'en-GB' => [ + 'name' => 'Payone secure invoice', + 'description' => 'Secure pay by invoice. After reception of goods.', + ], + ]; + + /** @var int */ + protected $position = 114; +} diff --git a/src/PaymentMethod/PayoneSofortBanking.php b/src/PaymentMethod/PayoneSofortBanking.php index cd7cbca05..4acccfa33 100644 --- a/src/PaymentMethod/PayoneSofortBanking.php +++ b/src/PaymentMethod/PayoneSofortBanking.php @@ -9,24 +9,27 @@ /** * TODO: only valid in DE, AT, CH, NL. Use ruleEngine to enforce this during the checkout */ -class PayoneSofortBanking implements PaymentMethodInterface +class PayoneSofortBanking extends AbstractPaymentMethod { public const UUID = '9022c4733d14411e84a78707088487aa'; /** @var string */ - private $name = 'Payone Sofort'; + protected $id = self::UUID; /** @var string */ - private $description = 'Wire the amount instantly with your online banking credentials.'; + protected $name = 'Payone Sofort'; /** @var string */ - private $paymentHandler = PayoneSofortBankingPaymentHandler::class; + protected $description = 'Wire the amount instantly with your online banking credentials.'; + + /** @var string */ + protected $paymentHandler = PayoneSofortBankingPaymentHandler::class; /** @var null|string */ - private $template; + protected $template; /** @var array */ - private $translations = [ + protected $translations = [ 'de-DE' => [ 'name' => 'Payone Sofort', 'description' => 'Überweisen Sie schnell und sicher mit Ihren Online Banking Zugangsdaten.', @@ -38,40 +41,5 @@ class PayoneSofortBanking implements PaymentMethodInterface ]; /** @var int */ - private $position = 106; - - public function getId(): string - { - return self::UUID; - } - - public function getName(): string - { - return $this->name; - } - - public function getDescription(): string - { - return $this->description; - } - - public function getPaymentHandler(): string - { - return $this->paymentHandler; - } - - public function getTemplate(): ?string - { - return $this->template; - } - - public function getTranslations(): array - { - return $this->translations; - } - - public function getPosition(): int - { - return $this->position; - } + protected $position = 106; } diff --git a/src/Payone/Request/Capture/CaptureRequest.php b/src/Payone/Request/Capture/CaptureRequest.php index cb2336584..938a1147a 100644 --- a/src/Payone/Request/Capture/CaptureRequest.php +++ b/src/Payone/Request/Capture/CaptureRequest.php @@ -67,10 +67,6 @@ public function getRequestParameters(OrderEntity $order, Context $context, array $parameters['clearingtype'] = $customFields[CustomFieldInstaller::CLEARING_TYPE]; } - if (!empty($customFields[CustomFieldInstaller::FINANCING_TYPE])) { - $parameters['financingtype'] = $customFields[CustomFieldInstaller::FINANCING_TYPE]; - } - return $parameters; } diff --git a/src/Payone/Request/SecureInvoice/AbstractSecureInvoiceAuthorizeRequest.php b/src/Payone/Request/SecureInvoice/AbstractSecureInvoiceAuthorizeRequest.php new file mode 100644 index 000000000..5e6d5eb46 --- /dev/null +++ b/src/Payone/Request/SecureInvoice/AbstractSecureInvoiceAuthorizeRequest.php @@ -0,0 +1,116 @@ +lineItemHydrator = $lineItemHydrator; + $this->currencyRepository = $currencyRepository; + $this->orderAddressRepository = $orderAddressRepository; + } + + public function getRequestParameters( + PaymentTransaction $transaction, + RequestDataBag $dataBag, + SalesChannelContext $context, + string $referenceNumber + ): array { + $order = $transaction->getOrder(); + $customer = $order->getOrderCustomer(); + $currency = $this->getOrderCurrency($order, $context->getContext()); + $billingAddress = $this->getBillingAddress($order, $context->getContext()); + $centAmountTotal = (int) round(($order->getAmountTotal() * (10 ** $currency->getDecimalPrecision()))); + + $parameters = [ + 'clearingtype' => 'rec', + 'clearingsubtype' => 'POV', + 'amount' => $centAmountTotal, + 'currency' => $currency->getIsoCode(), + 'reference' => $referenceNumber, + ]; + + $company = $billingAddress->getCompany(); + + if ($customer !== null) { + $parameters['email'] = $customer->getEmail(); + } + + $parameters['businessrelation'] = $company ? + PayoneSecureInvoice::BUSINESSRELATION_B2B : + PayoneSecureInvoice::BUSINESSRELATION_B2C; + + if (!empty($company)) { + $parameters['company'] = $billingAddress->getCompany(); + } + + $parameters = array_merge($parameters, $this->lineItemHydrator->mapOrderLines($currency, $order->getLineItems())); + + if (!$company && !empty($dataBag->get('secureInvoiceBirthday'))) { + $birthday = DateTime::createFromFormat('Y-m-d', $dataBag->get('secureInvoiceBirthday')); + + if (!empty($birthday)) { + $parameters['birthday'] = $birthday->format('Ymd'); + } + } + + return array_filter($parameters); + } + + private function getOrderCurrency(OrderEntity $order, Context $context): CurrencyEntity + { + $criteria = new Criteria([$order->getCurrencyId()]); + + /** @var null|CurrencyEntity $currency */ + $currency = $this->currencyRepository->search($criteria, $context)->first(); + + if (null === $currency) { + throw new RuntimeException('missing order currency entity'); + } + + return $currency; + } + + private function getBillingAddress(OrderEntity $order, Context $context): OrderAddressEntity + { + $criteria = new Criteria([$order->getBillingAddressId()]); + + /** @var null|OrderAddressEntity $address */ + $address = $this->orderAddressRepository->search($criteria, $context)->first(); + + if (null === $address) { + throw new RuntimeException('missing order customer billing address'); + } + + return $address; + } +} diff --git a/src/Payone/Request/SecureInvoice/AbstractSecureInvoiceAuthorizeRequestFactory.php b/src/Payone/Request/SecureInvoice/AbstractSecureInvoiceAuthorizeRequestFactory.php new file mode 100644 index 000000000..c2b869204 --- /dev/null +++ b/src/Payone/Request/SecureInvoice/AbstractSecureInvoiceAuthorizeRequestFactory.php @@ -0,0 +1,72 @@ +secureInvoiceRequest = $secureInvoiceRequest; + $this->secureInvoiceRequestBuilder = $secureInvoiceRequestBuilder; + $this->customerRequest = $customerRequest; + $this->systemRequest = $systemRequest; + } + + public function getRequestParameters( + PaymentTransaction $transaction, + RequestDataBag $dataBag, + SalesChannelContext $context + ): array { + $this->requests[] = $this->systemRequest->getRequestParameters( + $transaction->getOrder()->getSalesChannelId(), + ConfigurationPrefixes::CONFIGURATION_PREFIX_SECURE_INVOICE, + $context->getContext() + ); + + $this->requests[] = $this->customerRequest->getRequestParameters( + $context + ); + + $this->requests[] = $this->secureInvoiceRequest->getRequestParameters( + $transaction, + $dataBag, + $context, + $this->systemRequest->getReferenceNumber($transaction, true) + ); + + $this->requests[] = $this->secureInvoiceRequestBuilder->getAdditionalRequestParameters( + $transaction, + $context->getContext(), + $dataBag + ); + + return $this->createRequest(); + } +} diff --git a/src/Payone/Request/SecureInvoice/SecureInvoiceAuthorizeRequest.php b/src/Payone/Request/SecureInvoice/SecureInvoiceAuthorizeRequest.php new file mode 100644 index 000000000..4e5b0cbe6 --- /dev/null +++ b/src/Payone/Request/SecureInvoice/SecureInvoiceAuthorizeRequest.php @@ -0,0 +1,23 @@ + 'authorization', + ]); + } +} diff --git a/src/Payone/Request/SecureInvoice/SecureInvoiceAuthorizeRequestFactory.php b/src/Payone/Request/SecureInvoice/SecureInvoiceAuthorizeRequestFactory.php new file mode 100644 index 000000000..2fede3c62 --- /dev/null +++ b/src/Payone/Request/SecureInvoice/SecureInvoiceAuthorizeRequestFactory.php @@ -0,0 +1,9 @@ + 'preauthorization', + ]); + } +} diff --git a/src/Payone/Request/SecureInvoice/SecureInvoicePreAuthorizeRequestFactory.php b/src/Payone/Request/SecureInvoice/SecureInvoicePreAuthorizeRequestFactory.php new file mode 100644 index 000000000..ad96eaa11 --- /dev/null +++ b/src/Payone/Request/SecureInvoice/SecureInvoicePreAuthorizeRequestFactory.php @@ -0,0 +1,9 @@ +filter(static function (OrderTransactionEntity $transaction) { - $customFields = $transaction->getPaymentMethod()->getCustomFields(); + $paymentMethod = $transaction->getPaymentMethod(); + + if ($paymentMethod === null) { + return false; + } + + $customFields = $paymentMethod->getCustomFields(); if (empty($customFields)) { return false; @@ -119,6 +125,10 @@ private function getLatestReferenceNumber(PaymentTransaction $transaction): ?str }); $orderTransaction = $transactions->last(); + if ($orderTransaction === null) { + return null; + } + $customFields = $orderTransaction->getCustomFields(); if (empty($customFields[CustomFieldInstaller::TRANSACTION_DATA])) { @@ -138,10 +148,12 @@ private function getLatestReferenceNumber(PaymentTransaction $transaction): ?str private function getReferenceSuffix(OrderEntity $order): string { - if ($order->getTransactions()->count() <= 1) { + $transactions = $order->getTransactions(); + + if ($transactions === null || $transactions->count() <= 1) { return ''; } - return sprintf('_%d', $order->getTransactions()->count()); + return sprintf('_%d', $transactions->count()); } } diff --git a/src/PayonePayment.php b/src/PayonePayment.php index cc334e8a0..d7b8941c8 100644 --- a/src/PayonePayment.php +++ b/src/PayonePayment.php @@ -8,6 +8,7 @@ use PayonePayment\Installer\ConfigInstaller; use PayonePayment\Installer\CustomFieldInstaller; use PayonePayment\Installer\PaymentMethodInstaller; +use PayonePayment\Installer\RuleInstaller\RuleInstallerSecureInvoice; use Shopware\Core\Framework\Plugin; use Shopware\Core\Framework\Plugin\Context\ActivateContext; use Shopware\Core\Framework\Plugin\Context\DeactivateContext; @@ -33,6 +34,7 @@ public function install(InstallContext $context): void (new ConfigInstaller($this->container))->install($context); (new CustomFieldInstaller($this->container))->install($context); (new PaymentMethodInstaller($this->container))->install($context); + (new RuleInstallerSecureInvoice($this->container))->install($context); } public function update(UpdateContext $context): void @@ -40,6 +42,7 @@ public function update(UpdateContext $context): void (new ConfigInstaller($this->container))->update($context); (new CustomFieldInstaller($this->container))->update($context); (new PaymentMethodInstaller($this->container))->update($context); + (new RuleInstallerSecureInvoice($this->container))->update($context); } public function activate(ActivateContext $context): void @@ -47,6 +50,7 @@ public function activate(ActivateContext $context): void (new ConfigInstaller($this->container))->activate($context); (new CustomFieldInstaller($this->container))->activate($context); (new PaymentMethodInstaller($this->container))->activate($context); + (new RuleInstallerSecureInvoice($this->container))->activate($context); } public function deactivate(DeactivateContext $context): void @@ -54,6 +58,7 @@ public function deactivate(DeactivateContext $context): void (new ConfigInstaller($this->container))->deactivate($context); (new CustomFieldInstaller($this->container))->deactivate($context); (new PaymentMethodInstaller($this->container))->deactivate($context); + (new RuleInstallerSecureInvoice($this->container))->deactivate($context); } public function uninstall(UninstallContext $context): void @@ -61,6 +66,7 @@ public function uninstall(UninstallContext $context): void (new ConfigInstaller($this->container))->uninstall($context); (new CustomFieldInstaller($this->container))->uninstall($context); (new PaymentMethodInstaller($this->container))->uninstall($context); + (new RuleInstallerSecureInvoice($this->container))->uninstall($context); if ($context->keepUserData()) { return; diff --git a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js index 7e1099e2a..cd19891a2 100644 --- a/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js +++ b/src/Resources/app/administration/src/module/payone-payment/page/payone-settings/index.js @@ -41,6 +41,7 @@ Component.register('payone-settings', { 'payment_ideal': true, 'payment_paydirekt': true, 'payment_prepayment': true, + 'payment_secure_invoice': true, }, }; }, @@ -98,6 +99,7 @@ Component.register('payone-settings', { 'iDeal', 'paydirekt', 'prepayment', + 'secureInvoice', ]; }, diff --git a/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json b/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json index 11ede8371..4734fb9a4 100644 --- a/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json +++ b/src/Resources/app/administration/src/module/payone-payment/snippet/de_DE.json @@ -70,7 +70,8 @@ "payolutionDebit": "Die API-Zugangsdaten für Paysafe Pay Later Lastschrift sind nicht korrekt.", "sofort": "Die API-Zugangsdaten für SOFORT sind nicht korrekt.", "eps": "Die API-Zugangsdaten für EPS sind nicht korrekt.", - "iDeal": "Die API-Zugangsdaten für iDEAL sind nicht korrekt." + "iDeal": "Die API-Zugangsdaten für iDEAL sind nicht korrekt.", + "secureInvoice": "Die API-Zugangsdaten für den gesicherten Rechnungskauf sind nicht korrekt." } }, "supportModal": { diff --git a/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json b/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json index 5ae813283..cb07911ea 100644 --- a/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json +++ b/src/Resources/app/administration/src/module/payone-payment/snippet/en_GB.json @@ -70,7 +70,8 @@ "payolutionDebit": "The API credentials for Paysafe Pay Later Debit are not valid.", "sofort": "The API credentials for SOFORT are not valid.", "eps": "The API credentials for EPS are not valid.", - "iDeal": "The API credentials for iDEAL are not valid." + "iDeal": "The API credentials for iDEAL are not valid.", + "secureInvoice": "The API credentials for secure invoice payment are not valid." } }, "supportModal": { diff --git a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js b/src/Resources/app/storefront/dist/storefront/js/payone-payment.js index 5cdaf5a1b..477e807dc 100644 --- a/src/Resources/app/storefront/dist/storefront/js/payone-payment.js +++ b/src/Resources/app/storefront/dist/storefront/js/payone-payment.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([["payone-payment"],{T08A:function(e,t,n){"use strict";n.r(t);var r=n("FGIj");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t0)return!0;if(!this.iframe.isComplete()){var r=document.getElementById("iframeErrorOutput");return this.iframeFieldCheckerStarted||setInterval((function(){t.iframe.isComplete()?r.style.display="none":r.style.display="block"}),250),this.iframeFieldCheckerStarted=!0,e.preventDefault(),!1}return this.orderFormDisabled?(window.payoneCreditCardCheckCallback=this._payoneCheckCallback.bind(this),this.iframe.creditCardCheck("payoneCreditCardCheckCallback"),e.preventDefault(),!1):void 0}},{key:"_handleChangeSavedCard",value:function(){var e=document.getElementById("savedpseudocardpan");e.options[e.selectedIndex].value?i(document.getElementsByClassName("credit-card-input")).forEach((function(e){e.classList.add("hide")})):i(document.getElementsByClassName("credit-card-input")).forEach((function(e){e.classList.remove("hide")}))}},{key:"_payoneCheckCallback",value:function(e){if("VALID"===e.status)document.getElementById("pseudocardpan").value=e.pseudocardpan,document.getElementById("truncatedcardpan").value=e.truncatedcardpan,document.getElementById("cardexpiredate").value=e.cardexpiredate,this.orderFormDisabled=!1,document.getElementById("confirmOrderForm").submit();else{var t=document.getElementById("confirmFormSubmit"),n=document.getElementById("errorOutput");t.removeAttribute("disabled"),n.innerHTML=e.errormessage,n.style.display="block"}}}])&&a(n.prototype,r),o&&a(n,o),t}(r.a);y={supportedCardtypes:["#","V","A","M","D","J","O","U","P"]},(s="options")in(d=m)?Object.defineProperty(d,s,{value:y,enumerable:!0,configurable:!0,writable:!0}):d[s]=y;var f=n("p4AR"),p=n("2Jwc"),h=n("3xtq");function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e,t){for(var n=0;n0)return!0;if(!this.iframe.isComplete()){var r=document.getElementById("iframeErrorOutput");return this.iframeFieldCheckerStarted||setInterval((function(){t.iframe.isComplete()?r.style.display="none":r.style.display="block"}),250),this.iframeFieldCheckerStarted=!0,e.preventDefault(),!1}return this.orderFormDisabled?(window.payoneCreditCardCheckCallback=this._payoneCheckCallback.bind(this),this.iframe.creditCardCheck("payoneCreditCardCheckCallback"),e.preventDefault(),!1):void 0}},{key:"_handleChangeSavedCard",value:function(){var e=document.getElementById("savedpseudocardpan");e.options[e.selectedIndex].value?i(document.getElementsByClassName("credit-card-input")).forEach((function(e){e.classList.add("hide")})):i(document.getElementsByClassName("credit-card-input")).forEach((function(e){e.classList.remove("hide")}))}},{key:"_payoneCheckCallback",value:function(e){if("VALID"===e.status)document.getElementById("pseudocardpan").value=e.pseudocardpan,document.getElementById("truncatedcardpan").value=e.truncatedcardpan,document.getElementById("cardexpiredate").value=e.cardexpiredate,this.orderFormDisabled=!1,document.getElementById("confirmOrderForm").submit();else{var t=document.getElementById("confirmFormSubmit"),n=document.getElementById("errorOutput");t.removeAttribute("disabled"),n.innerHTML=e.errormessage,n.style.display="block"}}}])&&a(n.prototype,r),o&&a(n,o),t}(r.a);y={supportedCardtypes:["#","V","A","M","D","J","O","U","P"]},(s="options")in(d=f)?Object.defineProperty(d,s,{value:y,enumerable:!0,configurable:!0,writable:!0}):d[s]=y;var m=n("p4AR"),p=n("2Jwc"),h=n("3xtq");function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e,t){for(var n=0;n + + + Secure invoice (own payment portal is required) + Gesicherter Rechnungskauf (Eigenes Zahlungsportal wird benötigt) + + payment_secure_invoice + + + secureInvoiceMerchantId + + Uses the basic configuration value if nothing is entered here. + Nutzt den Wert der Grundeinstellungen, falls nichts eingetragen wird. + + + + secureInvoiceAccountId + + Uses the basic configuration value if nothing is entered here. + Nutzt den Wert der Grundeinstellungen, falls nichts eingetragen wird. + + + + secureInvoicePortalId + + You need an ID to a separate payment gateway to use this payment method. + Sie benötigen eine ID zu einem separates Zahlungsportal um diese Zahlart verwenden zu können. + + + + secureInvoicePortalKey + + You need a key to a separate payment gateway to use this payment method. + Sie benötigen einen Schlüssel zu einem separaten Zahlungsportal um diese Zahlart verwenden zu können. + + + + secureInvoiceAuthorizationMethod + + + Defines the authorization method for this payment method. + Legt die Autorisierungsmethode für diese Zahlungsart fest. + + + + + + diff --git a/src/Resources/public/administration/js/payone-payment.js b/src/Resources/public/administration/js/payone-payment.js index a0a5f199b..b1eb10e98 100644 --- a/src/Resources/public/administration/js/payone-payment.js +++ b/src/Resources/public/administration/js/payone-payment.js @@ -1 +1 @@ -(this.webpackJsonp=this.webpackJsonp||[]).push([["payone-payment"],{"4yeS":function(e,t,n){},AuFV:function(e,t){e.exports='{% block sw_data_grid_select_item_checkbox %}\n \n \n\n \n \n{% endblock %}\n'},DMdC:function(e,t,n){},E7l4:function(e,t){e.exports='{% block payone_payment_details %}\n
\n \n\n \n\n \n\n \n \n
\n{% endblock %}\n'},Jolr:function(e,t,n){var a=n("s6j0");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("f1a6c96e",a,!0,{})},KBQv:function(e,t){const{Application:n}=Shopware,a=Shopware.Classes.ApiService;class i extends a{constructor(e,t,n="payone"){super(e,t,n)}capturePayment(e){const t=`_action/${this.getApiBasePath()}/capture-payment`;return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then(e=>a.handleResponse(e))}refundPayment(e){const t=`_action/${this.getApiBasePath()}/refund-payment`;return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then(e=>a.handleResponse(e))}}n.addServiceProvider("PayonePaymentService",e=>{const t=n.getContainer("init");return new i(t.httpClient,e.loginService)})},Klmz:function(e,t,n){var a=n("zsm5");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("a28cbb14",a,!0,{})},Lvox:function(e,t,n){var a=n("DMdC");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3806acf0",a,!0,{})},McCE:function(e,t,n){var a=n("McMq");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("f06f327e",a,!0,{})},McMq:function(e,t,n){},NXBA:function(e,t,n){},OPxs:function(e,t,n){"use strict";n.r(t);var a=n("asGc"),i=n.n(a);n("qwju");const{Component:s,Mixin:o,Context:r}=Shopware;s.register("payone-capture-button",{template:i.a,mixins:[o.getByName("notification")],inject:["PayonePaymentService","repositoryFactory"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},computed:{totalTransactionAmount(){return Math.round(this.transaction.amount.totalPrice*10**this.order.currency.decimalPrecision,0)},capturedAmount(){return this.transaction.customFields&&void 0!==this.transaction.customFields.payone_captured_amount?this.transaction.customFields.payone_captured_amount:0},remainingAmount(){return this.totalTransactionAmount-this.capturedAmount},maxCaptureAmount(){return this.remainingAmount/10**this.order.currency.decimalPrecision},buttonEnabled(){return!!this.transaction.customFields&&(this.remainingAmount>0&&this.capturedAmount>0||this.transaction.customFields.payone_allow_capture)}},data:()=>({isLoading:!1,hasError:!1,showCaptureModal:!1,isCaptureSuccessful:!1,selection:[],captureAmount:0}),methods:{calculateCaptureAmount(){let e=0;this.selection.forEach(t=>{t.selected&&(e+=t.unit_price*t.quantity)}),e>this.remainingAmount&&(e=this.remainingAmount),this.captureAmount=e},openCaptureModal(){this.showCaptureModal=!0,this.isCaptureSuccessful=!1,this.selection=[]},closeCaptureModal(){this.showCaptureModal=!1},onCaptureFinished(){this.isCaptureSuccessful=!1},captureOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.captureAmount,orderLines:[],complete:this.captureAmount===this.remainingAmount};this.isLoading=!0,this.selection.forEach(t=>{this.order.lineItems.forEach(n=>{if(n.id===t.id&&t.selected&&0{this.order.lineItems.forEach(n=>{if(n.id===t.id&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.capture.successTitle"),message:this.$tc("payone-payment.capture.successMessage")}),this.isCaptureSuccessful=!0}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.capture.errorTitle"),message:e.message}),this.isCaptureSuccessful=!1}).finally(()=>{this.isLoading=!1,this.closeCaptureModal(),this.$nextTick().then(()=>{this.$emit("reload")})})},onSelectItem(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.selected=t)}),this.calculateCaptureAmount()},onChangeQuantity(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.quantity=t)}),this.calculateCaptureAmount()},_populateSelectionProperty(){this.order.lineItems.forEach(e=>{let t=e.quantity;e.customFields&&e.customFields.payone_captured_quantity&&0({isLoading:!1,hasError:!1,showRefundModal:!1,isRefundSuccessful:!1,selection:[],refundAmount:0}),computed:{remainingAmount(){return void 0===this.transaction.customFields||void 0===this.transaction.customFields.payone_captured_amount?0:this.transaction.customFields.payone_captured_amount-this.refundedAmount},refundedAmount(){return void 0===this.transaction.customFields||void 0===this.transaction.customFields.payone_refunded_amount?0:this.transaction.customFields.payone_refunded_amount},maxRefundAmount(){return this.remainingAmount/10**this.order.currency.decimalPrecision},buttonEnabled(){return!!this.transaction.customFields&&(this.remainingAmount>0&&this.refundedAmount>0||this.transaction.customFields.payone_allow_refund)}},methods:{calculateRefundAmount(){let e=0;this.selection.forEach(t=>{t.selected&&(e+=t.unit_price*t.quantity)}),Math.round(e*10**this.order.currency.decimalPrecision>this.remainingAmount)&&(e=this.remainingAmount/10**this.order.currency.decimalPrecision),this.refundAmount=e},openRefundModal(){this.showRefundModal=!0,this.isRefundSuccessful=!1,this.selection=[]},closeRefundModal(){this.showRefundModal=!1},onRefundFinished(){this.isRefundSuccessful=!1},refundOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.refundAmount,orderLines:[],complete:this.refundAmount===this.maxRefundAmount};this.isLoading=!0,this.selection.forEach(t=>{this.order.lineItems.forEach(n=>{if(n.id===t.id&&t.selected&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.refund.successTitle"),message:this.$tc("payone-payment.refund.successMessage")}),this.isRefundSuccessful=!0}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.refund.errorTitle"),message:e.message}),this.isRefundSuccessful=!1}).finally(()=>{this.isLoading=!1,this.closeRefundModal(),this.$nextTick().then(()=>{this.$emit("reload")})})},refundFullOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.maxRefundAmount,orderLines:[],complete:!0};this.isLoading=!0,this._populateSelectionProperty(),this.selection.forEach(t=>{this.order.lineItems.forEach(n=>{if(n.id===t.id&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.refund.successTitle"),message:this.$tc("payone-payment.refund.successMessage")}),this.isRefundSuccessful=!0}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.refund.errorTitle"),message:e.message}),this.isRefundSuccessful=!1}).finally(()=>{this.isLoading=!1,this.closeRefundModal(),this.$nextTick().then(()=>{this.$emit("reload")})})},onSelectItem(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.selected=t)}),this.calculateRefundAmount()},onChangeQuantity(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.quantity=t)}),this.calculateRefundAmount()},_populateSelectionProperty(){this.order.lineItems.forEach(e=>{let t=e.quantity;e.customFields&&e.customFields.payone_refunded_quantity&&0{const n=this.$options.filters.currency(t.totalPrice,this.order.currency.shortName,this.order.decimal_precision);let a=!1,i=t.quantity;t.customFields&&("refund"===this.mode?(t.customFields.payone_captured_quantity&&0>t.customFields.payone_captured_quantity&&(i=t.customFields.payone_captured_quantity),t.customFields.payone_refunded_quantity&&(i-=t.customFields.payone_refunded_quantity)):"capture"===this.mode&&t.customFields.payone_captured_quantity&&0i&&(a=!0),e.push({id:t.id,product:t.label,quantity:i,disabled:a,selected:!1,price:n,orderItem:t})}),e},orderItemColumns(){return[{property:"product",label:this.$tc("payone-payment.modal.columns.product"),rawData:!0},{property:"quantity",label:this.$tc("payone-payment.modal.columns.quantity"),rawData:!0},{property:"price",label:this.$tc("payone-payment.modal.columns.price"),rawData:!0}]}},methods:{onSelectItem(e,t,n){this.$emit("select-item",t.id,n)},onChangeQuantity(e,t){this.$emit("change-quantity",t,e)}}});var h=n("AuFV"),f=n.n(h);const{Component:g}=Shopware;g.extend("payone-data-grid","sw-data-grid",{template:f.a});var b=n("mLM4"),_=n.n(b);n("McCE");const{Component:w,Mixin:v}=Shopware;w.register("payone-settings",{template:_.a,mixins:[v.getByName("notification"),v.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data:()=>({isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,config:{},merchantIdFilled:!1,accountIdFilled:!1,portalIdFilled:!1,portalKeyFilled:!1,showValidationErrors:!1,isSupportModalOpen:!1,stateMachineTransitionActions:[],collapsibleState:{status_mapping:!0,payment_credit_card:!0,payment_paypal:!0,payment_paypal_express:!0,payment_debit:!0,payment_sofort:!0,payment_payolution_installment:!0,payment_payolution_invoicing:!0,payment_payolution_debit:!0,payment_eps:!0,payment_ideal:!0,payment_paydirekt:!0,payment_prepayment:!0}}),created(){this.createdComponent()},computed:{credentialsMissing:function(){return!(this.merchantIdFilled&&this.accountIdFilled&&this.portalIdFilled&&this.portalKeyFilled)}},metaInfo(){return{title:this.$createTitle()}},methods:{createdComponent(){let e=this;this.PayonePaymentSettingsService.getStateMachineTransitionActions().then(t=>{t.data.forEach(t=>{let n="payone-payment.transitionActionNames."+t.label,a=e.$t(n);a===n&&(a=t.label),e.stateMachineTransitionActions.push({label:a,value:t.value})})})},paymentMethodPrefixes:()=>["creditCard","debit","paypal","paypalExpress","payolutionInvoicing","payolutionInstallment","payolutionDebit","sofort","eps","iDeal","paydirekt","prepayment"],isCollapsible(e){return e.name in this.collapsibleState},displayField(e,t,n){return!(n.name in this.collapsibleState)||!this.collapsibleState[n.name]},isCollapsed(e){return this.collapsibleState[e.name]},toggleCollapsible(e){e.name in this.collapsibleState&&(this.collapsibleState[e.name]=!this.collapsibleState[e.name])},saveFinish(){this.isSaveSuccessful=!1},testFinish(){this.isTestSuccessful=!1},onConfigChange(e){this.config=e,this.checkCredentialsFilled(),this.showValidationErrors=!1},checkCredentialsFilled(){this.merchantIdFilled=!!this.getConfigValue("merchantId"),this.accountIdFilled=!!this.getConfigValue("accountId"),this.portalIdFilled=!!this.getConfigValue("portalId"),this.portalKeyFilled=!!this.getConfigValue("portalKey")},getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return null===this.$refs.systemConfig.currentSalesChannelId?this.config[`PayonePayment.settings.${e}`]:this.config[`PayonePayment.settings.${e}`]||t[`PayonePayment.settings.${e}`]},getPaymentConfigValue(e,t){let n=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+n)||this.getConfigValue(e)},onSave(){this.credentialsMissing?this.showValidationErrors=!0:(this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.isLoading=!1,this.isSaveSuccessful=!0}).catch(()=>{this.isLoading=!1}))},onTest(){this.isTesting=!0,this.isTestSuccessful=!1;let e={};this.paymentMethodPrefixes().forEach(t=>{e[t]={merchantId:this.getPaymentConfigValue("merchantId",t),accountId:this.getPaymentConfigValue("accountId",t),portalId:this.getPaymentConfigValue("portalId",t),portalKey:this.getPaymentConfigValue("portalKey",t)}}),this.PayonePaymentSettingsService.validateApiCredentials(e).then(e=>{const t=e.testCount,n=e.credentialsValid,a=e.errors;if(n)this.createNotificationSuccess({title:this.$tc("payone-payment.settingsForm.titleSuccess"),message:t>0?this.$tc("payone-payment.settingsForm.messageTestSuccess"):this.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),this.isTestSuccessful=!0;else for(let e in a)a.hasOwnProperty(e)&&this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError."+e)});this.isTesting=!1}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError.general")}),this.isTesting=!1})},getBind(e,t){return t!==this.config&&this.onConfigChange(t),this.showValidationErrors&&("PayonePayment.settings.merchantId"!==e.name||this.merchantIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.accountId"!==e.name||this.accountIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalId"!==e.name||this.portalIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalKey"!==e.name||this.portalKeyFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")})),e}}});var P=n("jAFz"),S=n.n(P);n("Lvox");const{Component:A,Mixin:C}=Shopware;A.override("sw-order-detail-base",{template:S.a,inject:["PayonePaymentService"],mixins:[C.getByName("notification")],data:()=>({disableButtons:!1}),computed:{payoneTransactions:function(){return this.order.transactions.filter(e=>this.isPayoneTransaction(e)).sort((e,t)=>e.createdAtt.createdAt?-1:0)}},methods:{isPayoneTransaction:e=>!!e.customFields&&e.customFields.payone_transaction_id,isActiveTransaction:e=>"cancelled"!==e.stateMachineState.technicalName,hasPayoneTransaction(e){let t=this,n=!1;return!!e.transactions&&(e.transactions.map((function(e){t.isPayoneTransaction(e)&&t.isActiveTransaction(e)&&(n=!0)})),n)}}});var k=n("Yjca"),T=n.n(k);n("d11z");const{Component:x}=Shopware;x.override("sw-settings-index",{template:T.a});n("fzay");var E=n("m1C4"),F=n("eQpg");const{Module:I}=Shopware;I.register("payone-payment",{type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":E,"en-GB":F},routeMiddleware(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}}});n("KBQv"),n("Q7qL")},Q7qL:function(e,t){const{Application:n}=Shopware,a=Shopware.Classes.ApiService;class i extends a{constructor(e,t,n="payone_payment"){super(e,t,n)}validateApiCredentials(e){const t=this.getBasicHeaders();return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-api-credentials`,{credentials:e},{headers:t}).then(e=>a.handleResponse(e))}getStateMachineTransitionActions(){const e=this.getBasicHeaders();return this.httpClient.get(`_action/${this.getApiBasePath()}/get-state-machine-transition-actions`,{headers:e}).then(e=>a.handleResponse(e))}}n.addServiceProvider("PayonePaymentSettingsService",e=>{const t=n.getContainer("init");return new i(t.httpClient,e.loginService)})},Yjca:function(e,t){e.exports='{# TODO: Remove this file before 6.4, deprecated since 6.2 #}\n{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},asGc:function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.capture.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},d11z:function(e,t,n){var a=n("NXBA");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("e7715378",a,!0,{})},eQpg:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture processed successfully.","errorTitle":"PAYONE","errorMessage":"Capture could not be processed.","tooltips":{"impossible":"Capture impossible"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund processed successfully.","errorTitle":"PAYONE","errorMessage":"Refund could not be processed.","tooltips":{"impossible":"Refund impossible"}},"modal":{"capture":{"title":"Capture","submit":"Capture","fullSubmit":"Full capture","amount":"Capture amount","captured":"Captured amount"},"refund":{"title":"Refund","submit":"Refund","fullSubmit":"Full Refund","amount":"Refund amount","refunded":"Refunded amount"},"orderAmount":"Order amount","remainingAmount":"Remaining amount","descriptionHelpText":"Description help text","close":"Close","labelComment":"Label comment","columns":{"reference":"Reference","product":"Product","quantity":"Quantity","price":"Price"}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for Credit Card are not valid.","debit":"The API credentials for Debit are not valid.","paypalExpress":"The API credentials for PayPal Express are not valid.","paypal":"The API credentials for PayPal are not valid.","payolutionInstallment":"The API credentials for Paysafe Pay Later Installment are not valid.","payolutionInvoicing":"The API credentials for Paysafe Pay Later Invoicing are not valid.","payolutionDebit":"The API credentials for Paysafe Pay Later Debit are not valid.","sofort":"The API credentials for SOFORT are not valid.","eps":"The API credentials for EPS are not valid.","iDeal":"The API credentials for iDEAL are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","txid":"TXID","sequenceNumber":{"label":"Sequence Number","empty":"none"},"transactionState":"State","transactionCancelled":"Transaction cancelled in Shopware","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}}}')},fBZk:function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.refund.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},fzay:function(e,t){const{Filter:n}=Shopware,{currency:a}=Shopware.Utils.format;n.register("payone_currency",(e,t,n,i)=>null===e?"-":(n||(n=0),a(e/=10**n,t,i)))},jAFz:function(e,t){e.exports='{% block sw_order_detail_delivery_metadata %}\n {% parent %}\n\n \n{% endblock %}\n'},m1C4:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Einstellungen für PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Capture konnte nicht durchgeführt werden.","tooltips":{"impossible":"Einzug unmöglich"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Refund konnte nicht durchgeführt werden.","tooltips":{"impossible":"Erstattung unmöglich"}},"modal":{"capture":{"title":"Einzug","submit":"Einziehen","fullSubmit":"Alles Einziehen","amount":"Einzugswert","captured":"Eingezogener Wert"},"refund":{"title":"Erstattung","submit":"Erstatten","fullSubmit":"Alles Erstatten","amount":"Erstattungswert","refunded":"Erstatteter Wert"},"close":"Schließen","orderAmount":"Bestellungswert","remainingAmount":"Ausstehender Wert","labelComment":"Label comment","descriptionHelpText":"Description help text","columns":{"reference":"Referenz","product":"Produkt","quantity":"Anzahl","price":"Preis"}},"settingsForm":{"save":"Speichern","test":"API-Zugangsdaten testen","titleSuccess":"Erfolg","titleError":"Fehler","messageTestSuccess":"Die API-Zugangsdaten wurden erfolgreich validiert.","messageTestNoTestedPayments":"Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --\x3e Shop --\x3e Zahlungsarten.","messageTestError":{"general":"Die API-Zugangsdaten konnten nicht validiert werden.","creditCard":"Die API-Zugangsdaten für Kreditkarte sind nicht korrekt.","debit":"Die API-Zugangsdaten für Lastschrift sind nicht korrekt.","paypalExpress":"Die API-Zugangsdaten für PayPal Express sind nicht korrekt.","paypal":"Die API-Zugangsdaten für PayPal sind nicht korrekt.","payolutionInstallment":"Die API-Zugangsdaten für Paysafe Pay Later Ratenzahlung sind nicht korrekt.","payolutionInvoicing":"Die API-Zugangsdaten für Paysafe Pay Later Rechnungskauf sind nicht korrekt.","payolutionDebit":"Die API-Zugangsdaten für Paysafe Pay Later Lastschrift sind nicht korrekt.","sofort":"Die API-Zugangsdaten für SOFORT sind nicht korrekt.","eps":"Die API-Zugangsdaten für EPS sind nicht korrekt.","iDeal":"Die API-Zugangsdaten für iDEAL sind nicht korrekt."}},"supportModal":{"menuButton":"Support","title":"Wie können wir Ihnen helfen?","documentation":{"description":"Lesen Sie unsere Online-Dokumentation","button":"Dokumentation"},"support":{"description":"Kontaktieren Sie unseren technischen Support","button":"Technischer Support"},"repository":{"description":"Melden Sie Fehler und Verbesserungen auf GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","txid":"TXID","sequenceNumber":{"label":"Sequenznummer","empty":"keine"},"transactionState":"Status","transactionCancelled":"Transaktion in Shopware abgebrochen","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}}}')},mLM4:function(e,t){e.exports='{% block payone_payment %}\n\n {% block payone_payment_header %}\n \n {% endblock %}\n\n {% block payone_payment_actions %}\n \n {% endblock %}\n\n {% block payone_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},qwju:function(e,t,n){var a=n("4yeS");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("dda1b75e",a,!0,{})},s6j0:function(e,t,n){},zsm5:function(e,t,n){}},[["OPxs","runtime","vendors-node"]]]); \ No newline at end of file +(this.webpackJsonp=this.webpackJsonp||[]).push([["payone-payment"],{"4yeS":function(e,t,n){},AuFV:function(e,t){e.exports='{% block sw_data_grid_select_item_checkbox %}\n \n \n\n \n \n{% endblock %}\n'},DMdC:function(e,t,n){},E7l4:function(e,t){e.exports='{% block payone_payment_details %}\n
\n \n\n \n\n \n\n \n \n
\n{% endblock %}\n'},Jolr:function(e,t,n){var a=n("s6j0");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("f1a6c96e",a,!0,{})},KBQv:function(e,t){const{Application:n}=Shopware,a=Shopware.Classes.ApiService;class i extends a{constructor(e,t,n="payone"){super(e,t,n)}capturePayment(e){const t=`_action/${this.getApiBasePath()}/capture-payment`;return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then(e=>a.handleResponse(e))}refundPayment(e){const t=`_action/${this.getApiBasePath()}/refund-payment`;return this.httpClient.post(t,e,{headers:this.getBasicHeaders()}).then(e=>a.handleResponse(e))}}n.addServiceProvider("PayonePaymentService",e=>{const t=n.getContainer("init");return new i(t.httpClient,e.loginService)})},Klmz:function(e,t,n){var a=n("zsm5");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("a28cbb14",a,!0,{})},Lvox:function(e,t,n){var a=n("DMdC");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("3806acf0",a,!0,{})},McCE:function(e,t,n){var a=n("McMq");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("f06f327e",a,!0,{})},McMq:function(e,t,n){},NXBA:function(e,t,n){},OPxs:function(e,t,n){"use strict";n.r(t);var a=n("asGc"),i=n.n(a);n("qwju");const{Component:s,Mixin:o,Context:r}=Shopware;s.register("payone-capture-button",{template:i.a,mixins:[o.getByName("notification")],inject:["PayonePaymentService","repositoryFactory"],props:{order:{type:Object,required:!0},transaction:{type:Object,required:!0}},computed:{totalTransactionAmount(){return Math.round(this.transaction.amount.totalPrice*10**this.order.currency.decimalPrecision,0)},capturedAmount(){return this.transaction.customFields&&void 0!==this.transaction.customFields.payone_captured_amount?this.transaction.customFields.payone_captured_amount:0},remainingAmount(){return this.totalTransactionAmount-this.capturedAmount},maxCaptureAmount(){return this.remainingAmount/10**this.order.currency.decimalPrecision},buttonEnabled(){return!!this.transaction.customFields&&(this.remainingAmount>0&&this.capturedAmount>0||this.transaction.customFields.payone_allow_capture)}},data:()=>({isLoading:!1,hasError:!1,showCaptureModal:!1,isCaptureSuccessful:!1,selection:[],captureAmount:0}),methods:{calculateCaptureAmount(){let e=0;this.selection.forEach(t=>{t.selected&&(e+=t.unit_price*t.quantity)}),e>this.remainingAmount&&(e=this.remainingAmount),this.captureAmount=e},openCaptureModal(){this.showCaptureModal=!0,this.isCaptureSuccessful=!1,this.selection=[]},closeCaptureModal(){this.showCaptureModal=!1},onCaptureFinished(){this.isCaptureSuccessful=!1},captureOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.captureAmount,orderLines:[],complete:this.captureAmount===this.remainingAmount};this.isLoading=!0,this.selection.forEach(t=>{this.order.lineItems.forEach(n=>{if(n.id===t.id&&t.selected&&0{this.order.lineItems.forEach(n=>{if(n.id===t.id&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.capture.successTitle"),message:this.$tc("payone-payment.capture.successMessage")}),this.isCaptureSuccessful=!0}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.capture.errorTitle"),message:e.message}),this.isCaptureSuccessful=!1}).finally(()=>{this.isLoading=!1,this.closeCaptureModal(),this.$nextTick().then(()=>{this.$emit("reload")})})},onSelectItem(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.selected=t)}),this.calculateCaptureAmount()},onChangeQuantity(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.quantity=t)}),this.calculateCaptureAmount()},_populateSelectionProperty(){this.order.lineItems.forEach(e=>{let t=e.quantity;e.customFields&&e.customFields.payone_captured_quantity&&0({isLoading:!1,hasError:!1,showRefundModal:!1,isRefundSuccessful:!1,selection:[],refundAmount:0}),computed:{remainingAmount(){return void 0===this.transaction.customFields||void 0===this.transaction.customFields.payone_captured_amount?0:this.transaction.customFields.payone_captured_amount-this.refundedAmount},refundedAmount(){return void 0===this.transaction.customFields||void 0===this.transaction.customFields.payone_refunded_amount?0:this.transaction.customFields.payone_refunded_amount},maxRefundAmount(){return this.remainingAmount/10**this.order.currency.decimalPrecision},buttonEnabled(){return!!this.transaction.customFields&&(this.remainingAmount>0&&this.refundedAmount>0||this.transaction.customFields.payone_allow_refund)}},methods:{calculateRefundAmount(){let e=0;this.selection.forEach(t=>{t.selected&&(e+=t.unit_price*t.quantity)}),Math.round(e*10**this.order.currency.decimalPrecision>this.remainingAmount)&&(e=this.remainingAmount/10**this.order.currency.decimalPrecision),this.refundAmount=e},openRefundModal(){this.showRefundModal=!0,this.isRefundSuccessful=!1,this.selection=[]},closeRefundModal(){this.showRefundModal=!1},onRefundFinished(){this.isRefundSuccessful=!1},refundOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.refundAmount,orderLines:[],complete:this.refundAmount===this.maxRefundAmount};this.isLoading=!0,this.selection.forEach(t=>{this.order.lineItems.forEach(n=>{if(n.id===t.id&&t.selected&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.refund.successTitle"),message:this.$tc("payone-payment.refund.successMessage")}),this.isRefundSuccessful=!0}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.refund.errorTitle"),message:e.message}),this.isRefundSuccessful=!1}).finally(()=>{this.isLoading=!1,this.closeRefundModal(),this.$nextTick().then(()=>{this.$emit("reload")})})},refundFullOrder(){const e={orderTransactionId:this.transaction.id,payone_order_id:this.transaction.customFields.payone_transaction_id,salesChannel:this.order.salesChannel,amount:this.maxRefundAmount,orderLines:[],complete:!0};this.isLoading=!0,this._populateSelectionProperty(),this.selection.forEach(t=>{this.order.lineItems.forEach(n=>{if(n.id===t.id&&0{this.createNotificationSuccess({title:this.$tc("payone-payment.refund.successTitle"),message:this.$tc("payone-payment.refund.successMessage")}),this.isRefundSuccessful=!0}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.refund.errorTitle"),message:e.message}),this.isRefundSuccessful=!1}).finally(()=>{this.isLoading=!1,this.closeRefundModal(),this.$nextTick().then(()=>{this.$emit("reload")})})},onSelectItem(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.selected=t)}),this.calculateRefundAmount()},onChangeQuantity(e,t){0===this.selection.length&&this._populateSelectionProperty(),this.selection.forEach(n=>{n.id===e&&(n.quantity=t)}),this.calculateRefundAmount()},_populateSelectionProperty(){this.order.lineItems.forEach(e=>{let t=e.quantity;e.customFields&&e.customFields.payone_refunded_quantity&&0{const n=this.$options.filters.currency(t.totalPrice,this.order.currency.shortName,this.order.decimal_precision);let a=!1,i=t.quantity;t.customFields&&("refund"===this.mode?(t.customFields.payone_captured_quantity&&0>t.customFields.payone_captured_quantity&&(i=t.customFields.payone_captured_quantity),t.customFields.payone_refunded_quantity&&(i-=t.customFields.payone_refunded_quantity)):"capture"===this.mode&&t.customFields.payone_captured_quantity&&0i&&(a=!0),e.push({id:t.id,product:t.label,quantity:i,disabled:a,selected:!1,price:n,orderItem:t})}),e},orderItemColumns(){return[{property:"product",label:this.$tc("payone-payment.modal.columns.product"),rawData:!0},{property:"quantity",label:this.$tc("payone-payment.modal.columns.quantity"),rawData:!0},{property:"price",label:this.$tc("payone-payment.modal.columns.price"),rawData:!0}]}},methods:{onSelectItem(e,t,n){this.$emit("select-item",t.id,n)},onChangeQuantity(e,t){this.$emit("change-quantity",t,e)}}});var h=n("AuFV"),f=n.n(h);const{Component:g}=Shopware;g.extend("payone-data-grid","sw-data-grid",{template:f.a});var b=n("mLM4"),_=n.n(b);n("McCE");const{Component:v,Mixin:w}=Shopware;v.register("payone-settings",{template:_.a,mixins:[w.getByName("notification"),w.getByName("sw-inline-snippet")],inject:["PayonePaymentSettingsService"],data:()=>({isLoading:!1,isTesting:!1,isSaveSuccessful:!1,isTestSuccessful:!1,config:{},merchantIdFilled:!1,accountIdFilled:!1,portalIdFilled:!1,portalKeyFilled:!1,showValidationErrors:!1,isSupportModalOpen:!1,stateMachineTransitionActions:[],collapsibleState:{status_mapping:!0,payment_credit_card:!0,payment_paypal:!0,payment_paypal_express:!0,payment_debit:!0,payment_sofort:!0,payment_payolution_installment:!0,payment_payolution_invoicing:!0,payment_payolution_debit:!0,payment_eps:!0,payment_ideal:!0,payment_paydirekt:!0,payment_prepayment:!0,payment_secure_invoice:!0}}),created(){this.createdComponent()},computed:{credentialsMissing:function(){return!(this.merchantIdFilled&&this.accountIdFilled&&this.portalIdFilled&&this.portalKeyFilled)}},metaInfo(){return{title:this.$createTitle()}},methods:{createdComponent(){let e=this;this.PayonePaymentSettingsService.getStateMachineTransitionActions().then(t=>{t.data.forEach(t=>{let n="payone-payment.transitionActionNames."+t.label,a=e.$t(n);a===n&&(a=t.label),e.stateMachineTransitionActions.push({label:a,value:t.value})})})},paymentMethodPrefixes:()=>["creditCard","debit","paypal","paypalExpress","payolutionInvoicing","payolutionInstallment","payolutionDebit","sofort","eps","iDeal","paydirekt","prepayment","secureInvoice"],isCollapsible(e){return e.name in this.collapsibleState},displayField(e,t,n){return!(n.name in this.collapsibleState)||!this.collapsibleState[n.name]},isCollapsed(e){return this.collapsibleState[e.name]},toggleCollapsible(e){e.name in this.collapsibleState&&(this.collapsibleState[e.name]=!this.collapsibleState[e.name])},saveFinish(){this.isSaveSuccessful=!1},testFinish(){this.isTestSuccessful=!1},onConfigChange(e){this.config=e,this.checkCredentialsFilled(),this.showValidationErrors=!1},checkCredentialsFilled(){this.merchantIdFilled=!!this.getConfigValue("merchantId"),this.accountIdFilled=!!this.getConfigValue("accountId"),this.portalIdFilled=!!this.getConfigValue("portalId"),this.portalKeyFilled=!!this.getConfigValue("portalKey")},getConfigValue(e){const t=this.$refs.systemConfig.actualConfigData.null;return null===this.$refs.systemConfig.currentSalesChannelId?this.config[`PayonePayment.settings.${e}`]:this.config[`PayonePayment.settings.${e}`]||t[`PayonePayment.settings.${e}`]},getPaymentConfigValue(e,t){let n=e.charAt(0).toUpperCase()+e.slice(1);return this.getConfigValue(t+n)||this.getConfigValue(e)},onSave(){this.credentialsMissing?this.showValidationErrors=!0:(this.isSaveSuccessful=!1,this.isLoading=!0,this.$refs.systemConfig.saveAll().then(()=>{this.isLoading=!1,this.isSaveSuccessful=!0}).catch(()=>{this.isLoading=!1}))},onTest(){this.isTesting=!0,this.isTestSuccessful=!1;let e={};this.paymentMethodPrefixes().forEach(t=>{e[t]={merchantId:this.getPaymentConfigValue("merchantId",t),accountId:this.getPaymentConfigValue("accountId",t),portalId:this.getPaymentConfigValue("portalId",t),portalKey:this.getPaymentConfigValue("portalKey",t)}}),this.PayonePaymentSettingsService.validateApiCredentials(e).then(e=>{const t=e.testCount,n=e.credentialsValid,a=e.errors;if(n)this.createNotificationSuccess({title:this.$tc("payone-payment.settingsForm.titleSuccess"),message:t>0?this.$tc("payone-payment.settingsForm.messageTestSuccess"):this.$tc("payone-payment.settingsForm.messageTestNoTestedPayments")}),this.isTestSuccessful=!0;else for(let e in a)a.hasOwnProperty(e)&&this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError."+e)});this.isTesting=!1}).catch(e=>{this.createNotificationError({title:this.$tc("payone-payment.settingsForm.titleError"),message:this.$tc("payone-payment.settingsForm.messageTestError.general")}),this.isTesting=!1})},getBind(e,t){return t!==this.config&&this.onConfigChange(t),this.showValidationErrors&&("PayonePayment.settings.merchantId"!==e.name||this.merchantIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.accountId"!==e.name||this.accountIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalId"!==e.name||this.portalIdFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")}),"PayonePayment.settings.portalKey"!==e.name||this.portalKeyFilled||(e.config.error={code:1,detail:this.$tc("payone-payment.messageNotBlank")})),e}}});var P=n("jAFz"),S=n.n(P);n("Lvox");const{Component:A,Mixin:C}=Shopware;A.override("sw-order-detail-base",{template:S.a,inject:["PayonePaymentService"],mixins:[C.getByName("notification")],data:()=>({disableButtons:!1}),computed:{payoneTransactions:function(){return this.order.transactions.filter(e=>this.isPayoneTransaction(e)).sort((e,t)=>e.createdAtt.createdAt?-1:0)}},methods:{isPayoneTransaction:e=>!!e.customFields&&e.customFields.payone_transaction_id,isActiveTransaction:e=>"cancelled"!==e.stateMachineState.technicalName,hasPayoneTransaction(e){let t=this,n=!1;return!!e.transactions&&(e.transactions.map((function(e){t.isPayoneTransaction(e)&&t.isActiveTransaction(e)&&(n=!0)})),n)}}});var k=n("Yjca"),T=n.n(k);n("d11z");const{Component:x}=Shopware;x.override("sw-settings-index",{template:T.a});n("fzay");var E=n("m1C4"),I=n("eQpg");const{Module:F}=Shopware;F.register("payone-payment",{type:"plugin",name:"PayonePayment",title:"payone-payment.general.mainMenuItemGeneral",description:"payone-payment.general.descriptionTextModule",version:"1.0.0",targetVersion:"1.0.0",icon:"default-action-settings",snippets:{"de-DE":E,"en-GB":I},routeMiddleware(e,t){e(t)},routes:{index:{component:"payone-settings",path:"index",meta:{parentPath:"sw.settings.index"}}}});n("KBQv"),n("Q7qL")},Q7qL:function(e,t){const{Application:n}=Shopware,a=Shopware.Classes.ApiService;class i extends a{constructor(e,t,n="payone_payment"){super(e,t,n)}validateApiCredentials(e){const t=this.getBasicHeaders();return this.httpClient.post(`_action/${this.getApiBasePath()}/validate-api-credentials`,{credentials:e},{headers:t}).then(e=>a.handleResponse(e))}getStateMachineTransitionActions(){const e=this.getBasicHeaders();return this.httpClient.get(`_action/${this.getApiBasePath()}/get-state-machine-transition-actions`,{headers:e}).then(e=>a.handleResponse(e))}}n.addServiceProvider("PayonePaymentSettingsService",e=>{const t=n.getContainer("init");return new i(t.httpClient,e.loginService)})},Yjca:function(e,t){e.exports='{# TODO: Remove this file before 6.4, deprecated since 6.2 #}\n{% block sw_settings_content_card_slot_plugins %}\n {% parent %}\n\n \n \n \n{% endblock %}\n'},asGc:function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.capture.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},d11z:function(e,t,n){var a=n("NXBA");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("e7715378",a,!0,{})},eQpg:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Settings for PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture processed successfully.","errorTitle":"PAYONE","errorMessage":"Capture could not be processed.","tooltips":{"impossible":"Capture impossible"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund processed successfully.","errorTitle":"PAYONE","errorMessage":"Refund could not be processed.","tooltips":{"impossible":"Refund impossible"}},"modal":{"capture":{"title":"Capture","submit":"Capture","fullSubmit":"Full capture","amount":"Capture amount","captured":"Captured amount"},"refund":{"title":"Refund","submit":"Refund","fullSubmit":"Full Refund","amount":"Refund amount","refunded":"Refunded amount"},"orderAmount":"Order amount","remainingAmount":"Remaining amount","descriptionHelpText":"Description help text","close":"Close","labelComment":"Label comment","columns":{"reference":"Reference","product":"Product","quantity":"Quantity","price":"Price"}},"settingsForm":{"save":"Save","test":"Test API Credentials","titleSuccess":"Success","titleError":"Error","messageTestSuccess":"The API credentials were verified successfully.","messageTestNoTestedPayments":"No payment methods were tested during the check because none of the PAYONE payment methods are activated. Please activate at least one PAYONE payment method under Settings --\x3e Shop --\x3e Payment.","messageTestError":{"general":"The API credentials could not be verified successfully.","creditCard":"The API credentials for Credit Card are not valid.","debit":"The API credentials for Debit are not valid.","paypalExpress":"The API credentials for PayPal Express are not valid.","paypal":"The API credentials for PayPal are not valid.","payolutionInstallment":"The API credentials for Paysafe Pay Later Installment are not valid.","payolutionInvoicing":"The API credentials for Paysafe Pay Later Invoicing are not valid.","payolutionDebit":"The API credentials for Paysafe Pay Later Debit are not valid.","sofort":"The API credentials for SOFORT are not valid.","eps":"The API credentials for EPS are not valid.","iDeal":"The API credentials for iDEAL are not valid.","secureInvoice":"The API credentials for secure invoice payment are not valid."}},"supportModal":{"menuButton":"Support","title":"How Can We Help You?","documentation":{"description":"Read our online manual","button":"Online Manual"},"support":{"description":"Contact our technical support","button":"Tech Support"},"repository":{"description":"Report errors on GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Cancel","complete":"Complete","pay":"Pay","pay_partially":"Pay partially","process":"Process","refund":"Refund","refund_partially":"Refund partially","remind":"Remind","reopen":"Reopen","retour":"Retour","retour_partially":"Retour partially","ship":"Ship","ship_partially":"Ship partially"},"messageNotBlank":"This field must not be empty.","txid":"TXID","sequenceNumber":{"label":"Sequence Number","empty":"none"},"transactionState":"State","transactionCancelled":"Transaction cancelled in Shopware","error":{"transaction":{"notFound":"No matching transaction could be found","orderNotFound":"No matching order could be found"}}}}')},fBZk:function(e,t){e.exports='{% block payone_payment_payment_details %}\n
\n \n \n {{ $tc(\'payone-payment.refund.buttonTitle\') }}\n \n \n\n \n \n \n\n
\n \n \n \n \n \n \n
\n\n \n
\n
\n{% endblock %}\n'},fzay:function(e,t){const{Filter:n}=Shopware,{currency:a}=Shopware.Utils.format;n.register("payone_currency",(e,t,n,i)=>null===e?"-":(n||(n=0),a(e/=10**n,t,i)))},jAFz:function(e,t){e.exports='{% block sw_order_detail_delivery_metadata %}\n {% parent %}\n\n \n{% endblock %}\n'},m1C4:function(e){e.exports=JSON.parse('{"payone-payment":{"title":"PAYONE","general":{"mainMenuItemGeneral":"PAYONE","descriptionTextModule":"Einstellungen für PAYONE"},"capture":{"buttonTitle":"Capture","successTitle":"PAYONE","successMessage":"Capture erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Capture konnte nicht durchgeführt werden.","tooltips":{"impossible":"Einzug unmöglich"}},"refund":{"buttonTitle":"Refund","successTitle":"PAYONE","successMessage":"Refund erfolgreich durchgeführt.","errorTitle":"PAYONE","errorMessage":"Refund konnte nicht durchgeführt werden.","tooltips":{"impossible":"Erstattung unmöglich"}},"modal":{"capture":{"title":"Einzug","submit":"Einziehen","fullSubmit":"Alles Einziehen","amount":"Einzugswert","captured":"Eingezogener Wert"},"refund":{"title":"Erstattung","submit":"Erstatten","fullSubmit":"Alles Erstatten","amount":"Erstattungswert","refunded":"Erstatteter Wert"},"close":"Schließen","orderAmount":"Bestellungswert","remainingAmount":"Ausstehender Wert","labelComment":"Label comment","descriptionHelpText":"Description help text","columns":{"reference":"Referenz","product":"Produkt","quantity":"Anzahl","price":"Preis"}},"settingsForm":{"save":"Speichern","test":"API-Zugangsdaten testen","titleSuccess":"Erfolg","titleError":"Fehler","messageTestSuccess":"Die API-Zugangsdaten wurden erfolgreich validiert.","messageTestNoTestedPayments":"Bei der Prüfung wurden keine Zahlarten getestet, weil keine der PAYONE Zahlarten aktiviert ist. Bitte aktivieren Sie mindestens eine PAYONE Zahlart unter Einstellungen --\x3e Shop --\x3e Zahlungsarten.","messageTestError":{"general":"Die API-Zugangsdaten konnten nicht validiert werden.","creditCard":"Die API-Zugangsdaten für Kreditkarte sind nicht korrekt.","debit":"Die API-Zugangsdaten für Lastschrift sind nicht korrekt.","paypalExpress":"Die API-Zugangsdaten für PayPal Express sind nicht korrekt.","paypal":"Die API-Zugangsdaten für PayPal sind nicht korrekt.","payolutionInstallment":"Die API-Zugangsdaten für Paysafe Pay Later Ratenzahlung sind nicht korrekt.","payolutionInvoicing":"Die API-Zugangsdaten für Paysafe Pay Later Rechnungskauf sind nicht korrekt.","payolutionDebit":"Die API-Zugangsdaten für Paysafe Pay Later Lastschrift sind nicht korrekt.","sofort":"Die API-Zugangsdaten für SOFORT sind nicht korrekt.","eps":"Die API-Zugangsdaten für EPS sind nicht korrekt.","iDeal":"Die API-Zugangsdaten für iDEAL sind nicht korrekt.","secureInvoice":"Die API-Zugangsdaten für den gesicherten Rechnungskauf sind nicht korrekt."}},"supportModal":{"menuButton":"Support","title":"Wie können wir Ihnen helfen?","documentation":{"description":"Lesen Sie unsere Online-Dokumentation","button":"Dokumentation"},"support":{"description":"Kontaktieren Sie unseren technischen Support","button":"Technischer Support"},"repository":{"description":"Melden Sie Fehler und Verbesserungen auf GitHub","button":"GitHub"}},"transitionActionNames":{"cancel":"Stornieren","complete":"Abschließen","pay":"Bezahlen","pay_partially":"Teilweise bezahlen","process":"Durchführen","refund":"Rückerstatten","refund_partially":"Teilweise rückerstatten","remind":"Erinnern","reopen":"Wieder öffnen","retour":"Retoure","retour_partially":"Teilweise retounieren","ship":"Versenden","ship_partially":"Teilweise versenden"},"messageNotBlank":"Dieser Wert darf nicht leer sein.","txid":"TXID","sequenceNumber":{"label":"Sequenznummer","empty":"keine"},"transactionState":"Status","transactionCancelled":"Transaktion in Shopware abgebrochen","error":{"transaction":{"notFound":"Es wurde keine passende Transaktion gefundend","orderNotFound":"Es wurde keine passende Bestellung gefundend"}}}}')},mLM4:function(e,t){e.exports='{% block payone_payment %}\n\n {% block payone_payment_header %}\n \n {% endblock %}\n\n {% block payone_payment_actions %}\n \n {% endblock %}\n\n {% block payone_payment_settings_content %}\n \n {% endblock %}\n\n{% endblock %}\n'},qwju:function(e,t,n){var a=n("4yeS");"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n("SZ7m").default)("dda1b75e",a,!0,{})},s6j0:function(e,t,n){},zsm5:function(e,t,n){}},[["OPxs","runtime","vendors-node"]]]); \ No newline at end of file diff --git a/src/Resources/translations/de_DE/messages.de-DE.json b/src/Resources/translations/de_DE/messages.de-DE.json index f8e9baab7..b537e6ca6 100644 --- a/src/Resources/translations/de_DE/messages.de-DE.json +++ b/src/Resources/translations/de_DE/messages.de-DE.json @@ -1,131 +1,137 @@ { - "PayonePayment": { - "errorMessages": { - "genericError": "Es ist ein Fehler aufgetreten. Bitte wählen Sie eine andere Zahlungsweise." + "PayonePayment": { + "errorMessages": { + "genericError": "Es ist ein Fehler aufgetreten. Bitte wählen Sie eine andere Zahlungsweise." + }, + "creditCard": { + "newCard": "Eine neue Kreditkarte verwenden", + "cardNumber": "Kartennummer", + "securityCode": "CVV", + "expiryDate": "Gültig bis", + "savedCards": "Gespeicherte Karte", + "iframeError": "Bitte prüfen Sie, ob alle Felder korrekt und vollständig ausgefüllt sind." + }, + "debit": { + "accountOwner": "Kontoinhaber", + "iban": "IBAN", + "bic": "BIC" + }, + "cardPage": { + "menuName": "Kreditkarten", + "success": "Die gespeicherte Kreditkarte wurde erfolgreich entfernt.", + "error": "Beim entfernen der Kreditkarte ist ein Fehler aufgetreten.", + "pageTitle": "Gespeicherte Kreditkarten", + "pageSubTitle": "Hier können Sie die gespeicerten Kreditkarten verwalten.", + "tableHeader": "Kartennummer", + "deleteButton": "Karte löschen", + "noEntries": "Keine Kreditkarten vorhanden.", + "expired": "abgelaufen", + "expiresAt": "läuft am %expiresAt% ab" + }, + "mandatePage": { + "menuName": "SEPA-Lastschriftmandate", + "pageTitle": "SEPA-Lastschriftmandate", + "pageSubTitle": "Hier können Sie die gespeicherten SEPA-Lastschriftmandate verwalten.", + "success": "Das SEPA-Lastschriftmandate wurde erfolgreich entfernt.", + "error": "Es ist ein Fehler aufgetretetn.", + "tableIdentification": "Nummer", + "tableSignatureDate": "Datum", + "downloadButton": "Mandat herunterladen", + "noEntries": "Keine SEPA-Lastschriftmandate vorhanden." + }, + "checkoutConfirmPage": { + "defaultCardTitle": "Zahlungsinformationen" + }, + "checkoutFinishPage": { + "mandateIdentification": "SEPA-Laschtschriftmandat" + }, + "mandateModal": { + "question": "Ich erteile das SEPA-Laschtschriftmandat", + "cancel": "Abbruch", + "confirm": "Absenden" + }, + "paypalExpress": { + "buttonTitle": "PayPal Express", + "buttonImage": "checkout-logo-medium-de.png", + "buttonImage2x": "checkout-logo-medium-de-2x.png" + }, + "payolution": { + "cardTitleInvoicing": "Paysafe Pay Later Rechnung", + "cardTitleInstallment": "Paysafe Pay Later Ratenzahlung", + "cardTitleDebit": "Paysafe Pay Later Lastschrift", + "birthday": { + "label": "Geburtsdatum" + }, + "accountHolder": { + "label": "Kontoinhaber" + }, + "iban": { + "label": "IBAN" + }, + "bic": { + "label": "BIC" + }, + "installment": { + "step1": "1. Verfügbarkeit prüfen", + "step2": "2. Rate auswählen", + "step3": "3. Übersicht und Kontoinformationen", + "checkAvailabilityButton": "Verfügbarkeit prüfen", + "downloadButton": "Kreditinformationen herunterladen", + "select": "%amount% pro Monat - %duration% Raten", + "selectInstallmentsLabel": "Bitte wählen Sie die Anzahl der Raten", + "info": "%index%. Rate: %amount% (fällig am %date%)", + "numberOfInstallments": "Anzahl der Raten:", + "financingAmount": "Finanzierungsbetrag:", + "total": "Total:", + "interestRate": "Nominalzins:", + "effectiveInterestRate": "Effektivzins:", + "monthlyInstallment": "Monatliche Rate:", + "accountOwner": "Kontoinhaber", + "iban": "IBAN", + "bic": "BIC" + }, + "document": { + "clearingReference": "Referenz: %reference%", + "invoicingDescription": "Bitte überweisen Sie den ausstehenden Betrag auf das folgende Konto:", + "iban": "IBAN: %iban%", + "bic": "BIC: %bic%" + }, + "consentCheckbox": { + "introduction": "Mit der Übermittlung der für die Abwicklung des Rechnungskaufes und einer Identitätsprüfung und Bonitätsprüfung erforderlicher Daten an die payolution GmbH, Am Euro Platz 2, 1120 Wien bin ich einverstanden.", + "textWithLink": "Meine Einwilligung kann ich jederzeit mit Wirkung für die Zukunft wiederrufen." + }, + "mandateCheckbox": { + "textWithLink": "Hiermit erteile ich das SEPA-Lastschriftmandat." + } + }, + "prepayment": { + "document": { + "clearingReference": "Referenz: %reference%", + "invoicingDescription": "Bitte überweisen Sie den ausstehenden Betrag auf das folgende Konto:", + "iban": "IBAN: %iban%", + "bic": "BIC: %bic%", + "reference": "Verwendungszweck: %reference%", + "holder": "Kontoinhaber: %holder%", + "accountNotice": "Damit wir Ihre Zahlung schnell zuordnen können, überweisen Sie den ausstehenden Betrag bitte ausschließlich auf das obige Konto." + } + }, + "eps": { + "cardTitle": "EPS Online Bank", + "bankGroupFieldLabel": "Bankengruppe Ihrer Hausbank" + }, + "ideal": { + "cardTitle": "iDeal Online Bank", + "bankGroupFieldLabel": "Bankengruppe Ihrer Hausbank" + }, + "secureInvoice": { + "cardTitle": "Payone gesicherte Rechnung", + "birthday": { + "label": "Geburtsdatum" + } + } }, - "creditCard": { - "newCard": "Eine neue Kreditkarte verwenden", - "cardNumber": "Kartennummer", - "securityCode": "CVV", - "expiryDate": "Gültig bis", - "savedCards": "Gespeicherte Karte", - "iframeError": "Bitte prüfen Sie, ob alle Felder korrekt und vollständig ausgefüllt sind." - }, - "debit": { - "accountOwner": "Kontoinhaber", - "iban": "IBAN", - "bic": "BIC" - }, - "cardPage": { - "menuName": "Kreditkarten", - "success": "Die gespeicherte Kreditkarte wurde erfolgreich entfernt.", - "error": "Beim entfernen der Kreditkarte ist ein Fehler aufgetreten.", - "pageTitle": "Gespeicherte Kreditkarten", - "pageSubTitle": "Hier können Sie die gespeicerten Kreditkarten verwalten.", - "tableHeader": "Kartennummer", - "deleteButton": "Karte löschen", - "noEntries": "Keine Kreditkarten vorhanden.", - "expired": "abgelaufen", - "expiresAt": "läuft am %expiresAt% ab" - }, - "mandatePage": { - "menuName": "SEPA-Lastschriftmandate", - "pageTitle": "SEPA-Lastschriftmandate", - "pageSubTitle": "Hier können Sie die gespeicherten SEPA-Lastschriftmandate verwalten.", - "success": "Das SEPA-Lastschriftmandate wurde erfolgreich entfernt.", - "error": "Es ist ein Fehler aufgetretetn.", - "tableIdentification": "Nummer", - "tableSignatureDate": "Datum", - "downloadButton": "Mandat herunterladen", - "noEntries": "Keine SEPA-Lastschriftmandate vorhanden." - }, - "checkoutConfirmPage": { - "defaultCardTitle": "Zahlungsinformationen" - }, - "checkoutFinishPage": { - "mandateIdentification": "SEPA-Laschtschriftmandat" - }, - "mandateModal": { - "question": "Ich erteile das SEPA-Laschtschriftmandat", - "cancel": "Abbruch", - "confirm": "Absenden" - }, - "paypalExpress": { - "buttonTitle": "PayPal Express", - "buttonImage": "checkout-logo-medium-de.png", - "buttonImage2x": "checkout-logo-medium-de-2x.png" - }, - "payolution": { - "cardTitleInvoicing": "Paysafe Pay Later Rechnung", - "cardTitleInstallment": "Paysafe Pay Later Ratenzahlung", - "cardTitleDebit": "Paysafe Pay Later Lastschrift", - "birthday": { - "label": "Geburtsdatum" - }, - "accountHolder": { - "label": "Kontoinhaber" - }, - "iban": { - "label": "IBAN" - }, - "bic": { - "label": "BIC" - }, - "installment": { - "step1": "1. Verfügbarkeit prüfen", - "step2": "2. Rate auswählen", - "step3": "3. Übersicht und Kontoinformationen", - "checkAvailabilityButton": "Verfügbarkeit prüfen", - "downloadButton": "Kreditinformationen herunterladen", - "select": "%amount% pro Monat - %duration% Raten", - "selectInstallmentsLabel": "Bitte wählen Sie die Anzahl der Raten", - "info": "%index%. Rate: %amount% (fällig am %date%)", - "numberOfInstallments": "Anzahl der Raten:", - "financingAmount": "Finanzierungsbetrag:", - "total": "Total:", - "interestRate": "Nominalzins:", - "effectiveInterestRate": "Effektivzins:", - "monthlyInstallment": "Monatliche Rate:", - "accountOwner": "Kontoinhaber", - "iban": "IBAN", - "bic": "BIC" - }, - "document": { - "clearingReference": "Referenz: %reference%", - "invoicingDescription": "Bitte überweisen Sie den ausstehenden Betrag auf das folgende Konto:", - "iban": "IBAN: %iban%", - "bic": "BIC: %bic%" - }, - "consentCheckbox": { - "introduction": "Mit der Übermittlung der für die Abwicklung des Rechnungskaufes und einer Identitätsprüfung und Bonitätsprüfung erforderlicher Daten an die payolution GmbH, Am Euro Platz 2, 1120 Wien bin ich einverstanden.", - "textWithLink": "Meine Einwilligung kann ich jederzeit mit Wirkung für die Zukunft wiederrufen." - }, - "mandateCheckbox": { - "textWithLink": "Hiermit erteile ich das SEPA-Lastschriftmandat." - } - }, - "prepayment": { - "document": { - "clearingReference": "Referenz: %reference%", - "invoicingDescription": "Bitte überweisen Sie den ausstehenden Betrag auf das folgende Konto:", - "iban": "IBAN: %iban%", - "bic": "BIC: %bic%", - "reference": "Verwendungszweck: %reference%", - "holder": "Kontoinhaber: %holder%", - "accountNotice": "Damit wir Ihre Zahlung schnell zuordnen können, überweisen Sie den ausstehenden Betrag bitte ausschließlich auf das obige Konto." - } - }, - "eps": { - "cardTitle": "EPS Online Bank", - "bankGroupFieldLabel": "Bankengruppe Ihrer Hausbank" - }, - "ideal": { - "cardTitle": "iDeal Online Bank", - "bankGroupFieldLabel": "Bankengruppe Ihrer Hausbank" + "error": { + "VIOLATION::PAYONE_BIRTHDAY_NOT_VALID": "Für diese Zahlung müssen Sie mindestens 18 Jahre alt sein.", + "VIOLATION::PAYONE_INVALID_PAYMENT_METHOD": "Die ausgewählte Zahlungsweise ist nicht verfügbar." } - }, - "error": { - "VIOLATION::PAYONE_BIRTHDAY_NOT_VALID": "Für diese Zahlung müssen Sie mindestens 18 Jahre alt sein.", - "VIOLATION::PAYONE_INVALID_PAYMENT_METHOD": "Die ausgewählte Zahlungsweise ist nicht verfügbar." - } } diff --git a/src/Resources/translations/en_GB/messages.en-GB.json b/src/Resources/translations/en_GB/messages.en-GB.json index b0ba9cb06..82704bc0a 100644 --- a/src/Resources/translations/en_GB/messages.en-GB.json +++ b/src/Resources/translations/en_GB/messages.en-GB.json @@ -1,131 +1,137 @@ { - "PayonePayment": { - "errorMessages": { - "genericError": "An error has occurred. Please try another payment method." + "PayonePayment": { + "errorMessages": { + "genericError": "An error has occurred. Please try another payment method." + }, + "creditCard": { + "newCard": "Use a new credit card", + "cardNumber": "Card number", + "securityCode": "Security code", + "expiryDate": "Expiry date", + "savedCards": "Saved card", + "iframeError": "Please verify the fields and make sure no field is empty." + }, + "debit": { + "accountOwner": "Account owner", + "iban": "IBAN", + "bic": "BIC" + }, + "cardPage": { + "menuName": "Credit Cards", + "success": "The saved credit card was removed successfully.", + "error": "An error has occurred while removing the saved credit card.", + "pageTitle": "Saved Cards", + "pageSubTitle": "Here you can manage your saved credit cards.", + "tableHeader": "Card Numbers", + "deleteButton": "Delete Card", + "noEntries": "No cards saved.", + "expired": "expired", + "expiresAt": "expires on %expiresAt%" + }, + "mandatePage": { + "menuName": "Direct Debit Mandates", + "pageTitle": "Direct Debit Mandates", + "pageSubTitle": "Here you can manage your saved direct debit mandates.", + "success": "The saved Direct Debit Mandate was removed successfully.", + "error": "An error has occurred.", + "tableIdentification": "Nummer", + "tableSignatureDate": "Date", + "downloadButton": "Download Mandate", + "noEntries": "No mandates saved." + }, + "checkoutConfirmPage": { + "defaultCardTitle": "Payment Information" + }, + "checkoutFinishPage": { + "mandateIdentification": "Direct Debit Mandate" + }, + "mandateModal": { + "question": "I accept the direct debit mandate", + "cancel": "Cancel", + "confirm": "Submit" + }, + "paypalExpress": { + "buttonTitle": "PayPal Express", + "buttonImage": "checkout-logo-medium-en.png", + "buttonImage2x": "checkout-logo-medium-en-2x.png" + }, + "payolution": { + "cardTitleInvoicing": "Paysafe Pay Later Invoice", + "cardTitleInstallment": "Paysafe Pay Later Installment", + "cardTitleDebit": "Paysafe Pay Later Debit", + "birthday": { + "label": "Date of birth" + }, + "accountHolder": { + "label": "Account Holder" + }, + "iban": { + "label": "IBAN" + }, + "bic": { + "label": "BIC" + }, + "installment": { + "step1": "1. Check Installment availability", + "step2": "2. Installment selection", + "step3": "3. Overview and Account Information", + "checkAvailabilityButton": "Check Installment availability", + "downloadButton": "Download Installment Draft", + "select": "%amount% per month - %duration% installments", + "selectInstallmentsLabel": "Please select number of installments", + "info": "%index%. installment: %amount% (due %date%)", + "numberOfInstallments": "No. of installments:", + "financingAmount": "Financingamount:", + "total": "Total:", + "interestRate": "Nominal interest:", + "effectiveInterestRate": "Effective interest:", + "monthlyInstallment": "Monthly rate:", + "accountOwner": "Account owner", + "iban": "IBAN", + "bic": "BIC" + }, + "document": { + "clearingReference": "Reference: %reference%", + "invoicingDescription": "Please transfer the outstanding amount to the following bank account:", + "iban": "IBAN: %iban%", + "bic": "BIC: %bic%" + }, + "consentCheckbox": { + "introduction": "With the transmission of the data necessary for the completion of the invoice purchase, an identity check and credit check to payolution GmbH, Am Euro Platz 2, 1120 Wien I agree.", + "textWithLink": "I can revoke my consent at any time with effect for the future." + }, + "mandateCheckbox": { + "textWithLink": "I hereby issue the SEPA direct debit mandate." + } + }, + "prepayment": { + "document": { + "clearingReference": "Reference: %reference%", + "invoicingDescription": "Please transfer the outstanding amount to the following bank account:", + "iban": "IBAN: %iban%", + "bic": "BIC: %bic%", + "reference": "Reference: %reference%", + "holder": "Account Holder: %holder%", + "accountNotice": "In order for us to quickly allocate your payment, please transfer the outstanding amount exclusively to the account above." + } + }, + "eps": { + "cardTitle": "EPS Online Bank", + "bankGroupFieldLabel": "Banking group of you bank" + }, + "ideal": { + "cardTitle": "iDeal Online Bank", + "bankGroupFieldLabel": "Banking group of you bank" + }, + "secureInvoice": { + "cardTitle": "Payone secure invoice", + "birthday": { + "label": "Date of birth" + } + } }, - "creditCard": { - "newCard": "Use a new credit card", - "cardNumber": "Card number", - "securityCode": "Security code", - "expiryDate": "Expiry date", - "savedCards": "Saved card", - "iframeError": "Please verify the fields and make sure no field is empty." - }, - "debit": { - "accountOwner": "Account owner", - "iban": "IBAN", - "bic": "BIC" - }, - "cardPage": { - "menuName": "Credit Cards", - "success": "The saved credit card was removed successfully.", - "error": "An error has occurred while removing the saved credit card.", - "pageTitle": "Saved Cards", - "pageSubTitle": "Here you can manage your saved credit cards.", - "tableHeader": "Card Numbers", - "deleteButton": "Delete Card", - "noEntries": "No cards saved.", - "expired": "expired", - "expiresAt": "expires on %expiresAt%" - }, - "mandatePage": { - "menuName": "Direct Debit Mandates", - "pageTitle": "Direct Debit Mandates", - "pageSubTitle": "Here you can manage your saved direct debit mandates.", - "success": "The saved Direct Debit Mandate was removed successfully.", - "error": "An error has occurred.", - "tableIdentification": "Nummer", - "tableSignatureDate": "Date", - "downloadButton": "Download Mandate", - "noEntries": "No mandates saved." - }, - "checkoutConfirmPage": { - "defaultCardTitle": "Payment Information" - }, - "checkoutFinishPage": { - "mandateIdentification": "Direct Debit Mandate" - }, - "mandateModal": { - "question": "I accept the direct debit mandate", - "cancel": "Cancel", - "confirm": "Submit" - }, - "paypalExpress": { - "buttonTitle": "PayPal Express", - "buttonImage": "checkout-logo-medium-en.png", - "buttonImage2x": "checkout-logo-medium-en-2x.png" - }, - "payolution": { - "cardTitleInvoicing": "Paysafe Pay Later Invoice", - "cardTitleInstallment": "Paysafe Pay Later Installment", - "cardTitleDebit": "Paysafe Pay Later Debit", - "birthday": { - "label": "Date of birth" - }, - "accountHolder": { - "label": "Account Holder" - }, - "iban": { - "label": "IBAN" - }, - "bic": { - "label": "BIC" - }, - "installment": { - "step1": "1. Check Installment availability", - "step2": "2. Installment selection", - "step3": "3. Overview and Account Information", - "checkAvailabilityButton": "Check Installment availability", - "downloadButton": "Download Installment Draft", - "select": "%amount% per month - %duration% installments", - "selectInstallmentsLabel": "Please select number of installments", - "info": "%index%. installment: %amount% (due %date%)", - "numberOfInstallments": "No. of installments:", - "financingAmount": "Financingamount:", - "total": "Total:", - "interestRate": "Nominal interest:", - "effectiveInterestRate": "Effective interest:", - "monthlyInstallment": "Monthly rate:", - "accountOwner": "Account owner", - "iban": "IBAN", - "bic": "BIC" - }, - "document": { - "clearingReference": "Reference: %reference%", - "invoicingDescription": "Please transfer the outstanding amount to the following bank account:", - "iban": "IBAN: %iban%", - "bic": "BIC: %bic%" - }, - "consentCheckbox": { - "introduction": "With the transmission of the data necessary for the completion of the invoice purchase, an identity check and credit check to payolution GmbH, Am Euro Platz 2, 1120 Wien I agree.", - "textWithLink": "I can revoke my consent at any time with effect for the future." - }, - "mandateCheckbox": { - "textWithLink": "I hereby issue the SEPA direct debit mandate." - } - }, - "prepayment": { - "document": { - "clearingReference": "Reference: %reference%", - "invoicingDescription": "Please transfer the outstanding amount to the following bank account:", - "iban": "IBAN: %iban%", - "bic": "BIC: %bic%", - "reference": "Reference: %reference%", - "holder": "Account Holder: %holder%", - "accountNotice": "In order for us to quickly allocate your payment, please transfer the outstanding amount exclusively to the account above." - } - }, - "eps": { - "cardTitle": "EPS Online Bank", - "bankGroupFieldLabel": "Banking group of you bank" - }, - "ideal": { - "cardTitle": "iDeal Online Bank", - "bankGroupFieldLabel": "Banking group of you bank" + "error": { + "VIOLATION::PAYONE_BIRTHDAY_NOT_VALID": "For this payment you must be over 18 years old.", + "VIOLATION::PAYONE_INVALID_PAYMENT_METHOD": "The selected payment method is not available." } - }, - "error": { - "VIOLATION::PAYONE_BIRTHDAY_NOT_VALID": "For this payment you must be over 18 years old.", - "VIOLATION::PAYONE_INVALID_PAYMENT_METHOD": "The selected payment method is not available." - } } diff --git a/src/Resources/views/storefront/payone/secure-invoice/birthDay.html.twig b/src/Resources/views/storefront/payone/secure-invoice/birthDay.html.twig new file mode 100644 index 000000000..73ef396a9 --- /dev/null +++ b/src/Resources/views/storefront/payone/secure-invoice/birthDay.html.twig @@ -0,0 +1,18 @@ +
+
+ +
+ +
+ +
+
diff --git a/src/Resources/views/storefront/payone/secure-invoice/secure-invoice.html.twig b/src/Resources/views/storefront/payone/secure-invoice/secure-invoice.html.twig new file mode 100644 index 000000000..ca1f6c933 --- /dev/null +++ b/src/Resources/views/storefront/payone/secure-invoice/secure-invoice.html.twig @@ -0,0 +1,18 @@ +{% if context.customer.activeBillingAddress and context.customer.activeBillingAddress.company is empty %} +
+ + + {% block page_checkout_confirm_payone_card_title_secure_invoice %} +
+ {{ "PayonePayment.secureInvoice.cardTitle" | trans }} +
+ {% endblock %} + + {% block page_checkout_confirm_payone_card_content_secure_invoice %} + {% sw_include '@Storefront/storefront/payone/secure-invoice/birthDay.html.twig' with { + style: 'wide' + } %} + {% endblock %} +
+{% endif %} diff --git a/tests/Payone/Request/Capture/CaptureRequestFactoryTest.php b/tests/Payone/Request/Capture/CaptureRequestFactoryTest.php index 60d9c4829..5b49ec042 100644 --- a/tests/Payone/Request/Capture/CaptureRequestFactoryTest.php +++ b/tests/Payone/Request/Capture/CaptureRequestFactoryTest.php @@ -6,7 +6,7 @@ use DMS\PHPUnitExtensions\ArraySubset\Assert; use PayonePayment\Components\DependencyInjection\Factory\RequestBuilderFactory; -use PayonePayment\Components\RequestBuilder\AbstractRequestBuilder; +use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator; use PayonePayment\Components\RequestBuilder\CreditCardRequestBuilder; use PayonePayment\Components\RequestBuilder\PayolutionInstallmentRequestBuilder; use PayonePayment\Installer\CustomFieldInstaller; @@ -105,9 +105,7 @@ public function testCorrectPartialCaptureRequestParameters(): void public function testCorrectFullCaptureLineItemRequestParameters(): void { - $paramterBag = new ParameterBag(); - - $paramterBag->add([ + $paramterBag = new ParameterBag([ 'amount' => 100, 'orderLines' => [ [ @@ -124,11 +122,11 @@ public function testCorrectFullCaptureLineItemRequestParameters(): void $paymentTransaction = $this->getPaymentTransaction(2); $orderTransaction = $paymentTransaction->getOrderTransaction(); $orderTransaction->setPaymentMethodId(PayonePayolutionInstallment::UUID); - $paymentTransaction->assign(['orderTransation' => $orderTransaction]); + $paymentTransaction->assign(['orderTransaction' => $orderTransaction]); $factory = new CaptureRequestFactory($this->getSystemRequest(), $this->getCaptureRequest(), new RequestBuilderFactory([ - PayoneCreditCard::UUID => new CreditCardRequestBuilder(), - PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(), + PayoneCreditCard::UUID => new CreditCardRequestBuilder(new LineItemHydrator()), + PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(new LineItemHydrator()), ]), new NullLogger()); $request = $factory->getRequest($paymentTransaction, $paramterBag, Context::createDefaultContext()); @@ -149,13 +147,13 @@ public function testCorrectFullCaptureLineItemRequestParameters(): void 'sequencenumber' => 1, 'solution_name' => 'kellerkinder', 'txid' => 'test-transaction-id', - 'it[1]' => AbstractRequestBuilder::TYPE_GOODS, + 'it[1]' => LineItemHydrator::TYPE_GOODS, 'id[1]' => Constants::LINE_ITEM_IDENTIFIER, 'pr[1]' => (int) (Constants::LINE_ITEM_UNIT_PRICE * (10 ** Constants::CURRENCY_DECIMAL_PRECISION)), 'no[1]' => Constants::LINE_ITEM_QUANTITY, 'de[1]' => Constants::LINE_ITEM_LABEL, 'va[1]' => (int) (Constants::CURRENCY_TAX_RATE * (10 ** Constants::CURRENCY_DECIMAL_PRECISION)), - 'it[2]' => AbstractRequestBuilder::TYPE_GOODS, + 'it[2]' => LineItemHydrator::TYPE_GOODS, 'id[2]' => Constants::LINE_ITEM_IDENTIFIER, 'pr[2]' => (int) (Constants::LINE_ITEM_UNIT_PRICE * (10 ** Constants::CURRENCY_DECIMAL_PRECISION)), 'no[2]' => Constants::LINE_ITEM_QUANTITY, @@ -189,8 +187,8 @@ public function testCorrectPartialCaptureLineItemRequestParameters(): void $paymentTransaction->assign(['orderTransation' => $orderTransaction]); $factory = new CaptureRequestFactory($this->getSystemRequest(), $this->getCaptureRequest(), new RequestBuilderFactory([ - PayoneCreditCard::UUID => new CreditCardRequestBuilder(), - PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(), + PayoneCreditCard::UUID => new CreditCardRequestBuilder(new LineItemHydrator()), + PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(new LineItemHydrator()), ]), new NullLogger()); $request = $factory->getRequest($paymentTransaction, $paramterBag, Context::createDefaultContext()); @@ -211,7 +209,7 @@ public function testCorrectPartialCaptureLineItemRequestParameters(): void 'sequencenumber' => 1, 'solution_name' => 'kellerkinder', 'txid' => 'test-transaction-id', - 'it[1]' => AbstractRequestBuilder::TYPE_GOODS, + 'it[1]' => LineItemHydrator::TYPE_GOODS, 'id[1]' => Constants::LINE_ITEM_IDENTIFIER, 'pr[1]' => (int) (Constants::LINE_ITEM_UNIT_PRICE * (10 ** Constants::CURRENCY_DECIMAL_PRECISION)), 'no[1]' => Constants::LINE_ITEM_QUANTITY, diff --git a/tests/Payone/Request/Refund/RefundRequestFactoryTest.php b/tests/Payone/Request/Refund/RefundRequestFactoryTest.php index 7aac7dbe0..10f780d40 100644 --- a/tests/Payone/Request/Refund/RefundRequestFactoryTest.php +++ b/tests/Payone/Request/Refund/RefundRequestFactoryTest.php @@ -6,7 +6,7 @@ use DMS\PHPUnitExtensions\ArraySubset\Assert; use PayonePayment\Components\DependencyInjection\Factory\RequestBuilderFactory; -use PayonePayment\Components\RequestBuilder\AbstractRequestBuilder; +use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator; use PayonePayment\Components\RequestBuilder\CreditCardRequestBuilder; use PayonePayment\Components\RequestBuilder\PayolutionInstallmentRequestBuilder; use PayonePayment\Installer\CustomFieldInstaller; @@ -127,8 +127,8 @@ public function testCorrectFullRefundLineItemRequestParameters(): void $paymentTransaction->assign(['orderTransation' => $orderTransaction]); $factory = new RefundRequestFactory($this->getSystemRequest(), $this->getRefundRequest(), new RequestBuilderFactory([ - PayoneCreditCard::UUID => new CreditCardRequestBuilder(), - PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(), + PayoneCreditCard::UUID => new CreditCardRequestBuilder(new LineItemHydrator()), + PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(new LineItemHydrator()), ]), new NullLogger()); $request = $factory->getRequest($paymentTransaction, $paramterBag, Context::createDefaultContext()); @@ -149,7 +149,7 @@ public function testCorrectFullRefundLineItemRequestParameters(): void 'txid' => 'test-transaction-id', 'integrator_name' => 'shopware6', 'solution_name' => 'kellerkinder', - 'it[1]' => AbstractRequestBuilder::TYPE_GOODS, + 'it[1]' => LineItemHydrator::TYPE_GOODS, 'id[1]' => Constants::LINE_ITEM_IDENTIFIER, 'pr[1]' => (int) (Constants::LINE_ITEM_UNIT_PRICE * (10 ** Constants::CURRENCY_DECIMAL_PRECISION)), 'no[1]' => Constants::LINE_ITEM_QUANTITY, @@ -183,8 +183,8 @@ public function testCorrectPartialRefundLineItemRequestParameters(): void $paymentTransaction->assign(['orderTransation' => $orderTransaction]); $factory = new RefundRequestFactory($this->getSystemRequest(), $this->getRefundRequest(), new RequestBuilderFactory([ - PayoneCreditCard::UUID => new CreditCardRequestBuilder(), - PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(), + PayoneCreditCard::UUID => new CreditCardRequestBuilder(new LineItemHydrator()), + PayonePayolutionInstallment::UUID => new PayolutionInstallmentRequestBuilder(new LineItemHydrator()), ]), new NullLogger()); $request = $factory->getRequest($paymentTransaction, $paramterBag, Context::createDefaultContext()); @@ -205,7 +205,7 @@ public function testCorrectPartialRefundLineItemRequestParameters(): void 'txid' => 'test-transaction-id', 'integrator_name' => 'shopware6', 'solution_name' => 'kellerkinder', - 'it[1]' => AbstractRequestBuilder::TYPE_GOODS, + 'it[1]' => LineItemHydrator::TYPE_GOODS, 'id[1]' => Constants::LINE_ITEM_IDENTIFIER, 'pr[1]' => (int) (Constants::LINE_ITEM_UNIT_PRICE * (10 ** Constants::CURRENCY_DECIMAL_PRECISION)), 'no[1]' => Constants::LINE_ITEM_QUANTITY,