Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PISHPS-329 UrlParsingService - matching trackign code from tracking url #798

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .github/workflows/ci_pipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ jobs:
fail-fast: false
matrix:
include:
- shopware: '6.6.4.1'
- shopware: '6.6.4.0'
php: '8.2'
- shopware: '6.5.8.8'
php: '8.2'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_pipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ jobs:
fail-fast: false
matrix:
include:
- shopware: '6.6.4.1'
- shopware: '6.6.4.0'
php: '8.2'
- shopware: '6.5.8.8'
php: '8.2'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_pipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ jobs:
fail-fast: false
matrix:
include:
- shopware: '6.6.4.1'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert shopware versions in the pipelines, you have the old ones

- shopware: '6.6.4.0'
php: '8.2'
- shopware: '6.5.8.8'
php: '8.2'
Expand Down
8 changes: 7 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ ifneq (,$(findstring v12,$(NODE_VERSION)))
endif
cd .. && rm -rf ./.build/MolliePayments* && mkdir -p ./.build
# -------------------------------------------------------------------------------------------------
@echo "UPDATE SHOPWARE DEPENDENCIES"
php switch-composer.php dev
composer update shopware/core
composer update shopware/storefront
composer update shopware/administration
# -------------------------------------------------------------------------------------------------
@echo "INSTALL DEV DEPENDENCIES AND BUILD"
make clean -B
make dev -B
Expand All @@ -168,7 +174,7 @@ endif
php switch-composer.php prod
# -------------------------------------------------------------------------------------------------
@echo "CREATE ZIP FILE"
cd .. && zip -qq -r -0 ./.build/MolliePayments.zip MolliePayments/* -x '*/vendor/*' '*.editorconfig' '*.git*' '*.reports*' '*/.idea*' '*/tests*' '*/node_modules*' '*/makefile' '*.DS_Store' '*/.shopware-extension.yml' '*/switch-composer.php' '*/phpunit.xml' '*/.phpunuhi.xml' '*/.infection.json' '*/phpunit.autoload.php' '*/.phpstan*' '*/.php_cs.php' '*/phpinsights.php'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wron merge, add vendor again

cd .. && zip -qq -r -0 ./.build/MolliePayments.zip MolliePayments/* -x '*.editorconfig' '*.git*' '*.reports*' '*/.idea*' '*/tests*' '*/node_modules*' '*/makefile' '*.DS_Store' '*/.shopware-extension.yml' '*/switch-composer.php' '*/phpunit.xml' '*/.phpunuhi.xml' '*/.infection.json' '*/phpunit.autoload.php' '*/.phpstan*' '*/.php_cs.php' '*/phpinsights.php'
# -------------------------------------------------------------------------------------------------
@echo "RESET COMPOSER.JSON"
php switch-composer.php dev
Expand Down
6 changes: 3 additions & 3 deletions polyfill/Shopware/Core/Checkout/Payment/PaymentException.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php declare(strict_types=1);

namespace Shopware\Core\Checkout\Payment;
use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentFinalizeException;
use Shopware\Core\Checkout\Payment\Exception\CustomerCanceledAsyncPaymentException;

