Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
987e528
feat: paypal sdk v6
cyl3x Nov 19, 2025
aad1e6d
feat google pay web component
cyl3x Nov 20, 2025
1f49d44
feat: improve loader
cyl3x Nov 20, 2025
0990b61
feat: script loading and preloading
cyl3x Nov 20, 2025
9888d99
feat: eslint
cyl3x Nov 20, 2025
dd70e1a
fix: update
cyl3x Nov 20, 2025
4254ac1
fix: ci
cyl3x Nov 21, 2025
cb134f5
fix: update
cyl3x Nov 21, 2025
1407b60
feat: page type
cyl3x Nov 21, 2025
501f06c
fix: update
cyl3x Nov 21, 2025
6fc82f5
fix: update
cyl3x Nov 21, 2025
36dd937
fix: update
cyl3x Nov 21, 2025
045e08b
feat: update
cyl3x Nov 24, 2025
3144e48
feat: admin banner
cyl3x Nov 24, 2025
e0de96f
fix: ci
cyl3x Nov 24, 2025
0eff30f
feat: pl button
cyl3x Nov 24, 2025
3bb8572
feat: acdc style
cyl3x Nov 25, 2025
2d4e0d9
fix: ci
cyl3x Nov 25, 2025
0adbd08
fix: update
cyl3x Nov 25, 2025
19e5858
fix: acdc loader
cyl3x Nov 25, 2025
5d25707
fix: ci
cyl3x Nov 25, 2025
27c7682
fix: token resource
cyl3x Dec 1, 2025
40d11cd
fix: add deprecations
cyl3x Dec 2, 2025
d84320d
fix: rename acdc to card fields
cyl3x Dec 2, 2025
9a77889
fix: script load
cyl3x Dec 2, 2025
2b0ccc5
fix: lint
cyl3x Dec 2, 2025
c3d6bbd
feat(v6): fetch client token
cyl3x Dec 1, 2025
bf12d0f
fix: cr
cyl3x Dec 4, 2025
fb74e02
fix: dev dep
cyl3x Dec 4, 2025
4bb0458
fix: token
cyl3x Dec 4, 2025
01d2f68
fix: submit naming
cyl3x Dec 4, 2025
4edc959
fix: google pay tiotal price translation
cyl3x Dec 4, 2025
85522b6
feat: update apple pay js
cyl3x Dec 8, 2025
8fb4e1f
fix: apple pay
cyl3x Dec 8, 2025
3f69656
chore: deprecate TokenResourceInterface
cyl3x Dec 8, 2025
68fe08b
Merge branch 'trunk' into feat/paypal-sdk-v6
cyl3x Dec 9, 2025
dc2100b
fix: button size
cyl3x Dec 9, 2025
fd90965
fix: naming
cyl3x Dec 9, 2025
cad0712
Merge remote-tracking branch 'origin/trunk' into feat/paypal-sdk-v6
cyl3x Dec 10, 2025
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
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@
"lint:admin": "npm run lint-fix --prefix src/Resources/app/administration",
"lint:admin:ci": "npm run lint --prefix src/Resources/app/administration",
"init:storefront": "npm ci --no-audit --prefer-offline --prefix src/Resources/app/storefront",
"lint:storefront": "@lint:storefront:ci --fix",
"lint:storefront": [
"npm run lint-fix --prefix src/Resources/app/storefront",
"cd src/Resources/app/storefront && ../../../../../../../src/Storefront/Resources/app/storefront/node_modules/.bin/stylelint --config ../../../../../../../src/Storefront/Resources/app/storefront/stylelint.config.js ./src/scss"
],
"lint:storefront:ci": [
"cd src/Resources/app/storefront && ../../../../../../../src/Storefront/Resources/app/storefront/node_modules/.bin/eslint --config ../../../../../../../src/Storefront/Resources/app/storefront/.eslintrc.js ./src",
"npm run lint --prefix src/Resources/app/storefront",
"cd src/Resources/app/storefront && ../../../../../../../src/Storefront/Resources/app/storefront/node_modules/.bin/stylelint --config ../../../../../../../src/Storefront/Resources/app/storefront/stylelint.config.js ./src/scss"
],
"phpunit": "../../../vendor/bin/phpunit",
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ parameters:
constantHassers: false

ignoreErrors:
- # ignore own deprecations
message: '#.*tag:v11.0.0 -.*#'

# We won't type all arrays/iterables for now
- '#no value type specified in iterable type#'

Expand Down
9 changes: 9 additions & 0 deletions src/Checkout/ExpressCheckout/ExpressCheckoutButtonData.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class ExpressCheckoutButtonData extends AbstractScriptData

protected string $cancelRedirectUrl;

/**
* @deprecated tag:v11.0.0 - Will be removed and is replaced by {@see self::fundingSources}
*/
protected bool $showPayLater;

/**
Expand Down Expand Up @@ -200,11 +203,17 @@ public function setCancelRedirectUrl(string $cancelRedirectUrl): void
$this->cancelRedirectUrl = $cancelRedirectUrl;
}

/**
* @deprecated tag:v11.0.0 - Will be removed and is replaced by {@see self::fundingSources}
*/
public function isShowPayLater(): bool
{
return $this->showPayLater;
}

