From cf102dd20c5a13162e372d3662d004022988fbf5 Mon Sep 17 00:00:00 2001 From: Pascal Kleindienst Date: Mon, 26 Jan 2026 14:25:59 +0100 Subject: [PATCH] push new 2.0.1 --- Bootstrap.php | 6 +-- CHANGELOG.md | 9 +++++ README.md | 1 + checksums.csv | 18 ++++----- info.xml | 52 ++++++++++++------------- paymentmethod/UnzerWero.php | 18 ++++----- src/Charges/ChargeHandler.php | 22 ++++++++++- src/Orders/OrderMappingModel.php | 9 ++++- src/Payments/HeidelpayPaymentMethod.php | 5 +++ src/Webhooks/PaymentEventSubscriber.php | 2 +- 10 files changed, 91 insertions(+), 51 deletions(-) diff --git a/Bootstrap.php b/Bootstrap.php index 0ea314b..73b9675 100644 --- a/Bootstrap.php +++ b/Bootstrap.php @@ -238,7 +238,7 @@ public function installed() foreach ($this->getPlugin()->getPaymentMethods()->getMethods() as $method) { if ( ($method->getActive() || $method->getUsable()) && - in_array($method->getClassName(), $this->getDeprecatedPaymentMethods()) + in_array($method->getClassName(), self::getDeprecatedPaymentMethods()) ) { $this->getDB()->update( 'tzahlungsart', @@ -269,7 +269,7 @@ public function updated($oldVersion, $newVersion) foreach ($this->getPlugin()->getPaymentMethods()->getMethods() as $method) { if ( ($method->getActive() || $method->getUsable()) && - in_array($method->getClassName(), $this->getDeprecatedPaymentMethods()) + in_array($method->getClassName(), self::getDeprecatedPaymentMethods()) ) { $this->getDB()->update( 'tzahlungsart', @@ -363,7 +363,7 @@ public function renderAdminMenuTab(string $tabName, int $menuID, JTLSmarty $smar } } - private function getDeprecatedPaymentMethods(): array + public static function getDeprecatedPaymentMethods(): array { return [ HeidelpayInvoiceFactoring::class, diff --git a/CHANGELOG.md b/CHANGELOG.md index 051b4f8..0a25c49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [2.0.1] (January 2026) +### Fixed +- issue with prepayment not marked as paid in JTL WAWI +- issue with "Email: Confirmation of payment" setting not working correctly + +### Changed +- removed "Booking Mode": "Authorization" from **Wero** as it is not supported by all banks +- changed default order of payment methods + ## [2.0.0] (December 2025) > [!CAUTION] diff --git a/README.md b/README.md index a7513dd..6553803 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ Dieses Plugin integriert die folgenden Unzer-Zahlungsarten im JTL Shop: +- Alipay - Apple Pay - Bancontact - Kreditkarte und Click to Pay diff --git a/checksums.csv b/checksums.csv index 6e38628..fd00887 100644 --- a/checksums.csv +++ b/checksums.csv @@ -896,7 +896,7 @@ e0b9e6894421345360862d2571283a23;adminmenu/template/partials/_header.tpl dad4062692dbd99b16ae3233b36ec1ec;adminmenu/template/orders.tpl 30e621c301583a4e13928bd8b9a09a9d;.jshintrc 2c62fe5947e6614a783d78e29f531d00;phpmd-ruleset.xml -d5a6f78c1d199bf994fa8340868dadc2;README.md +7303b464bd38e88bf11ddf0bafff802d;README.md 767ba442de91503e5b6245c2d114a5c7;src/ApplePay/CertificatesResource.php 6703c52f0190cd22bfa1f72d7930fce1;src/ApplePay/CertificationService.php 4ad80bac1bc3c0c244426c6dd6279a96;src/ApplePay/CertificateException.php @@ -904,7 +904,7 @@ d5a6f78c1d199bf994fa8340868dadc2;README.md a3255fc904b7509e171553ea009c9c82;src/ApplePay/ActivateCertificateResource.php 4ba10c90d08b3f639e188c332647e1c5;src/Payments/PaymentMethodModuleFactory.php bc9b1a4143127ff23236afb65e788a89;src/Payments/HeidelpayApiAdapter.php -f32c6ae7116a1c23d6bdd1d594acf20c;src/Payments/HeidelpayPaymentMethod.php +b84d538275b94512897bcfa43fbfb27e;src/Payments/HeidelpayPaymentMethod.php 85dadc4e055384cf11546247308921f5;src/Payments/Traits/PriceCurrencyConverter.php 54f0fff5386a4145ce981a2c4e24d576;src/Payments/Traits/SupportsB2B.php d78c74c0918be9b079a8cf4655446589;src/Payments/Traits/HasState.php @@ -924,7 +924,7 @@ d98195f0c1485f6412b599b3f1581902;src/Payments/Interfaces/HasPayButton.php 04525b7293527904b5c527dd5aecbd9b;src/Payments/Interfaces/HandleStepReviewOrderInterface.php ab1b1e5c0f257e793786fd8f49b3a9b7;src/Payments/Interfaces/NotificationInterface.php 24bea0a602bf575ea6c7d432587c4fba;src/Charges/ChargeMappingModel.php -a73ea5c19bab6939e41d81018eb6c8e4;src/Charges/ChargeHandler.php +9e1567a3d74129750aa8bd161d51f8fc;src/Charges/ChargeHandler.php 20db0d8770933362b0b8b7fa32c18494;src/Charges/ChargeMappingEntity.php cc1c780662e1a85826bafc4dbfef25fc;src/Controllers/Controller.php 6b557d2f5af216698fad3cbb233f211e;src/Controllers/AjaxResponse.php @@ -940,7 +940,7 @@ e990705d5e8da7895d4460e98f516ec3;src/Controllers/Admin/AdminController.php 47d5c9582887c2d15265d9ef572b9b8d;src/Controllers/Admin/AdminKeyPairsController.php 5827d6899028ef0919847b0fdaafcee0;src/Controllers/Admin/AdminOrdersController.php 8a9dc40409220ffb905b588d056d2427;src/Controllers/Admin/AdminSettingsController.php -bcc814dcdea7b1904456777943f2b18f;src/Orders/OrderMappingModel.php +8296f8b464c72e7441c7dedec8159728;src/Orders/OrderMappingModel.php 3da45aa29a08f869b95627a6e46e5f9a;src/Orders/OrderViewStruct.php c1f8da0ce57d62d455c5e259c24685d0;src/Orders/OrderMappingEntity.php 521e61755ca1485bfe834b40a50ac426;src/Utils/Logger.php @@ -950,7 +950,7 @@ dcdeac17d651b1ec66d15b927d9a797b;src/Utils/Config.php d5d5d79ab6d86b5a965cf17240ff601e;src/Utils/JtlLoggerTrait.php 45d77592d5be177698832b19d2f84b78;src/Utils/Compatibility.php 48830baed39f5710178337ad6d6f8444;src/Utils/TranslatorTrait.php -8670bbececd78c3c6a8e52dd9105dc1d;src/Webhooks/PaymentEventSubscriber.php +82c185d48308e87dd3f586a6b4e3261e;src/Webhooks/PaymentEventSubscriber.php 4a6bd5f25d0487b44b664403d6b0315c;src/KeyPairs/KeyPairModel.php 8e0682ac5c506aa7ed6bc23a06970633;src/KeyPairs/KeyPairService.php 02ead16397ed114e97dc4a017cf2b30e;src/KeyPairs/KeyPairEntity.php @@ -966,7 +966,7 @@ ea7aa4025fd765d650d31bf1c60e768f;LICENSE eb925bcc8e525c0151338006a2c34ac7;paymentmethod/UnzerPaylaterDirectDebit.php 1ef765d0ee365680c13dc50356da8aa4;paymentmethod/HeidelpayPrepayment.php ec0675d513fe14aa3766347ab3fe45ba;paymentmethod/UnzerDirectBankTransfer.php -5a480160473e2dbf7ee0e5a373d16794;paymentmethod/UnzerWero.php +cdf083b85ad47dd962fb7223301609c3;paymentmethod/UnzerWero.php 4704fb5d3c5b2581977682c705979bf0;paymentmethod/HeidelpayInvoiceGuaranteed.php 9e34f11f989a7ec68c9e4cc9c8a380d2;paymentmethod/UnzerKlarna.php 96b585ddc78e8c6441df7b160a012680;paymentmethod/UnzerBancontact.php @@ -1060,13 +1060,13 @@ ddaaceadd4366b7aa7aaa82ae405c821;paymentmethod/template/alipay_form.tpl 43aa1ac4c28b351cdb5c54656b0586b5;paymentmethod/template/invoice_guaranteed_form.tpl 54fd30a2872c9c7223da7c93d746029b;paymentmethod/template/prepayment_form.tpl da1763f3cb4977cbf05e81cad338293c;paymentmethod/HeidelpayCreditCard.php -0d63ba0e32e3fd96d6e667d2d9450776;info.xml +11a427c9bcae7ec07135cbec382ff200;info.xml c237fcf06c9da2f07028932e8eb8aa36;Migrations/Migration20230925100000.php 55ccfd103771065e96f3e482ee49499e;Migrations/Migration20220511114913.php cd6d409b4fbd95d76bfe82ab4805a17b;Migrations/Migration20230919100000.php 166d9346b496a3a2a2332586e8dcfa44;Migrations/Migration20221006103000.php 3faed6c0507c6f399d352282db7c777b;Migrations/Migration20201027083900.php -079b44de2e017a797d944e83bde215f7;Bootstrap.php +1149e01925063e361c6f6b2cbdc0b0dd;Bootstrap.php c9f6e33220cf462393c7070cffcfff1a;NOTICE 4db0ef5803b943bc62cf9a6e0f7b40b5;Seeders/Shop4PluginMigrationSeeder.php 9cd6264e498cee75cca04be54e74951e;locale/de-DE/base.po @@ -1074,4 +1074,4 @@ d889ba5a35fd2ce7293e876f80ada24b;locale/de-DE/base.mo a91aa01032b7966bc4af5b4ab78f9184;locale/en-GB/base.po 4cd18640657e259941c4fbcdba4c5b3d;locale/en-GB/base.mo e73740baa8bcab9ac6d47b2a95daa826;jsconfig.json -e8e2cdb77aa3e392df8c46948b55d107;CHANGELOG.md +8034c4a2def4187be26df1986d62e579;CHANGELOG.md diff --git a/info.xml b/info.xml index fc95203..35992a9 100644 --- a/info.xml +++ b/info.xml @@ -6,7 +6,7 @@ http://www.solution360.de 100 5.0.0 - 2.0.0 + 2.0.1 s360_unzer_shop5 2020-10-27 @@ -405,7 +405,7 @@ - 0 + 25 1 CREDIT_CARD @@ -438,7 +438,7 @@ - 0 + 80 1 DIRECT_DEBIT @@ -488,7 +488,7 @@ - 0 + 90 1 INVOICE @@ -513,7 +513,7 @@ - 0 + 90 1 INVOICE @@ -538,7 +538,7 @@ - 0 + 5 1 INVOICE @@ -588,7 +588,7 @@ - 0 + 100 1 PAYPAL @@ -663,7 +663,7 @@ - 0 + 60 1 OTHER @@ -688,7 +688,7 @@ - 0 + 55 1 OTHER @@ -713,7 +713,7 @@ - 0 + 85 1 OTHER @@ -738,7 +738,7 @@ - 0 + 50 1 OTHER @@ -788,7 +788,7 @@ - 0 + 105 1 OTHER @@ -813,7 +813,7 @@ - 0 + 110 1 OTHER @@ -838,7 +838,7 @@ - 0 + 10 1 OTHER @@ -870,7 +870,7 @@ - 10 + 30 1 OTHER @@ -895,7 +895,7 @@ - 20 + 95 1 OTHER @@ -920,7 +920,7 @@ - 30 + 10 1 OTHER @@ -945,7 +945,7 @@ - 40 + 15 1 OTHER @@ -970,7 +970,7 @@ - 50 + 35 1 OTHER @@ -1115,7 +1115,7 @@ - 60 + 65 1 OTHER @@ -1141,7 +1141,7 @@ - 15 + 30 1 OTHER @@ -1176,7 +1176,7 @@ - 70 + 20 1 OTHER @@ -1202,7 +1202,7 @@ - 80 + 45 1 OTHER @@ -1228,7 +1228,7 @@ - 90 + 40 1 OTHER @@ -1251,14 +1251,14 @@ - + diff --git a/paymentmethod/UnzerWero.php b/paymentmethod/UnzerWero.php index 3fadd33..d6e5457 100644 --- a/paymentmethod/UnzerWero.php +++ b/paymentmethod/UnzerWero.php @@ -71,15 +71,15 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); // Authorize payment - if ($config->getPaymentSetting(Config::PAYMENT_BOOKING_MODE, $this->moduleID) === 'authorize') { - return $this->adapter->getCurrentConnection()->performAuthorization( - $this->createAuthorization($shopCustomer, $order, false), - $payment->getId(), - $customer, - $this->createMetadata(), - $basket - ); - } + // if ($config->getPaymentSetting(Config::PAYMENT_BOOKING_MODE, $this->moduleID) === 'authorize') { + // return $this->adapter->getCurrentConnection()->performAuthorization( + // $this->createAuthorization($shopCustomer, $order, false), + // $payment->getId(), + // $customer, + // $this->createMetadata(), + // $basket + // ); + // } // Charge Payment return $this->adapter->getCurrentConnection()->performCharge( diff --git a/src/Charges/ChargeHandler.php b/src/Charges/ChargeHandler.php index 8253d68..7c14bfc 100644 --- a/src/Charges/ChargeHandler.php +++ b/src/Charges/ChargeHandler.php @@ -241,9 +241,27 @@ public function addCharge( * @param Bestellung $order * @return void */ - public function markAsPaid(HeidelpayPaymentMethod $paymentMethod, Bestellung $order): void + public function markAsPaid(Payment $payment, HeidelpayPaymentMethod $paymentMethod, Bestellung $order): void { - if ($order->cStatus != BESTELLUNG_STATUS_BEZAHLT && $this->config->get(Config::ADD_INCOMING_PAYMENTS, true)) { + $this->debugLog( + "Check if order {$order->cBestellNr} should be marked as paid." . + "Status: {$order->cStatus} | Add Incoming Payment: {$this->config->get(Config::ADD_INCOMING_PAYMENTS, true)}", + static::class + ); + + // Do not check status as it might be paid already (e.g. via redirect payments) + // instead check the payment is completed + if ($payment->isCompleted() && $this->config->get(Config::ADD_INCOMING_PAYMENTS, 'on') == 'on') { + $this->debugLog( + 'No remaining amount to capture. Mark order ' . $order->cBestellNr . ' as paid.', + static::class + ); + $paymentMethod->setOrderStatusToPaid($order); + $paymentMethod->sendConfirmationMail($order); + return; + } + + if ($order->cStatus != BESTELLUNG_STATUS_BEZAHLT && $this->config->get(Config::ADD_INCOMING_PAYMENTS, 'on') == 'on') { $this->debugLog( 'No remaining amount to capture. Mark order ' . $order->cBestellNr . ' as paid.', static::class diff --git a/src/Orders/OrderMappingModel.php b/src/Orders/OrderMappingModel.php index 8b427b9..8288c2d 100644 --- a/src/Orders/OrderMappingModel.php +++ b/src/Orders/OrderMappingModel.php @@ -5,6 +5,7 @@ namespace Plugin\s360_unzer_shop5\src\Orders; use JTL\Checkout\Bestellung; +use JTL\DB\ReturnType; use Plugin\s360_unzer_shop5\src\Foundation\Entity; use Plugin\s360_unzer_shop5\src\Foundation\Model; use stdClass; @@ -78,7 +79,13 @@ public function releaseOrder(int $id): int */ public function findByPayment(string $paymentId): ?OrderMappingEntity { - $result = $this->database->select($this->getTable(), 'payment_id', $paymentId); + $result = $this->database->queryPrepared( + "SELECT * FROM {$this->getTable()} + WHERE payment_id = :paymentId + ORDER BY jtl_order_id DESC LIMIT 1", + ['paymentId' => $paymentId], + ReturnType::SINGLE_OBJECT + ); if ($result) { $entity = $this->createEntity($result); diff --git a/src/Payments/HeidelpayPaymentMethod.php b/src/Payments/HeidelpayPaymentMethod.php index b322013..3178d0c 100644 --- a/src/Payments/HeidelpayPaymentMethod.php +++ b/src/Payments/HeidelpayPaymentMethod.php @@ -19,6 +19,7 @@ use JTL\Plugin\PluginInterface; use JTL\Session\Frontend; use JTL\Shop; +use Plugin\s360_unzer_shop5\Bootstrap; use Plugin\s360_unzer_shop5\src\Payments\Interfaces\HandleStepAdditionalInterface; use Plugin\s360_unzer_shop5\src\Payments\Interfaces\NotificationInterface; use Plugin\s360_unzer_shop5\src\Payments\Interfaces\PaymentStatusInterface; @@ -148,6 +149,10 @@ public function initBackendNotification(): void if (!empty($message)) { $payMethod = $this->plugin->getPaymentMethods()->getMethodByID($this->moduleID); + if ($payMethod === null || $payMethod->getActive() === false || \in_array($payMethod->getClassName(), Bootstrap::getDeprecatedPaymentMethods())) { + return; + } + if ($payMethod !== null) { $this->kZahlungsart = $payMethod->getMethodID(); } diff --git a/src/Webhooks/PaymentEventSubscriber.php b/src/Webhooks/PaymentEventSubscriber.php index c3ef505..876e944 100644 --- a/src/Webhooks/PaymentEventSubscriber.php +++ b/src/Webhooks/PaymentEventSubscriber.php @@ -105,7 +105,7 @@ public function onHandleIncomingPayment(EventPayload $payload) // Mark order as paid if there is no remaining amount on the payment. if ($payment->getAmount()->getRemaining() <= 0) { - $this->charges->markAsPaid($paymentMethod, $orderMapping->getOrder()); + $this->charges->markAsPaid($payment, $paymentMethod, $orderMapping->getOrder()); } // Update Mapped Status