diff --git a/src/DependencyInjection/requestParameter/builder.xml b/src/DependencyInjection/requestParameter/builder.xml
index 0beee686..c9f2485d 100644
--- a/src/DependencyInjection/requestParameter/builder.xml
+++ b/src/DependencyInjection/requestParameter/builder.xml
@@ -15,13 +15,11 @@
-
+
-
-
getRequestData();
- $parameter = [
+ return [
'request' => $arguments->getAction(),
'clearingtype' => self::CLEARING_TYPE_FINANCING,
'add_paydata[authorization_token]' => $dataBag->get('payoneKlarnaAuthorizationToken'),
];
-
- $context = $arguments->getSalesChannelContext()->getContext();
- $order = $arguments->getPaymentTransaction()->getOrder();
- $currency = $this->getOrderCurrency($order, $context);
- $lineItems = $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context);
-
- return array_merge($parameter, $lineItems);
}
public function supports(AbstractRequestParameterStruct $arguments): bool
diff --git a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php
index c7cde25c..097d1203 100644
--- a/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/OpenInvoice/AuthorizeRequestParameterBuilder.php
@@ -16,22 +16,10 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder
*/
public function getRequestParameter(AbstractRequestParameterStruct $arguments): array
{
- $paymentTransaction = $arguments->getPaymentTransaction();
- $salesChannelContext = $arguments->getSalesChannelContext();
- $context = $salesChannelContext->getContext();
- $order = $paymentTransaction->getOrder();
- $currency = $this->getOrderCurrency($order, $salesChannelContext->getContext());
-
- $parameters = [
+ return [
'clearingtype' => self::CLEARING_TYPE_INVOICE,
- 'request' => self::REQUEST_ACTION_AUTHORIZE,
+ 'request' => $arguments->getAction(),
];
-
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
- return $parameters;
}
public function supports(AbstractRequestParameterStruct $arguments): bool
diff --git a/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php
index 6ad0e595..7892287b 100644
--- a/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilder.php
@@ -4,6 +4,7 @@
namespace PayonePayment\Payone\RequestParameter\Builder;
+use PayonePayment\PaymentHandler\AbstractKlarnaPaymentHandler;
use PayonePayment\PaymentHandler\AbstractPostfinancePaymentHandler;
use PayonePayment\PaymentHandler\PayoneAlipayPaymentHandler;
use PayonePayment\PaymentHandler\PayoneBancontactPaymentHandler;
@@ -22,6 +23,7 @@
use PayonePayment\PaymentHandler\PayoneWeChatPayPaymentHandler;
use PayonePayment\Payone\RequestParameter\Struct\AbstractRequestParameterStruct;
use PayonePayment\Payone\RequestParameter\Struct\FinancialTransactionStruct;
+use PayonePayment\Payone\RequestParameter\Struct\PaymentTransactionStruct;
class OrderLinesRequestParameterBuilder extends AbstractRequestParameterBuilder
{
@@ -41,12 +43,16 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
return [];
}
- $parameters = $this->serviceAccessor->lineItemHydrator->mapPayoneOrderLinesByRequest(
- $currency,
- $paymentTransaction->getOrder(),
- $orderLines,
- $isCompleted ? true : $includeShippingCosts
- );
+ if ($arguments instanceof PaymentTransactionStruct && $this->isAuthorizeAction($arguments) && $orderLines === []) {
+ $parameters = $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $paymentTransaction->getOrder(), $arguments->getSalesChannelContext()->getContext());
+ } else {
+ $parameters = $this->serviceAccessor->lineItemHydrator->mapPayoneOrderLinesByRequest(
+ $currency,
+ $paymentTransaction->getOrder(),
+ $orderLines,
+ $isCompleted ? true : $includeShippingCosts
+ );
+ }
// For specific payment methods the "pr" parameter must be negative on refunds
$paymentMethodsThatRequireNegativePriceForRefunds = [
@@ -68,35 +74,65 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
public function supports(AbstractRequestParameterStruct $arguments): bool
{
- if (!($arguments instanceof FinancialTransactionStruct)) {
- return false;
- }
+ if ($arguments instanceof PaymentTransactionStruct) {
+ $config = $this->serviceAccessor->configReader->read($arguments->getPaymentTransaction()->getOrder()->getSalesChannelId());
+
+ if ($this->isAuthorizeAction($arguments) && $config->get('submitOrderLineItems', false)) {
+ return true;
+ }
- $paymentMethod = $arguments->getPaymentMethod();
-
- switch ($paymentMethod) {
- case PayonePayolutionDebitPaymentHandler::class:
- case PayonePayolutionInstallmentPaymentHandler::class:
- case PayonePayolutionInvoicingPaymentHandler::class:
- case PayoneSecureInvoicePaymentHandler::class:
- case PayoneOpenInvoicePaymentHandler::class:
- case PayoneBancontactPaymentHandler::class:
- case PayoneRatepayDebitPaymentHandler::class:
- case PayoneRatepayInstallmentPaymentHandler::class:
- case PayoneRatepayInvoicingPaymentHandler::class:
- case PayonePrzelewy24PaymentHandler::class:
- case PayoneWeChatPayPaymentHandler::class:
- case PayoneAlipayPaymentHandler::class:
- case PayoneSecuredInvoicePaymentHandler::class:
- case PayoneSecuredInstallmentPaymentHandler::class:
- case PayoneSecuredDirectDebitPaymentHandler::class:
+ // for some methods the line items are always required
+ if (is_subclass_of($arguments->getPaymentMethod(), AbstractKlarnaPaymentHandler::class)) {
return true;
+ }
+
+ // for some methods the line items are always required
+ switch ($arguments->getPaymentMethod()) {
+ case PayoneOpenInvoicePaymentHandler::class:
+ case PayoneRatepayDebitPaymentHandler::class:
+ case PayoneRatepayInstallmentPaymentHandler::class:
+ case PayoneRatepayInvoicingPaymentHandler::class:
+ case PayoneSecuredDirectDebitPaymentHandler::class:
+ case PayoneSecuredInstallmentPaymentHandler::class:
+ case PayoneSecuredInvoicePaymentHandler::class:
+ case PayoneSecureInvoicePaymentHandler::class:
+ case PayonePayolutionDebitPaymentHandler::class:
+ case PayonePayolutionInstallmentPaymentHandler::class:
+ case PayonePayolutionInvoicingPaymentHandler::class:
+ return true;
+ }
}
- if (is_subclass_of($arguments->getPaymentMethod(), AbstractPostfinancePaymentHandler::class)) {
- return true;
+ if ($arguments instanceof FinancialTransactionStruct) {
+ switch ($arguments->getPaymentMethod()) {
+ case PayonePayolutionDebitPaymentHandler::class:
+ case PayonePayolutionInstallmentPaymentHandler::class:
+ case PayonePayolutionInvoicingPaymentHandler::class:
+ case PayoneSecureInvoicePaymentHandler::class:
+ case PayoneOpenInvoicePaymentHandler::class:
+ case PayoneBancontactPaymentHandler::class:
+ case PayoneRatepayDebitPaymentHandler::class:
+ case PayoneRatepayInstallmentPaymentHandler::class:
+ case PayoneRatepayInvoicingPaymentHandler::class:
+ case PayonePrzelewy24PaymentHandler::class:
+ case PayoneWeChatPayPaymentHandler::class:
+ case PayoneAlipayPaymentHandler::class:
+ case PayoneSecuredInvoicePaymentHandler::class:
+ case PayoneSecuredInstallmentPaymentHandler::class:
+ case PayoneSecuredDirectDebitPaymentHandler::class:
+ return true;
+ }
+
+ if (is_subclass_of($arguments->getPaymentMethod(), AbstractPostfinancePaymentHandler::class)) {
+ return true;
+ }
}
return false;
}
+
+ private function isAuthorizeAction(AbstractRequestParameterStruct $arguments): bool
+ {
+ return \in_array($arguments->getAction(), [self::REQUEST_ACTION_AUTHORIZE, self::REQUEST_ACTION_PREAUTHORIZE], true);
+ }
}
diff --git a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php
index 17804105..73c99847 100644
--- a/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilder.php
@@ -38,7 +38,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
$context = $salesChannelContext->getContext();
$paymentTransaction = $arguments->getPaymentTransaction();
$order = $this->getOrder($paymentTransaction->getOrder()->getId(), $context);
- $currency = $this->getOrderCurrency($order, $context);
$profile = $this->getProfile($order, PayoneRatepayDebitPaymentHandler::class);
$parameters = [
@@ -54,10 +53,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
$this->applyPhoneParameter($order, $parameters, $dataBag, $context);
$this->applyBirthdayParameter($order, $parameters, $dataBag, $context);
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
return $parameters;
}
diff --git a/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php
index 5266fb78..8eeb52f2 100644
--- a/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilder.php
@@ -49,10 +49,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
$this->applyPhoneParameter($order, $parameters, $dataBag, $context);
$this->applyBirthdayParameter($order, $parameters, $dataBag, $context);
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
return $parameters;
}
diff --git a/src/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilder.php
index a7dd61de..04cec284 100644
--- a/src/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilder.php
@@ -22,7 +22,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
$context = $salesChannelContext->getContext();
$paymentTransaction = $arguments->getPaymentTransaction();
$order = $this->getOrder($paymentTransaction->getOrder()->getId(), $context);
- $currency = $this->getOrderCurrency($order, $context);
$profile = $this->getProfile($order, PayoneRatepayInvoicingPaymentHandler::class);
$parameters = [
@@ -37,10 +36,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
$this->applyPhoneParameter($order, $parameters, $dataBag, $context);
$this->applyBirthdayParameter($order, $parameters, $dataBag, $context);
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
return $parameters;
}
diff --git a/src/Payone/RequestParameter/Builder/RequestBuilderServiceAccessor.php b/src/Payone/RequestParameter/Builder/RequestBuilderServiceAccessor.php
index b1579486..3bed1ada 100644
--- a/src/Payone/RequestParameter/Builder/RequestBuilderServiceAccessor.php
+++ b/src/Payone/RequestParameter/Builder/RequestBuilderServiceAccessor.php
@@ -4,6 +4,7 @@
namespace PayonePayment\Payone\RequestParameter\Builder;
+use PayonePayment\Components\ConfigReader\ConfigReader;
use PayonePayment\Components\Currency\CurrencyPrecisionInterface;
use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydratorInterface;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
@@ -16,7 +17,8 @@ public function __construct(
public readonly EntityRepository $customerAddressRepository,
public readonly EntityRepository $currencyRepository,
public readonly CurrencyPrecisionInterface $currencyPrecision,
- public readonly LineItemHydratorInterface $lineItemHydrator
+ public readonly LineItemHydratorInterface $lineItemHydrator,
+ public readonly ConfigReader $configReader
) {
}
}
diff --git a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php
index 897ee928..a2195efc 100644
--- a/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/SecureInvoice/AuthorizeRequestParameterBuilder.php
@@ -16,23 +16,11 @@ class AuthorizeRequestParameterBuilder extends AbstractRequestParameterBuilder
*/
public function getRequestParameter(AbstractRequestParameterStruct $arguments): array
{
- $paymentTransaction = $arguments->getPaymentTransaction();
- $salesChannelContext = $arguments->getSalesChannelContext();
- $context = $salesChannelContext->getContext();
- $order = $paymentTransaction->getOrder();
- $currency = $this->getOrderCurrency($order, $context);
-
- $parameters = [
+ return [
'clearingtype' => self::CLEARING_TYPE_INVOICE,
'clearingsubtype' => 'POV',
'request' => self::REQUEST_ACTION_AUTHORIZE,
];
-
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
- return $parameters;
}
public function supports(AbstractRequestParameterStruct $arguments): bool
diff --git a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php
index ff3e0a4e..8568b92d 100644
--- a/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilder.php
@@ -53,10 +53,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
'iban' => $dataBag->get('securedDirectDebitIban'),
];
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
$this->applyPhoneParameter($order, $parameters, $dataBag, $context);
$this->applyBirthdayParameter($order, $parameters, $dataBag, $context);
diff --git a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php
index 22e0c2ab..f91c277a 100644
--- a/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilder.php
@@ -54,10 +54,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
'add_paydata[installment_option_id]' => $dataBag->get('securedInstallmentOptionId'),
];
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
$this->applyPhoneParameter($order, $parameters, $dataBag, $context);
$this->applyBirthdayParameter($order, $parameters, $dataBag, $context);
diff --git a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php
index 76c8988d..2d94708b 100644
--- a/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php
+++ b/src/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilder.php
@@ -46,10 +46,6 @@ public function getRequestParameter(AbstractRequestParameterStruct $arguments):
'currency' => $currency->getIsoCode(),
];
- if ($order->getLineItems() !== null) {
- $parameters = array_merge($parameters, $this->serviceAccessor->lineItemHydrator->mapOrderLines($currency, $order, $context));
- }
-
$this->applyPhoneParameter($order, $parameters, $dataBag, $context);
$this->applyBirthdayParameter($order, $parameters, $dataBag, $context);
$this->applyB2bParameters($order, $parameters);
diff --git a/src/Resources/config/settings.xml b/src/Resources/config/settings.xml
index bcc345fa..25d8a0af 100644
--- a/src/Resources/config/settings.xml
+++ b/src/Resources/config/settings.xml
@@ -58,6 +58,14 @@
When activated, the data entered by the customer into the fields provided by PAYONE will be saved in the customer account, allowing them to be directly reused for future orders.
Wenn aktiviert, werden die Daten, welche der Kunde in die von PAYONE bereitgestellten Felder, eingibt, in den Kundenaccount gespeichert, sodass diese bei weiteren Bestellungen direkt wiederverwendet werden können.
+
+
+ submitOrderLineItems
+
+
+ If activated, all order line-items are submitted to the PAYONE gateway. This enables the generation of invoices through PAYONE.
+ Wenn aktiviert, werden alle Bestellpositionen an das PAYONE-Gateway übermittelt. Dadurch ist es möglich, Rechnungen direkt über PAYONE zu erstellen.
+
diff --git a/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php
index 6bd77ad8..72eb1674 100644
--- a/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/GeneralTransactionRequestParameterBuilderTest.php
@@ -5,6 +5,7 @@
namespace PayonePayment\Payone\RequestParameter\Builder;
use PayonePayment\Components\CartHasher\CartHasherInterface;
+use PayonePayment\Components\ConfigReader\ConfigReader;
use PayonePayment\Components\ConfigReader\ConfigReaderInterface;
use PayonePayment\Components\Currency\CurrencyPrecisionInterface;
use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydratorInterface;
@@ -88,7 +89,8 @@ public function testItAddsCorrectAmountAndCurrency(): void
$this->getContainer()->get('customer_address.repository'),
$this->getContainer()->get('currency.repository'),
$currencyPrecision,
- $this->getContainer()->get(LineItemHydratorInterface::class)
+ $this->getContainer()->get(LineItemHydratorInterface::class),
+ $this->getContainer()->get(ConfigReader::class)
),
$this->createMock(CartHasherInterface::class),
$this->createMock(ConfigReaderInterface::class)
diff --git a/tests/Payone/RequestParameter/Builder/Klarna/AbstractKlarna.php b/tests/Payone/RequestParameter/Builder/Klarna/AbstractKlarna.php
index 937e0ad4..03432d9f 100644
--- a/tests/Payone/RequestParameter/Builder/Klarna/AbstractKlarna.php
+++ b/tests/Payone/RequestParameter/Builder/Klarna/AbstractKlarna.php
@@ -4,7 +4,6 @@
namespace PayonePayment\Payone\RequestParameter\Builder\Klarna;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\PayoneKlarnaDirectDebitPaymentHandler;
use PayonePayment\PaymentHandler\PayoneKlarnaInstallmentPaymentHandler;
use PayonePayment\PaymentHandler\PayoneKlarnaInvoicePaymentHandler;
@@ -37,18 +36,6 @@ final public function testItSupportsOnlyKlarnaMethods(): void
abstract protected function getStructForTestingSupportMethod(string $paymentHandler): AbstractRequestParameterStruct;
- protected function assertLineItemHasBeenSet(array $parameters, int $index = 1): void
- {
- // just verify if the keys exists. Tests for the contents, will be performed by testing the line-item-hydrator
- $indexStr = "[$index]";
- static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_NAME . $indexStr, $parameters);
- static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_NUMBER . $indexStr, $parameters);
- static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_PRICE . $indexStr, $parameters);
- static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_QTY . $indexStr, $parameters);
- static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_TAX_RATE . $indexStr, $parameters);
- static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_TYPE . $indexStr, $parameters);
- }
-
private function getClassToTest(): string
{
$class = preg_replace('/Test$/', '', static::class);
diff --git a/tests/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilderTest.php
index def1ac6a..7dbf32a0 100644
--- a/tests/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/Klarna/AuthorizeRequestParameterBuilderTest.php
@@ -47,8 +47,6 @@ public function testItAddsCorrectAuthorizeParameters(): void
static::assertEquals('test-token', $parameters['add_paydata[authorization_token]']);
static::assertArrayHasKey('clearingtype', $parameters);
-
- $this->assertLineItemHasBeenSet($parameters);
}
protected function getStructForTestingSupportMethod(string $paymentHandler): AbstractRequestParameterStruct
diff --git a/tests/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilderTest.php
index 2fbb95fb..b9cad57b 100644
--- a/tests/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/Klarna/CreateSessionRequestParameterBuilderTest.php
@@ -4,6 +4,7 @@
namespace PayonePayment\Payone\RequestParameter\Builder\Klarna;
+use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\PayoneKlarnaInvoicePaymentHandler;
use PayonePayment\Payone\RequestParameter\Struct\AbstractRequestParameterStruct;
use PayonePayment\Payone\RequestParameter\Struct\KlarnaCreateSessionStruct;
@@ -68,4 +69,16 @@ protected function getStructForTestingSupportMethod(string $paymentHandler): Abs
return $mock;
}
+
+ protected function assertLineItemHasBeenSet(array $parameters, int $index = 1): void
+ {
+ // just verify if the keys exists. Tests for the contents, will be performed by testing the line-item-hydrator
+ $indexStr = "[$index]";
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_NAME . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_NUMBER . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_PRICE . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_QTY . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_TAX_RATE . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_TYPE . $indexStr, $parameters);
+ }
}
diff --git a/tests/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilderTest.php
index 59e3456a..c8d8d195 100644
--- a/tests/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/OrderLinesRequestParameterBuilderTest.php
@@ -5,6 +5,7 @@
namespace PayonePayment\Payone\RequestParameter\Builder;
use DMS\PHPUnitExtensions\ArraySubset\Assert;
+use PayonePayment\Components\ConfigReader\ConfigReader;
use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\Constants;
use PayonePayment\PaymentHandler\PayoneBancontactPaymentHandler;
@@ -18,10 +19,15 @@
use PayonePayment\PaymentHandler\PayoneRatepayDebitPaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayInstallmentPaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayInvoicingPaymentHandler;
+use PayonePayment\PaymentHandler\PayoneSecuredDirectDebitPaymentHandler;
+use PayonePayment\PaymentHandler\PayoneSecuredInstallmentPaymentHandler;
+use PayonePayment\PaymentHandler\PayoneSecuredInvoicePaymentHandler;
use PayonePayment\PaymentHandler\PayoneSecureInvoicePaymentHandler;
use PayonePayment\TestCaseBase\PayoneTestBehavior;
use PHPUnit\Framework\TestCase;
use Shopware\Core\Framework\Validation\DataBag\RequestDataBag;
+use Shopware\Core\System\SystemConfig\SystemConfigService;
+use stdClass;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
@@ -65,19 +71,6 @@ public function testItNotSupportsInvalidPaymentMethods($paymentHandler): void
static::assertFalse($builder->supports($struct));
}
- public function testItNotSupportsPaymentRequests(): void
- {
- $struct = $this->getPaymentTransactionStruct(
- new RequestDataBag([]),
- PayonePayolutionDebitPaymentHandler::class,
- AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE
- );
-
- $builder = $this->getContainer()->get(OrderLinesRequestParameterBuilder::class);
-
- static::assertFalse($builder->supports($struct));
- }
-
public function testItAddsCorrectOrderLineParametersForFullCapture(): void
{
$dataBag = new ParameterBag();
@@ -254,6 +247,106 @@ public function testItAddsCorrectOrderLineParametersForPartialRefund(): void
static::assertArrayNotHasKey('it[2]', $parameters);
}
+ public function testItNotSendItemsIfDisabledForOptionalMethods(): void
+ {
+ $configService = $this->getContainer()->get(SystemConfigService::class);
+ $builder = $this->getContainer()->get(OrderLinesRequestParameterBuilder::class);
+
+ $struct = $this->getPaymentTransactionStruct(
+ new RequestDataBag(),
+ stdClass::class,
+ AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE
+ );
+
+ $configService->set(ConfigReader::SYSTEM_CONFIG_DOMAIN . 'submitOrderLineItems', false, $struct->getPaymentTransaction()->getOrder()->getSalesChannelId());
+ static::assertFalse($builder->supports($struct), 'builder should not supports stdclass if configuration (send order items) is disabled.');
+ }
+
+ public function testItSendItemsIfEnabledForOptionalMethods(): void
+ {
+ $configService = $this->getContainer()->get(SystemConfigService::class);
+ $builder = $this->getContainer()->get(OrderLinesRequestParameterBuilder::class);
+
+ $allowedActions = [
+ AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE,
+ AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE,
+ ];
+
+ foreach ($allowedActions as $allowedAction) {
+ $struct = $this->getPaymentTransactionStruct(new RequestDataBag(), stdClass::class, $allowedAction);
+ $configService->set(ConfigReader::SYSTEM_CONFIG_DOMAIN . 'submitOrderLineItems', true, $struct->getPaymentTransaction()->getOrder()->getSalesChannelId());
+
+ static::assertTrue($builder->supports($struct), sprintf('builder should supports stdclass if configuration (send order items) is enabled and action %s is given.', $allowedAction));
+ $parameters = $builder->getRequestParameter($struct);
+
+ foreach (array_values($struct->getPaymentTransaction()->getOrder()->getLineItems()->getElements()) as $index => $lineItem) {
+ static::assertLineItemHasBeenSet($parameters, $index + 1);
+ }
+ }
+ }
+
+ /**
+ * @dataProvider dataProviderPaymentMethodsWithRequiredLineItems
+ */
+ public function testIfSendItemIfOrderLineItemsAreRequired(string $paymentHandler): void
+ {
+ $configService = $this->getContainer()->get(SystemConfigService::class);
+ $builder = $this->getContainer()->get(OrderLinesRequestParameterBuilder::class);
+
+ $allowedActions = [
+ AbstractRequestParameterBuilder::REQUEST_ACTION_PREAUTHORIZE,
+ AbstractRequestParameterBuilder::REQUEST_ACTION_AUTHORIZE,
+ ];
+
+ foreach ($allowedActions as $allowedAction) {
+ $struct = $this->getPaymentTransactionStruct(new RequestDataBag(), $paymentHandler, $allowedAction);
+ $configService->set(ConfigReader::SYSTEM_CONFIG_DOMAIN . 'submitOrderLineItems', false, $struct->getPaymentTransaction()->getOrder()->getSalesChannelId());
+
+ static::assertTrue($builder->supports($struct), sprintf('builder should always supports %s. Also if configuration (send order items) is disabled.', $paymentHandler));
+ $parameters = $builder->getRequestParameter($struct);
+
+ foreach (array_values($struct->getPaymentTransaction()->getOrder()->getLineItems()->getElements()) as $index => $lineItem) {
+ static::assertLineItemHasBeenSet($parameters, $index + 1);
+ }
+ }
+ }
+
+ public static function dataProviderPaymentMethodsWithRequiredLineItems(): array
+ {
+ return [
+ [PayoneOpenInvoicePaymentHandler::class],
+ [PayoneRatepayDebitPaymentHandler::class],
+ [PayoneRatepayInstallmentPaymentHandler::class],
+ [PayoneRatepayInvoicingPaymentHandler::class],
+ [PayoneSecuredDirectDebitPaymentHandler::class],
+ [PayoneSecuredInstallmentPaymentHandler::class],
+ [PayoneSecuredInvoicePaymentHandler::class],
+ [PayoneSecureInvoicePaymentHandler::class],
+ [PayonePayolutionDebitPaymentHandler::class],
+ [PayonePayolutionInstallmentPaymentHandler::class],
+ [PayonePayolutionInvoicingPaymentHandler::class],
+ ];
+ }
+
+ public function testItNotSendItemsIfEnabledWithDisallowedActionForOptionalMethods(): void
+ {
+ $configService = $this->getContainer()->get(SystemConfigService::class);
+ $builder = $this->getContainer()->get(OrderLinesRequestParameterBuilder::class);
+
+ $disallowedActions = [
+ AbstractRequestParameterBuilder::REQUEST_ACTION_CAPTURE,
+ AbstractRequestParameterBuilder::REQUEST_ACTION_REFUND,
+ AbstractRequestParameterBuilder::REQUEST_ACTION_GENERIC_PAYMENT,
+ 'something-else',
+ ];
+
+ foreach ($disallowedActions as $disallowedAction) {
+ $struct = $this->getPaymentTransactionStruct(new RequestDataBag(), stdClass::class, $disallowedAction);
+ $configService->set(ConfigReader::SYSTEM_CONFIG_DOMAIN . 'submitOrderLineItems', true, $struct->getPaymentTransaction()->getOrder()->getSalesChannelId());
+ static::assertFalse($builder->supports($struct), sprintf('builder should not supports stdclass if configuration (send order items) is enabled and not allowed action %s is given.', $disallowedAction));
+ }
+ }
+
public function getValidPaymentHandler(): array
{
return [
@@ -278,4 +371,16 @@ public function getInvalidPaymentHandler(): array
// ...
];
}
+
+ protected function assertLineItemHasBeenSet(array $parameters, int $index): void
+ {
+ // just verify if the keys exists. Tests for the contents, will be performed by testing the line-item-hydrator
+ $indexStr = "[$index]";
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_NAME . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_NUMBER . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_PRICE . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_QTY . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_TAX_RATE . $indexStr, $parameters);
+ static::assertArrayHasKey(LineItemHydrator::PAYONE_ARRAY_KEY_TYPE . $indexStr, $parameters);
+ }
}
diff --git a/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php
index 0083a76f..332276f9 100644
--- a/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/RatepayDebit/AuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\RatepayDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayDebitPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -60,7 +59,6 @@ public function testItAddsCorrectAuthorizeParameters(): void
'add_paydata[device_token]' => 'the-device-ident-token',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php
index bba8b231..c725de95 100644
--- a/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/RatepayDebit/PreAuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\RatepayDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayDebitPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -60,7 +59,6 @@ public function testItAddsCorrectPreAuthorizeParameters(): void
'add_paydata[device_token]' => 'the-device-ident-token',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php
index 01761e7e..fe48a16f 100644
--- a/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/RatepayInstallment/AuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\RatepayDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayInstallmentPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -77,7 +76,6 @@ public function testItAddsCorrectAuthorizeParametersWithIban(): void
'add_paydata[debit_paytype]' => 'DIRECT-DEBIT',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php
index 7320102e..f263759e 100644
--- a/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/RatepayInstallment/PreAuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\RatepayDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayInstallmentPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -77,7 +76,6 @@ public function testItAddsCorrectPreAuthorizeParameters(): void
'add_paydata[debit_paytype]' => 'DIRECT-DEBIT',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php
index b5c72d3c..5da052bc 100644
--- a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/AuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\RatepayDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayInvoicingPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -58,7 +57,6 @@ public function testItAddsCorrectAuthorizeParameters(): void
'add_paydata[device_token]' => 'the-device-ident-token',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php
index 41da0134..57a11799 100644
--- a/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/RatepayInvoicing/PreAuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\RatepayDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneRatepayInvoicingPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -58,7 +57,6 @@ public function testItAddsCorrectPreAuthorizeParameters(): void
'add_paydata[device_token]' => 'the-device-ident-token',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php
index b85bafbe..4614333e 100644
--- a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/AuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\PayoneBNPLDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneSecuredDirectDebitPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -55,7 +54,6 @@ public function testItAddsCorrectAuthorizeParameters(): void
'birthday' => '20000101',
'bankaccountholder' => 'Max Mustermann',
'iban' => 'DE85500105173716329595',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php
index 5516724b..7d925c37 100644
--- a/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/SecuredDirectDebit/PreAuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\PayoneBNPLDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneSecuredDirectDebitPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -55,7 +54,6 @@ public function testItAddsCorrectPreAuthorizeParameters(): void
'birthday' => '20000101',
'bankaccountholder' => 'Max Mustermann',
'iban' => 'DE85500105173716329595',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php
index 644a34a4..7a380320 100644
--- a/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/SecuredInstallment/AuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\PayoneBNPLDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneSecuredInstallmentPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -57,7 +56,6 @@ public function testItAddsCorrectAuthorizeParameters(): void
'bankaccountholder' => 'Max Mustermann',
'iban' => 'DE85500105173716329595',
'add_paydata[installment_option_id]' => 'the-option-id',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php
index b38af8c0..60e40b1c 100644
--- a/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/SecuredInstallment/PreAuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\PayoneBNPLDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneSecuredInstallmentPaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -57,7 +56,6 @@ public function testItAddsCorrectPreAuthorizeParameters(): void
'bankaccountholder' => 'Max Mustermann',
'iban' => 'DE85500105173716329595',
'add_paydata[installment_option_id]' => 'the-option-id',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
diff --git a/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php
index 2673eae0..4c617516 100644
--- a/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/SecuredInvoice/AuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\PayoneBNPLDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneSecuredInvoicePaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -52,7 +51,6 @@ public function testItAddsCorrectAuthorizeParameters(): void
'add_paydata[device_token]' => 'the-device-ident-token',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);
@@ -149,7 +147,6 @@ public function testItAddsCorrectAuthorizeParametersForB2b(): void
'financingtype' => AbstractPayonePaymentHandler::PAYONE_FINANCING_PIV,
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
'businessrelation' => 'b2b',
'company' => 'The Company',
'vatid' => 'DE123456789',
diff --git a/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php b/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php
index 6b335ebe..bddfad7b 100644
--- a/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php
+++ b/tests/Payone/RequestParameter/Builder/SecuredInvoice/PreAuthorizeRequestParameterBuilderTest.php
@@ -6,7 +6,6 @@
use DMS\PHPUnitExtensions\ArraySubset\Assert;
use PayonePayment\Components\DeviceFingerprint\PayoneBNPLDeviceFingerprintService;
-use PayonePayment\Components\Hydrator\LineItemHydrator\LineItemHydrator;
use PayonePayment\PaymentHandler\AbstractPayonePaymentHandler;
use PayonePayment\PaymentHandler\PayoneSecuredInvoicePaymentHandler;
use PayonePayment\Payone\RequestParameter\Builder\AbstractRequestParameterBuilder;
@@ -52,7 +51,6 @@ public function testItAddsCorrectPreAuthorizeParameters(): void
'add_paydata[device_token]' => 'the-device-ident-token',
'telephonenumber' => '0123456789',
'birthday' => '20000101',
- 'it[1]' => LineItemHydrator::TYPE_GOODS,
],
$parameters
);