Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PISHPW-221: remove ideal dropdown #415

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .phpstan.lvl8.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ parameters:
level: 8
paths:
- ./Command/OrdersShippingCommand.php
- ./Components/iDEAL
- ./Components/Config
- ./Exceptions
- ./Services
Expand All @@ -16,11 +15,6 @@ parameters:
# ignore Shopware attributes with magic getters and setters
- '#Call to method getMollieReturn\(\) on an unknown class Shopware\\Models\\Attribute\\OrderDetail#'
- '#Call to method setMollieReturn\(\) on an unknown class Shopware\\Models\\Attribute\\OrderDetail#'
- '#Call to method getMollieShopwareIdealIssuer\(\) on an unknown class Shopware\\Models\\Attribute\\Customer#'
- '#Call to method setMollieShopwareIdealIssuer\(\) on an unknown class Shopware\\Models\\Attribute\\Customer#'
# -----------------------------------------------------------------------------------------------------------
# ignore magic getters and setters in Mollie API objects
- '#Access to an undefined property Mollie\\Api\\Resources\\Issuer::\$isSelected#'
# -----------------------------------------------------------------------------------------------------------

services:
Expand Down
25 changes: 3 additions & 22 deletions Components/Services/PaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use MollieShopware\Components\Constants\PaymentMethodType;
use MollieShopware\Components\Constants\PaymentStatus;
use MollieShopware\Components\CurrentCustomer;
use MollieShopware\Components\iDEAL\iDEALInterface;

use MollieShopware\Components\Mollie\Builder\MolliePaymentBuilder;
use MollieShopware\Components\Mollie\MollieShipping;
use MollieShopware\Components\Mollie\Services\TransactionUUID\TransactionUUID;
Expand Down Expand Up @@ -121,10 +121,7 @@ class PaymentService
*/
private $applePayFactory;

/**
* @var iDEALInterface $idealService
*/
private $idealService;


/**
* @var CurrentCustomer
Expand Down Expand Up @@ -233,7 +230,7 @@ public function startMollieSession($paymentMethodName, Transaction $transaction,
# a shop service is somewhere used in there...
$this->creditCardService = Shopware()->Container()->get('mollie_shopware.credit_card_service');
$this->applePayFactory = Shopware()->Container()->get('mollie_shopware.components.apple_pay_direct.factory');
$this->idealService = Shopware()->Container()->get('mollie_shopware.ideal_service');

$this->customer = Shopware()->Container()->get('mollie_shopware.customer');
$shopID = Shopware()->Shop()->getId();

Expand Down Expand Up @@ -632,22 +629,6 @@ private function configurePaymentSettings(PaymentInterface $paymentMethodObject,
}


if ($paymentMethodObject instanceof IDeal) {
# test if we have a current customer (we should have one)
# if so, get his selected iDeal issuer.
# if an issuer has been set, then also use it for our payment,
# otherwise just continue without a prefilled issuer.
$currentCustomer = $this->customer->getCurrent();

if ($currentCustomer instanceof Customer) {
$issuer = $this->idealService->getCustomerIssuer($currentCustomer);
if (!empty($issuer)) {
/** @var IDeal $paymentMethodObject */
$paymentMethodObject->setIssuer($issuer);
}
}
}