/**
* @deprecated tag:v11.0.0 - Will be removed and is replaced by {@see self::fundingSources}
*/
public function setShowPayLater(bool $showPayLater): void
{
$this->showPayLater = $showPayLater;
Expand Down
25 changes: 24 additions & 1 deletion src/Checkout/ExpressCheckout/ExpressCheckoutSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use Swag\PayPal\Setting\Exception\PayPalSettingsInvalidException;
use Swag\PayPal\Setting\Service\SettingsValidationServiceInterface;
use Swag\PayPal\Setting\Settings;
use Swag\PayPal\Storefront\Data\Struct\AbstractScriptData;
use Swag\PayPal\Util\PaymentMethodUtil;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
Expand Down Expand Up @@ -313,11 +314,15 @@ private function getExpressCheckoutButtonData(
return null;
}

return $this->expressCheckoutDataService->buildExpressCheckoutButtonData(
$data = $this->expressCheckoutDataService->buildExpressCheckoutButtonData(
$event->getSalesChannelContext(),
$addProductToCart,
$event
);

$data?->setPageType($this->getPageType($event));

return $data;
}

private function checkSettings(SalesChannelContext $context, string $eventName): bool
Expand Down Expand Up @@ -362,4 +367,22 @@ private function expressOptionForEventEnabled(string $salesChannelId, string $ev
return false;
}
}

private function getPageType(ShopwareSalesChannelEvent $event): ?string
{
return match (true) {
$event instanceof ProductPageLoadedEvent,
$event instanceof QuickviewPageletLoadedEvent => AbstractScriptData::PAGE_TYPE_PRODUCT_DETAILS,
$event instanceof OffcanvasCartPageLoadedEvent => AbstractScriptData::PAGE_TYPE_MINI_CART,
$event instanceof CheckoutRegisterPageLoadedEvent => AbstractScriptData::PAGE_TYPE_CHECKOUT,
$event instanceof CheckoutCartPageLoadedEvent => AbstractScriptData::PAGE_TYPE_CART,
$event instanceof NavigationPageLoadedEvent,
$event instanceof CmsPageLoadedEvent,
$event instanceof SearchPageLoadedEvent,
$event instanceof GuestWishlistPageletLoadedEvent,
$event instanceof SwitchBuyBoxVariantEvent,
$event instanceof SalesChannelEntitySearchResultLoadedEvent => AbstractScriptData::PAGE_TYPE_PRODUCT_LISTING,
default => null,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ class PayPalExpressCheckoutDataService extends AbstractScriptDataService
public function __construct(
private readonly CartService $cartService,
LocaleCodeProvider $localeCodeProvider,
private readonly RouterInterface $router,
RouterInterface $router,
private readonly PaymentMethodUtil $paymentMethodUtil,
SystemConfigService $systemConfigService,
CredentialsUtilInterface $credentialsUtil,
private readonly CartPriceService $cartPriceService,
private readonly PayLaterMethodData $payLaterMethodData,
) {
parent::__construct($localeCodeProvider, $systemConfigService, $credentialsUtil);
parent::__construct($localeCodeProvider, $systemConfigService, $credentialsUtil, $router);
}

public function buildExpressCheckoutButtonData(
Expand Down
21 changes: 21 additions & 0 deletions src/Checkout/SalesChannel/AbstractClientTokenRoute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php declare(strict_types=1);
/*
* (c) shopware AG <info@shopware.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Swag\PayPal\Checkout\SalesChannel;

use Shopware\Core\Framework\Log\Package;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

#[Package('checkout')]
abstract class AbstractClientTokenRoute
{
abstract public function getDecorated(): AbstractClientTokenRoute;

abstract public function getClientToken(Request $request, SalesChannelContext $salesChannelContext): Response;
}
58 changes: 58 additions & 0 deletions src/Checkout/SalesChannel/ClientTokenRoute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php declare(strict_types=1);
/*
* (c) shopware AG <info@shopware.com>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Swag\PayPal\Checkout\SalesChannel;

use OpenApi\Attributes as OA;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Swag\PayPal\Checkout\TokenResponse;
use Swag\PayPal\RestApi\V1\Resource\TokenResource;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

#[Package('checkout')]
#[Route(defaults: ['_routeScope' => ['store-api']])]
class ClientTokenRoute extends AbstractClientTokenRoute
{
/**
* @internal
*/
public function __construct(
private readonly TokenResource $tokenResource,
) {
}

public function getDecorated(): AbstractClientTokenRoute
{
throw new DecorationPatternException(self::class);
}

#[OA\Post(
path: '/paypal/client-token',
operationId: 'paypalClientToken',
description: 'Retrieves a client ID token for the current sales channel',
tags: ['Store API', 'PayPal'],
responses: [new OA\Response(
response: Response::HTTP_OK,
description: 'Client ID token',
content: new OA\JsonContent(properties: [new OA\Property(
property: 'token',
type: 'string'
)])
)]
)]
#[Route(path: '/store-api/paypal/client-token', name: 'store-api.paypal.client-token', methods: ['POST'], defaults: ['_loginRequired' => true])]
public function getClientToken(Request $request, SalesChannelContext $salesChannelContext): Response
{
$clientToken = $this->tokenResource->getClientToken($salesChannelContext)->getAccessToken();

return new TokenResponse($clientToken);
}
}
2 changes: 2 additions & 0 deletions src/Checkout/SalesChannel/CustomerVaultTokenRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class CustomerVaultTokenRoute
{
/**
* @internal
*
* @deprecated tag:v11.0.0 - reason:remove-interface - Interface TokenResourceInterface will be replaced by TokenResource
*/
public function __construct(
private EntityRepository $vaultRepository,
Expand Down
Loading