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

MOL-245: PPE #705

Merged
merged 52 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
6fc14cd
MOL-245: Add PayPal Express
boxblinkracer Nov 20, 2023
8a76def
NTR: Squashed commit of the following:
Jan 25, 2024
9c434f4
MOL-245: refactor code
Feb 5, 2024
908ac79
MOL-245: reuse addresses
Feb 6, 2024
e622568
MOL-245: refactor buttons
Feb 9, 2024
912f6e2
NTR: Merge branch 'master' into users/vm/MOL-245-ppe
Feb 9, 2024
24484c7
MOL-245: PPE
Feb 13, 2024
4bd3e7f
MOL-245: refactor custom fields keys
Feb 13, 2024
c808b06
MOL-245: refactor custom fields
Feb 13, 2024
b1f13f8
MOL-245: refactor
Feb 13, 2024
1a92ecd
MOL-245: use quantity + fix 2nd attempt payment
Feb 13, 2024
2855dbe
MOL-245: fix csrf
Feb 13, 2024
79f55d5
MOL-245: fix customfields for first customer
Feb 13, 2024
b993ee8
MOL-245: fix config
Feb 13, 2024
21d29dc
MOL-245: add cypress ui tests
Feb 13, 2024
b9b26e7
MOL-245: setup a timer
Feb 14, 2024
d44b016
MOL-245: added release tag
Feb 16, 2024
d825d3b
NTR: Squashed commit of the following:
Apr 23, 2024
2d29e0f
NTR: update PPE
Apr 23, 2024
0186792
NTR: fix guest account
Apr 23, 2024
049d909
NTR: Merge branch 'master' into users/vm/MOL-245-ppe
Apr 23, 2024
31939b0
NTR: update composer
Apr 23, 2024
77f655a
NTR: fix ppe tests
Apr 24, 2024
f18813a
NTR: Merge branch 'master' into users/vm/MOL-245-ppe
Apr 24, 2024
6c85b51
NTR: update
Apr 24, 2024
83c1cc1
NTR: Merge master into PPE
May 21, 2024
bb05df9
NTR: Merge branch 'master' into users/vm/MOL-245-ppe
May 21, 2024
2f65e19
NTR: Cs fix
May 21, 2024
e18b7aa
NTR: fix subscriber
May 21, 2024
9ef589c
NTR: do not check paypal redirect, api key is not set in pipeline
May 21, 2024
5fa2200
NTR: Merge branch 'master' into users/vm/MOL-245-ppe
Sep 11, 2024
cbc545c
NTR: fixed config
Sep 12, 2024
a8241cd
NTR: Merge branch 'master' into users/vm/MOL-245-ppe
Oct 9, 2024
f0df9d1
NTR: update mollie api to 2.73
Oct 9, 2024
dee05a1
NTR: CS Fix
Oct 9, 2024
284fa4d
NTR: Fix cypress
Oct 9, 2024
1ece0b3
NTR: switch to method Details
Oct 10, 2024
f7fa76f
NTR: add onfig over env
Oct 11, 2024
1ca3581
NTR: fix tests
Oct 11, 2024
4297f60
NTR: fix tests
Oct 11, 2024
1759533
NTR: added more logs in PPE
Oct 11, 2024
668fe97
NTR: fix settings
Oct 14, 2024
48c255f
NTR: use express buttons as class selector
Oct 14, 2024
d7b5b55
NTR: remove old klarna from tests
Oct 15, 2024
0115c17
NTR: Cs fix
Oct 15, 2024
baf5c5d
NTR: Merge branch 'master' into users/vm/MOL-245-ppe
Oct 17, 2024
6673e0e
NTR: display privacy note checkbox
Oct 17, 2024
38e1cf6
NTR: refactored JS
Oct 21, 2024
c1c4939
NTR: accepted data protection serverside check
Oct 21, 2024
490d600
NTR: update backup cart
Oct 21, 2024
8fa9706
NTR: Fix ppe cypress tests
Oct 21, 2024
8afe095
NTR: refactor apple pay
Oct 22, 2024
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
1 change: 1 addition & 0 deletions .github/actions/run-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ runs:
docker exec shop bash -c 'sed -i "s/APP_ENV=dev/APP_ENV=prod/g" /var/www/html/.env' || true;
# we have to enable cypress mode in our shop, this helps us to create subscriptions without webhooks
docker exec shop bash -c "echo "MOLLIE_CYPRESS_MODE=1" >> /var/www/html/.env" || true;
docker exec shop bash -c "echo "MOLLIE_PAYPAL_EXPRESS_BETA=1" >> /var/www/html/.env" || true;

