Skip to content

Commit

Permalink
Merge pull request #480 from mollie/revert-472-MOLIM-256/order-compon…
Browse files Browse the repository at this point in the history
…ents

Revert "MOLIM-256: single click payment + components and env settings fix"
  • Loading branch information
margud authored Dec 2, 2021
2 parents da4bed6 + 91b100d commit f595c8e
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 47 deletions.
4 changes: 0 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions config/context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,3 @@ services:
mollie.country:
class: 'Shop'
factory: ['Mollie\Factory\ContextFactory', 'getCountry']

mollie.customer:
class: 'Customer'
factory: ['Mollie\Factory\ContextFactory', 'getCustomer']
2 changes: 0 additions & 2 deletions config/handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
5 changes: 0 additions & 5 deletions src/Factory/ContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,4 @@ public static function getCountry()
{
return Context::getContext()->country;
}

public static function getCustomer()
{
return Context::getContext()->customer;
}
}
29 changes: 1 addition & 28 deletions src/Handler/PaymentOption/PaymentOptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Service/ApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/Service/CustomerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion src/Service/PaymentMethodService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions views/js/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f595c8e

Please sign in to comment.