diff --git a/changelog.md b/changelog.md index f0cba18c6..179431da2 100644 --- a/changelog.md +++ b/changelog.md @@ -18,10 +18,6 @@ + Removed mail switch for awaiting and open order statuses. + Fixed issue where creating mollie order from back office had issues + Fixed issue where on some payment methods refund status would not be changed after refund webhook is called -+ Fixed issue where on some payment methods refund status would not be changed after refund webhook is called -+ Added option to have credit card components and also save credit card token. -+ Fixed issue where after changing environment it would load old environment payment settings, and you would need to refresh page to see correct ones. -+ Added label for expiry date input. ## Changes in release 4.4.2 ## + Fixed payment methods translations using API in checkout diff --git a/config/context.yml b/config/context.yml index acc62419f..8480f35b9 100644 --- a/config/context.yml +++ b/config/context.yml @@ -34,7 +34,3 @@ services: mollie.country: class: 'Shop' factory: ['Mollie\Factory\ContextFactory', 'getCountry'] - - mollie.customer: - class: 'Customer' - factory: ['Mollie\Factory\ContextFactory', 'getCustomer'] diff --git a/config/handler.yml b/config/handler.yml index fda2d5365..374d87037 100644 --- a/config/handler.yml +++ b/config/handler.yml @@ -30,8 +30,6 @@ services: - '@Mollie\Provider\PaymentOption\BasePaymentOptionProvider' - '@Mollie\Provider\PaymentOption\CreditCardPaymentOptionProvider' - '@Mollie\Provider\PaymentOption\IdealPaymentOptionProvider' - - '@Mollie\Repository\MolCustomerRepository' - - '@mollie.customer' Mollie\Handler\PaymentOption\PaymentOptionHandlerInterface: '@Mollie\Handler\PaymentOption\PaymentOptionHandler' diff --git a/src/Factory/ContextFactory.php b/src/Factory/ContextFactory.php index e8d094e1e..0bfa69a82 100644 --- a/src/Factory/ContextFactory.php +++ b/src/Factory/ContextFactory.php @@ -60,9 +60,4 @@ public static function getCountry() { return Context::getContext()->country; } - - public static function getCustomer() - { - return Context::getContext()->customer; - } } diff --git a/src/Handler/PaymentOption/PaymentOptionHandler.php b/src/Handler/PaymentOption/PaymentOptionHandler.php index 1b4e3a6a2..961fad3d8 100644 --- a/src/Handler/PaymentOption/PaymentOptionHandler.php +++ b/src/Handler/PaymentOption/PaymentOptionHandler.php @@ -37,14 +37,11 @@ namespace Mollie\Handler\PaymentOption; use Configuration; -use Customer; -use MolCustomer; use Mollie\Api\Types\PaymentMethod; use Mollie\Config\Config; use Mollie\Provider\PaymentOption\BasePaymentOptionProvider; use Mollie\Provider\PaymentOption\CreditCardPaymentOptionProvider; use Mollie\Provider\PaymentOption\IdealPaymentOptionProvider; -use Mollie\Repository\MolCustomerRepository; use MolPaymentMethod; class PaymentOptionHandler implements PaymentOptionHandlerInterface @@ -63,27 +60,15 @@ class PaymentOptionHandler implements PaymentOptionHandlerInterface * @var IdealPaymentOptionProvider */ private $idealPaymentOptionProvider; - /** - * @var MolCustomerRepository - */ - private $customerRepository; - /** - * @var Customer - */ - private $customer; public function __construct( BasePaymentOptionProvider $basePaymentOptionProvider, CreditCardPaymentOptionProvider $creditCardPaymentOptionProvider, - IdealPaymentOptionProvider $idealPaymentOptionProvider, - MolCustomerRepository $customerRepository, - Customer $customer + IdealPaymentOptionProvider $idealPaymentOptionProvider ) { $this->basePaymentOptionProvider = $basePaymentOptionProvider; $this->creditCardPaymentOptionProvider = $creditCardPaymentOptionProvider; $this->idealPaymentOptionProvider = $idealPaymentOptionProvider; - $this->customerRepository = $customerRepository; - $this->customer = $customer; } /** @@ -137,18 +122,6 @@ private function isCreditCardPaymentMethod(MolPaymentMethod $paymentMethod) if (!Configuration::get(Config::MOLLIE_IFRAME)) { return false; } - $fullName = "{$this->customer->firstname} {$this->customer->lastname}"; - - /** @var MolCustomer|null $molCustomer */ - $molCustomer = $this->customerRepository->findOneBy( - [ - 'name' => $fullName, - 'email' => $this->customer->email, - ] - ); - if ($molCustomer) { - return false; - } return true; } diff --git a/src/Service/ApiService.php b/src/Service/ApiService.php index 013b7549b..74a36aebf 100644 --- a/src/Service/ApiService.php +++ b/src/Service/ApiService.php @@ -147,8 +147,6 @@ public function getMethodsForConfig(MollieApiClient $api, $path) private function getMethodsObjForConfig($apiMethods) { - $this->environment = (int) $this->configurationAdapter->get(Config::MOLLIE_ENVIRONMENT); - $methods = []; $defaultPaymentMethod = new MolPaymentMethod(); $defaultPaymentMethod->enabled = false; diff --git a/src/Service/CustomerService.php b/src/Service/CustomerService.php index 41701e3ba..1f56913c5 100644 --- a/src/Service/CustomerService.php +++ b/src/Service/CustomerService.php @@ -91,8 +91,9 @@ public function isSingleCLickPaymentEnabled($method) if (PaymentMethod::CREDITCARD !== $method) { return false; } + $isComponentEnabled = \Configuration::get(Config::MOLLIE_IFRAME); $isSingleClickPaymentEnabled = \Configuration::get(Config::MOLLIE_SINGLE_CLICK_PAYMENT); - if ($isSingleClickPaymentEnabled) { + if (!$isComponentEnabled && $isSingleClickPaymentEnabled) { return true; } diff --git a/src/Service/PaymentMethodService.php b/src/Service/PaymentMethodService.php index 72a163167..c7d3b8ff6 100644 --- a/src/Service/PaymentMethodService.php +++ b/src/Service/PaymentMethodService.php @@ -411,9 +411,10 @@ private function getLocale($method) private function isCustomerSaveEnabled() { + $isComponentsEnabled = Configuration::get(Config::MOLLIE_IFRAME); $isSingleClickPaymentEnabled = Configuration::get(Config::MOLLIE_SINGLE_CLICK_PAYMENT); - return $isSingleClickPaymentEnabled; + return !$isComponentsEnabled && $isSingleClickPaymentEnabled; } private function removeNotSupportedMethods($methods, $mollieMethods) diff --git a/views/js/validation.js b/views/js/validation.js index 2f427c3eb..b02db8b82 100644 --- a/views/js/validation.js +++ b/views/js/validation.js @@ -57,6 +57,14 @@ $(document).ready(function () { $paymentMethodsEnable.each(validatePaymentMethod); }); + var $profileSwitch = $('input[name="MOLLIE_IFRAME"]'); + var $singleClickPayment = $('input[name="MOLLIE_SINGLE_CLICK_PAYMENT"]'); + + hideElementIfChecked($profileSwitch, $singleClickPayment); + $profileSwitch.on('change', function () { + hideElementIfChecked($profileSwitch, $singleClickPayment); + }); + var $automaticallyShipSwitch = $('input[name="MOLLIE_AS_MAIN"]'); var $statusesContainer = $('#MOLLIE_AS_STATUSES_container'); hideElementIfNotChecked($automaticallyShipSwitch, $statusesContainer);