if (class_exists(PaymentException::class) && !class_exists(AsyncPaymentFinalizeException::class) && !class_exists(CustomerCanceledAsyncPaymentException::class)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong merge, add the statements again

if (class_exists(PaymentException::class)) {
return;
}

use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentFinalizeException;
use Shopware\Core\Checkout\Payment\Exception\CustomerCanceledAsyncPaymentException;

class PaymentException extends \Exception
{
Expand Down
67 changes: 8 additions & 59 deletions src/Components/ApplePayDirect/ApplePayDirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

namespace Kiener\MolliePayments\Components\ApplePayDirect;

use Kiener\MolliePayments\Components\ApplePayDirect\Exceptions\ApplePayDirectDomainAllowListCanNotBeEmptyException;
use Kiener\MolliePayments\Components\ApplePayDirect\Exceptions\ApplePayDirectDomainNotInAllowListException;
use Kiener\MolliePayments\Components\ApplePayDirect\Gateways\ApplePayDirectDomainAllowListGateway;
use Kiener\MolliePayments\Components\ApplePayDirect\Models\ApplePayCart;
use Kiener\MolliePayments\Components\ApplePayDirect\Services\ApplePayDirectDomainSanitizer;
use Kiener\MolliePayments\Components\ApplePayDirect\Services\ApplePayDomainVerificationService;
use Kiener\MolliePayments\Components\ApplePayDirect\Services\ApplePayFormatter;
use Kiener\MolliePayments\Components\ApplePayDirect\Services\ApplePayShippingBuilder;
Expand Down Expand Up @@ -109,16 +105,6 @@ class ApplePayDirect
*/
private $repoOrderAdresses;

/**
* @var ApplePayDirectDomainAllowListGateway
*/
private $applePayDirectDomainAllowListGateway;

/**
* @var ApplePayDirectDomainSanitizer
*/
private $domainSanitizer;


/**
* @param ApplePayDomainVerificationService $domainFileDownloader
Expand All @@ -135,10 +121,8 @@ class ApplePayDirect
* @param ShopService $shopService
* @param OrderService $orderService
* @param OrderAddressRepositoryInterface $repoOrderAdresses
* @param ApplePayDirectDomainAllowListGateway $domainAllowListGateway
* @param ApplePayDirectDomainSanitizer $domainSanitizer
*/
public function __construct(ApplePayDomainVerificationService $domainFileDownloader, ApplePayPayment $paymentHandler, MolliePaymentDoPay $molliePayments, CartServiceInterface $cartService, ApplePayFormatter $formatter, ApplePayShippingBuilder $shippingBuilder, SettingsService $pluginSettings, CustomerService $customerService, PaymentMethodRepository $repoPaymentMethods, CartBackupService $cartBackupService, MollieApiFactory $mollieApiFactory, ShopService $shopService, OrderService $orderService, OrderAddressRepositoryInterface $repoOrderAdresses, ApplePayDirectDomainAllowListGateway $domainAllowListGateway, ApplePayDirectDomainSanitizer $domainSanitizer)
public function __construct(ApplePayDomainVerificationService $domainFileDownloader, ApplePayPayment $paymentHandler, MolliePaymentDoPay $molliePayments, CartServiceInterface $cartService, ApplePayFormatter $formatter, ApplePayShippingBuilder $shippingBuilder, SettingsService $pluginSettings, CustomerService $customerService, PaymentMethodRepository $repoPaymentMethods, CartBackupService $cartBackupService, MollieApiFactory $mollieApiFactory, ShopService $shopService, OrderService $orderService, OrderAddressRepositoryInterface $repoOrderAdresses)
{
$this->domainFileDownloader = $domainFileDownloader;
$this->paymentHandler = $paymentHandler;
Expand All @@ -154,8 +138,6 @@ public function __construct(ApplePayDomainVerificationService $domainFileDownloa
$this->shopService = $shopService;
$this->orderService = $orderService;
$this->repoOrderAdresses = $repoOrderAdresses;
$this->applePayDirectDomainAllowListGateway = $domainAllowListGateway;
$this->domainSanitizer = $domainSanitizer;
}


Expand Down Expand Up @@ -279,16 +261,18 @@ public function setShippingMethod(string $shippingMethodID, SalesChannelContext

/**
* @param string $validationURL
* @param string $domain
* @param SalesChannelContext $context
* @throws ApiException
* @throws ApplePayDirectDomainAllowListCanNotBeEmptyException
* @throws ApplePayDirectDomainNotInAllowListException
* @return string
*/
public function createPaymentSession(string $validationURL, string $domain, SalesChannelContext $context): string
public function createPaymentSession(string $validationURL, SalesChannelContext $context): string
{
$domain = $this->getValidDomain($domain, $context);
# make sure to get rid of any http prefixes or
# also any sub shop slugs like /de or anything else
# that would NOT work with Mollie and Apple Pay!
$domainExtractor = new DomainExtractor();
$domain = $domainExtractor->getCleanDomain($this->shopService->getShopUrl(true));

# we always have to use the LIVE api key for
# our first domain validation for Apple Pay!
# the rest will be done with our test API key (if test mode active), or also Live API key (no test mode)
Expand Down Expand Up @@ -523,39 +507,4 @@ private function buildApplePayCart(Cart $cart): ApplePayCart

return $appleCart;
}

/**
* This method will return a valid domain if not provided by the user it will use the shop domain
*
* @param SalesChannelContext $context
* @param string $domain
* @throws ApplePayDirectDomainAllowListCanNotBeEmptyException
* @throws ApplePayDirectDomainNotInAllowListException
* @return string
*/
private function getValidDomain(string $domain, SalesChannelContext $context): string
{
# if we have no domain, then we need to use the shop domain
if (empty($domain)) {
# make sure to get rid of any http prefixes or
# also any sub shop slugs like /de or anything else
# that would NOT work with Mollie and Apple Pay!
$domainExtractor = new DomainExtractor();
return $domainExtractor->getCleanDomain($this->shopService->getShopUrl(true));
}

$allowList = $this->applePayDirectDomainAllowListGateway->getAllowList($context);

if ($allowList->isEmpty()) {
throw new ApplePayDirectDomainAllowListCanNotBeEmptyException();
}

$sanitizedDomain = $this->domainSanitizer->sanitizeDomain($domain);

if ($allowList->contains($sanitizedDomain) === false) {
throw new ApplePayDirectDomainNotInAllowListException($sanitizedDomain);
}

return $sanitizedDomain;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.