Skip to content

Commit

Permalink
RATESWSX-318: fix reloading profile-config if legacy payment-methods …
Browse files Browse the repository at this point in the history
…are available
  • Loading branch information
rommelfreddy committed Oct 17, 2024
1 parent 75c08bf commit c337784
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

# Version 7.1.3 - Released on 2024-10-17

This release is only for Shopware 6.5 and contains all changes from version 7.1.2

## Version 7.1.2 - Released on 2024-10-17

* RATESWSX-318: fix reloading profile-config if legacy payment-methods are available

## Version 7.1.1 - Released on 2024-09-19

This release is only for Shopware 6.5 and contains all changes from version 7.1.0
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ratepay/shopware6-module",
"description": "Ratepay payment methods for Shopware 6",
"version": "7.1.1",
"version": "7.1.3",
"license": "MIT",
"authors": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use RatePAY\Model\Response\ProfileRequest;
use Ratepay\RpayPayments\Components\PaymentHandler\InstallmentPaymentHandler;
use Ratepay\RpayPayments\Components\PaymentHandler\InstallmentZeroPercentPaymentHandler;
use Ratepay\RpayPayments\Components\PaymentHandler\LegacyPaymentHandler;
use Ratepay\RpayPayments\Components\ProfileConfig\Model\ProfileConfigEntity;
use Ratepay\RpayPayments\Components\ProfileConfig\Model\ProfileConfigMethodEntity;
use Ratepay\RpayPayments\Components\ProfileConfig\Model\ProfileConfigMethodInstallmentEntity;
Expand All @@ -24,6 +25,7 @@
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\NotFilter;
use Shopware\Core\Framework\Uuid\Uuid;

class ProfileConfigResponseConverter
Expand Down Expand Up @@ -65,7 +67,12 @@ public function convert(ProfileRequest $response, string $profileId): array

/** @var PaymentMethodEntity $paymentMethod */
foreach ($paymentMethods as $paymentMethod) {
$arrayKey = strtolower((string) constant($paymentMethod->getHandlerIdentifier() . '::RATEPAY_METHOD'));
$constantName = $paymentMethod->getHandlerIdentifier() . '::RATEPAY_METHOD';
if (!defined($constantName)) {
continue;
}

$arrayKey = strtolower((string) constant($constantName));

if (!isset($responseData['merchantConfig']['activation-status-' . $arrayKey]) ||
(((int) $responseData['merchantConfig']['activation-status-' . $arrayKey]) === 1)) {
Expand Down Expand Up @@ -131,6 +138,7 @@ private function getPaymentMethods(): array
$criteria = new Criteria();
$criteria->addAssociation('plugin');
$criteria->addFilter(new EqualsFilter('plugin.baseClass', RpayPayments::class));
$criteria->addFilter(new NotFilter(NotFilter::CONNECTION_AND, [new EqualsFilter('handlerIdentifier', LegacyPaymentHandler::class)]));
/** @var PaymentMethodEntity[] $paymentMethods */
$paymentMethods = $this->paymentMethodRepository->search($criteria, Context::createDefaultContext())->getElements();
$this->paymentMethods = $paymentMethods;
Expand Down

0 comments on commit c337784

Please sign in to comment.