# --------------------------------------------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_pipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ jobs:
MOLLIE_APIKEY_TEST: ${{ secrets.MOLLIE_APIKEY_TEST }}
# -------------------------------------------
RUN_CYPRESS: true
TESTRAIL: true
TESTRAIL: false
TESTRAIL_DOMAIN: ${{ secrets.TESTRAIL_DOMAIN }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
TESTRAIL_PASSWORD: ${{ secrets.TESTRAIL_PASSWORD }}
2 changes: 1 addition & 1 deletion .github/workflows/nightly_pipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ jobs:
MOLLIE_APIKEY_TEST: ${{ secrets.MOLLIE_APIKEY_TEST }}
# -------------------------------------------
RUN_CYPRESS: true
TESTRAIL: true
TESTRAIL: false
TESTRAIL_DOMAIN: ${{ secrets.TESTRAIL_DOMAIN }}
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
TESTRAIL_PASSWORD: ${{ secrets.TESTRAIL_PASSWORD }}
71 changes: 44 additions & 27 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ NODE_VERSION:=$(shell node -v)


help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@printf "\033[33mInstallation:%-30s\033[0m %s\n"
@grep -E '^[a-zA-Z_-]+:.*?##1 .*$$' $(firstword $(MAKEFILE_LIST)) | awk 'BEGIN {FS = ":.*?##1 "}; {printf "\033[33m - %-30s\033[0m %s\n", $$1, $$2}'
@echo "---------------------------------------------------------------------------------------------------------"
@printf "\033[36mDevelopment:%-30s\033[0m %s\n"
@grep -E '^[a-zA-Z_-]+:.*?##2 .*$$' $(firstword $(MAKEFILE_LIST)) | awk 'BEGIN {FS = ":.*?##2 "}; {printf "\033[36m - %-30s\033[0m %s\n", $$1, $$2}'
@echo "---------------------------------------------------------------------------------------------------------"
@printf "\033[35mDevOps:%-30s\033[0m %s\n"
@grep -E '^[a-zA-Z_-]+:.*?##3 .*$$' $(firstword $(MAKEFILE_LIST)) | awk 'BEGIN {FS = ":.*?##3 "}; {printf "\033[35m - %-30s\033[0m %s\n", $$1, $$2}'

# ------------------------------------------------------------------------------------------------------------

prod: ## Installs all production dependencies
prod: ##1 Installs all production dependencies
# do not switch to production composer PROD, otherwise it would
# also install shopware in here -> we just need it for the release composer.json file
# so just switch to our dev dependency variant
Expand All @@ -27,7 +34,7 @@ prod: ## Installs all production dependencies
cd src/Resources/app/administration && npm install --omit=dev
cd src/Resources/app/storefront && npm install --omit=dev

dev: ## Installs all dev dependencies
dev: ##1 Installs all dev dependencies
php switch-composer.php dev
@composer validate
# we have to run update in dev mode, because dev dependencies are not compatible with newer php version. should be updated when support for 6.4 is dropped
Expand All @@ -36,10 +43,10 @@ dev: ## Installs all dev dependencies
cd src/Resources/app/storefront && npm install
curl -1sLf 'https://dl.cloudsmith.io/public/friendsofshopware/stable/setup.deb.sh' | sudo -E bash && sudo apt install -y --allow-downgrades shopware-cli=0.3.18

install: ## [deprecated] Installs all production dependencies. Please use "make prod" now.
install: ##1 [deprecated] Installs all production dependencies. Please use "make prod" now.
@make prod -B

clean: ## Cleans all dependencies and files
clean: ##1 Cleans all dependencies and files
rm -rf vendor/*
# ------------------------------------------------------
rm -rf .reports | true
Expand All @@ -52,7 +59,7 @@ clean: ## Cleans all dependencies and files
rm -rf ./src/Resources/public/administration
rm -rf ./src/Resources/public/mollie-payments.js

build: ## Installs the plugin, and builds the artifacts using the Shopware build commands.
build: ##3 Installs the plugin, and builds the artifacts using the Shopware build commands.
# -----------------------------------------------------
# CUSTOM WEBPACK
php switch-composer.php dev
Expand All @@ -68,83 +75,93 @@ build: ## Installs the plugin, and builds the artifacts using the Shopware build
cd ../../.. && php bin/console --no-debug assets:install
cd ../../.. && php bin/console --no-debug cache:clear

fixtures: ## Installs all available testing fixtures of the Mollie plugin
fixtures: ##3 Installs all available testing fixtures of the Mollie plugin
cd ../../.. && php bin/console --no-debug cache:clear
cd ../../.. && php bin/console --no-debug fixture:load:group mollie

# ------------------------------------------------------------------------------------------------------------

phpcheck: ## Starts the PHP syntax checks
phpcheck: ##2 Starts the PHP syntax checks
@find . -name '*.php' -not -path "./vendor/*" -not -path "./tests/*" | xargs -n 1 -P4 php -l

phpmin: ## Starts the PHP compatibility checks
phpmin: ##2 Starts the PHP compatibility checks
@php vendor/bin/phpcs -p --standard=PHPCompatibility --extensions=php --runtime-set testVersion 7.4 ./src

csfix: ## Starts the PHP CS Fixer
csfix: ##2 Starts the PHP CS Fixer
@PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer fix --config=./.php_cs.php --dry-run

stan: ## Starts the PHPStan Analyser
stan: ##2 Starts the PHPStan Analyser
@php vendor/bin/phpstan analyse -c ./.phpstan.neon

phpunit: ## Starts all PHPUnit Tests
phpunit: ##2 Starts all PHPUnit Tests
@XDEBUG_MODE=coverage php vendor/bin/phpunit --configuration=phpunit.xml --coverage-html ./.reports/phpunit/coverage

infection: ## Starts all Infection/Mutation tests
infection: ##2 Starts all Infection/Mutation tests
@XDEBUG_MODE=coverage php vendor/bin/infection --configuration=./.infection.json --log-verbosity=all --debug

insights: ## Starts the PHPInsights Analyser
insights: ##2 Starts the PHPInsights Analyser
@php vendor/bin/phpinsights analyse --no-interaction

jest: ## Starts all Jest tests
jest: ##2 Starts all Jest tests
cd ./src/Resources/app/administration && ./node_modules/.bin/jest --config=.jest.config.js --coverage
cd ./src/Resources/app/storefront && ./node_modules/.bin/jest --config=.jest.config.js --coverage

stryker: ## Starts the Stryker Jest Mutation Tests
stryker: ##2 Starts the Stryker Jest Mutation Tests
cd ./src/Resources/app/administration && ./node_modules/.bin/stryker run .stryker.conf.json
@# Storefront has no tests at the moment
@# cd ./src/Resources/app/storefront && ./node_modules/.bin/stryker run .stryker.conf.json

eslint: ## Starts the ESLinter
eslint: ##2 Starts the ESLinter
ifndef mode
cd ./src/Resources/app/administration && ./node_modules/.bin/eslint --config ./.eslintrc.json ./src
cd ./src/Resources/app/storefront && ./node_modules/.bin/eslint --config ./.eslintrc.json ./src
endif
ifeq ($(mode), no-dry-run)
cd ./src/Resources/app/administration && ./node_modules/.bin/eslint --config ./.eslintrc.json ./src --fix
cd ./src/Resources/app/storefront && ./node_modules/.bin/eslint --config ./.eslintrc.json ./src --fix
endif




stylelint: ## Starts the Stylelinter

stylelint: ##2 Starts the Stylelinter
cd ./src/Resources/app/administration && ./node_modules/.bin/stylelint --allow-empty-input ./src/**/*.scss
cd ./src/Resources/app/storefront && ./node_modules/.bin/stylelint --allow-empty-input ./src/**/*.scss

configcheck: ## Tests and verifies the plugin configuration file
configcheck: ##2 Tests and verifies the plugin configuration file
cd ./tests/Custom && php verify-plugin-config.php

# ------------------------------------------------------------------------------------------------------------

snippetcheck: ## Tests and verifies all plugin snippets
snippetcheck: ##2 Tests and verifies all plugin snippets
php vendor/bin/phpunuhi validate --configuration=./.phpunuhi.xml --report-format=junit --report-output=./.phpunuhi/junit.xml

snippetexport: ## Exports all snippets
snippetexport: ##2 Exports all snippets
php vendor/bin/phpunuhi export --configuration=./.phpunuhi.xml --dir=./.phpunuhi

snippetimport: ## Imports the provided snippet set [set=xyz file=xz.csv]
snippetimport: ##2 Imports the provided snippet set [set=xyz file=xz.csv]
php vendor/bin/phpunuhi import --configuration=./.phpunuhi.xml --set=$(set) --file=$(file) --intent=1

# ------------------------------------------------------------------------------------------------------------

pr: ## Prepares everything for a Pull Request
pr: ##2 Prepares everything for a Pull Request
@PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer fix --config=./.php_cs.php
@make phpcheck -B
@make phpmin -B
@make stan -B
@make phpunit -B
@make infection -B
@make jest -B
@make stryker -B
@make eslint -B
@make eslint mode=no-dry-run -B
@make stylelint -B
@make configcheck -B
@make snippetcheck -B
@make stryker -B
@make infection -B

# -------------------------------------------------------------------------------------------------

release: ## Builds a PROD version and creates a ZIP file in plugins/.build.
release: ##3 Builds a PROD version and creates a ZIP file in plugins/.build.
ifneq (,$(findstring v12,$(NODE_VERSION)))
$(warning Attention, reqruires Node v14 or higher to build a release!)
@exit 1
Expand Down
31 changes: 14 additions & 17 deletions src/Components/ApplePayDirect/ApplePayDirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Kiener\MolliePayments\Service\OrderService;
use Kiener\MolliePayments\Service\SettingsService;
use Kiener\MolliePayments\Service\ShopService;
use Kiener\MolliePayments\Struct\Address\AddressStruct;
use Mollie\Api\Exceptions\ApiException;
use Shopware\Core\Checkout\Cart\Cart;
use Shopware\Core\Checkout\Cart\LineItem\LineItemCollection;
Expand Down Expand Up @@ -251,7 +252,7 @@ public function addProduct(string $productId, int $quantity, SalesChannelContext
{
# if we already have a backup cart, then do NOT backup again.
# because this could backup our temp. apple pay cart
if (!$this->cartBackupService->isBackupExisting($context)) {
if (! $this->cartBackupService->isBackupExisting($context)) {
$this->cartBackupService->backupCart($context);
}

Expand Down Expand Up @@ -348,7 +349,7 @@ public function restoreCart(SalesChannelContext $context): void
* @throws \Exception
* @return SalesChannelContext
*/
public function prepareCustomer(string $firstname, string $lastname, string $email, string $street, string $zipcode, string $city, string $countryCode, string $phone, string $paymentToken, int $acceptedDataProtection, SalesChannelContext $context): SalesChannelContext
public function prepareCustomer(string $firstname, string $lastname, string $email, string $street, string $zipcode, string $city, string $countryCode, string $phone, string $paymentToken, ?int $acceptedDataProtection, SalesChannelContext $context): SalesChannelContext
{
if (empty($paymentToken)) {
throw new \Exception('PaymentToken not found!');
Expand All @@ -359,28 +360,24 @@ public function prepareCustomer(string $firstname, string $lastname, string $ema

# if we are not logged in,
# then we have to create a new guest customer for our express order
if (!$this->customerService->isCustomerLoggedIn($context)) {
$customer = $this->customerService->createApplePayDirectCustomerIfNotExists(
$firstname,
$lastname,
$email,
$phone,
$street,
$zipcode,
$city,
$countryCode,
$acceptedDataProtection,
$context
if (! $this->customerService->isCustomerLoggedIn($context)) {
$address = new AddressStruct($firstname, $lastname, $email, $street, '', $zipcode, $city, $countryCode, $phone);

$customer = $this->customerService->createGuestAccount(
$address,
$applePayID,
$context,
$acceptedDataProtection
);

if (!$customer instanceof CustomerEntity) {
if (! $customer instanceof CustomerEntity) {
throw new \Exception('Error when creating customer!');
}

# now start the login of our customer.
# Our SalesChannelContext will be correctly updated after our
# forward to the finish-payment page.
$this->customerService->customerLogin($customer, $context);
$this->customerService->loginCustomer($customer, $context);
}

# also (always) update our payment method to use Apple Pay for our cart
Expand Down Expand Up @@ -455,7 +452,7 @@ public function createPayment(OrderEntity $order, string $shopwareReturnUrl, str
$transactions = $order->getTransactions();
$transaction = $transactions->last();

if (!$transaction instanceof OrderTransactionEntity) {
if (! $transaction instanceof OrderTransactionEntity) {
throw new \Exception('Created Apple Pay Direct order has not OrderTransaction!');
}

Expand Down
Loading
Loading