diff --git a/src/Controller/Action/Shop/QrCodeAction.php b/src/Controller/Action/Shop/QrCodeAction.php
index df26018b..e74ca8b0 100644
--- a/src/Controller/Action/Shop/QrCodeAction.php
+++ b/src/Controller/Action/Shop/QrCodeAction.php
@@ -12,6 +12,7 @@
use SyliusMolliePlugin\Entity\OrderInterface;
use SyliusMolliePlugin\Logger\MollieLoggerActionInterface;
use SyliusMolliePlugin\Resolver\MollieApiClientKeyResolverInterface;
+use SyliusMolliePlugin\Helper\IntToStringConverterInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -43,6 +44,9 @@ final class QrCodeAction
/** @var RepositoryInterface */
private $methodRepository;
+ /** @var IntToStringConverterInterface */
+ private $intToStringConverter;
+
/**
* QrCodeAction constructor
*/
@@ -53,7 +57,8 @@ public function __construct(
MollieApiClientKeyResolverInterface $apiClientKeyResolver,
OrderRepositoryInterface $orderRepository,
UrlGeneratorInterface $urlGenerator,
- RepositoryInterface $methodRepository
+ RepositoryInterface $methodRepository,
+ IntToStringConverterInterface $intToStringConverter
)
{
$this->loggerAction = $loggerAction;
@@ -63,6 +68,7 @@ public function __construct(
$this->orderRepository = $orderRepository;
$this->urlGenerator = $urlGenerator;
$this->methodRepository = $methodRepository;
+ $this->intToStringConverter = $intToStringConverter;
}
/**
@@ -189,7 +195,7 @@ private function setMolliePaymentIdOnOrder(OrderInterface $order, ?string $molli
private function buildPaymentObject(Request $request, OrderInterface $order): MolliePayment
{
$molliePayment = new MolliePayment();
- $molliePayment->setAmount(new Amount((string)($order->getTotal() / 100), $order->getCurrencyCode()));
+ $molliePayment->setAmount(new Amount($this->intToStringConverter->convertIntToString($order->getTotal()), $order->getCurrencyCode()));
$molliePayment->setMethod($request->get('paymentMethod'));
$molliePayment->setDescription((string)$order->getId());
$molliePayment->setIssuer($request->get('issuer') ?? '');
diff --git a/src/Migrations/Version20231225151033.php b/src/Migrations/Version20231225151033.php
index 598eb810..695e4a98 100644
--- a/src/Migrations/Version20231225151033.php
+++ b/src/Migrations/Version20231225151033.php
@@ -47,7 +47,7 @@ public function up(Schema $schema): void
/**
* @param Schema $schema
- *
+ *
* @return void
*/
public function down(Schema $schema): void
@@ -69,14 +69,6 @@ public function down(Schema $schema): void
$this->renameTableIfExists($schema, 'mollie_subscription_schedule', 'bitbag_mollie_subscription_schedule');
}
- /**
- * @return bool
- */
- public function isTransactional(): bool
- {
- return false;
- }
-
/**
* @param Schema $schema
* @param string $oldTableName
diff --git a/src/Resolver/MolliePaymentsMethodResolver.php b/src/Resolver/MolliePaymentsMethodResolver.php
index 9825a3a5..a3401303 100644
--- a/src/Resolver/MolliePaymentsMethodResolver.php
+++ b/src/Resolver/MolliePaymentsMethodResolver.php
@@ -12,6 +12,7 @@
use SyliusMolliePlugin\Entity\OrderInterface as MollieOrderInterface;
use SyliusMolliePlugin\Logger\MollieLoggerActionInterface;
use SyliusMolliePlugin\Repository\MollieGatewayConfigRepository;
+use SyliusMolliePlugin\Provider\Divisor\DivisorProviderInterface;
use SyliusMolliePlugin\Repository\MollieGatewayConfigRepositoryInterface;
use SyliusMolliePlugin\Repository\PaymentMethodRepositoryInterface;
use SyliusMolliePlugin\Resolver\Order\PaymentCheckoutOrderResolverInterface;
@@ -49,6 +50,9 @@ final class MolliePaymentsMethodResolver implements MolliePaymentsMethodResolver
/** @var MollieFactoryNameResolverInterface */
private $mollieFactoryNameResolver;
+ /** @var DivisorProviderInterface */
+ private $divisorProvider;
+
public function __construct(
MollieGatewayConfigRepository $mollieGatewayRepository,
MollieCountriesRestrictionResolverInterface $countriesRestrictionResolver,
@@ -57,7 +61,8 @@ public function __construct(
PaymentMethodRepositoryInterface $paymentMethodRepository,
MollieAllowedMethodsResolverInterface $allowedMethodsResolver,
MollieLoggerActionInterface $loggerAction,
- MollieFactoryNameResolverInterface $mollieFactoryNameResolver
+ MollieFactoryNameResolverInterface $mollieFactoryNameResolver,
+ DivisorProviderInterface $divisorProvider
) {
$this->mollieGatewayRepository = $mollieGatewayRepository;
$this->countriesRestrictionResolver = $countriesRestrictionResolver;
@@ -67,6 +72,7 @@ public function __construct(
$this->allowedMethodsResolver = $allowedMethodsResolver;
$this->loggerAction = $loggerAction;
$this->mollieFactoryNameResolver = $mollieFactoryNameResolver;
+ $this->divisorProvider = $divisorProvider;
}
public function resolve(): array
@@ -128,7 +134,7 @@ private function getMolliePaymentOptions(MollieOrderInterface $order, string $co
return $this->getDefaultOptions();
}
- $allowedMethods = $this->filterPaymentMethods($paymentConfigs, $allowedMethodsIds, (float)$order->getTotal()/100);
+ $allowedMethods = $this->filterPaymentMethods($paymentConfigs, $allowedMethodsIds, (float)$order->getTotal()/$this->divisorProvider->getDivisor());
if (0 === count($allowedMethods)) {
return $this->getDefaultOptions();
diff --git a/src/Resources/config/services/controller.xml b/src/Resources/config/services/controller.xml
index 2423f133..640c224b 100644
--- a/src/Resources/config/services/controller.xml
+++ b/src/Resources/config/services/controller.xml
@@ -49,6 +49,7 @@
+
diff --git a/src/Resources/config/services/resolver.xml b/src/Resources/config/services/resolver.xml
index c66a8363..1a9357c4 100644
--- a/src/Resources/config/services/resolver.xml
+++ b/src/Resources/config/services/resolver.xml
@@ -13,6 +13,7 @@
+
%images_dir%