diff --git a/src/Components/MandateService/MandateService.php b/src/Components/MandateService/MandateService.php deleted file mode 100644 index 67f638d9a..000000000 --- a/src/Components/MandateService/MandateService.php +++ /dev/null @@ -1,125 +0,0 @@ -addFilter( - new EqualsFilter('customerId', $customer->getId()) - ); - - return $this->mandateRepository->search($criteria, $context->getContext()); - } - - public function saveMandate( - CustomerEntity $customer, - string $identification, - \DateTime $signatureDate, - SalesChannelContext $context - ): void { - $mandate = $this->getExistingMandate( - $customer, - $identification, - $context->getContext() - ); - - $data = [ - 'id' => $mandate === null ? Uuid::randomHex() : $mandate->getId(), - 'identification' => $identification, - 'signatureDate' => $signatureDate, - 'customerId' => $customer->getId(), - ]; - - $this->mandateRepository->upsert([$data], $context->getContext()); - } - - public function downloadMandate( - CustomerEntity $customer, - string $identification, - SalesChannelContext $context - ): string { - $mandate = $this->getExistingMandate( - $customer, - $identification, - $context->getContext() - ); - - if ($mandate === null) { - throw new FileNotFoundException('mandate not found'); - } - - $request = $this->requestFactory->getRequestParameter( - new GetFileStruct( - $context, - PayoneDebitPaymentHandler::class, - $mandate->getIdentification() - ) - ); - - try { - $response = $this->client->request($request, false); - } catch (\Throwable) { - throw new \RuntimeException('mandate not found'); - } - - return (string) $response['data']; - } - - public function removeAllMandatesForCustomer(CustomerEntity $customer, SalesChannelContext $context): void - { - $mandates = $this->getMandates($customer, $context); - - $ids = array_map(static fn ($item) => ['id' => $item], array_values($mandates->getIds())); - - $this->mandateRepository->delete($ids, $context->getContext()); - } - - protected function getExistingMandate( - CustomerEntity $customer, - string $identification, - Context $context - ): ?PayonePaymentMandateEntity { - $criteria = new Criteria(); - - $criteria->addFilter( - new EqualsFilter('identification', $identification) - ); - - $criteria->addFilter( - new EqualsFilter('customerId', $customer->getId()) - ); - - /** @var PayonePaymentMandateEntity|null $mandate */ - $mandate = $this->mandateRepository->search($criteria, $context)->first(); - - return $mandate; - } -} diff --git a/src/Components/MandateService/MandateServiceInterface.php b/src/Components/MandateService/MandateServiceInterface.php deleted file mode 100644 index 709b4ef89..000000000 --- a/src/Components/MandateService/MandateServiceInterface.php +++ /dev/null @@ -1,35 +0,0 @@ - - */ -class PayonePaymentMandateCollection extends EntityCollection -{ - protected function getExpectedClass(): string - { - return PayonePaymentMandateEntity::class; - } -} diff --git a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateDefinition.php b/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateDefinition.php deleted file mode 100644 index e58ef93da..000000000 --- a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateDefinition.php +++ /dev/null @@ -1,62 +0,0 @@ -setFlags(new Required()); - - if (class_exists(ApiAware::class)) { - $identificationField = (new StringField('identification', 'identification'))->setFlags(new Required(), new ApiAware()); - } - - return new FieldCollection([ - (new IdField('id', 'id'))->setFlags(new PrimaryKey(), new Required()), - - (new FkField('customer_id', 'customerId', CustomerDefinition::class))->addFlags(new Required()), - - $identificationField, - (new DateTimeField('signature_date', 'signatureDate'))->setFlags(new Required()), - - new ManyToOneAssociationField('customer', 'customer_id', CustomerDefinition::class, 'id', false), - - new CreatedAtField(), - new UpdatedAtField(), - ]); - } -} diff --git a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateEntity.php b/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateEntity.php deleted file mode 100644 index 5d048e814..000000000 --- a/src/DataAbstractionLayer/Entity/Mandate/PayonePaymentMandateEntity.php +++ /dev/null @@ -1,62 +0,0 @@ -identification; - } - - public function setIdentification(string $identification): void - { - $this->identification = $identification; - } - - public function getSignatureDate(): \DateTimeInterface - { - return $this->signatureDate; - } - - public function setSignatureDate(\DateTimeInterface $signatureDate): void - { - $this->signatureDate = $signatureDate; - } - - public function getCustomer(): ?CustomerEntity - { - return $this->customer; - } - - public function setCustomer(CustomerEntity $customer): void - { - $this->customer = $customer; - } - - public function setCustomerId(string $customerId): void - { - $this->customerId = $customerId; - } - - public function getCustomerId(): string - { - return $this->customerId; - } -} diff --git a/src/DependencyInjection/controllers.xml b/src/DependencyInjection/controllers.xml index a6341c296..8b7d5d0e2 100644 --- a/src/DependencyInjection/controllers.xml +++ b/src/DependencyInjection/controllers.xml @@ -61,18 +61,6 @@ - - - - - - - - - - - - diff --git a/src/DependencyInjection/entities.xml b/src/DependencyInjection/entities.xml index 585c44243..3caec124c 100644 --- a/src/DependencyInjection/entities.xml +++ b/src/DependencyInjection/entities.xml @@ -8,10 +8,6 @@ - - - - diff --git a/src/DependencyInjection/handler/payment_handler.xml b/src/DependencyInjection/handler/payment_handler.xml index 7b98d1d30..2f4e90c5e 100644 --- a/src/DependencyInjection/handler/payment_handler.xml +++ b/src/DependencyInjection/handler/payment_handler.xml @@ -87,7 +87,6 @@ - diff --git a/src/DependencyInjection/listeners.xml b/src/DependencyInjection/listeners.xml index 3490cc2fa..e4a92f4d0 100644 --- a/src/DependencyInjection/listeners.xml +++ b/src/DependencyInjection/listeners.xml @@ -19,12 +19,6 @@ - - - - - - @@ -41,13 +35,6 @@ - - - - - - - diff --git a/src/DependencyInjection/pages.xml b/src/DependencyInjection/pages.xml index 6af6cd580..a68dbe51a 100644 --- a/src/DependencyInjection/pages.xml +++ b/src/DependencyInjection/pages.xml @@ -9,11 +9,5 @@ - - - - - - diff --git a/src/DependencyInjection/requestParameter/builder.xml b/src/DependencyInjection/requestParameter/builder.xml index f9f1e05f8..7b9ef7da6 100644 --- a/src/DependencyInjection/requestParameter/builder.xml +++ b/src/DependencyInjection/requestParameter/builder.xml @@ -574,13 +574,6 @@ - - - - - - diff --git a/src/DependencyInjection/services.xml b/src/DependencyInjection/services.xml index c8b810ad0..b33344bdd 100644 --- a/src/DependencyInjection/services.xml +++ b/src/DependencyInjection/services.xml @@ -39,12 +39,6 @@ - - - - - - diff --git a/src/DependencyInjection/store_api.xml b/src/DependencyInjection/store_api.xml index 400df753f..75c790516 100644 --- a/src/DependencyInjection/store_api.xml +++ b/src/DependencyInjection/store_api.xml @@ -10,10 +10,6 @@ - - - - diff --git a/src/EventListener/CheckoutConfirmDebitEventListener.php b/src/EventListener/CheckoutConfirmDebitEventListener.php deleted file mode 100644 index 7635c03d6..000000000 --- a/src/EventListener/CheckoutConfirmDebitEventListener.php +++ /dev/null @@ -1,56 +0,0 @@ - 'addPayonePageData', - AccountEditOrderPageLoadedEvent::class => 'addPayonePageData', - ]; - } - - public function addPayonePageData(CheckoutConfirmPageLoadedEvent|AccountEditOrderPageLoadedEvent $event): void - { - $page = $event->getPage(); - $context = $event->getSalesChannelContext(); - - if ($context->getPaymentMethod()->getId() !== PayoneDebit::UUID) { - return; - } - - $savedMandates = null; - - if ($context->getCustomer() !== null) { - $savedMandates = $this->mandateRoute->load($context)->getSearchResult(); - } - - $payoneData = $page->hasExtension(CheckoutCartPaymentData::EXTENSION_NAME) - ? $page->getExtension(CheckoutCartPaymentData::EXTENSION_NAME) - : new CheckoutConfirmPaymentData(); - - if ($payoneData !== null) { - $payoneData->assign([ - 'savedMandates' => $savedMandates, - ]); - - $page->addExtension(CheckoutConfirmPaymentData::EXTENSION_NAME, $payoneData); - } - } -} diff --git a/src/EventListener/CheckoutFinishEventListener.php b/src/EventListener/CheckoutFinishEventListener.php deleted file mode 100644 index 03790002f..000000000 --- a/src/EventListener/CheckoutFinishEventListener.php +++ /dev/null @@ -1,108 +0,0 @@ - 'onCheckoutFinish', - ]; - } - - public function onCheckoutFinish(CheckoutFinishPageLoadedEvent $event): void - { - $salesChannelContext = $event->getSalesChannelContext(); - $context = $salesChannelContext->getContext(); - - if (!$this->isPayonePayment($salesChannelContext->getPaymentMethod())) { - return; - } - - $mandateIdentification = $this->getMandateIdentification( - $event->getPage()->getOrder(), - $context - ); - - if ($mandateIdentification === null) { - return; - } - - if (!$this->hasDirectDebitPayment($mandateIdentification)) { - return; - } - - $payoneData = new CheckoutFinishPaymentData(); - - $payoneData->assign([ - 'mandate' => $this->getMandate($mandateIdentification, $context), - ]); - - $event->getPage()->addExtension(CheckoutFinishPaymentData::EXTENSION_NAME, $payoneData); - } - - protected function hasDirectDebitPayment(?string $mandateIdentification): bool - { - return $mandateIdentification !== null; - } - - private function isPayonePayment(PaymentMethodEntity $paymentMethod): bool - { - return \in_array($paymentMethod->getId(), PaymentMethodInstaller::PAYMENT_METHOD_IDS, true); - } - - private function getMandate(string $mandateIdentification, Context $context): ?PayonePaymentMandateEntity - { - $criteria = new Criteria(); - $criteria->addFilter(new EqualsFilter('identification', $mandateIdentification)); - - /** @var PayonePaymentMandateEntity|null $mandate */ - $mandate = $this->mandateRepository->search($criteria, $context)->first(); - - return $mandate; - } - - private function getMandateIdentification(OrderEntity $order, Context $context): ?string - { - $criteria = new Criteria(); - $criteria->addFilter(new EqualsFilter('orderId', $order->getId())); - - $transactions = $this->orderTransactionRepository->search($criteria, $context); - - /** @var OrderTransactionEntity $transaction */ - foreach ($transactions as $transaction) { - /** @var PayonePaymentOrderTransactionDataEntity|null $payoneTransactionData */ - $payoneTransactionData = $transaction->getExtension(PayonePaymentOrderTransactionExtension::NAME); - - if ($payoneTransactionData !== null && !empty($payoneTransactionData->getMandateIdentification())) { - return $payoneTransactionData->getMandateIdentification(); - } - } - - return null; - } -} diff --git a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php index b5dfa4c91..0b88882f2 100644 --- a/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php +++ b/src/Migration/Migration1562097986AddPayonePaymentMandateTable.php @@ -16,30 +16,7 @@ public function getCreationTimestamp(): int public function update(Connection $connection): void { - $sql = ' - CREATE TABLE `payone_payment_mandate` ( - `id` BINARY(16) NOT NULL, - - `customer_id` BINARY(16) NOT NULL, - - `identification` VARCHAR(255) NOT NULL, - `signature_date` datetime(3) NOT NULL, - - `created_at` DATETIME(3) NOT NULL, - `updated_at` DATETIME(3) NULL, - - PRIMARY KEY (`id`), - - KEY `fk.payone_payment_mandate.customer_id` (`customer_id`), - - CONSTRAINT `fk.payone_payment_mandate.customer_id` - FOREIGN KEY (`customer_id`) - REFERENCES `customer` (`id`) - ON DELETE RESTRICT ON UPDATE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci - '; - - $connection->executeStatement($sql); + // PAYOSWXP-114: has been removed. } public function updateDestructive(Connection $connection): void diff --git a/src/Migration/Migration1718635783DeleteSavedDebitMandates.php b/src/Migration/Migration1718635783DeleteSavedDebitMandates.php new file mode 100644 index 000000000..e3491a185 --- /dev/null +++ b/src/Migration/Migration1718635783DeleteSavedDebitMandates.php @@ -0,0 +1,25 @@ +executeStatement('DROP TABLE IF EXISTS payone_payment_mandate'); + } +} diff --git a/src/PaymentHandler/PayoneDebitPaymentHandler.php b/src/PaymentHandler/PayoneDebitPaymentHandler.php index 442e926ae..b24b2006e 100644 --- a/src/PaymentHandler/PayoneDebitPaymentHandler.php +++ b/src/PaymentHandler/PayoneDebitPaymentHandler.php @@ -4,59 +4,19 @@ namespace PayonePayment\PaymentHandler; -use PayonePayment\Components\ConfigReader\ConfigReaderInterface; -use PayonePayment\Components\CustomerDataPersistor\CustomerDataPersistor; -use PayonePayment\Components\DataHandler\OrderActionLog\OrderActionLogDataHandlerInterface; -use PayonePayment\Components\DataHandler\Transaction\TransactionDataHandlerInterface; -use PayonePayment\Components\MandateService\MandateServiceInterface; use PayonePayment\Components\TransactionStatus\TransactionStatusService; -use PayonePayment\Payone\Client\PayoneClientInterface; use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder; -use PayonePayment\Payone\RequestParameter\RequestParameterFactory; -use PayonePayment\Struct\PaymentTransaction; -use Shopware\Core\Checkout\Payment\Cart\SyncPaymentTransactionStruct; -use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\Validation\DataBag\RequestDataBag; -use Shopware\Core\System\SalesChannel\SalesChannelContext; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Contracts\Translation\TranslatorInterface; class PayoneDebitPaymentHandler extends AbstractSynchronousPayonePaymentHandler { - final public const REQUEST_PARAM_SAVE_MANDATE = 'saveMandate'; - - public function __construct( - ConfigReaderInterface $configReader, - EntityRepository $lineItemRepository, - RequestStack $requestStack, - PayoneClientInterface $client, - TranslatorInterface $translator, - TransactionDataHandlerInterface $transactionDataHandler, - OrderActionLogDataHandlerInterface $orderActionLogDataHandler, - RequestParameterFactory $requestParameterFactory, - CustomerDataPersistor $customerDataPersistor, - protected MandateServiceInterface $mandateService - ) { - parent::__construct( - $configReader, - $lineItemRepository, - $requestStack, - $client, - $translator, - $transactionDataHandler, - $orderActionLogDataHandler, - $requestParameterFactory, - $customerDataPersistor - ); - } - public static function isCapturable(array $transactionData, array $payoneTransActionData): bool { if (static::isNeverCapturable($payoneTransActionData)) { return false; } - $txAction = isset($transactionData['txaction']) ? strtolower((string) $transactionData['txaction']) : null; + $txAction = isset($transactionData['txaction']) ? strtolower((string)$transactionData['txaction']) : null; if ($txAction === TransactionStatusService::ACTION_APPOINTED) { return true; @@ -79,39 +39,6 @@ protected function getDefaultAuthorizationMethod(): string return AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE; } - protected function handleResponse( - SyncPaymentTransactionStruct $transaction, - PaymentTransaction $paymentTransaction, - RequestDataBag $dataBag, - array $request, - array $response, - SalesChannelContext $salesChannelContext - ): void { - parent::handleResponse($transaction, $paymentTransaction, $dataBag, $request, $response, $salesChannelContext); - - $date = \DateTime::createFromFormat('Ymd', $response['mandate']['DateOfSignature']); - - if (empty($date)) { - throw new \LogicException('could not parse sepa mandate signature date'); - } - - $saveMandate = $dataBag->get(self::REQUEST_PARAM_SAVE_MANDATE) === 'on'; - - if ($saveMandate && $salesChannelContext->getCustomer() !== null) { - $this->mandateService->saveMandate( - $salesChannelContext->getCustomer(), - $response['mandate']['Identification'], - $date, - $salesChannelContext - ); - } elseif (!$saveMandate && $salesChannelContext->getCustomer() !== null) { - $this->mandateService->removeAllMandatesForCustomer( - $salesChannelContext->getCustomer(), - $salesChannelContext - ); - } - } - protected function getAdditionalTransactionData(RequestDataBag $dataBag, array $request, array $response): array { return [ diff --git a/src/Payone/RequestParameter/Builder/Mandate/GetFileRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/Mandate/GetFileRequestParameterBuilder.php deleted file mode 100644 index 8d7325b75..000000000 --- a/src/Payone/RequestParameter/Builder/Mandate/GetFileRequestParameterBuilder.php +++ /dev/null @@ -1,30 +0,0 @@ - self::REQUEST_ACTION_GET_FILE, - 'file_reference' => $arguments->getIdentification(), - 'file_type' => 'SEPA_MANDATE', - 'file_format' => 'PDF', - ]; - } - - public function supports(AbstractRequestParameterStruct $arguments): bool - { - return $arguments instanceof GetFileStruct; - } -} diff --git a/src/PayonePayment.php b/src/PayonePayment.php index 25175b4cb..5d7869722 100644 --- a/src/PayonePayment.php +++ b/src/PayonePayment.php @@ -112,7 +112,7 @@ public function uninstall(UninstallContext $uninstallContext): void $connection->executeStatement('DROP TABLE IF EXISTS payone_payment_card'); $connection->executeStatement('DROP TABLE IF EXISTS payone_payment_redirect'); - $connection->executeStatement('DROP TABLE IF EXISTS payone_payment_mandate'); + $connection->executeStatement('DROP TABLE IF EXISTS payone_payment_mandate'); // legacy table. does not exist anymore. $connection->executeStatement('DROP TABLE IF EXISTS payone_payment_notification_forward'); $connection->executeStatement('DROP TABLE IF EXISTS payone_payment_notification_target'); $connection->executeStatement('DROP TABLE IF EXISTS payone_payment_order_transaction_data'); diff --git a/src/Resources/snippet/de_DE/messages.de-DE.json b/src/Resources/snippet/de_DE/messages.de-DE.json index 1660b3d8a..26d6b0743 100644 --- a/src/Resources/snippet/de_DE/messages.de-DE.json +++ b/src/Resources/snippet/de_DE/messages.de-DE.json @@ -37,21 +37,9 @@ "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 aufgetreten.", - "tableIdentification": "Nummer", - "tableSignatureDate": "Datum", - "downloadButton": "Mandat herunterladen", - "noEntries": "Keine SEPA-Lastschriftmandate vorhanden." - }, "checkoutConfirmPage": { "defaultCardTitle": "Zahlungsinformationen", "save": "Daten für zukünftige Nutzung speichern", - "saveMandate": "Lastschrift-Mandat für zukünftige Nutzung speichern", "back-to-standard-checkout": "Zahlungsart ändern", "express-checkout-canceled": "Der Express-Checkout wurde abgebrochen." }, diff --git a/src/Resources/snippet/en_GB/messages.en-GB.json b/src/Resources/snippet/en_GB/messages.en-GB.json index bc0575d8b..a8a785d46 100644 --- a/src/Resources/snippet/en_GB/messages.en-GB.json +++ b/src/Resources/snippet/en_GB/messages.en-GB.json @@ -37,21 +37,9 @@ "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", "save": "Save data for future use", - "saveMandate": "Save direct debit mandate for future use", "back-to-standard-checkout": "Change payment method", "express-checkout-canceled": "The express checkout has been cancelled." }, diff --git a/src/Resources/views/storefront/page/account/sidebar.html.twig b/src/Resources/views/storefront/page/account/sidebar.html.twig index 799cfad63..9f69cbb2c 100644 --- a/src/Resources/views/storefront/page/account/sidebar.html.twig +++ b/src/Resources/views/storefront/page/account/sidebar.html.twig @@ -20,22 +20,4 @@ {% endif %} {% endblock %} - - {% block page_account_sidebar_link_payone_mandate %} - {% if constant('PayonePayment\\PaymentMethod\\PayoneDebit::UUID') in activePaymentPaymentMethods %} - {% set css_class %} - list-group-item - list-group-item-action - account-aside-item - - {% if controllerName is same as('PayoneAccountMandate') and controllerAction is same as('mandateOverview') %} - is-active - {% endif %} - {% endset %} - - - {{ "PayonePayment.mandatePage.menuName" | trans }} - - {% endif %} - {% endblock %} {% endblock %} diff --git a/src/Resources/views/storefront/page/checkout/finish/finish-details.html.twig b/src/Resources/views/storefront/page/checkout/finish/finish-details.html.twig index c447dcc45..de89d0c5c 100644 --- a/src/Resources/views/storefront/page/checkout/finish/finish-details.html.twig +++ b/src/Resources/views/storefront/page/checkout/finish/finish-details.html.twig @@ -1,14 +1,16 @@ {% sw_extends '@Storefront/storefront/page/checkout/finish/finish-details.html.twig' %} -{% block page_checkout_finish_order_dispatch_method %} +{% block page_checkout_finish_order_payment_method %} {{ parent() }} - {% block payone_payment_mandate_information %} - {% if page.extensions.payone.mandate %} + {% if page.order and page.order.transactions and page.order.transactions.last %} + {% set payoneData = page.order.transactions.last.getExtension('payonePaymentOrderTransactionData') %} + {% if payoneData and payoneData.mandateIdentification %}

- {{ "PayonePayment.checkoutFinishPage.mandateIdentification" | trans }}: - {{ page.extensions.payone.mandate.identification }} + {{ "PayonePayment.checkoutFinishPage.mandateIdentification"|trans|sw_sanitize }}: + {{ payoneData.mandateIdentification }}

{% endif %} - {% endblock %} + {% endif %} + {% endblock %} diff --git a/src/Resources/views/storefront/payone/account/mandate.html.twig b/src/Resources/views/storefront/payone/account/mandate.html.twig deleted file mode 100644 index c77ec8c72..000000000 --- a/src/Resources/views/storefront/payone/account/mandate.html.twig +++ /dev/null @@ -1,55 +0,0 @@ -{% sw_extends '@Storefront/storefront/page/account/_page.html.twig' %} - -{# @var page \PayonePayment\Storefront\Page\Mandate\AccountMandatePage #} -{# @var card \PayonePayment\DataAbstractionLayer\Entity\Card\PayonePaymentCardEntity #} - -{% block page_account_main_content %} - -{% endblock %} diff --git a/src/Resources/views/storefront/payone/debit/debit-form.html.twig b/src/Resources/views/storefront/payone/debit/debit-form.html.twig index 9067c0dc4..fa7efc2c1 100644 --- a/src/Resources/views/storefront/payone/debit/debit-form.html.twig +++ b/src/Resources/views/storefront/payone/debit/debit-form.html.twig @@ -27,22 +27,6 @@ - - {% if context.customer and not context.customer.guest %} -
-
- 0 %} - checked="checked" - {% endif %} - /> - -
-
- {% endif %} diff --git a/src/StoreApi/Route/AbstractMandateRoute.php b/src/StoreApi/Route/AbstractMandateRoute.php deleted file mode 100644 index 9c22f64b0..000000000 --- a/src/StoreApi/Route/AbstractMandateRoute.php +++ /dev/null @@ -1,18 +0,0 @@ - ['store-api']])] -class MandateRoute extends AbstractMandateRoute -{ - public function __construct(private readonly MandateServiceInterface $mandateService) - { - } - - public function getDecorated(): AbstractMandateRoute - { - throw new DecorationPatternException(self::class); - } - - #[Route(path: '/store-api/payone/account/mandate', name: 'store-api.payone.account.mandate', defaults: ['_contextTokenRequired' => true, '_entity' => 'payone_payment_mandate'], methods: ['GET'])] - public function load(SalesChannelContext $context): MandateResponse - { - $customer = $context->getCustomer(); - - if ($customer === null) { - throw CartException::customerNotLoggedIn(); - } - - $result = $this->mandateService->getMandates($customer, $context); - - return new MandateResponse($result); - } - - #[Route(path: '/store-api/payone/account/mandate/{mandateId}', name: 'store-api.payone.account.mandate.file', defaults: ['_contextTokenRequired' => true, '_entity' => 'payone_payment_mandate'], methods: ['GET'])] - public function getFile(string $mandateId, SalesChannelContext $context): Response - { - if ($context->getCustomer() === null) { - throw CartException::customerNotLoggedIn(); - } - - try { - $content = $this->mandateService->downloadMandate($context->getCustomer(), $mandateId, $context); - } catch (FileNotFoundException) { - return new Response(null, 404); - } - - $response = new Response($content); - - $disposition = HeaderUtils::makeDisposition( - HeaderUtils::DISPOSITION_ATTACHMENT, - 'mandate.pdf' - ); - - $response->headers->set('Content-Disposition', $disposition); - - return $response; - } -} diff --git a/src/Storefront/Controller/Account/AccountMandateController.php b/src/Storefront/Controller/Account/AccountMandateController.php deleted file mode 100644 index 72763fb11..000000000 --- a/src/Storefront/Controller/Account/AccountMandateController.php +++ /dev/null @@ -1,45 +0,0 @@ - ['storefront']])] -class AccountMandateController extends StorefrontController -{ - public function __construct( - private readonly AccountMandatePageLoader $accountMandatePageLoader, - private readonly AbstractMandateRoute $mandateRoute - ) { - } - - #[Route(path: '/account/mandate/overview', name: 'frontend.account.payone.mandate.page', options: ['seo' => false], methods: ['GET'])] - public function mandateOverview(Request $request, SalesChannelContext $context): Response - { - $page = $this->accountMandatePageLoader->load($request, $context); - - return $this->renderStorefront('@Storefront/storefront/payone/account/mandate.html.twig', ['page' => $page]); - } - - #[Route(path: '/account/mandate/download', name: 'frontend.account.payone.mandate.download', options: ['seo' => false], methods: ['GET'])] - public function downloadMandate(Request $request, SalesChannelContext $context): Response - { - try { - $response = $this->mandateRoute->getFile($request->get('mandate'), $context); - } catch (\Throwable) { - $this->addFlash('danger', $this->trans('PayonePayment.mandatePage.error')); - - return $this->forwardToRoute('frontend.account.payone.mandate.page'); - } - - return $response; - } -} diff --git a/src/Storefront/Page/Mandate/AccountMandatePage.php b/src/Storefront/Page/Mandate/AccountMandatePage.php deleted file mode 100644 index 899f78705..000000000 --- a/src/Storefront/Page/Mandate/AccountMandatePage.php +++ /dev/null @@ -1,23 +0,0 @@ -mandates; - } - - public function setMandates(EntitySearchResult $mandates): void - { - $this->mandates = $mandates; - } -} diff --git a/src/Storefront/Page/Mandate/AccountMandatePageLoadedEvent.php b/src/Storefront/Page/Mandate/AccountMandatePageLoadedEvent.php deleted file mode 100644 index be89477a4..000000000 --- a/src/Storefront/Page/Mandate/AccountMandatePageLoadedEvent.php +++ /dev/null @@ -1,47 +0,0 @@ -context->getContext(); - } - - public function getSalesChannelContext(): SalesChannelContext - { - return $this->context; - } - - public function getPage(): AccountMandatePage - { - return $this->page; - } - - public function getRequest(): Request - { - return $this->request; - } -} diff --git a/src/Storefront/Page/Mandate/AccountMandatePageLoader.php b/src/Storefront/Page/Mandate/AccountMandatePageLoader.php deleted file mode 100644 index 49c201272..000000000 --- a/src/Storefront/Page/Mandate/AccountMandatePageLoader.php +++ /dev/null @@ -1,45 +0,0 @@ -getCustomer()) { - throw CartException::customerNotLoggedIn(); - } - - $page = AccountMandatePage::createFrom( - $this->genericLoader->load($request, $context) - ); - - $page->setMandates( - $this->mandateRoute->load( - $context - )->getSearchResult() - ); - - $this->eventDispatcher->dispatch( - new AccountMandatePageLoadedEvent($page, $context, $request) - ); - - return $page; - } -} diff --git a/src/Storefront/Struct/CheckoutConfirmPaymentData.php b/src/Storefront/Struct/CheckoutConfirmPaymentData.php index b06fb94b5..d26f22732 100644 --- a/src/Storefront/Struct/CheckoutConfirmPaymentData.php +++ b/src/Storefront/Struct/CheckoutConfirmPaymentData.php @@ -23,8 +23,6 @@ class CheckoutConfirmPaymentData extends Struct protected ?string $cartHash = ''; - protected ?EntitySearchResult $savedMandates = null; - protected bool $showExitExpressCheckoutLink = false; protected bool $preventAddressEdit = false; @@ -59,11 +57,6 @@ public function getCartHash(): ?string return $this->cartHash; } - public function getSavedMandates(): ?EntitySearchResult - { - return $this->savedMandates; - } - public function isshowExitExpressCheckoutLink(): bool { return $this->showExitExpressCheckoutLink; diff --git a/src/Storefront/Struct/CheckoutFinishPaymentData.php b/src/Storefront/Struct/CheckoutFinishPaymentData.php deleted file mode 100644 index f0aa1f09e..000000000 --- a/src/Storefront/Struct/CheckoutFinishPaymentData.php +++ /dev/null @@ -1,20 +0,0 @@ -mandate; - } -}