Skip to content
Closed
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
14 changes: 11 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
php-version: [ '8.2', '8.3' ]
php-version: [ '8.2', '8.3', '8.4' ]
composer-version: [ '2.2', '2.8' ]
mysql-version: [ '8.0' ]
shopware-version: [ 'v6.6.0.0', 'v6.6.1.0', 'v6.6.2.0', 'v6.6.3.0', 'v6.6.4.0' ]
shopware-version: [ 'v6.7.0.0', 'v6.7.1.0', 'v6.7.2.0' ]
exclude:
- php-version: 8.2
composer-version: 2.8
- php-version: 8.3
composer-version: 2.8
- php-version: 8.4
composer-version: 2.2
fail-fast: false
max-parallel: 10
services:
Expand All @@ -39,7 +47,7 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, xdebug, curl, dom, fileinfo, gd, iconv, intl, json, xml, mbstring, pdo, phar, zip, sodium, pdo_mysql
tools: composer:2.2
tools: composer:${{ matrix.composer-version }}

- name: "Check PHP Version"
run: php -v
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/var/cache/
composer.lock
__COMPOSER_HOME__
node_modules/
src/Resources/app/administration/node_modules
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Version 8.0.0 - Released on 2025-09-18

* RATESWSX-332: add Shopware 6.7.x.x compatibility
* RATESWSX-332: build tool: migration from Webpack to Vite
* RATESWSX-332: upgrade code to be compatible with PHP 8.2, PHP 8.3 and PHP 8.4
* RATESWSX-332: upgrade composer version to be compatible with PHP 8.4

## Version 7.2.0 - Released on 2024-12-09

* RATESWSX-320: dfp: remove validation & improve user-identification
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Ratepay GmbH - Shopware 6 Payment Module

