From bfe6ab39b2619053e4f680dade2e87eb6b7a468d Mon Sep 17 00:00:00 2001 From: Christian Dangl Date: Mon, 25 Sep 2023 08:54:13 +0200 Subject: [PATCH] MOL-1250: Add TWINT payment method --- src/Handler/Method/TwintPayment.php | 32 +++++++++++++++++++ src/Resources/config/services/handlers.xml | 7 ++++ src/Service/PaymentMethodService.php | 21 +++++++----- .../checkout/checkout-success.cy.js | 1 + 4 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 src/Handler/Method/TwintPayment.php diff --git a/src/Handler/Method/TwintPayment.php b/src/Handler/Method/TwintPayment.php new file mode 100644 index 000000000..51939c51b --- /dev/null +++ b/src/Handler/Method/TwintPayment.php @@ -0,0 +1,32 @@ + $orderData + * @param OrderEntity $orderEntity + * @param SalesChannelContext $salesChannelContext + * @param CustomerEntity $customer + * @return array + */ + public function processPaymentMethodSpecificParameters(array $orderData, OrderEntity $orderEntity, SalesChannelContext $salesChannelContext, CustomerEntity $customer): array + { + return $orderData; + } +} diff --git a/src/Resources/config/services/handlers.xml b/src/Resources/config/services/handlers.xml index fc21046ae..0cb06f79d 100644 --- a/src/Resources/config/services/handlers.xml +++ b/src/Resources/config/services/handlers.xml @@ -148,6 +148,13 @@ + + + + + + + diff --git a/src/Service/PaymentMethodService.php b/src/Service/PaymentMethodService.php index a511c923a..cd68ecc1a 100644 --- a/src/Service/PaymentMethodService.php +++ b/src/Service/PaymentMethodService.php @@ -23,6 +23,7 @@ use Kiener\MolliePayments\Handler\Method\PosPayment; use Kiener\MolliePayments\Handler\Method\Przelewy24Payment; use Kiener\MolliePayments\Handler\Method\SofortPayment; +use Kiener\MolliePayments\Handler\Method\TwintPayment; use Kiener\MolliePayments\Handler\Method\VoucherPayment; use Kiener\MolliePayments\MolliePayments; use Kiener\MolliePayments\Repository\Media\MediaRepository; @@ -44,7 +45,9 @@ class PaymentMethodService { - /** @var MediaService */ + /** + * @var MediaService + */ private $mediaService; /** @@ -52,7 +55,9 @@ class PaymentMethodService */ private $paymentRepository; - /** @var PluginIdProvider */ + /** + * @var PluginIdProvider + */ private $pluginIdProvider; /** @@ -60,7 +65,9 @@ class PaymentMethodService */ private $mediaRepository; - /** @var HttpClientInterface */ + /** + * @var HttpClientInterface + */ private $httpClient; @@ -267,11 +274,8 @@ public function disablePaymentMethod(string $handlerName, Context $context): voi * * @return EntityWrittenContainerEvent */ - public function setPaymentMethodActivated( - string $paymentMethodId, - bool $active, - Context $context - ): EntityWrittenContainerEvent { + public function setPaymentMethodActivated(string $paymentMethodId, bool $active, Context $context): EntityWrittenContainerEvent + { return $this->paymentRepository->upsert( [ [ @@ -385,6 +389,7 @@ public function getPaymentHandlers(): array VoucherPayment::class, In3Payment::class, PosPayment::class, + TwintPayment::class, // IngHomePayPayment::class, // not allowed anymore // DirectDebitPayment::class, // only allowed when updating subsriptions, aka => not allowed anymore ]; diff --git a/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js b/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js index f4a3ca270..118e0042d 100644 --- a/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js +++ b/tests/Cypress/cypress/e2e/storefront/checkout/checkout-success.cy.js @@ -40,6 +40,7 @@ const device = devices.getFirstDevice(); const payments = [ + {caseId: 'C1617016', key: 'twint', name: 'TWINT'}, {caseId: 'C4101', key: 'credit-card', name: 'Card'}, {caseId: 'C4111', key: 'paypal', name: 'PayPal'}, {caseId: 'C466903', key: 'billie', name: 'Billie'},