if ($paymentMethodObject instanceof CreditCard) {
# prevent this method from failing, because at this
# point we're not sure if the credit card token
Expand Down
111 changes: 0 additions & 111 deletions Components/iDEAL/iDEAL.php

This file was deleted.

28 changes: 0 additions & 28 deletions Components/iDEAL/iDEALInterface.php

This file was deleted.

49 changes: 2 additions & 47 deletions Controllers/Frontend/Mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use MollieShopware\Components\Helpers\LocaleFinder;
use MollieShopware\Components\Helpers\MollieRefundStatus;
use MollieShopware\Components\Helpers\MollieStatusConverter;
use MollieShopware\Components\iDEAL\iDEALInterface;
use MollieShopware\Components\MollieApiFactory;
use MollieShopware\Components\Order\OrderCancellation;
use MollieShopware\Components\Order\ShopwareOrderBuilder;
Expand Down Expand Up @@ -95,10 +94,7 @@ class Shopware_Controllers_Frontend_Mollie extends AbstractPaymentController
*/
private $localeFinder;

/**
* @var iDEALInterface
*/
private $iDEAL;


/**
* @var CurrentCustomer
Expand Down Expand Up @@ -448,47 +444,6 @@ public function retryAction()
$this->redirectToShopwareCheckoutFailed($this);
}

/**
* Get the issuers for the iDEAL payment method.
* Called in an ajax call on the frontend.
*/
public function idealIssuersAction()
{
Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender();

try {
$this->loadServices();

$customer = $this->customers->getCurrent();

if (!$customer instanceof Customer) {
throw new \Exception('No active customer found for iDEAL AJAX list');
}

/** @var array $idealIssuers */
$idealIssuers = $this->iDEAL->getIssuers($customer);

$this->sendResponse([
'data' => $idealIssuers,
'success' => true,
]);
} catch (\Exception $ex) {
$this->logger->error(
'Error iDEAL issuer AJAX action.',
[
'error' => $ex->getMessage(),
]
);

$this->sendResponse(
[
'message' => $ex->getMessage(),
'success' => false
],
500
);
}
}

/**
*
Expand Down Expand Up @@ -589,7 +544,7 @@ private function loadServices()
$paymentService = Shopware()->Container()->get('mollie_shopware.payment_service');
$orderService = Shopware()->Container()->get('mollie_shopware.order_service');

$this->iDEAL = $this->container->get('mollie_shopware.components.ideal');

$this->customers = $this->container->get('mollie_shopware.customer');


Expand Down
25 changes: 0 additions & 25 deletions Gateways/Mollie/MollieGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,31 +128,6 @@ public function getPayment($paymentId)
return $payment;
}

/**
* @throws \Mollie\Api\Exceptions\ApiException
* @return Issuer[]
*/
public function getIdealIssuers()
{
$paymentMethods = $this->apiClient->methods->allActive(
[
'include' => 'issuers'
]
);

$issuers = [];

foreach ($paymentMethods as $paymentMethod) {
if ($paymentMethod->id === PaymentMethod::IDEAL) {
foreach ($paymentMethod->issuers() as $key => $issuer) {
$issuers[] = $issuer;
}
break;
}
}

return $issuers;
}

/**
* @param array $requestData
Expand Down
6 changes: 1 addition & 5 deletions Gateways/MollieGatewayInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace MollieShopware\Gateways;

use Mollie\Api\MollieApiClient;
use Mollie\Api\Resources\Issuer;
use Mollie\Api\Resources\Order;
use Mollie\Api\Resources\Payment;
use Mollie\Api\Resources\Shipment;
Expand Down Expand Up @@ -38,10 +37,7 @@ public function getOrder($orderId);
*/
public function getPayment($paymentId);

/**
* @return Issuer[]
*/
public function getIdealIssuers();


/**
* @param array $requestData
Expand Down
7 changes: 1 addition & 6 deletions Resources/services/subscriber.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
<tag name="shopware.event_subscriber"/>
</service>

<service id="mollie_shopware.subscriber.ideal_issuers" class="MollieShopware\Subscriber\IdealIssuersSubscriber">
<argument type="service" id="mollie_shopware.ideal_service"/>
<argument type="service" id="mollie_shopware.customer"/>
<argument type="service" id="mollie_shopware.components.logger"/>
<tag name="shopware.event_subscriber"/>
</service>


<service id="mollie_shopware.subscriber.credit_card_token"
class="MollieShopware\Subscriber\CreditCardTokenSubscriber">
Expand Down
12 changes: 0 additions & 12 deletions Resources/views/frontend/plugins/payment/mollie_ideal.tpl

This file was deleted.

Loading
Loading