| Module | Ratepay Payment Plugin for Shopware 6 |
|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| Author | Interlutions GmbH |
| Shop Version | `6.3.0.2 to 6.6.x.x` |
| Link | http://www.ratepay.com |
| Mail | integration@ratepay.com |
| Full Documentation | [click here](https://docs.ratepay.com/docs/developer/shop_modules/shopware/shopware_6/ratepay_payment_plugin_for_shopware_6/) |
| Legal Disclaimer | [click here](https://docs.ratepay.com/docs/developer/shop_modules/overview/) |
| Module | Ratepay Payment Plugin for Shopware 6 |
|--------------------|-------------------------------------------------------------------------------------------------------------------------------|
| Author | Interlutions GmbH |
| Shop Version | `6.3.0.2 to 6.7.x.x` |
| Link | http://www.ratepay.com |
| Mail | integration@ratepay.com |
| Full Documentation | [click here](https://docs.ratepay.com/docs/developer/shop_modules/shopware/shopware_6/ratepay_payment_plugin_for_shopware_6/) |
| Legal Disclaimer | [click here](https://docs.ratepay.com/docs/developer/shop_modules/overview/) |

## Installation via Shopware Store

Expand Down
11 changes: 8 additions & 3 deletions 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.2.0",
"version": "8.0.0",
"license": "MIT",
"authors": [
{
Expand Down Expand Up @@ -41,9 +41,9 @@
}
},
"require": {
"php": "^8.1",
"php": "^8.2",
"ratepay/php-library": "^1.8",
"shopware/core": "~6.6.0",
"shopware/core": "~6.7.0",
"ext-simplexml": "*",
"ext-json": "*"
},
Expand Down Expand Up @@ -73,5 +73,10 @@
"rector/rector": "^1.1",
"symplify/easy-coding-standard": "^12.2",
"phpunit/phpunit": "^9.6"
},
"config": {
"allow-plugins": {
"symfony/runtime": false
}
}
}
6 changes: 3 additions & 3 deletions src/Components/AdminOrders/Service/DfpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ public function __construct(
) {
}

public function generatedDfpId(Request $request, SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): ?string
public function generatedDfpId(Request $request, SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): ?string
{
return $this->isDfpRequired($salesChannelContext, $orderEntity) ? $this->decorated->generatedDfpId($request, $salesChannelContext, $orderEntity) : null;
}

public function getDfpSnippet(Request $request, SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): ?string
public function getDfpSnippet(Request $request, SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): ?string
{
return $this->isDfpRequired($salesChannelContext, $orderEntity) ? $this->decorated->getDfpSnippet($request, $salesChannelContext, $orderEntity) : null;
}

public function isDfpRequired(SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): bool
public function isDfpRequired(SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): bool
{
$session = $this->requestStack->getMainRequest()->getSession();
if ($this->sessionService->isAdminSession($salesChannelContext, $session)) {
Expand Down
7 changes: 1 addition & 6 deletions src/Components/AdminOrders/Service/SessionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public function canLogout(SalesChannelContext $context, SessionInterface $sessio

public function isLoggedInAsCustomer(SalesChannelContext $context, SessionInterface $session): bool
{
// supported since SW 6.6.5.x - TODO remove this check if compatibility has been change to Shopware >= 6.6.5
if (method_exists($context, 'getImitatingUserId') && $context->getImitatingUserId() !== null) {
return true;
}

if ($context->getCustomerId() === null) {
return false;
}
Expand All @@ -55,7 +50,7 @@ public function destroy(SessionInterface $session): void
{
$session->remove($this->sessionKey);

// make sure that the third-party modules did not left any data, which we will check
// make sure that the third-party modules did not leave any data, which we will check
foreach ($this->getThirdPartyLoginAsSessionKeys() as $key) {
$session->remove($key);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/AdminOrders/Subscriber/LoginSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
public static function getSubscribedEvents(): array
{
return [
CustomerLogoutEvent::class => ['onLogout', -3000], // as late as possible to prioritize thirdparty modules
CustomerLogoutEvent::class => ['onLogout', -3000], // as late as possible to prioritize third-party modules
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ abstract class AbstractCheckoutController
{
abstract public function getDecorated(): self;

abstract public function getPaymentData(Request $request, SalesChannelContext $salesChannelContext, string $orderId = null): Response;
abstract public function getPaymentData(Request $request, SalesChannelContext $salesChannelContext, ?string $orderId = null): Response;
}
2 changes: 1 addition & 1 deletion src/Components/Checkout/Controller/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
],
methods: ['GET']
)]
public function getPaymentData(Request $request, SalesChannelContext $salesChannelContext, string $orderId = null): Response
public function getPaymentData(Request $request, SalesChannelContext $salesChannelContext, ?string $orderId = null): Response
{
try {
if ($orderId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function isAvailable(): bool
}

/**
* if <code>$isAvailable</code> is false, the event will stopped.
* if <code>$isAvailable</code> is false, the event will be stopped.
*/
public function setIsAvailable(bool $isAvailable): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Checkout/Service/DataValidationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
) {
}

public function validatePaymentData(DataBag $parameterBag, SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): void
public function validatePaymentData(DataBag $parameterBag, SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): void
{
if ($orderEntity instanceof OrderEntity) {
$paymentMethodId = $orderEntity->getTransactions()->last()->getPaymentMethodId();
Expand Down
18 changes: 9 additions & 9 deletions src/Components/Checkout/Service/ExtensionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function createOrderExtensionEntity(
public function buildPaymentDataExtension(
SalesChannelContext $salesChannelContext,
?OrderEntity $order = null,
Request $httpRequest = null
?Request $httpRequest = null
): ?ArrayStruct {
$paymentMethod = $salesChannelContext->getPaymentMethod();

Expand Down Expand Up @@ -169,19 +169,19 @@ public function buildPaymentDataExtension(
}

$extension = new ArrayStruct();
$extension->offsetSet('isSandbox', $profileConfig->isSandbox());
$extension->offsetSet('birthday', $customerBirthday ?? null);
$extension->offsetSet('vatId', $customerVatId ?? null);
$extension->offsetSet('phoneNumber', $customerPhoneNumber ?? null);
$extension->offsetSet('company', $customerCompany ?? null);
$extension->offsetSet('accountHolders', $accountHolders ?? null);
$extension->offsetSet(
$extension->set('isSandbox', $profileConfig->isSandbox());
$extension->set('birthday', $customerBirthday ?? null);
$extension->set('vatId', $customerVatId ?? null);
$extension->set('phoneNumber', $customerPhoneNumber ?? null);
$extension->set('company', $customerCompany ?? null);
$extension->set('accountHolders', $accountHolders ?? null);
$extension->set(
'paymentMethod',
strtolower((string) constant($paymentMethod->getHandlerIdentifier() . '::RATEPAY_METHOD'))
);

if ($httpRequest instanceof Request) {
// add user entered values again, so that the user have not to reenter his values
// add user entered values again, so that the user has not to reenter his values
foreach (RequestHelper::getArray($httpRequest, RequestHelper::RATEPAY_DATA_KEY) ?: [] as $key => $value) {
if ($key === 'birthday' && is_array($value)) {
$value = (new DateTime())->setDate((int) $value['year'], (int) $value['month'], (int) $value['day']);
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Checkout/Service/PaymentFilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
) {
}

public function filterPaymentMethods(PaymentMethodCollection $paymentMethodCollection, SalesChannelContext $salesChannelContext, OrderEntity $order = null): void
public function filterPaymentMethods(PaymentMethodCollection $paymentMethodCollection, SalesChannelContext $salesChannelContext, ?OrderEntity $order = null): void
{
foreach ($paymentMethodCollection->getElements() as $key => $paymentMethod) {
if (!$this->isPaymentMethodAvailable($paymentMethod, $salesChannelContext, $order)) {
Expand All @@ -44,7 +44,7 @@ public function filterPaymentMethods(PaymentMethodCollection $paymentMethodColle
}
}

private function isPaymentMethodAvailable(PaymentMethodEntity $paymentMethod, SalesChannelContext $salesChannelContext, OrderEntity $order = null): bool
private function isPaymentMethodAvailable(PaymentMethodEntity $paymentMethod, SalesChannelContext $salesChannelContext, ?OrderEntity $order = null): bool
{
if ($paymentMethod->getHandlerIdentifier() === LegacyPaymentHandler::class) {
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/Components/Checkout/Struct/PaymentDataResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Shopware\Core\Framework\Struct\ArrayStruct;
use Shopware\Core\System\SalesChannel\StoreApiResponse;

/**
* @extends StoreApiResponse<ArrayStruct>
*/
class PaymentDataResponse extends StoreApiResponse
{
public function __construct(ArrayStruct $paymentExtension, int $status = self::HTTP_OK)
Expand Down
8 changes: 4 additions & 4 deletions src/Components/DeviceFingerprint/DfpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(
* provide the user-agent via header or a request variable `userAgent` to generate a more unique device-identifier
* the request-variable is prioritized
*/
public function generatedDfpId(Request $request, SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): ?string
public function generatedDfpId(Request $request, SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): ?string
{
if (!$this->isDfpRequired($salesChannelContext, $orderEntity)) {
return null;
Expand All @@ -52,7 +52,7 @@ public function generatedDfpId(Request $request, SalesChannelContext $salesChann
return $this->getCustomerToken($request, $salesChannelContext);
}

public function getDfpSnippet(Request $request, SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): ?string
public function getDfpSnippet(Request $request, SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): ?string
{
if ($id = $this->generatedDfpId($request, $salesChannelContext, $orderEntity)) {
$dfpHelper = new DeviceFingerprint($this->configService->getDeviceFingerprintSnippetId());
Expand All @@ -62,7 +62,7 @@ public function getDfpSnippet(Request $request, SalesChannelContext $salesChanne
return null;
}

public function isDfpRequired(SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): bool
public function isDfpRequired(SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): bool
{
return true;
}
Expand Down Expand Up @@ -93,7 +93,7 @@ private function getCustomerToken(Request $request, SalesChannelContext $context
'uuid' => $existingHashData->uuid,
'token' => $context->getToken(),

// user-agent is only required for logged-in users. This will prevent that they can not switch the device
// user-agent is only required for logged-in users. This will prevent switching the device
'user-agent' => $request->get('userAgent') ?? $request->headers->get('User-Agent') ?? $context->getCustomer()?->getRemoteAddress(),

// if user-agent is not given, we need another parameter. We will try the last-login.
Expand Down
4 changes: 2 additions & 2 deletions src/Components/DeviceFingerprint/DfpServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

interface DfpServiceInterface
{
public function generatedDfpId(Request $request, SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): ?string;
public function generatedDfpId(Request $request, SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): ?string;

public function getDfpSnippet(Request $request, SalesChannelContext $salesChannelContext, OrderEntity $orderEntity = null): ?string;
public function getDfpSnippet(Request $request, SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): ?string;

public function isDfpRequired(SalesChannelContext $salesChannelContext, ?OrderEntity $orderEntity = null): bool;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<call method="setContainer">
<argument id="service_container" type="service"/>
</call>
<call method="setTwig">
<argument type="service" id="twig"/>
</call>
<tag name="controller.service_arguments"/>
</service>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class InstallmentCalculationException extends ShopwareHttpException
{
public function __construct(string $message = null, array $parameters = [], ?Throwable $e = null)
public function __construct(?string $message = null, array $parameters = [], ?Throwable $e = null)
{
$message = 'Calculation of the installment plan was not successful. ' . $message;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
use Shopware\Core\Framework\Struct\ArrayStruct;
use Shopware\Core\System\SalesChannel\StoreApiResponse;

/**
* @extends StoreApiResponse<ArrayStruct>
*/
class InstallmentCalculationResponse extends StoreApiResponse
{
/**
* @var ArrayStruct
*/
protected $object;

/**
* @param array{translations: array, plan: array} $data
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Components/OrderManagement/Controller/ProductPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public function __construct(
public function load(string $orderId, Context $context): JsonResponse
{
$criteria = new Criteria([$orderId]);
$criteria->addAssociation(OrderExtension::EXTENSION_NAME);
$criteria->addAssociation('lineItems');
$criteria->addAssociation('lineItems.' . OrderLineItemExtension::EXTENSION_NAME);

$order = $this->orderRepository->search($criteria, $context)->first();

Expand Down
Loading
Loading