diff --git a/makefile b/makefile index e5d53fc5e..91afda248 100644 --- a/makefile +++ b/makefile @@ -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 @@ -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 --production -dev: ## Installs all dev dependencies +dev: ##1 Installs all dev dependencies php switch-composer.php dev @composer validate @composer install @@ -35,10 +42,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 shopware-cli -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 @@ -51,7 +58,7 @@ clean: ## Cleans all dependencies and files rm -rf ./src/Resources/public/administration rm -rf ./src/Resources/public/molllie-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. php switch-composer.php prod cd ../../.. && export NODE_OPTIONS=--openssl-legacy-provider && shopware-cli extension build custom/plugins/MolliePayments php switch-composer.php dev @@ -65,67 +72,67 @@ 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.2 ./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 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 -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 @@ -141,7 +148,7 @@ pr: ## Prepares everything for a Pull Request # ------------------------------------------------------------------------------------------------- -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 diff --git a/src/Components/ApplePayDirect/ApplePayDirect.php b/src/Components/ApplePayDirect/ApplePayDirect.php index bcb490c93..ad169b730 100644 --- a/src/Components/ApplePayDirect/ApplePayDirect.php +++ b/src/Components/ApplePayDirect/ApplePayDirect.php @@ -351,7 +351,7 @@ 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->createApplePayDirectCustomer( + $customer = $this->customerService->createGuestAccount( $firstname, $lastname, $email, @@ -371,7 +371,7 @@ public function prepareCustomer(string $firstname, string $lastname, string $ema # 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 diff --git a/src/Components/PaypalExpress/PayPalExpress.php b/src/Components/PaypalExpress/PayPalExpress.php new file mode 100644 index 000000000..84ae14156 --- /dev/null +++ b/src/Components/PaypalExpress/PayPalExpress.php @@ -0,0 +1,189 @@ +repoPaymentMethods = $repoPaymentMethods; + $this->mollieApiFactory = $mollieApiFactory; + $this->priceBuilder = $priceBuilder; + $this->urlBuilder = $urlBuilder; + $this->customerService = $customerService; + $this->cartService = $cartService; + } + + + /** + * @param SalesChannelContext $context + * @return bool + */ + public function isPaypalExpressEnabled(SalesChannelContext $context): bool + { + try { + $methodID = $this->getActivePaypalExpressID($context); + + return (!empty($methodID)); + } catch (\Exception $ex) { + return false; + } + } + + /** + * @param SalesChannelContext $context + * @return string + * @throws \Exception + */ + public function getActivePaypalExpressID(SalesChannelContext $context): string + { + return $this->repoPaymentMethods->getActivePaypalExpressID($context->getContext()); + } + + public function getActivePaypalID(SalesChannelContext $context) + { + return $this->repoPaymentMethods->getActivePaypalID($context->getContext()); + + } + + + /** + * @param Cart $cart + * @param SalesChannelContext $context + * @return string + * @throws \Mollie\Api\Exceptions\ApiException + */ + public function startSession(Cart $cart, SalesChannelContext $context): string + { + $mollie = $this->mollieApiFactory->getClient($context->getSalesChannelId()); + + $params = [ + 'method' => 'paypal', + 'methodDetails' => [ + 'checkoutFlow' => 'express', + ], + 'amount' => $this->priceBuilder->build( + $cart->getPrice()->getTotalPrice(), + $context->getCurrency()->getIsoCode() + ), + 'description' => 'test', + # 'redirectUrl' => $this->urlBuilder->buildPaypalExpressRedirectUrl(), + # 'cancelUrl' => $this->urlBuilder->buildPaypalExpressCancelUrl(), + ]; + + $session = $mollie->sessions->create($params); + + $redirectUrl = $session->getRedirectUrl(); + + if (empty($redirectUrl)) { + return ''; + # throw new \Exception('Paypal Express RedirectURL is empty! Cannot proceed'); + } + + return $redirectUrl; + } + + + /** + * @param string $firstname + * @param string $lastname + * @param string $email + * @param string $street + * @param string $zipcode + * @param string $city + * @param string $countryCode + * @param string $paymentToken + * @param SalesChannelContext $context + * @return SalesChannelContext + * @throws \Exception + */ + public function prepareCustomer(string $firstname, string $lastname, string $email, string $street, string $zipcode, string $city, string $countryCode, string $paymentToken, SalesChannelContext $context): SalesChannelContext + { + if (empty($paymentToken)) { + throw new \Exception('PaymentToken not found!'); + } + + + $paypalExpressId = $this->getActivePaypalExpressID($context); + + # 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->createGuestAccount( + $firstname, + $lastname, + $email, + '', + $street, + $zipcode, + $city, + $countryCode, + $paypalExpressId, + $context + ); + + 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->loginCustomer($customer, $context); + } + + # also (always) update our payment method to use Apple Pay for our cart + return $this->cartService->updatePaymentMethod($context, $paypalExpressId); + } + + +} diff --git a/src/Controller/Storefront/PaypalExpress/PaypalExpressControllerBase.php b/src/Controller/Storefront/PaypalExpress/PaypalExpressControllerBase.php new file mode 100644 index 000000000..abd4cbcb0 --- /dev/null +++ b/src/Controller/Storefront/PaypalExpress/PaypalExpressControllerBase.php @@ -0,0 +1,169 @@ +paypalExpress = $paypalExpress; + $this->cartService = $cartService; + $this->router = $router; + $this->customerService = $customerService; + } + + + /** + * @Route("/mollie/paypal-express/paypal-id", defaults={"csrf_protected"=true}, name="frontend.mollie.paypal.id", options={"seo"="false"}, methods={"GET"}) + * + * @param SalesChannelContext $context + * @return JsonResponse + */ + public function getPaypalID(SalesChannelContext $context): JsonResponse + { + try { + $id = $this->paypalExpress->getActivePaypalID($context); + + return new JsonResponse([ + 'id' => $id, + ]); + } catch (\Throwable $ex) { + # ! WE DO NOT LOG IN HERE! + # otherwise we would always get logs if its just not enabled + # so this is either a valid response or invalid one...that's it + + return new JsonResponse([ + 'id' => 'not-found', + ]); + } + } + + + /** + * @Route("/mollie/paypal-express/paypal-express-id", defaults={"csrf_protected"=true}, name="frontend.mollie.paypal-express.id", options={"seo"="false"}, methods={"GET"}) + * + * @param SalesChannelContext $context + * @return JsonResponse + */ + public function getPaypalExpressID(SalesChannelContext $context): JsonResponse + { + try { + $id = $this->paypalExpress->getActivePaypalExpressID($context); + + return new JsonResponse([ + 'id' => $id, + ]); + } catch (\Throwable $ex) { + # ! WE DO NOT LOG IN HERE! + # otherwise we would always get logs if its just not enabled + # so this is either a valid response or invalid one...that's it + + return new JsonResponse([ + 'id' => 'not-found', + ]); + } + } + + /** + * @Route("/mollie/paypal-express/start", defaults={"csrf_protected"=true}, name="frontend.mollie.paypal-express.start", options={"seo"="false"}, methods={"GET"}) + * + * @param SalesChannelContext $context + * @return Response + * @throws \Mollie\Api\Exceptions\ApiException + */ + public function startCheckout(SalesChannelContext $context): Response + { + $cart = $this->cartService->getCalculatedMainCart($context); + + $url = $this->paypalExpress->startSession($cart, $context); + + $url = '/mollie/paypal-express/finish'; + + return new RedirectResponse($url); + } + + /** + * @Route("/mollie/paypal-express/finish", defaults={"csrf_protected"=true}, name="frontend.mollie.paypal-express.finish", options={"seo"="false"}, methods={"GET"}) + * + * @param SalesChannelContext $context + * @return Response + */ + public function finishCheckout(SalesChannelContext $context): Response + { + # register account + $newContext = $this->paypalExpress->prepareCustomer( + 'Mollie', + 'Mollie', + 'cd@dasistweb.de', + 'test', + 'test', + 'test', + 'DE', + 'token-123', + $context + ); + + + /** @var CustomerEntity $customer */ + $customer = $this->customerService->getCustomer( + $newContext->getCustomerId(), + $newContext->getContext() + ); + + $this->customerService->setPaypalExpress($customer, $context->getContext()); + + # redirect to confirm page + $returnUrl = $this->getCheckoutConfirmPage($this->router); + + return new RedirectResponse($returnUrl); + } + +} \ No newline at end of file diff --git a/src/Controller/Storefront/PaypalExpress/Sw6/PaypalExpressController.php b/src/Controller/Storefront/PaypalExpress/Sw6/PaypalExpressController.php new file mode 100644 index 000000000..a600606d8 --- /dev/null +++ b/src/Controller/Storefront/PaypalExpress/Sw6/PaypalExpressController.php @@ -0,0 +1,14 @@ + $orderData + * @param OrderEntity $orderEntity + * @param SalesChannelContext $salesChannelContext + * @param CustomerEntity $customer + * @return array + */ + public function processPaymentMethodSpecificParameters(array $orderData, OrderEntity $orderEntity, SalesChannelContext $salesChannelContext, CustomerEntity $customer): array + { + return $orderData; + } + +} diff --git a/src/Repository/PaymentMethod/PaymentMethodRepository.php b/src/Repository/PaymentMethod/PaymentMethodRepository.php index 4eed03162..d66a57a4c 100644 --- a/src/Repository/PaymentMethod/PaymentMethodRepository.php +++ b/src/Repository/PaymentMethod/PaymentMethodRepository.php @@ -2,7 +2,10 @@ namespace Kiener\MolliePayments\Repository\PaymentMethod; +use Kiener\MolliePayments\Components\PaypalExpress\PayPalExpress; use Kiener\MolliePayments\Handler\Method\ApplePayPayment; +use Kiener\MolliePayments\Handler\Method\PayPalExpressPayment; +use Kiener\MolliePayments\Handler\Method\PayPalPayment; use Shopware\Core\Framework\Context; use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository; use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent; @@ -59,8 +62,8 @@ public function search(Criteria $criteria, Context $context): EntitySearchResult /** * @param Context $context - * @throws \Exception * @return string + * @throws \Exception */ public function getActiveApplePayID(Context $context): string { @@ -77,4 +80,41 @@ public function getActiveApplePayID(Context $context): string return (string)$paymentMethods[0]; } + + /** + * @param Context $context + * @return string + * @throws \Exception + */ + public function getActivePaypalExpressID(Context $context): string + { + $criteria = new Criteria(); + $criteria->addFilter(new EqualsFilter('handlerIdentifier', PayPalExpressPayment::class)); + $criteria->addFilter(new EqualsFilter('active', true)); + + /** @var array $paymentMethods */ + $paymentMethods = $this->repoPaymentMethods->searchIds($criteria, $context)->getIds(); + + if (count($paymentMethods) <= 0) { + throw new \Exception('Payment Method PayPal Express not found in system'); + } + + return (string)$paymentMethods[0]; + } + + public function getActivePaypalID(Context $context) + { + $criteria = new Criteria(); + $criteria->addFilter(new EqualsFilter('handlerIdentifier', PayPalPayment::class)); + $criteria->addFilter(new EqualsFilter('active', true)); + + /** @var array $paymentMethods */ + $paymentMethods = $this->repoPaymentMethods->searchIds($criteria, $context)->getIds(); + + if (count($paymentMethods) <= 0) { + throw new \Exception('Payment Method PayPal Express not found in system'); + } + + return (string)$paymentMethods[0]; + } } diff --git a/src/Resources/app/storefront/src/mollie-payments/plugins/paypal-express-payment-method.plugin.js b/src/Resources/app/storefront/src/mollie-payments/plugins/paypal-express-payment-method.plugin.js new file mode 100644 index 000000000..71f854b8b --- /dev/null +++ b/src/Resources/app/storefront/src/mollie-payments/plugins/paypal-express-payment-method.plugin.js @@ -0,0 +1,112 @@ +import Plugin from '@shopware-storefront-sdk/plugin-system/plugin.class'; +import HttpClient from '../services/HttpClient'; + +export default class PaypalExpressPaymentMethodPlugin extends Plugin { + + /** + * + */ + init() { + + const me = this; + + const hideAlways = this.options.hideAlways; + const isUsed = this.options.isUsed; + const shopUrl = this.getShopUrl(); + + + console.log(isUsed); + + // support for >= Shopware 6.4 + // we have to find the dynamic ID and use that + // one as a selector to hide it + const client = new HttpClient(); + + if (isUsed) { + client.get( + shopUrl + '/mollie/paypal-express/paypal-id', + (data) => { + me.hidePaypalExpress('#paymentMethod' + data.id); + } + ); + } else { + client.get( + shopUrl + '/mollie/paypal-express/paypal-express-id', + (data) => { + me.hidePaypalExpress('#paymentMethod' + data.id); + } + ); + } + } + + /** + * + * @param innerIdentifier + */ + hidePaypalExpress(innerIdentifier) { + const element = document.querySelector(innerIdentifier); + const rootElement = this.getClosest(element, '.payment-method'); + + if (!!rootElement && !!rootElement.classList) { + rootElement.remove(); + } + } + + /** + * + * @returns {*} + */ + getShopUrl() { + // get sales channel base URL + // so that our shop slug is correctly + let shopSlug = this.options.shopUrl; + + if (shopSlug === undefined) { + return ''; + } + + // remove trailing slash if existing + // sometimes more exist + while (shopSlug.substr(-1) === '/') { + shopSlug = shopSlug.substr(0, shopSlug.length - 1); + } + + return shopSlug; + } + + /** + * + * @param elem + * @param selector + * @returns {null|*} + */ + getClosest(elem, selector) { + // Element.matches() polyfill + if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function (s) { + const matches = (this.document || this.ownerDocument).querySelectorAll(s); + let i = matches.length; + // eslint-disable-next-line no-empty + while (--i >= 0 && matches.item(i) !== this) { + } + return i > -1; + }; + } + + // Get the closest matching element + for (; elem && elem !== document; elem = elem.parentNode) { + if (elem.matches(selector)) { + return elem; + } + } + + return null; + } + +} \ No newline at end of file diff --git a/src/Resources/app/storefront/src/register.js b/src/Resources/app/storefront/src/register.js index 9de86e174..3251f2b9f 100644 --- a/src/Resources/app/storefront/src/register.js +++ b/src/Resources/app/storefront/src/register.js @@ -5,9 +5,10 @@ import MollieApplePayDirect from './mollie-payments/plugins/apple-pay-direct.plu import MollieApplePayPaymentMethod from './mollie-payments/plugins/apple-pay-payment-method.plugin'; import MollieCreditCardMandateManage from './mollie-payments/plugins/creditcard-mandate-manage.plugin'; import MolliePosTerminalPlugin from './mollie-payments/plugins/pos-terminal.plugin'; +import MolliePayPalExpressPaymentMethod from './mollie-payments/plugins/paypal-express-payment-method.plugin'; -export default class MolliRegistration { +export default class MollieRegistration { /** * @@ -29,6 +30,12 @@ export default class MolliRegistration { pluginManager.register('MollieApplePayPaymentMethod', MollieApplePayPaymentMethod, '[data-mollie-template-applepay-checkout]'); + // hide paypal express if not started with it + // ----------------------------------------------------------------------------- + pluginManager.register('MolliePayPalExpressPaymentMethod', MolliePayPalExpressPaymentMethod, '[data-mollie-template-ppe-account]'); + pluginManager.register('MolliePayPalExpressPaymentMethod', MolliePayPalExpressPaymentMethod, '[data-mollie-template-ppe-checkout]'); + + // showing credit card components in the checkout // we have 2 versions for < Shopware 6.4 and >= Shopware 6.4 // ----------------------------------------------------------------------------- diff --git a/src/Resources/app/storefront/src/scss/base.scss b/src/Resources/app/storefront/src/scss/base.scss index 4430b328a..9f9d36ee5 100644 --- a/src/Resources/app/storefront/src/scss/base.scss +++ b/src/Resources/app/storefront/src/scss/base.scss @@ -4,3 +4,4 @@ @import "./account/payment-selection"; @import "./account/subscriptions"; @import "./component/credit-card-mandate"; +@import "./component/paypal-express-button"; diff --git a/src/Resources/app/storefront/src/scss/component/paypal-express-button.scss b/src/Resources/app/storefront/src/scss/component/paypal-express-button.scss new file mode 100644 index 000000000..c741377ea --- /dev/null +++ b/src/Resources/app/storefront/src/scss/component/paypal-express-button.scss @@ -0,0 +1,73 @@ +.mollie-paypal-button { + display: flex; + align-items: center; + justify-content: center; + + font-size: 16px; + font-weight: bold; + text-decoration: none; + text-align: center; + cursor: pointer; + transition: background-color 0.3s ease; + width: 100%; + padding: 7px; +} + +.paypal-button-pill { + border-radius: 30px; +} + +.paypal-button-rect { + border-radius: 0; +} + +.paypal-theme-gold { + color: #000000; + background-color: #FFC439FF; + border: 1px solid #fcc85b; +} + +.paypal-theme-gold:hover { + background-color: #fcc85b; +} + +.paypal-theme-blue { + color: #ffffff; + background-color: #009CDEFF; + border: 1px solid #09adf3; +} + +.paypal-theme-blue:hover { + background-color: #09adf3; +} + +.paypal-theme-silver { + color: #000000; + background-color: #EEEEEEFF; + border: 1px solid #f6f6f6; +} + +.paypal-theme-silver:hover { + background-color: #f6f6f6; +} + +.paypal-theme-white { + color: #000000; + background-color: #ffffff; + border: 1px solid #f3f3f3; +} + +.paypal-theme-white:hover { + background-color: #f3f3f3; +} + +.paypal-theme-black { + color: #ffffff; + background-color: #000000; + border: 1px solid #555555; +} + +.paypal-theme-black:hover { + background-color: #333333; +} + diff --git a/src/Resources/config/compatibility/controller.xml b/src/Resources/config/compatibility/controller.xml index 60e9ee634..79ef920bf 100644 --- a/src/Resources/config/compatibility/controller.xml +++ b/src/Resources/config/compatibility/controller.xml @@ -148,8 +148,7 @@ - + @@ -165,6 +164,15 @@ + + + + + + + + + diff --git a/src/Resources/config/compatibility/controller_6.5.xml b/src/Resources/config/compatibility/controller_6.5.xml index ef39bd795..509ba3c00 100644 --- a/src/Resources/config/compatibility/controller_6.5.xml +++ b/src/Resources/config/compatibility/controller_6.5.xml @@ -168,6 +168,16 @@ + + + + + + + + + + diff --git a/src/Resources/config/config.xml b/src/Resources/config/config.xml index e42d361d3..777635ef4 100644 --- a/src/Resources/config/config.xml +++ b/src/Resources/config/config.xml @@ -35,9 +35,15 @@ true - Enables the test mode with the Mollie Sandbox payment page. The Storefront will also show (Test Mode) next to the payment method names. - Aktiviert den Testmodus mit der Mollie Sandbox Zahlungsseite. In der Storefront wird (Test Modus) neben den Zahlungsarten angezeigt. - Staat de test modus toe met de Mollie Sandbox betalingspagina. De Storefront zal ook "(Test Mode)" tonen naast de naam van de betaalmethode. + Enables the test mode with the Mollie Sandbox payment page. The Storefront will also show (Test + Mode) next to the payment method names. + + Aktiviert den Testmodus mit der Mollie Sandbox Zahlungsseite. In der Storefront wird + (Test Modus) neben den Zahlungsarten angezeigt. + + Staat de test modus toe met de Mollie Sandbox betalingspagina. De Storefront zal ook + "(Test Mode)" tonen naast de naam van de betaalmethode. + debugMode @@ -45,9 +51,16 @@ false - Mollie has a custom log file in the Shopware log directory. This feature enables the extended logs with more information that could help to solve problems. - Mollie hat eine eigene LOG Datei im Shopware Log Verzeichnis. Dieser Modus kümmert sich um erweiterte Informationen in diesen Log Dateien, die zusätzlich bei der Analyse von Fehlern beitragen können. - Mollie heeft een op maat logbestand in de Shopware logboek-map. Deze functie maakt uitgebreide logs mogelijk met meer informatie die helpen bij het oplossen van problemen. + Mollie has a custom log file in the Shopware log directory. This feature enables the extended logs + with more information that could help to solve problems. + + Mollie hat eine eigene LOG Datei im Shopware Log Verzeichnis. Dieser Modus kümmert + sich um erweiterte Informationen in diesen Log Dateien, die zusätzlich bei der Analyse von Fehlern + beitragen können. + + Mollie heeft een op maat logbestand in de Shopware logboek-map. Deze functie maakt + uitgebreide logs mogelijk met meer informatie die helpen bij het oplossen van problemen. + molliePluginConfigSectionApi @@ -63,19 +76,94 @@ true - Use the default Shopware behaviour on failed payments. If disabled, Mollie will automatically provide a way to retry the payment by redirecting the user to the Mollie payments page. - Aktiviert das Standardverhalten von Shopware für fehlerhafte Zahlungen. Wenn nicht aktiv, kümmert sich das Mollie Plugin um einen erneuten Versuch der Zahlung und leitet den Käufer auf die externe Mollie Zahlungsauswahl. - Gebruik de standaard Shopware instelling voor mislukte betalingen. Indien uitgeschakeld, zal Mollie automatisch een manier aanbieden om de betaling opnieuw te proberen door de user om te leiden naar de Mollie betalingspagina. + Use the default Shopware behaviour on failed payments. If disabled, Mollie will automatically + provide a way to retry the payment by redirecting the user to the Mollie payments page. + + Aktiviert das Standardverhalten von Shopware für fehlerhafte Zahlungen. Wenn nicht + aktiv, kümmert sich das Mollie Plugin um einen erneuten Versuch der Zahlung und leitet den Käufer auf + die externe Mollie Zahlungsauswahl. + + Gebruik de standaard Shopware instelling voor mislukte betalingen. Indien + uitgeschakeld, zal Mollie automatisch een manier aanbieden om de betaling opnieuw te proberen door de + user om te leiden naar de Mollie betalingspagina. + + + createCustomersAtMollie + + + + false + Automatically have customers being created inside your Mollie Dashboard to see all payments of a + specific customer. + + Erstellt automatisch Kunden im Mollie Dashboard. Dadurch hat man einen zusätzlichen + Überblick über alle Zahlungen dieses Kunden innerhalb von Mollie. + + Automatisch klanten laten aanmaken in het Mollie Dashboard om alle betalingen van een + specifieke klant te zien. + + + + useMolliePaymentMethodLimits + false + + + + Automatically hides payment methods in the checkout based on the limits of Mollie. For instance, + if you can only accept credit card payments up to 500 euros, the checkout for a cart of 600 euros will + not display credit card as a payment method. + + Blendet automatisch Zahlungsart im Checkout basierend auf den Limits von Mollie aus. + Wenn Sie beispielsweise nur Kreditkartenzahlungen bis zu 500 Euro akzeptieren können, wird an der Kasse + für einen Warenkorb von 600 Euro keine Kreditkarte als Zahlungsarte angezeigt. + + Verbergt automatisch betaalmethoden in de checkout op basis van Mollie's limieten. + Als je bijvoorbeeld alleen creditcardbetalingen tot 500 euro kan accepteren, wordt bij een winkelwagen + van 600 euro geen creditcard weergegeven als betaalmethode bij het afrekenen. + + + + formatOrderNumber + + + + If set, this format will be used before the order number in the Mollie dashboard. This will also + be passed on to PayPal as invoice number. + + Wenn gesetzt, wird dieses Format vor der Bestellnummer im Mollie-Dashboard verwendet. + Dieser Wert wird auch an PayPal als Rechnungsnummber übergeben + + Indien ingesteld, wordt dit formaat vóór het bestelnummer in het Mollie-dashboard + gebruikt. Dit wordt ook als factuurnummer doorgegeven aan PayPal. + + + + molliePluginConfigSectionPaymentsFormat + + + molliePluginConfigSectionPayments + + + + Credit card + Kreditkarte + Credit card enableCreditCardComponents true - Show credit card input fields directly within your Shopware shop. If disabled, Mollie will show the forms on the Mollie payment page. - Zeigt Kreditkartenfelder direkt im Shopware shop an. Wenn nicht aktiviert, dann zeigt Mollie diese Felder direkt auf der externen Mollie Zahlungsseite. - Toon credit card invoervelden direct in jouw Shopware shop. Indien uitgeschakeld, zal Mollie de formulieren tonen op de Mollie betaalpagina. + Show credit card input fields directly within your Shopware shop. If disabled, Mollie will show + the forms on the Mollie payment page. + + Zeigt Kreditkartenfelder direkt im Shopware shop an. Wenn nicht aktiviert, dann zeigt + Mollie diese Felder direkt auf der externen Mollie Zahlungsseite. + + Toon credit card invoervelden direct in jouw Shopware shop. Indien uitgeschakeld, zal + Mollie de formulieren tonen op de Mollie betaalpagina. + oneClickPaymentsEnabled @@ -83,9 +171,15 @@ false - Customers can choose to save their credit card data for repeating orders. Sensitive data will only be stored on the Mollie servers and not in Shopware. - Kunden haben die Möglichkeit, ihre Kreditkartendaten für erneute Bestellungen zu speichern. Sensible Daten werden nur auf den Mollie-Servern und nicht in Shopware gespeichert. - Klanten kunnen ervoor kiezen hun creditcardgegevens op te slaan voor toekomstige bestellingen. Gevoelige gegevens worden alleen opgeslagen op de servers van Mollie en niet in Shopware. + Customers can choose to save their credit card data for repeating orders. Sensitive data will only + be stored on the Mollie servers and not in Shopware. + + Kunden haben die Möglichkeit, ihre Kreditkartendaten für erneute Bestellungen zu + speichern. Sensible Daten werden nur auf den Mollie-Servern und nicht in Shopware gespeichert. + + Klanten kunnen ervoor kiezen hun creditcardgegevens op te slaan voor toekomstige + bestellingen. Gevoelige gegevens worden alleen opgeslagen op de servers van Mollie en niet in Shopware. + oneClickPaymentsCompactView @@ -93,19 +187,138 @@ false - If enabled, the stored credit cards will not be displayed as visual cards on the checkout page. - Wenn aktiviert, werden die gespeicherten Kreditkarten nicht als visuelle Karten auf der Checkout-Seite angezeigt. - Indien ingeschakeld, worden de opgeslagen creditcards niet weergegeven als visuele kaarten op de afrekenpagina. + If enabled, the stored credit cards will not be displayed as visual cards on the checkout page. + + Wenn aktiviert, werden die gespeicherten Kreditkarten nicht als visuelle Karten auf + der Checkout-Seite angezeigt. + + Indien ingeschakeld, worden de opgeslagen creditcards niet weergegeven als visuele + kaarten op de afrekenpagina. + + + + + PayPal Express + PayPal Express + PayPal Express + + paypalExpressButtonStyle + + 1 + + + + + + + + + + paypalExpressButtonShape + + 1 + + + + + + + paypalExpressRestrictions + + + + Restrict PayPal Express from being displayed on these pages. + Verhindere die Anzeige von PayPal Express auf den hier gewählten Seiten + Voorkom dat PayPal Express wordt weergegeven op deze pagina's. + + + + + + + + + + Apple Pay + Apple Pay + Apple Pay enableApplePayDirect false - Show Apple Pay buttons and payment options directly on a product detail page or listing. This feature requires the payment method Apple Pay to be assigned to your Sales Channel. - Zeigt Apple Pay Buttons direkt auf der Produktseite oder Kategorie Seite an. Dieses Feature setzt voraus, dass die Zahlungsart 'Apple Pay' dem Verkaufskanal zugewiesen ist. - Toon Apple Pay-buttons en betaalopties direct op een productdetailpagina of product listing pagina. Deze functie vereist dat de betaalmethode Apple Pay is toegewezen aan jouw verkoopkanaal. + Show Apple Pay buttons and payment options directly on a product detail page or listing. This + feature requires the payment method Apple Pay to be assigned to your Sales Channel. + + Zeigt Apple Pay Buttons direkt auf der Produktseite oder Kategorie Seite an. Dieses + Feature setzt voraus, dass die Zahlungsart 'Apple Pay' dem Verkaufskanal zugewiesen ist. + + Toon Apple Pay-buttons en betaalopties direct op een productdetailpagina of product + listing pagina. Deze functie vereist dat de betaalmethode Apple Pay is toegewezen aan jouw + verkoopkanaal. + applePayDirectRestrictions @@ -142,41 +355,6 @@ - - createCustomersAtMollie - - - - false - Automatically have customers being created inside your Mollie Dashboard to see all payments of a specific customer. - Erstellt automatisch Kunden im Mollie Dashboard. Dadurch hat man einen zusätzlichen Überblick über alle Zahlungen dieses Kunden innerhalb von Mollie. - Automatisch klanten laten aanmaken in het Mollie Dashboard om alle betalingen van een specifieke klant te zien. - - - useMolliePaymentMethodLimits - false - - - - Automatically hides payment methods in the checkout based on the limits of Mollie. For instance, if you can only accept credit card payments up to 500 euros, the checkout for a cart of 600 euros will not display credit card as a payment method. - Blendet automatisch Zahlungsart im Checkout basierend auf den Limits von Mollie aus. Wenn Sie beispielsweise nur Kreditkartenzahlungen bis zu 500 Euro akzeptieren können, wird an der Kasse für einen Warenkorb von 600 Euro keine Kreditkarte als Zahlungsarte angezeigt. - Verbergt automatisch betaalmethoden in de checkout op basis van Mollie's limieten. Als je bijvoorbeeld alleen creditcardbetalingen tot 500 euro kan accepteren, wordt bij een winkelwagen van 600 euro geen creditcard weergegeven als betaalmethode bij het afrekenen. - - - formatOrderNumber - - - - If set, this format will be used before the order number in the Mollie dashboard. This will also be passed on to PayPal as invoice number. - Wenn gesetzt, wird dieses Format vor der Bestellnummer im Mollie-Dashboard verwendet. Dieser Wert wird auch an PayPal als Rechnungsnummber übergeben - Indien ingesteld, wordt dit formaat vóór het bestelnummer in het Mollie-dashboard gebruikt. Dit wordt ook als factuurnummer doorgegeven aan PayPal. - - - molliePluginConfigSectionPaymentsFormat - - - molliePluginConfigSectionPayments - Order Management @@ -187,9 +365,15 @@ - Assign a custom "due date" for the Bank Transfer payment method. This is the time the customer can pay until the payment expires. - Konfiguration eines eigenen Verfallsdatums für die Zahlungsart 'Bank Transfer'. Dies ist der Zeitraum einer möglichen Zahlung bis die Zahlungsmöglichkeit verfällt. - Wijs een aangepaste "vervaldatum" toe voor de betaalmethode Bankoverschrijving. Dit is de periode dat de klant kan betalen totdat de betaling vervalt. + Assign a custom "due date" for the Bank Transfer payment method. This is the time the customer can + pay until the payment expires. + + Konfiguration eines eigenen Verfallsdatums für die Zahlungsart 'Bank Transfer'. Dies + ist der Zeitraum einer möglichen Zahlung bis die Zahlungsmöglichkeit verfällt. + + Wijs een aangepaste "vervaldatum" toe voor de betaalmethode Bankoverschrijving. Dit + is de periode dat de klant kan betalen totdat de betaling vervalt. + molliePluginConfigSectionOrderLifeTimeWarning @@ -199,9 +383,15 @@ - Configure the lifetime of an order until it expires when not paid. This applies to all payment methods. - Konfiguration der Lebensdauer bis eine Bestellung verfällt, sofern sie nicht bezahlt wurde. Diese Konfiguration wirkt sich auf alle Zahlungsarten aus. - Configureer de levensduur van een bestelling totdat deze vervalt als er niet betaald is. Dit geldt voor alle betaalmethoden. + Configure the lifetime of an order until it expires when not paid. This applies to all payment + methods. + + Konfiguration der Lebensdauer bis eine Bestellung verfällt, sofern sie nicht bezahlt + wurde. Diese Konfiguration wirkt sich auf alle Zahlungsarten aus. + + Configureer de levensduur van een bestelling totdat deze vervalt als er niet betaald + is. Dit geldt voor alle betaalmethoden. + automaticShipping @@ -209,9 +399,15 @@ - If enabled, the plugin will automatically trigger a shipment at Mollie when the delivery status transitions to 'shipped'. - Sofern aktiv, schickt das Plugin automatisch eine Versand Mitteilung an Mollie, sobald der Lieferstatus auf 'verschickt' übergeleitet wird. - Indien ingeschakeld, zal de plugin automatisch een verzending activeren bij Mollie wanneer de leveringstatus overgaat naar ‘verzonden’. + If enabled, the plugin will automatically trigger a shipment at Mollie when the delivery status + transitions to 'shipped'. + + Sofern aktiv, schickt das Plugin automatisch eine Versand Mitteilung an Mollie, + sobald der Lieferstatus auf 'verschickt' übergeleitet wird. + + Indien ingeschakeld, zal de plugin automatisch een verzending activeren bij Mollie + wanneer de leveringstatus overgaat naar ‘verzonden’. + automaticCancellation @@ -219,9 +415,19 @@ - If enabled, the plugin will automatically cancel Mollie orders when being cancelled in Shopware. Only orders that are created, authorized or partially shipped will be cancelled. If partially shipped, only items that where not shipped will be cancelled. - Wenn aktiviert, storniert das Plugin Mollie-Bestellungen automatisch, wenn sie in Shopware storniert werden. Nur Bestellungen, die erstellt, autorisiert oder teilweise versandt wurden, werden storniert. Bei teilweisem Versand werden nur Artikel storniert, die nicht versendet wurden. - Indien ingeschakeld, zal de plug-in automatisch Mollie-bestellingen annuleren wanneer ze worden geannuleerd in Shopware. Alleen bestellingen die zijn aangemaakt, geautoriseerd of gedeeltelijk zijn verzonden, worden geannuleerd. Indien gedeeltelijk verzonden, worden alleen artikelen geannuleerd die niet zijn verzonden. + If enabled, the plugin will automatically cancel Mollie orders when being cancelled in Shopware. + Only orders that are created, authorized or partially shipped will be cancelled. If partially shipped, + only items that where not shipped will be cancelled. + + Wenn aktiviert, storniert das Plugin Mollie-Bestellungen automatisch, wenn sie in + Shopware storniert werden. Nur Bestellungen, die erstellt, autorisiert oder teilweise versandt wurden, + werden storniert. Bei teilweisem Versand werden nur Artikel storniert, die nicht versendet wurden. + + Indien ingeschakeld, zal de plug-in automatisch Mollie-bestellingen annuleren wanneer + ze worden geannuleerd in Shopware. Alleen bestellingen die zijn aangemaakt, geautoriseerd of + gedeeltelijk zijn verzonden, worden geannuleerd. Indien gedeeltelijk verzonden, worden alleen artikelen + geannuleerd die niet zijn verzonden. + @@ -244,9 +450,15 @@ - Automatically set the entered refund quantity also as the quantity to be used to increase the stock again. - Sofern aktiv, wird die eingegebene Rückerstattungsmenge automatisch als Menge für den Lagerbestand verwendet und dieses Feld vorbefüllt. - Stel de ingevoerde restitutiehoeveelheid automatisch ook in als de hoeveelheid die moet worden gebruikt om de voorraad weer te vergroten + Automatically set the entered refund quantity also as the quantity to be used to increase the + stock again. + + Sofern aktiv, wird die eingegebene Rückerstattungsmenge automatisch als Menge für den + Lagerbestand verwendet und dieses Feld vorbefüllt. + + Stel de ingevoerde restitutiehoeveelheid automatisch ook in als de hoeveelheid die + moet worden gebruikt om de voorraad weer te vergroten + refundManagerVerifyRefund @@ -254,9 +466,16 @@ - If enabled, a verification checkbox needs to be checked to proceed with the refund. We recommend this to avoid accidental refunds and stock changes. - Wenn aktiv, muss ein Überprüfungskästchen aktiviert werden, um mit der Rückerstattung fortzufahren. Wir empfehlen dies, um versehentliche Rückerstattungen und Bestandsänderungen zu vermeiden. - Indien actief, moet een selectievakje worden geactiveerd om verder te gaan met de terugbetaling. Wij raden dit aan om onbedoelde terugbetalingen en voorraadwijzigingen te voorkomen. + If enabled, a verification checkbox needs to be checked to proceed with the refund. We recommend + this to avoid accidental refunds and stock changes. + + Wenn aktiv, muss ein Überprüfungskästchen aktiviert werden, um mit der Rückerstattung + fortzufahren. Wir empfehlen dies, um versehentliche Rückerstattungen und Bestandsänderungen zu + vermeiden. + + Indien actief, moet een selectievakje worden geactiveerd om verder te gaan met de + terugbetaling. Wij raden dit aan om onbedoelde terugbetalingen en voorraadwijzigingen te voorkomen. + refundManagerShowInstructions @@ -264,9 +483,15 @@ - Shows or hides the instructions area. You can simply turn this off in case it's disturbing once you're familiar with the Refund Manager. - Diese Funktion kann benutzt werden, um die Anleitungen auszublenden, sofern man einmal mit dem Refund Manager vetraut ist. - Toont of verbergt de handleiding. Als het storend is, kan je het direkt deactiveren als je eenmaal vertrouwd bent met de Refund Manager. + Shows or hides the instructions area. You can simply turn this off in case it's disturbing once + you're familiar with the Refund Manager. + + Diese Funktion kann benutzt werden, um die Anleitungen auszublenden, sofern man + einmal mit dem Refund Manager vetraut ist. + + Toont of verbergt de handleiding. Als het storend is, kan je het direkt deactiveren + als je eenmaal vertrouwd bent met de Refund Manager. + @@ -546,9 +771,18 @@ - If enabled, the plugin will not transition to a new order state, if the final state is already set in the order. Use this feature in combination with plugins and systems if their workflows do not match the one from Mollie. - Wenn aktiv, wechselt das Plugin nicht in einen neuen Bestellstatus, wenn der finale Status bereits in der Bestellung verwendet wird. Verwenden Sie diese Funktion in Kombination mit Plugins und -Systemen, wenn deren Workflows nicht mit denen von Mollie übereinstimmen. - Indien ingeschakeld, gaat de plug-in niet over naar een nieuwe bestelstatus, als de definitieve status al in de bestelling is ingesteld. Gebruik deze functie in combinatie met plug-ins en -systemen als hun workflows niet overeenkomen met die van Mollie. + If enabled, the plugin will not transition to a new order state, if the final state is already set + in the order. Use this feature in combination with plugins and systems if their workflows do not match + the one from Mollie. + + Wenn aktiv, wechselt das Plugin nicht in einen neuen Bestellstatus, wenn der finale + Status bereits in der Bestellung verwendet wird. Verwenden Sie diese Funktion in Kombination mit Plugins + und -Systemen, wenn deren Workflows nicht mit denen von Mollie übereinstimmen. + + Indien ingeschakeld, gaat de plug-in niet over naar een nieuwe bestelstatus, als de + definitieve status al in de bestelling is ingesteld. Gebruik deze functie in combinatie met plug-ins en + -systemen als hun workflows niet overeenkomen met die van Mollie. + @@ -563,9 +797,15 @@ - Enables or disables the full subscription functionality. Please reload the administration after changing this setting. - Aktiviert oder deaktiviert die vollständige Abonnementfunktion. Bitte laden Sie die Administration neu, nachdem Sie diese Einstellung geändert haben. - Schakelt de volledige abonnementsfunctionaliteit in of uit. Herlaad de administratie na het wijzigen van deze instelling. + Enables or disables the full subscription functionality. Please reload the administration after + changing this setting. + + Aktiviert oder deaktiviert die vollständige Abonnementfunktion. Bitte laden Sie die + Administration neu, nachdem Sie diese Einstellung geändert haben. + + Schakelt de volledige abonnementsfunctionaliteit in of uit. Herlaad de administratie + na het wijzigen van deze instelling. + subscriptionsShowIndicator @@ -575,17 +815,28 @@ Shows a subscription indicator on the product detail page of a subscription product. Zeigt einen Abonnementhinweis auf der Produktdetailseite an. - Toont een abonnement indicator op de productpagina van een abonnement product. + Toont een abonnement indicator op de productpagina van een abonnement product. + subscriptionsAllowAddressEditing false - - If enabled, customers are allowed to edit their billing and shipping addresses in the shop. Please consider that no new shipping costs will be calculated for modified addresses. Countries are not allowed to be edited. - Wenn aktiv, dürfen Kunden ihre Rechnungs- und Lieferadressen im Shop bearbeiten. Bitte beachten Sie, dass für geänderte Adressen keine neuen Versandkosten berechnet werden. Länder dürfen nicht bearbeitet werden. - Indien ingeschakeld, mogen klanten hun factuur- en verzendadres in de shop bewerken. Houd er rekening mee dat er geen nieuwe verzendkosten worden berekend voor gewijzigde adressen. Landen mogen niet worden bewerkt. + + If enabled, customers are allowed to edit their billing and shipping addresses in the shop. Please + consider that no new shipping costs will be calculated for modified addresses. Countries are not allowed + to be edited. + + Wenn aktiv, dürfen Kunden ihre Rechnungs- und Lieferadressen im Shop bearbeiten. + Bitte beachten Sie, dass für geänderte Adressen keine neuen Versandkosten berechnet werden. Länder + dürfen nicht bearbeitet werden. + + Indien ingeschakeld, mogen klanten hun factuur- en verzendadres in de shop bewerken. + Houd er rekening mee dat er geen nieuwe verzendkosten worden berekend voor gewijzigde adressen. Landen + mogen niet worden bewerkt. + subscriptionsAllowPauseResume @@ -593,9 +844,14 @@ - If enabled, customers are allowed to pause and also resume their subscriptions in their account. - Wenn diese Option aktiviert ist, können Kunden ihre Abonnements in ihrem Konto pausieren und auch fortsetzen. - Indien ingeschakeld, mogen klanten hun abonnementen onderbreken en hervatten in hun account. + If enabled, customers are allowed to pause and also resume their subscriptions in their account. + + Wenn diese Option aktiviert ist, können Kunden ihre Abonnements in ihrem Konto + pausieren und auch fortsetzen. + + Indien ingeschakeld, mogen klanten hun abonnementen onderbreken en hervatten in hun + account. + subscriptionsAllowSkip @@ -603,9 +859,15 @@ - If enabled, customers are allowed to skip an upcoming renewal of a running subscription. This also takes the last notice period into account. - Wenn diese Option aktiviert ist, können Kunden eine bevorstehende Verlängerung eines laufenden Abonnements überspringen. Dabei wird auch die letzte Kündigungsfrist berücksichtigt. - Indien ingeschakeld, mogen klanten een aanstaande verlenging van een lopend abonnement overslaan. Hierbij wordt ook rekening gehouden met de laatste opzegtermijn. + If enabled, customers are allowed to skip an upcoming renewal of a running subscription. This also + takes the last notice period into account. + + Wenn diese Option aktiviert ist, können Kunden eine bevorstehende Verlängerung eines + laufenden Abonnements überspringen. Dabei wird auch die letzte Kündigungsfrist berücksichtigt. + + Indien ingeschakeld, mogen klanten een aanstaande verlenging van een lopend + abonnement overslaan. Hierbij wordt ook rekening gehouden met de laatste opzegtermijn. + subscriptionSkipRenewalsOnFailedPayments @@ -613,9 +875,17 @@ - If skipped, the plugin will not create new orders on subscription renewals, if the payment was not successful. If not skipped, then a new order is created and the customer can pay again within Shopware. - Wenn es übersprungen wird, erstellt das Plugin keine neuen Bestellungen bei Abonnementverlängerungen, wenn die Zahlung nicht erfolgreich war. Wenn nicht übersprungen, wird eine neue Bestellung erstellt und der Kunde kann innerhalb von Shopware erneut bezahlen. - Indien overgeslagen, zal de plug-in geen nieuwe bestellingen maken bij abonnementsverlengingen, als de betaling niet succesvol was. Indien niet overgeslagen, dan wordt er een nieuwe bestelling aangemaakt en kan de klant opnieuw betalen binnen Shopware. + If skipped, the plugin will not create new orders on subscription renewals, if the payment was not + successful. If not skipped, then a new order is created and the customer can pay again within Shopware. + + Wenn es übersprungen wird, erstellt das Plugin keine neuen Bestellungen bei + Abonnementverlängerungen, wenn die Zahlung nicht erfolgreich war. Wenn nicht übersprungen, wird eine + neue Bestellung erstellt und der Kunde kann innerhalb von Shopware erneut bezahlen. + + Indien overgeslagen, zal de plug-in geen nieuwe bestellingen maken bij + abonnementsverlengingen, als de betaling niet succesvol was. Indien niet overgeslagen, dan wordt er een + nieuwe bestelling aangemaakt en kan de klant opnieuw betalen binnen Shopware. + subscriptionsReminderDays @@ -623,9 +893,15 @@ - Set the days in prior to the renewal for sending renewal reminder events in the system (Flow Builder, Business Events, ...). - Legen Sie die Tage vor der Verlängerung für das Senden von Verlängerungs-Erinnerungsereignissen im System fest (Flow Builder, Business Events, ...). - Stel de dagen voorafgaand aan de verlenging in voor het verzenden van herinneringsgebeurtenissen in het systeem (Flow Builder, Business Events, ...) + Set the days in prior to the renewal for sending renewal reminder events in the system (Flow + Builder, Business Events, ...). + + Legen Sie die Tage vor der Verlängerung für das Senden von + Verlängerungs-Erinnerungsereignissen im System fest (Flow Builder, Business Events, ...). + + Stel de dagen voorafgaand aan de verlenging in voor het verzenden van + herinneringsgebeurtenissen in het systeem (Flow Builder, Business Events, ...) + subscriptionsCancellationDays @@ -633,9 +909,18 @@ - Set a notice period for customers before renewing the subscription. If a subscription renews on Friday and you use "2", then it can be cancelled or paused with latest Wednesday. Use "0" to always allow cancellations. - Legen Sie eine Kündigungsfrist für Verlänägerungen von Abonnements fest. Wenn sich ein Abonnement am Freitag verlängert und Sie "2" verwenden, kann es bis spätestens Mittwoch gekündigt oder pausiert werden. Verwenden Sie "0", um Stornierungen immer zuzulassen. - Stel een opzegtermijn in voor klanten voordat ze het abonnement verlengen. Als een abonnement op vrijdag wordt verlengd en je gebruikt "2", dan kan het uiterlijk woensdag worden opgezegd of onderbroken. Gebruik "0" om annuleringen altijd toe te staan + Set a notice period for customers before renewing the subscription. If a subscription renews on + Friday and you use "2", then it can be cancelled or paused with latest Wednesday. Use "0" to always + allow cancellations. + + Legen Sie eine Kündigungsfrist für Verlänägerungen von Abonnements fest. Wenn sich + ein Abonnement am Freitag verlängert und Sie "2" verwenden, kann es bis spätestens Mittwoch gekündigt + oder pausiert werden. Verwenden Sie "0", um Stornierungen immer zuzulassen. + + Stel een opzegtermijn in voor klanten voordat ze het abonnement verlengen. Als een + abonnement op vrijdag wordt verlengd en je gebruikt "2", dan kan het uiterlijk woensdag worden opgezegd + of onderbroken. Gebruik "0" om annuleringen altijd toe te staan + @@ -655,18 +940,30 @@ - Set a custom name for your separate line item. This helps if you need to identify it in another system. - Lege einen benutzerdefinierten Namen für die separate Position fest. Dies hilft, wenn diese in einem anderen System identifiert werden muss. - Stel een aangepaste naam in voor uw afzonderlijke regelitem. Dit is handig als u het in een ander systeem moet identificeren. + Set a custom name for your separate line item. This helps if you need to identify it in another + system. + + Lege einen benutzerdefinierten Namen für die separate Position fest. Dies hilft, wenn + diese in einem anderen System identifiert werden muss. + + Stel een aangepaste naam in voor uw afzonderlijke regelitem. Dit is handig als u het + in een ander systeem moet identificeren. + fixRoundingDiffSKU - Set a custom SKU value for your separate line item. This helps if you need to identify it in another system. - Lege einen benutzerdefinierten SKU Wert für die separate Position fest. Dies hilft, wenn diese in einem anderen System identifiert werden muss. - Stel een aangepaste SKU in voor uw afzonderlijke regelitem. Dit is handig als u het in een ander systeem moet identificeren. + Set a custom SKU value for your separate line item. This helps if you need to identify it in + another system. + + Lege einen benutzerdefinierten SKU Wert für die separate Position fest. Dies hilft, + wenn diese in einem anderen System identifiert werden muss. + + Stel een aangepaste SKU in voor uw afzonderlijke regelitem. Dit is handig als u het + in een ander systeem moet identificeren. + molliePluginConfigSectionRounding @@ -680,12 +977,20 @@ useShopwareJavascript - + false - You can also bring back Mollie inside the "all.js" of the theme directly. This requires that you rebuild the Storefront on your own. - Sie können Mollie auch direkt in die "all.js" des Themes zurückbringen. Dies erfordert, dass Sie die Storefront selbst neu erstellen. - Je kunt Mollie ook rechtstreeks terugbrengen in de "all.js" van het thema. Dit vereist dat je de Storefront zelf herbouwt. + You can also bring back Mollie inside the "all.js" of the theme directly. This requires that you + rebuild the Storefront on your own. + + Sie können Mollie auch direkt in die "all.js" des Themes zurückbringen. Dies erfordert, dass Sie + die Storefront selbst neu erstellen. + + Je kunt Mollie ook rechtstreeks terugbrengen in de "all.js" van het thema. Dit + vereist dat je de Storefront zelf herbouwt. + diff --git a/src/Resources/config/services/components.xml b/src/Resources/config/services/components.xml index 9e7808e22..f27027599 100644 --- a/src/Resources/config/services/components.xml +++ b/src/Resources/config/services/components.xml @@ -41,6 +41,15 @@ + + + + + + + + + diff --git a/src/Resources/config/services/handlers.xml b/src/Resources/config/services/handlers.xml index 0cb06f79d..6c510155a 100644 --- a/src/Resources/config/services/handlers.xml +++ b/src/Resources/config/services/handlers.xml @@ -134,6 +134,13 @@ + + + + + + + diff --git a/src/Resources/config/services/subscriber.xml b/src/Resources/config/services/subscriber.xml index eb89fc689..0f9f227b5 100644 --- a/src/Resources/config/services/subscriber.xml +++ b/src/Resources/config/services/subscriber.xml @@ -54,6 +54,13 @@ + + + + + + + diff --git a/src/Resources/public/static/ppe-black.png b/src/Resources/public/static/ppe-black.png new file mode 100644 index 000000000..9297e8922 Binary files /dev/null and b/src/Resources/public/static/ppe-black.png differ diff --git a/src/Resources/public/static/ppe-primary.png b/src/Resources/public/static/ppe-primary.png new file mode 100644 index 000000000..780c84f6c Binary files /dev/null and b/src/Resources/public/static/ppe-primary.png differ diff --git a/src/Resources/public/static/ppe-white.png b/src/Resources/public/static/ppe-white.png new file mode 100644 index 000000000..62e847fe0 Binary files /dev/null and b/src/Resources/public/static/ppe-white.png differ diff --git a/src/Resources/views/mollie/component/paypal-express-button.twig b/src/Resources/views/mollie/component/paypal-express-button.twig new file mode 100644 index 000000000..776ae44c3 --- /dev/null +++ b/src/Resources/views/mollie/component/paypal-express-button.twig @@ -0,0 +1,37 @@ +{% set theme = '' %} +{% set shape = '' %} +{% set image = asset('bundles/molliepayments/static/ppe-primary.png', 'asset') %} + + +{% if mollie_paypalexpress_style == 1 %} + {% set theme = 'gold' %} +{% elseif mollie_paypalexpress_style == 2 %} + {% set theme = 'blue' %} + {% set image = asset('bundles/molliepayments/static/ppe-white.png', 'asset') %} +{% elseif mollie_paypalexpress_style == 3 %} + {% set theme = 'silver' %} +{% elseif mollie_paypalexpress_style == 4 %} + {% set theme = 'white' %} +{% elseif mollie_paypalexpress_style == 5 %} + {% set theme = 'black' %} + {% set image = asset('bundles/molliepayments/static/ppe-white.png', 'asset') %} +{% else %} + {% set themeso = 'gold' %} +{% endif %} + + +{% if mollie_paypalexpress_shape == 1 %} + {% set shape = 'rect' %} +{% else %} + {% set shape = 'pill' %} +{% endif %} + + +
+
+ +
+
diff --git a/src/Resources/views/storefront/component/buy-widget/buy-widget-form.html.twig b/src/Resources/views/storefront/component/buy-widget/buy-widget-form.html.twig index a58304efe..15836aab0 100644 --- a/src/Resources/views/storefront/component/buy-widget/buy-widget-form.html.twig +++ b/src/Resources/views/storefront/component/buy-widget/buy-widget-form.html.twig @@ -34,6 +34,15 @@ {% endblock %} {% endif %} + + {% if mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) %} + {% block page_product_detail_buy_container_mollie_paypal_express_component %} +
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %} +
+ {% endblock %} + {% endif %} + {% endblock %} {% endblock %} diff --git a/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig b/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig index 61882e92b..3647b8b67 100644 --- a/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig +++ b/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig @@ -4,6 +4,7 @@ {% block component_offcanvas_cart_actions_checkout %} {{ parent() }} {% if page.cart.lineItems|length > 0 %} + {% if mollie_applepaydirect_enabled and ('offcanvas' not in mollie_applepaydirect_restrictions) %} {% block component_offcanvas_cart_actions_checkout_apple_direct_component %}
@@ -11,6 +12,15 @@
{% endblock %} {% endif %} + + {% if mollie_paypalexpress_enabled and ('offcanvas' not in mollie_paypalexpress_restrictions) %} + {% block component_offcanvas_cart_actions_checkout_mollie_paypal_express_component %} +
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' %} +
+ {% endblock %} + {% endif %} + {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/component/product/card/action.html.twig b/src/Resources/views/storefront/component/product/card/action.html.twig index c12246dec..371f096f5 100644 --- a/src/Resources/views/storefront/component/product/card/action.html.twig +++ b/src/Resources/views/storefront/component/product/card/action.html.twig @@ -26,6 +26,14 @@ {% endblock %} {% endif %} + {% if mollie_paypalexpress_enabled and ('plp' not in mollie_paypalexpress_restrictions) %} + {% block component_offcanvas_cart_actions_checkout_mollie_paypal_express_component %} +
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' %} +
+ {% endblock %} + {% endif %} + {% endblock %} {% endblock %} diff --git a/src/Resources/views/storefront/page/account/payment/index.html.twig b/src/Resources/views/storefront/page/account/payment/index.html.twig index eb67c69ef..d62e1e99c 100644 --- a/src/Resources/views/storefront/page/account/payment/index.html.twig +++ b/src/Resources/views/storefront/page/account/payment/index.html.twig @@ -9,6 +9,12 @@ |json_encode }}"> {% endif %} +
+ {{ parent() }} {% endblock %} diff --git a/src/Resources/views/storefront/page/checkout/address/index.html.twig b/src/Resources/views/storefront/page/checkout/address/index.html.twig new file mode 100644 index 000000000..370a7b006 --- /dev/null +++ b/src/Resources/views/storefront/page/checkout/address/index.html.twig @@ -0,0 +1,14 @@ +{% sw_extends '@Storefront/storefront/page/checkout/address/index.html.twig' %} + +{% block page_checkout_address_login_toggle %} + + {{ parent() }} + + {% if mollie_paypalexpress_enabled and ('register' not in mollie_paypalexpress_restrictions) %} + {% block page_checkout_address_mollie_paypal_express_component %} +
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-5'} %} +
+ {% endblock %} + {% endif %} +{% endblock %} diff --git a/src/Resources/views/storefront/page/checkout/cart/index.html.twig b/src/Resources/views/storefront/page/checkout/cart/index.html.twig index 536dffa58..3b562fd0e 100644 --- a/src/Resources/views/storefront/page/checkout/cart/index.html.twig +++ b/src/Resources/views/storefront/page/checkout/cart/index.html.twig @@ -28,5 +28,13 @@ {% endblock %} {% endif %} + + {% if mollie_paypalexpress_enabled and ('cart' not in mollie_paypalexpress_restrictions) %} + {% block page_checkout_aside_actions_mollie_paypal_express_component %} +
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' %} +
+ {% endblock %} + {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/page/checkout/confirm/index.html.twig b/src/Resources/views/storefront/page/checkout/confirm/index.html.twig index 556efe76f..4f290428d 100644 --- a/src/Resources/views/storefront/page/checkout/confirm/index.html.twig +++ b/src/Resources/views/storefront/page/checkout/confirm/index.html.twig @@ -3,11 +3,23 @@ {% block page_checkout_main_content %} {% if mollie_applepay_enabled %} -
+
+ {% endif %} + + + {% if mollie_paypalexpress_enabled %} +
{% endif %} {% if page.enable_credit_card_components == true %} diff --git a/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig b/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig index a6671aaf4..713e4e85c 100755 --- a/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig +++ b/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig @@ -29,6 +29,15 @@ {% endblock %} {% endif %} + + {% if mollie_paypalexpress_enabled and ('pdp' not in mollie_paypalexpress_restrictions) %} + {% block page_product_detail_buy_container_mollie_paypal_express_component %} +
+ {% include '@MolliePayments/mollie/component/paypal-express-button.twig' with {cols: 'col-8'} %} +
+ {% endblock %} + {% endif %} + {% endblock %} {% endblock %} @@ -39,7 +48,9 @@ {% block page_product_detail_buy_button %} {% if mollie_subscriptions_enabled and page.product.customFields.mollie_payments_product_subscription_enabled %} - {% else %} diff --git a/src/Service/CustomerService.php b/src/Service/CustomerService.php index eb3917637..058836da8 100644 --- a/src/Service/CustomerService.php +++ b/src/Service/CustomerService.php @@ -115,7 +115,7 @@ public function __construct(CountryRepositoryInterface $countryRepository, Custo * * @return null|string */ - public function customerLogin(CustomerEntity $customer, SalesChannelContext $context): ?string + public function loginCustomer(CustomerEntity $customer, SalesChannelContext $context): ?string { /** @var null|string $newToken */ $newToken = null; @@ -318,8 +318,8 @@ public function setPosTerminal(CustomerEntity $customer, string $terminalId, Con * @param string $customerId * @param string $salesChannelId * @param Context $context - * @throws CustomerCouldNotBeFoundException * @return string + * @throws CustomerCouldNotBeFoundException */ public function getMollieCustomerId(string $customerId, string $salesChannelId, Context $context): string { @@ -380,8 +380,8 @@ public function getCustomer(string $customerId, Context $context): ?CustomerEnti /** * @param string $customerId * @param Context $context - * @throws CustomerCouldNotBeFoundException * @return CustomerStruct + * @throws CustomerCouldNotBeFoundException */ public function getCustomerStruct(string $customerId, Context $context): CustomerStruct { @@ -451,7 +451,7 @@ public function getAddressArray($address, CustomerEntity $customer): array * @param SalesChannelContext $context * @return null|CustomerEntity */ - public function createApplePayDirectCustomer(string $firstname, string $lastname, string $email, string $phone, string $street, string $zipCode, string $city, string $countryISO2, string $paymentMethodId, SalesChannelContext $context): ?CustomerEntity + public function createGuestAccount(string $firstname, string $lastname, string $email, string $phone, string $street, string $zipCode, string $city, string $countryISO2, string $paymentMethodId, SalesChannelContext $context): ?CustomerEntity { $customerId = Uuid::randomHex(); $addressId = Uuid::randomHex(); @@ -619,4 +619,34 @@ public function createMollieCustomer(string $customerId, string $salesChannelId, $context ); } + + + public function setPaypalExpress(CustomerEntity $customer, Context $context): void + { + // Get existing custom fields + $customFields = $customer->getCustomFields(); + + // If custom fields are empty, create a new array + if (!is_array($customFields)) { + $customFields = []; + } + + // Store the card token in the custom fields + $customFields[CustomFieldService::CUSTOM_FIELDS_KEY_MOLLIE_PAYMENTS]['is_ppe'] = true; + + $this->logger->debug("Setting PPE Marker", [ + 'customerId' => $customer->getId(), + 'customFields' => $customFields, + ]); + + // Store the custom fields on the customer + $this->customerRepository->update( + [ + [ + 'id' => $customer->getId(), + 'customFields' => $customFields + ] + ], + $context); + } } diff --git a/src/Service/CustomerServiceInterface.php b/src/Service/CustomerServiceInterface.php index 47505d23f..77ac2b5a8 100644 --- a/src/Service/CustomerServiceInterface.php +++ b/src/Service/CustomerServiceInterface.php @@ -14,9 +14,12 @@ interface CustomerServiceInterface { - public function customerLogin(CustomerEntity $customer, SalesChannelContext $context): ?string; + public function loginCustomer(CustomerEntity $customer, SalesChannelContext $context): ?string; + public function isCustomerLoggedIn(SalesChannelContext $context): bool; + public function setCardToken(CustomerEntity $customer, string $cardToken, SalesChannelContext $context, bool $shouldSaveCardDetail = false): EntityWrittenContainerEvent; + public function setMandateId(CustomerEntity $customer, string $cardToken, Context $context): EntityWrittenContainerEvent; /** @@ -26,10 +29,15 @@ public function setMandateId(CustomerEntity $customer, string $cardToken, Contex * @return EntityWrittenContainerEvent */ public function saveCustomerCustomFields(string $customerID, array $customFields, Context $context): EntityWrittenContainerEvent; + public function setIDealIssuer(CustomerEntity $customer, string $issuerId, Context $context): EntityWrittenContainerEvent; + public function getMollieCustomerId(string $customerId, string $salesChannelId, Context $context): string; + public function setMollieCustomerId(string $customerId, string $mollieCustomerId, string $profileId, bool $testMode, Context $context): void; + public function getCustomer(string $customerId, Context $context): ?CustomerEntity; + public function getCustomerStruct(string $customerId, Context $context): CustomerStruct; /** @@ -38,8 +46,14 @@ public function getCustomerStruct(string $customerId, Context $context): Custome * @return array */ public function getAddressArray($address, CustomerEntity $customer): array; - public function createApplePayDirectCustomer(string $firstname, string $lastname, string $email, string $phone, string $street, string $zipCode, string $city, string $countryISO2, string $paymentMethodId, SalesChannelContext $context): ?CustomerEntity; + + public function createGuestAccount(string $firstname, string $lastname, string $email, string $phone, string $street, string $zipCode, string $city, string $countryISO2, string $paymentMethodId, SalesChannelContext $context): ?CustomerEntity; + public function getCountryId(string $countryCode, Context $context): ?string; + public function getSalutationId(Context $context): ?string; + public function createMollieCustomer(string $customerId, string $salesChannelId, Context $context): void; + + public function setPaypalExpress(CustomerEntity $customer, Context $context); } diff --git a/src/Service/PaymentMethodService.php b/src/Service/PaymentMethodService.php index cd68ecc1a..cad8faee0 100644 --- a/src/Service/PaymentMethodService.php +++ b/src/Service/PaymentMethodService.php @@ -18,6 +18,7 @@ use Kiener\MolliePayments\Handler\Method\KlarnaPayLaterPayment; use Kiener\MolliePayments\Handler\Method\KlarnaPayNowPayment; use Kiener\MolliePayments\Handler\Method\KlarnaSliceItPayment; +use Kiener\MolliePayments\Handler\Method\PayPalExpressPayment; use Kiener\MolliePayments\Handler\Method\PayPalPayment; use Kiener\MolliePayments\Handler\Method\PaySafeCardPayment; use Kiener\MolliePayments\Handler\Method\PosPayment; @@ -383,6 +384,7 @@ public function getPaymentHandlers(): array KlarnaPayNowPayment::class, KlarnaSliceItPayment::class, PayPalPayment::class, + PayPalExpressPayment::class, PaySafeCardPayment::class, Przelewy24Payment::class, SofortPayment::class, @@ -405,8 +407,14 @@ public function getPaymentHandlers(): array */ private function getMediaId(array $paymentMethod, Context $context): ?string { + $name = $paymentMethod['name']; + + if ($name === PayPalExpressPayment::PAYMENT_METHOD_NAME) { + $name = PayPalPayment::PAYMENT_METHOD_NAME; + } + /** @var string $fileName */ - $fileName = $paymentMethod['name'] . '-icon'; + $fileName = $name . '-icon'; $criteria = new Criteria(); $criteria->addFilter(new EqualsFilter('fileName', $fileName)); diff --git a/src/Service/Router/RoutingBuilder.php b/src/Service/Router/RoutingBuilder.php index 010ed56f1..d30ab7e36 100644 --- a/src/Service/Router/RoutingBuilder.php +++ b/src/Service/Router/RoutingBuilder.php @@ -192,6 +192,27 @@ public function buildSubscriptionPaymentUpdatedReturnUrl(string $subscriptionId) return $this->applyCustomDomain((string)$webhookUrl); } + /** + * @return string + */ + public function buildPaypalExpressRedirectUrl(): string + { + $confirmPage = $this->router->generate('frontend.mollie.paypal-express.finish', [], $this->router::ABSOLUTE_URL); + + return $confirmPage; + } + + /** + * @return string + */ + public function buildPaypalExpressCancelUrl(): string + { + $confirmPage = $this->router->generate('frontend.checkout.confirm.page', [], $this->router::ABSOLUTE_URL); + + return $confirmPage; + } + + /** * @param string $url * @return string diff --git a/src/Setting/MollieSettingStruct.php b/src/Setting/MollieSettingStruct.php index 9d1249c1f..300b2589e 100644 --- a/src/Setting/MollieSettingStruct.php +++ b/src/Setting/MollieSettingStruct.php @@ -238,6 +238,21 @@ class MollieSettingStruct extends Struct */ protected $useShopwareJavascript = false; + /** + * @var int + */ + protected $paypalExpressButtonStyle = 1; + + /** + * @var int + */ + protected $paypalExpressButtonShape = 1; + + /** + * @var array + */ + protected $paypalExpressRestrictions = []; + /** * @return string */ @@ -489,8 +504,8 @@ public function getPaymentMethodBankTransferDueDateDays(): ?int /** * returns bank transfer due date in YYYY-MM-DD format or null * - * @throws Exception * @return null|string + * @throws Exception */ public function getPaymentMethodBankTransferDueDate(): ?string { @@ -523,8 +538,8 @@ public function getOrderLifetimeDays(): ?int } /** - * @throws Exception * @return string + * @throws Exception */ public function getOrderLifetimeDate(): ?string { @@ -922,4 +937,35 @@ public function setUseShopwareJavascript(bool $useShopwareJavascript): void { $this->useShopwareJavascript = $useShopwareJavascript; } + + public function getPaypalExpressButtonStyle(): int + { + return $this->paypalExpressButtonStyle; + } + + public function setPaypalExpressButtonStyle(int $paypalExpressButtonStyle): void + { + $this->paypalExpressButtonStyle = $paypalExpressButtonStyle; + } + + public function getPaypalExpressButtonShape(): int + { + return $this->paypalExpressButtonShape; + } + + public function setPaypalExpressButtonShape(int $paypalExpressButtonShape): void + { + $this->paypalExpressButtonShape = $paypalExpressButtonShape; + } + + public function getPaypalExpressRestrictions(): array + { + return $this->paypalExpressRestrictions; + } + + public function setPaypalExpressRestrictions(array $paypalExpressRestrictions): void + { + $this->paypalExpressRestrictions = $paypalExpressRestrictions; + } + } diff --git a/src/Subscriber/PaypalExpressSubscriber.php b/src/Subscriber/PaypalExpressSubscriber.php new file mode 100644 index 000000000..2b2cc796d --- /dev/null +++ b/src/Subscriber/PaypalExpressSubscriber.php @@ -0,0 +1,92 @@ +settingsService = $settingsService; + $this->paypal = $paypal; + $this->customerService = $customerService; + } + + + /** + * @inheritDoc + */ + public static function getSubscribedEvents() + { + return [ + StorefrontRenderEvent::class => 'onStorefrontRender', + ]; + } + + /** + * @param StorefrontRenderEvent $event + * @return void + * @throws \Exception + */ + public function onStorefrontRender(StorefrontRenderEvent $event): void + { + $settings = $this->settingsService->getSettings($event->getSalesChannelContext()->getSalesChannel()->getId()); + + $paymentEnabled = $this->paypal->isPaypalExpressEnabled($event->getSalesChannelContext()); + + $event->setParameter('mollie_paypalexpress_enabled', $paymentEnabled); + + $style = $settings->getPaypalExpressButtonStyle(); + $shape = $settings->getPaypalExpressButtonShape(); + + $restrictions = $settings->getPaypalExpressRestrictions(); + + $isPPE = false; + if ($paymentEnabled) { + $customer = $this->customerService->getCustomer( + (string)$event->getSalesChannelContext()->getCustomerId(), + $event->getContext() + ); + + if ($customer instanceof CustomerEntity) { + $customFields = $customer->getCustomFields(); + if ($customFields !== null && isset($customFields['mollie_payments'])) { + $isPPE = (bool)$customFields['mollie_payments']['is_ppe']; + } + } + } + + $event->setParameter('mollie_paypalexpress_used', $isPPE); + $event->setParameter('mollie_paypalexpress_style', $style); + $event->setParameter('mollie_paypalexpress_shape', $shape); + $event->setParameter('mollie_paypalexpress_restrictions', $restrictions); + + } +} diff --git a/tests/PHPUnit/Fakes/FakeCustomerService.php b/tests/PHPUnit/Fakes/FakeCustomerService.php index 446956bd6..bcae1765e 100644 --- a/tests/PHPUnit/Fakes/FakeCustomerService.php +++ b/tests/PHPUnit/Fakes/FakeCustomerService.php @@ -28,7 +28,7 @@ public function __construct(bool $throwException = false) $this->throwException = $throwException; } - public function customerLogin(CustomerEntity $customer, SalesChannelContext $context): ?string + public function loginCustomer(CustomerEntity $customer, SalesChannelContext $context): ?string { return null; } @@ -83,7 +83,7 @@ public function getAddressArray($address, CustomerEntity $customer): array return []; } - public function createApplePayDirectCustomer(string $firstname, string $lastname, string $email, string $phone, string $street, string $zipCode, string $city, string $countryISO2, string $paymentMethodId, SalesChannelContext $context): ?CustomerEntity + public function createGuestAccount(string $firstname, string $lastname, string $email, string $phone, string $street, string $zipCode, string $city, string $countryISO2, string $paymentMethodId, SalesChannelContext $context): ?CustomerEntity { return null; } diff --git a/tests/PHPUnit/Service/PaymentMethodServiceTest.php b/tests/PHPUnit/Service/PaymentMethodServiceTest.php index ab4b30848..05d1c9273 100644 --- a/tests/PHPUnit/Service/PaymentMethodServiceTest.php +++ b/tests/PHPUnit/Service/PaymentMethodServiceTest.php @@ -17,6 +17,7 @@ use Kiener\MolliePayments\Handler\Method\KlarnaPayLaterPayment; use Kiener\MolliePayments\Handler\Method\KlarnaPayNowPayment; use Kiener\MolliePayments\Handler\Method\KlarnaSliceItPayment; +use Kiener\MolliePayments\Handler\Method\PayPalExpressPayment; use Kiener\MolliePayments\Handler\Method\PayPalPayment; use Kiener\MolliePayments\Handler\Method\PaySafeCardPayment; use Kiener\MolliePayments\Handler\Method\PosPayment; @@ -107,6 +108,7 @@ public function testSupportedMethods(): void KlarnaPayNowPayment::class, KlarnaSliceItPayment::class, PayPalPayment::class, + PayPalExpressPayment::class, PaySafeCardPayment::class, Przelewy24Payment::class, SofortPayment::class, diff --git a/vendor_manual/makefile b/vendor_manual/makefile index 4e1d8209e..880e6a673 100644 --- a/vendor_manual/makefile +++ b/vendor_manual/makefile @@ -1,5 +1,6 @@ -MOLLIE_PHP_VERSION:=2.61.0 +#MOLLIE_PHP_VERSION:=v2.61.0 +MOLLIE_PHP_VERSION:=feature/add-sessions help: @@ -9,7 +10,7 @@ help: install: ## Installs all production dependencies rm -rf mollie - git clone -b v$(MOLLIE_PHP_VERSION) https://github.com/mollie/mollie-api-php.git mollie/mollie-api-php + git clone -b $(MOLLIE_PHP_VERSION) https://github.com/mollie/mollie-api-php.git mollie/mollie-api-php rm -rf mollie/mollie-api-php/.git rm -rf mollie/mollie-api-php/.github rm -rf mollie/mollie-api-php/.gitattributes diff --git a/vendor_manual/mollie/mollie-api-php/README.md b/vendor_manual/mollie/mollie-api-php/README.md index c29135950..6ed9f0ee4 100644 --- a/vendor_manual/mollie/mollie-api-php/README.md +++ b/vendor_manual/mollie/mollie-api-php/README.md @@ -1,9 +1,10 @@

- +

+

Mollie API client for PHP

- +![mollie-api-php-header](https://github.com/mollie/mollie-api-php/assets/7265703/e79b7770-fe00-4dfe-bb8b-3d5ed221e329) Accepting [iDEAL](https://www.mollie.com/payments/ideal/), [Apple Pay](https://www.mollie.com/payments/apple-pay), [Bancontact](https://www.mollie.com/payments/bancontact/), [SOFORT Banking](https://www.mollie.com/payments/sofort/), [Creditcard](https://www.mollie.com/payments/credit-card/), [SEPA Bank transfer](https://www.mollie.com/payments/bank-transfer/), [SEPA Direct debit](https://www.mollie.com/payments/direct-debit/), [PayPal](https://www.mollie.com/payments/paypal/), [Belfius Direct Net](https://www.mollie.com/payments/belfius/), [KBC/CBC](https://www.mollie.com/payments/kbc-cbc/), [paysafecard](https://www.mollie.com/payments/paysafecard/), [ING Home'Pay](https://www.mollie.com/payments/ing-homepay/), [Giropay](https://www.mollie.com/payments/giropay/), [EPS](https://www.mollie.com/payments/eps/), [Przelewy24](https://www.mollie.com/payments/przelewy24/), [Postepay](https://www.mollie.com/en/payments/postepay), [In3](https://www.mollie.com/payments/in3/), [Klarna](https://www.mollie.com/payments/klarna-pay-later/) ([Pay now](https://www.mollie.com/payments/klarna-pay-now/), [Pay later](https://www.mollie.com/payments/klarna-pay-later/), [Slice it](https://www.mollie.com/payments/klarna-slice-it/), [Pay in 3](https://www.mollie.com/payments/klarna-pay-in-3/)), [Giftcard](https://www.mollie.com/payments/gift-cards/) and [Voucher](https://www.mollie.com/en/payments/meal-eco-gift-vouchers) online payments without fixed monthly costs or any punishing registration procedures. Just use the Mollie API to receive payments directly on your website or easily refund transactions to your customers. diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceEndpoint.php index b1a9d69aa..5f44e41af 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceEndpoint.php @@ -6,6 +6,7 @@ use Mollie\Api\Resources\Balance; use Mollie\Api\Resources\BalanceCollection; use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\LazyCollection; class BalanceEndpoint extends CollectionEndpointAbstract { @@ -45,7 +46,7 @@ protected function getResourceObject() public function get(string $balanceId, array $parameters = []) { if (empty($balanceId) || strpos($balanceId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid balance ID: '{$balanceId}'. A balance ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid balance ID: '{$balanceId}'. A balance ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_read($balanceId, $parameters); @@ -79,4 +80,19 @@ public function page(?string $from = null, ?int $limit = null, array $parameters { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over balances retrieved from Mollie. + * + * @param string $from The first Balance ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceTransactionEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceTransactionEndpoint.php index ed0cbb098..4f2447139 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceTransactionEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/BalanceTransactionEndpoint.php @@ -7,6 +7,7 @@ use Mollie\Api\Resources\Balance; use Mollie\Api\Resources\BalanceTransaction; use Mollie\Api\Resources\BalanceTransactionCollection; +use Mollie\Api\Resources\LazyCollection; class BalanceTransactionEndpoint extends CollectionEndpointAbstract { @@ -50,6 +51,20 @@ public function listFor(Balance $balance, array $parameters = []) return $this->listForId($balance->id, $parameters); } + /** + * Create an iterator for iterating over balance transactions for the given balance retrieved from Mollie. + * + * @param Balance $balance + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorFor(Balance $balance, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->iteratorForId($balance->id, $parameters, $iterateBackwards); + } + /** * List the transactions for a specific Balance ID. * @@ -66,6 +81,22 @@ public function listForId(string $balanceId, array $parameters = []) return parent::rest_list(null, null, $parameters); } + /** + * Create an iterator for iterating over balance transactions for the given balance id retrieved from Mollie. + * + * @param string $balanceId + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $balanceId, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $balanceId; + + return $this->rest_iterator(null, null, $parameters, $iterateBackwards); + } + /** * List the transactions for the primary Balance. * @@ -80,4 +111,19 @@ public function listForPrimary(array $parameters = []) return parent::rest_list(null, null, $parameters); } + + /** + * Create an iterator for iterating over transactions for the primary balance retrieved from Mollie. + * + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForPrimary(array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = "primary"; + + return $this->rest_iterator(null, null, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php index dd5045ab5..c40c179c0 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ChargebackEndpoint.php @@ -5,6 +5,7 @@ use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\Chargeback; use Mollie\Api\Resources\ChargebackCollection; +use Mollie\Api\Resources\LazyCollection; class ChargebackEndpoint extends CollectionEndpointAbstract { @@ -43,8 +44,23 @@ protected function getResourceCollectionObject($count, $_links) * @return ChargebackCollection * @throws ApiException */ - public function page($from = null, $limit = null, array $parameters = []) + public function page(?string $from = null, ?int $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over chargeback retrieved from Mollie. + * + * @param string $from The first chargevback ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ClientEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ClientEndpoint.php index 86891785f..9d7ba66b1 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ClientEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ClientEndpoint.php @@ -5,6 +5,7 @@ use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\Client; use Mollie\Api\Resources\ClientCollection; +use Mollie\Api\Resources\LazyCollection; class ClientEndpoint extends CollectionEndpointAbstract { @@ -62,8 +63,23 @@ public function get($clientId, array $parameters = []) * @return ClientCollection * @throws ApiException */ - public function page($from = null, $limit = null, array $parameters = []) + public function page(?string $from = null, ?int $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over clients retrieved from Mollie. + * + * @param string $from The first client ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php index b11ee9853..06b1dec21 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/CollectionEndpointAbstract.php @@ -4,6 +4,8 @@ use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\BaseCollection; +use Mollie\Api\Resources\CursorCollection; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\ResourceFactory; abstract class CollectionEndpointAbstract extends EndpointAbstract @@ -18,7 +20,7 @@ abstract class CollectionEndpointAbstract extends EndpointAbstract * @return mixed * @throws ApiException */ - protected function rest_list($from = null, $limit = null, array $filters = []) + protected function rest_list(?string $from = null, ?int $limit = null, array $filters = []) { $filters = array_merge(["from" => $from, "limit" => $limit], $filters); @@ -36,6 +38,27 @@ protected function rest_list($from = null, $limit = null, array $filters = []) return $collection; } + /** + * Create a generator for iterating over a resource's collection using REST API calls. + * + * This function fetches paginated data from a RESTful resource endpoint and returns a generator + * that allows you to iterate through the items in the collection one by one. It supports forward + * and backward iteration, pagination, and filtering. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $filters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * @return LazyCollection + */ + protected function rest_iterator(?string $from = null, ?int $limit = null, array $filters = [], bool $iterateBackwards = false): LazyCollection + { + /** @var CursorCollection $page */ + $page = $this->rest_list($from, $limit, $filters); + + return $page->getAutoIterator($iterateBackwards); + } + /** * Get the collection object that is used by this API endpoint. Every API endpoint uses one type of collection object. * diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php index ae04d8f4b..61c8e6895 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerEndpoint.php @@ -5,6 +5,7 @@ use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\Customer; use Mollie\Api\Resources\CustomerCollection; +use Mollie\Api\Resources\LazyCollection; class CustomerEndpoint extends CollectionEndpointAbstract { @@ -81,7 +82,7 @@ public function get($customerId, array $parameters = []) public function update($customerId, array $data = []) { if (empty($customerId) || strpos($customerId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid order ID: '{$customerId}'. An order ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid order ID: '{$customerId}'. An order ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_update($customerId, $data); @@ -114,8 +115,23 @@ public function delete($customerId, array $data = []) * @return CustomerCollection * @throws ApiException */ - public function page($from = null, $limit = null, array $parameters = []) + public function page(?string $from = null, ?int $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over customers retrieved from Mollie. + * + * @param string $from The first customer ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php index 3961ea6f3..1730cb245 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/CustomerPaymentsEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Resources\Customer; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Payment; use Mollie\Api\Resources\PaymentCollection; @@ -74,11 +75,27 @@ public function createForId($customerId, array $options = [], array $filters = [ * @return PaymentCollection * @throws \Mollie\Api\Exceptions\ApiException */ - public function listFor(Customer $customer, $from = null, $limit = null, array $parameters = []) + public function listFor(Customer $customer, ?string $from = null, ?int $limit = null, array $parameters = []) { return $this->listForId($customer->id, $from, $limit, $parameters); } + /** + * Create an iterator for iterating over payments for the given customer, retrieved from Mollie. + * + * @param Customer $customer + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorFor(Customer $customer, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->iteratorForId($customer->id, $from, $limit, $parameters, $iterateBackwards); + } + /** * @param string $customerId * @param string $from The first resource ID you want to include in your list. @@ -88,10 +105,28 @@ public function listFor(Customer $customer, $from = null, $limit = null, array $ * @return \Mollie\Api\Resources\PaymentCollection * @throws \Mollie\Api\Exceptions\ApiException */ - public function listForId($customerId, $from = null, $limit = null, array $parameters = []) + public function listForId($customerId, ?string $from = null, ?int $limit = null, array $parameters = []) { $this->parentId = $customerId; return parent::rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over payments for the given customer id, retrieved from Mollie. + * + * @param string $customerId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $customerId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $customerId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php index a228fd283..e577abd93 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/InvoiceEndpoint.php @@ -5,6 +5,7 @@ use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\Invoice; use Mollie\Api\Resources\InvoiceCollection; +use Mollie\Api\Resources\LazyCollection; class InvoiceEndpoint extends CollectionEndpointAbstract { @@ -76,4 +77,19 @@ public function all(array $parameters = []) { return $this->page(null, null, $parameters); } + + /** + * Create an iterator for iterating over invoices retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php index 046eaf2e1..d6dee89f3 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/MandateEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Resources\Customer; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Mandate; use Mollie\Api\Resources\MandateCollection; @@ -103,6 +104,22 @@ public function listFor(Customer $customer, $from = null, $limit = null, array $ return $this->listForId($customer->id, $from, $limit, $parameters); } + /** + * Create an iterator for iterating over mandates for the given customer, retrieved from Mollie. + * + * @param Customer $customer + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorFor(Customer $customer, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->iteratorForId($customer->id, $from, $limit, $parameters, $iterateBackwards); + } + /** * @param string $customerId * @param null $from @@ -119,6 +136,24 @@ public function listForId($customerId, $from = null, $limit = null, array $param return parent::rest_list($from, $limit, $parameters); } + /** + * Create an iterator for iterating over mandates for the given customer id, retrieved from Mollie. + * + * @param string $customerId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $customerId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $customerId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } + /** * @param Customer $customer * @param string $mandateId diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php index 605544a30..91f7bc347 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/OrderEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Order; use Mollie\Api\Resources\OrderCollection; @@ -68,7 +69,7 @@ public function create(array $data = [], array $filters = []) public function update($orderId, array $data = []) { if (empty($orderId) || strpos($orderId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid order ID: '{$orderId}'. An order ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid order ID: '{$orderId}'. An order ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_update($orderId, $data); @@ -87,7 +88,7 @@ public function update($orderId, array $data = []) public function get($orderId, array $parameters = []) { if (empty($orderId) || strpos($orderId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid order ID: '{$orderId}'. An order ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid order ID: '{$orderId}'. An order ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_read($orderId, $parameters); @@ -123,8 +124,23 @@ public function cancel($orderId, $parameters = []) * @return OrderCollection * @throws ApiException */ - public function page($from = null, $limit = null, array $parameters = []) + public function page(?string $from = null, ?int $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over orders retrieved from Mollie. + * + * @param string $from The first order ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php index 6766235ab..61b2a6d24 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentCaptureEndpoint.php @@ -4,6 +4,7 @@ use Mollie\Api\Resources\Capture; use Mollie\Api\Resources\CaptureCollection; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Payment; class PaymentCaptureEndpoint extends CollectionEndpointAbstract @@ -105,6 +106,22 @@ public function listFor(Payment $payment, array $parameters = []) return $this->listForId($payment->id, $parameters); } + /** + * Create an iterator for iterating over captures for the given payment, retrieved from Mollie. + * + * @param Payment $payment + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorFor(Payment $payment, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->iteratorForId($payment->id, $from, $limit, $parameters, $iterateBackwards); + } + /** * @param string $paymentId * @param array $parameters @@ -118,4 +135,22 @@ public function listForId($paymentId, array $parameters = []) return parent::rest_list(null, null, $parameters); } + + /** + * Create an iterator for iterating over captures for the given payment id, retrieved from Mollie. + * + * @param string $paymentId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $paymentId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $paymentId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php index e27ddeb5a..5a232f889 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentChargebackEndpoint.php @@ -4,6 +4,7 @@ use Mollie\Api\Resources\Chargeback; use Mollie\Api\Resources\ChargebackCollection; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Payment; class PaymentChargebackEndpoint extends CollectionEndpointAbstract @@ -73,6 +74,22 @@ public function listFor(Payment $payment, array $parameters = []) return $this->listForId($payment->id, $parameters); } + /** + * Create an iterator for iterating over chargebacks for the given payment, retrieved from Mollie. + * + * @param Payment $payment + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorFor(Payment $payment, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->iteratorForId($payment->id, $from, $limit, $parameters, $iterateBackwards); + } + /** * @param string $paymentId * @param array $parameters @@ -86,4 +103,22 @@ public function listForId($paymentId, array $parameters = []) return parent::rest_list(null, null, $parameters); } + + /** + * Create an iterator for iterating over chargebacks for the given payment id, retrieved from Mollie. + * + * @param string $paymentId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $paymentId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $paymentId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php index a840863e7..79b1c6b6e 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Payment; use Mollie\Api\Resources\PaymentCollection; use Mollie\Api\Resources\Refund; @@ -66,7 +67,7 @@ public function create(array $data = [], array $filters = []) public function update($paymentId, array $data = []) { if (empty($paymentId) || strpos($paymentId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid payment ID: '{$paymentId}'. A payment ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid payment ID: '{$paymentId}'. A payment ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_update($paymentId, $data); @@ -85,7 +86,7 @@ public function update($paymentId, array $data = []) public function get($paymentId, array $parameters = []) { if (empty($paymentId) || strpos($paymentId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid payment ID: '{$paymentId}'. A payment ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid payment ID: '{$paymentId}'. A payment ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_read($paymentId, $parameters); @@ -140,6 +141,21 @@ public function page($from = null, $limit = null, array $parameters = []) return $this->rest_list($from, $limit, $parameters); } + /** + * Create an iterator for iterating over payments retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } + /** * Issue a refund for the given payment. * diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentLinkEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentLinkEndpoint.php index 8f3f3bef1..f27d09ddf 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentLinkEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentLinkEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Payment; use Mollie\Api\Resources\PaymentLink; use Mollie\Api\Resources\PaymentLinkCollection; @@ -64,7 +65,7 @@ public function create(array $data = [], array $filters = []) public function get($paymentLinkId, array $parameters = []) { if (empty($paymentLinkId) || strpos($paymentLinkId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid payment link ID: '{$paymentLinkId}'. A payment link ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid payment link ID: '{$paymentLinkId}'. A payment link ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_read($paymentLinkId, $parameters); @@ -84,4 +85,19 @@ public function page($from = null, $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over payment links retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php index 3dfa24696..68524ec8c 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/PaymentRefundEndpoint.php @@ -2,6 +2,7 @@ namespace Mollie\Api\Endpoints; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Payment; use Mollie\Api\Resources\Refund; use Mollie\Api\Resources\RefundCollection; @@ -73,6 +74,22 @@ public function listFor(Payment $payment, array $parameters = []) return $this->listForId($payment->id, $parameters); } + /** + * Create an iterator for iterating over refunds for the given payment, retrieved from Mollie. + * + * @param Payment $payment + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorFor(Payment $payment, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->iteratorForId($payment->id, $from, $limit, $parameters, $iterateBackwards); + } + /** * @param string $paymentId * @param array $parameters @@ -87,6 +104,24 @@ public function listForId($paymentId, array $parameters = []) return parent::rest_list(null, null, $parameters); } + /** + * Create an iterator for iterating over refunds for the given payment id, retrieved from Mollie. + * + * @param string $paymentId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $paymentId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $paymentId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } + /** * Creates a refund for a specific payment. diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php index 498d442ad..d430275c9 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ProfileEndpoint.php @@ -4,6 +4,7 @@ use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\CurrentProfile; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Profile; use Mollie\Api\Resources\ProfileCollection; @@ -88,7 +89,7 @@ public function get($profileId, array $parameters = []) public function update($profileId, array $data = []) { if (empty($profileId) || strpos($profileId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid profile id: '{$profileId}'. An profile id should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid profile id: '{$profileId}'. An profile id should start with '" . self::RESOURCE_ID_PREFIX . "'."); } return parent::rest_update($profileId, $data); @@ -140,4 +141,19 @@ public function page($from = null, $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over profiles retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php index 385e21c0f..de03c477a 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/RefundEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Refund; use Mollie\Api\Resources\RefundCollection; @@ -47,4 +48,19 @@ public function page($from = null, $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over refunds retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SessionEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SessionEndpoint.php new file mode 100644 index 000000000..8f2d72ee8 --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SessionEndpoint.php @@ -0,0 +1,139 @@ +client); + } + + /** + * Get the collection object that is used by this API endpoint. Every API + * endpoint uses one type of collection object. + * + * @param int $count + * @param \stdClass $_links + * + * @return SessionCollection + */ + protected function getResourceCollectionObject($count, $_links) + { + return new SessionCollection($this->client, $count, $_links); + } + + /** + * Creates a session in Mollie. + * + * @param array $data An array containing details on the session. + * @param array $filters + * + * @return Session + * @throws ApiException + */ + public function create(array $data = [], array $filters = []) + { + return $this->rest_create($data, $filters); + } + + /** + * Update a specific Session resource + * + * Will throw a ApiException if the resource id is invalid or the resource cannot be found. + * + * @param string $resourceId + * + * @param array $data + * @return Session + * @throws ApiException + */ + public function update($resourceId, array $data = []) + { + if (empty($resourceId) || strpos($resourceId, self::RESOURCE_ID_PREFIX) !== 0) { + throw new ApiException("Invalid session ID: '{$resourceId}'. A session ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); + } + + return parent::rest_update($resourceId, $data); + } + + /** + * Retrieve a single session from Mollie. + * + * Will throw a ApiException if the resource id is invalid or the resource cannot + * be found. + * + * @param array $parameters + * @return Session + * @throws ApiException + */ + public function get($resourceId, array $parameters = []) + { + if (empty($resourceId) || strpos($resourceId, self::RESOURCE_ID_PREFIX) !== 0) { + throw new ApiException("Invalid session ID: '{$resourceId}'. A session ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); + } + + return parent::rest_read($resourceId, $parameters); + } + + /** + * Cancel the given Session. + * + * @param string $resourceId + * @param array $parameters + * @return Session + * @throws ApiException + */ + public function cancel($resourceId, $parameters = []) + { + return $this->rest_delete($resourceId, $parameters); + } + + /** + * Retrieves a collection of Sessions from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * + * @return SessionCollection + * @throws ApiException + */ + public function page(?string $from = null, ?int $limit = null, array $parameters = []) + { + return $this->rest_list($from, $limit, $parameters); + } + + /** + * Create an iterator for iterating over sessions retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse resource iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementCaptureEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementCaptureEndpoint.php new file mode 100644 index 000000000..3e51443ef --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementCaptureEndpoint.php @@ -0,0 +1,63 @@ +client); + } + + protected function getResourceCollectionObject($count, $_links) + { + return new CaptureCollection($this->client, $count, $_links); + } + + /** + * Retrieves a collection of Settlement Captures from Mollie. + * + * @param string $settlementId + * @param string|null $from The first capture ID you want to include in your list. + * @param int|null $limit + * @param array $parameters + * + * @return mixed + * @throws \Mollie\Api\Exceptions\ApiException + */ + public function pageForId(string $settlementId, string $from = null, int $limit = null, array $parameters = []) + { + $this->parentId = $settlementId; + + return $this->rest_list($from, $limit, $parameters); + } + + /** + * Create an iterator for iterating over captures for the given settlement id, retrieved from Mollie. + * + * @param string $settlementId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $settlementId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $settlementId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementChargebackEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementChargebackEndpoint.php new file mode 100644 index 000000000..585ccf2c5 --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementChargebackEndpoint.php @@ -0,0 +1,66 @@ +client); + } + + /** + * @inheritDoc + */ + protected function getResourceCollectionObject($count, $_links) + { + return new ChargebackCollection($this->client, $count, $_links); + } + + /** + * Retrieves a collection of Settlement Chargebacks from Mollie. + * + * @param string $settlementId + * @param string|null $from The first chargeback ID you want to include in your list. + * @param int|null $limit + * @param array $parameters + * + * @return mixed + * @throws \Mollie\Api\Exceptions\ApiException + */ + public function pageForId(string $settlementId, string $from = null, int $limit = null, array $parameters = []) + { + $this->parentId = $settlementId; + + return $this->rest_list($from, $limit, $parameters); + } + + /** + * Create an iterator for iterating over chargeback for the given settlement id, retrieved from Mollie. + * + * @param string $settlementId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $settlementId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $settlementId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementPaymentEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementPaymentEndpoint.php index 6ac8304e5..ed9b10b5f 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementPaymentEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementPaymentEndpoint.php @@ -2,6 +2,7 @@ namespace Mollie\Api\Endpoints; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Payment; use Mollie\Api\Resources\PaymentCollection; @@ -42,4 +43,22 @@ public function pageForId($settlementId, $from = null, $limit = null, array $par return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over payments for the given settlement id, retrieved from Mollie. + * + * @param string $settlementId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $settlementId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $settlementId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementRefundEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementRefundEndpoint.php new file mode 100644 index 000000000..4f751da79 --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementRefundEndpoint.php @@ -0,0 +1,66 @@ +client, $count, $_links); + } + + /** + * @inheritDoc + */ + protected function getResourceObject() + { + return new Refund($this->client); + } + + /** + * Retrieves a collection of Settlement Refunds from Mollie. + * + * @param string $settlementId + * @param string|null $from The first refund ID you want to include in your list. + * @param int|null $limit + * @param array $parameters + * + * @return mixed + * @throws \Mollie\Api\Exceptions\ApiException + */ + public function pageForId(string $settlementId, string $from = null, int $limit = null, array $parameters = []) + { + $this->parentId = $settlementId; + + return $this->rest_list($from, $limit, $parameters); + } + + /** + * Create an iterator for iterating over refunds for the given settlement id, retrieved from Mollie. + * + * @param string $settlementId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $settlementId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $settlementId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php index a4d49e85e..76c7cad84 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SettlementsEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Settlement; use Mollie\Api\Resources\SettlementCollection; @@ -84,4 +85,19 @@ public function page($from = null, $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over settlements retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php index 6456ab7ca..c62bcb361 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/ShipmentEndpoint.php @@ -121,7 +121,7 @@ public function getForId($orderId, $shipmentId, array $parameters = []) public function update($orderId, $shipmentId, array $data = []) { if (empty($shipmentId) || strpos($shipmentId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid subscription ID: '{$shipmentId}'. An subscription ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid subscription ID: '{$shipmentId}'. An subscription ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } $this->parentId = $orderId; diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php index d9b919af3..8e2d8122c 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/SubscriptionEndpoint.php @@ -4,6 +4,7 @@ use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\Customer; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\ResourceFactory; use Mollie\Api\Resources\Subscription; use Mollie\Api\Resources\SubscriptionCollection; @@ -88,7 +89,7 @@ public function createForId($customerId, array $options = [], array $filters = [ public function update($customerId, $subscriptionId, array $data = []) { if (empty($subscriptionId) || strpos($subscriptionId, self::RESOURCE_ID_PREFIX) !== 0) { - throw new ApiException("Invalid subscription ID: '{$subscriptionId}'. An subscription ID should start with '".self::RESOURCE_ID_PREFIX."'."); + throw new ApiException("Invalid subscription ID: '{$subscriptionId}'. An subscription ID should start with '" . self::RESOURCE_ID_PREFIX . "'."); } $this->parentId = $customerId; @@ -138,6 +139,22 @@ public function listFor(Customer $customer, $from = null, $limit = null, array $ return $this->listForId($customer->id, $from, $limit, $parameters); } + /** + * Create an iterator for iterating over subscriptions for the given customer, retrieved from Mollie. + * + * @param Customer $customer + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorFor(Customer $customer, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->iteratorForId($customer->id, $from, $limit, $parameters, $iterateBackwards); + } + /** * @param string $customerId * @param string $from The first resource ID you want to include in your list. @@ -154,6 +171,24 @@ public function listForId($customerId, $from = null, $limit = null, array $param return parent::rest_list($from, $limit, $parameters); } + /** + * Create an iterator for iterating over subscriptions for the given customer id, retrieved from Mollie. + * + * @param string $customerId + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iteratorForId(string $customerId, ?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $this->parentId = $customerId; + + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } + /** * @param Customer $customer * @param string $subscriptionId @@ -209,4 +244,21 @@ public function page($from = null, $limit = null, array $parameters = []) return $collection; } + + /** + * Create an iterator for iterating over subscriptions retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + $page = $this->page($from, $limit, $parameters); + + return $page->getAutoIterator($iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Endpoints/TerminalEndpoint.php b/vendor_manual/mollie/mollie-api-php/src/Endpoints/TerminalEndpoint.php index 4b100b566..4f7a65c62 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Endpoints/TerminalEndpoint.php +++ b/vendor_manual/mollie/mollie-api-php/src/Endpoints/TerminalEndpoint.php @@ -3,6 +3,7 @@ namespace Mollie\Api\Endpoints; use Mollie\Api\Exceptions\ApiException; +use Mollie\Api\Resources\LazyCollection; use Mollie\Api\Resources\Terminal; use Mollie\Api\Resources\TerminalCollection; @@ -69,4 +70,19 @@ public function page($from = null, $limit = null, array $parameters = []) { return $this->rest_list($from, $limit, $parameters); } + + /** + * Create an iterator for iterating over terminals retrieved from Mollie. + * + * @param string $from The first resource ID you want to include in your list. + * @param int $limit + * @param array $parameters + * @param bool $iterateBackwards Set to true for reverse order iteration (default is false). + * + * @return LazyCollection + */ + public function iterator(?string $from = null, ?int $limit = null, array $parameters = [], bool $iterateBackwards = false): LazyCollection + { + return $this->rest_iterator($from, $limit, $parameters, $iterateBackwards); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/MollieApiClient.php b/vendor_manual/mollie/mollie-api-php/src/MollieApiClient.php index 86f5d5c7a..df0989030 100644 --- a/vendor_manual/mollie/mollie-api-php/src/MollieApiClient.php +++ b/vendor_manual/mollie/mollie-api-php/src/MollieApiClient.php @@ -30,7 +30,11 @@ use Mollie\Api\Endpoints\ProfileEndpoint; use Mollie\Api\Endpoints\ProfileMethodEndpoint; use Mollie\Api\Endpoints\RefundEndpoint; +use Mollie\Api\Endpoints\SessionEndpoint; +use Mollie\Api\Endpoints\SettlementCaptureEndpoint; +use Mollie\Api\Endpoints\SettlementChargebackEndpoint; use Mollie\Api\Endpoints\SettlementPaymentEndpoint; +use Mollie\Api\Endpoints\SettlementRefundEndpoint; use Mollie\Api\Endpoints\SettlementsEndpoint; use Mollie\Api\Endpoints\ShipmentEndpoint; use Mollie\Api\Endpoints\SubscriptionEndpoint; @@ -47,7 +51,7 @@ class MollieApiClient /** * Version of our client. */ - public const CLIENT_VERSION = "2.61.0"; + public const CLIENT_VERSION = "2.62.0"; /** * Endpoint of the remote API. @@ -117,6 +121,20 @@ class MollieApiClient */ public $settlements; + /** + * RESTful Settlement capture resource. + * + * @var \Mollie\Api\Endpoints\SettlementCaptureEndpoint + */ + public $settlementCaptures; + + /** + * RESTful Settlement chargeback resource. + * + * @var \Mollie\Api\Endpoints\SettlementChargebackEndpoint + */ + public $settlementChargebacks; + /** * RESTful Settlement payment resource. * @@ -124,6 +142,13 @@ class MollieApiClient */ public $settlementPayments; + /** + * RESTful Settlement refund resource. + * + * @var \Mollie\Api\Endpoints\SettlementRefundEndpoint + */ + public $settlementRefunds; + /** * RESTful Subscription resource. * @@ -339,6 +364,13 @@ class MollieApiClient */ public $clientLinks; + /** + * RESTful Session resource. + * + * @var SessionEndpoint + */ + public $sessions; + /** * @param \GuzzleHttp\ClientInterface|\Mollie\Api\HttpAdapter\MollieHttpAdapterInterface|null $httpClient * @param \Mollie\Api\HttpAdapter\MollieHttpAdapterPickerInterface|null $httpAdapterPicker, @@ -365,7 +397,10 @@ public function initializeEndpoints() $this->profileMethods = new ProfileMethodEndpoint($this); $this->customers = new CustomerEndpoint($this); $this->settlements = new SettlementsEndpoint($this); + $this->settlementCaptures = new SettlementCaptureEndpoint($this); + $this->settlementChargebacks = new SettlementChargebackEndpoint($this); $this->settlementPayments = new SettlementPaymentEndpoint($this); + $this->settlementRefunds = new SettlementRefundEndpoint($this); $this->subscriptions = new SubscriptionEndpoint($this); $this->customerPayments = new CustomerPaymentsEndpoint($this); $this->mandates = new MandateEndpoint($this); @@ -394,6 +429,7 @@ public function initializeEndpoints() $this->organizationPartners = new OrganizationPartnerEndpoint($this); $this->clients = new ClientEndpoint($this); $this->clientLinks = new ClientLinkEndpoint($this); + $this->sessions = new SessionEndpoint($this); } protected function initializeVersionStrings() diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/CursorCollection.php b/vendor_manual/mollie/mollie-api-php/src/Resources/CursorCollection.php index e32653351..0f83c7e56 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Resources/CursorCollection.php +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/CursorCollection.php @@ -2,6 +2,7 @@ namespace Mollie\Api\Resources; +use Generator; use Mollie\Api\MollieApiClient; abstract class CursorCollection extends BaseCollection @@ -93,4 +94,32 @@ public function hasPrevious() { return isset($this->_links->previous->href); } + + /** + * Iterate over a CursorCollection and yield its elements. + * + * @param bool $iterateBackwards + * + * @return LazyCollection + */ + public function getAutoIterator(bool $iterateBackwards = false): LazyCollection + { + $page = $this; + + return new LazyCollection(function () use ($page, $iterateBackwards): Generator { + while (true) { + foreach ($page as $item) { + yield $item; + } + + if (($iterateBackwards && ! $page->hasPrevious()) || ! $page->hasNext()) { + break; + } + + $page = $iterateBackwards + ? $page->previous() + : $page->next(); + } + }); + } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/Customer.php b/vendor_manual/mollie/mollie-api-php/src/Resources/Customer.php index 98fc7443d..bc44daaf2 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Resources/Customer.php +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/Customer.php @@ -6,6 +6,8 @@ class Customer extends BaseResource { + use HasPresetOptions; + /** * Id of the customer. * @@ -221,30 +223,4 @@ public function hasValidMandateForMethod($method) return false; } - - /** - * When accessed by oAuth we want to pass the testmode by default - * - * @return array - */ - private function getPresetOptions() - { - $options = []; - if ($this->client->usesOAuth()) { - $options["testmode"] = $this->mode === "test" ? true : false; - } - - return $options; - } - - /** - * Apply the preset options. - * - * @param array $options - * @return array - */ - private function withPresetOptions(array $options) - { - return array_merge($this->getPresetOptions(), $options); - } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/HasPresetOptions.php b/vendor_manual/mollie/mollie-api-php/src/Resources/HasPresetOptions.php new file mode 100644 index 000000000..8a0e24e21 --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/HasPresetOptions.php @@ -0,0 +1,38 @@ +client->usesOAuth()) { + $options["testmode"] = $this->mode === "test" ? true : false; + } + + return $options; + } + + /** + * Apply the preset options. + * + * @param array $options + * @return array + */ + protected function withPresetOptions(array $options) + { + return array_merge($this->getPresetOptions(), $options); + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/LazyCollection.php b/vendor_manual/mollie/mollie-api-php/src/Resources/LazyCollection.php new file mode 100644 index 000000000..0fc90f081 --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/LazyCollection.php @@ -0,0 +1,198 @@ + + */ +class LazyCollection implements IteratorAggregate +{ + /** + * @var callable + */ + private $source; + + /** + * @param callable $source + */ + public function __construct($source) + { + $this->source = $source; + } + + /** + * Get all items in the collection. + * + * @return array + */ + public function all(): array + { + return iterator_to_array($this->getIterator()); + } + + /** + * Get an item from the collection by key. + * + * @param TKey $key + * @return TValue|null + */ + public function get($key) + { + foreach ($this as $outerKey => $outerValue) { + if ($outerKey == $key) { + return $outerValue; + } + } + + return null; + } + + /** + * Run a filter over each of the items. + * + * @param (callable(TValue, TKey): bool) $callback + * @return self + */ + public function filter(callable $callback): self + { + return new self(function () use ($callback) { + foreach ($this as $key => $value) { + if ($callback($value, $key)) { + yield $key => $value; + } + } + }); + } + + /** + * Get the first item from the collection passing the given truth test. + * + * @param (callable(TValue, TKey): bool)|null $callback + * @return TValue|null + */ + public function first(callable $callback = null) + { + $iterator = $this->getIterator(); + + if (is_null($callback)) { + if (! $iterator->valid()) { + return null; + } + + return $iterator->current(); + } + + foreach ($iterator as $key => $value) { + if ($callback($value, $key)) { + return $value; + } + } + + return null; + } + + /** + * Run a map over each of the items. + * + * @template TMapValue + * + * @param callable(TValue, TKey): TMapValue $callback + * @return static + */ + public function map(callable $callback): self + { + return new self(function () use ($callback) { + foreach ($this as $key => $value) { + yield $key => $callback($value, $key); + } + }); + } + + /** + * Take the first {$limit} items. + * + * @param int $limit + * @return static + */ + public function take(int $limit): self + { + return new self(function () use ($limit) { + $iterator = $this->getIterator(); + + while ($limit--) { + if (! $iterator->valid()) { + break; + } + + yield $iterator->key() => $iterator->current(); + + if ($limit) { + $iterator->next(); + } + } + }); + } + + /** + * Determine if all items pass the given truth test. + * + * @param (callable(TValue, TKey): bool) $callback + * @return bool + */ + public function every(callable $callback): bool + { + $iterator = $this->getIterator(); + + foreach ($iterator as $key => $value) { + if (! $callback($value, $key)) { + return false; + } + } + + return true; + } + + /** + * Count the number of items in the collection. + * + * @return int + */ + public function count(): int + { + return iterator_count($this->getIterator()); + } + + /** + * Get an iterator for the items. + * + * @return Iterator + */ + public function getIterator(): Iterator + { + return $this->makeIterator($this->source); + } + + /** + * Get an iterator for the given value. + * + * @template TIteratorKey of array-key + * @template TIteratorValue + * + * @param IteratorAggregate|(callable(): \Generator) $source + * @return Iterator + */ + protected function makeIterator($source): Iterator + { + if ($source instanceof IteratorAggregate) { + return $source->getIterator(); + } + + return $source(); + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/Order.php b/vendor_manual/mollie/mollie-api-php/src/Resources/Order.php index 349a2c3df..9920e10f1 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Resources/Order.php +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/Order.php @@ -8,6 +8,8 @@ class Order extends BaseResource { + use HasPresetOptions; + /** * Id of the order. * @@ -541,30 +543,4 @@ public function payments() Payment::class ); } - - /** - * When accessed by oAuth we want to pass the testmode by default - * - * @return array - */ - private function getPresetOptions() - { - $options = []; - if ($this->client->usesOAuth()) { - $options["testmode"] = $this->mode === "test" ? true : false; - } - - return $options; - } - - /** - * Apply the preset options. - * - * @param array $options - * @return array - */ - private function withPresetOptions(array $options) - { - return array_merge($this->getPresetOptions(), $options); - } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/Payment.php b/vendor_manual/mollie/mollie-api-php/src/Resources/Payment.php index e56861f19..a47c6187a 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Resources/Payment.php +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/Payment.php @@ -9,6 +9,8 @@ class Payment extends BaseResource { + use HasPresetOptions; + /** * Id of the payment (on the Mollie platform). * @@ -734,32 +736,6 @@ public function update() return ResourceFactory::createFromApiResult($result, new Payment($this->client)); } - /** - * When accessed by oAuth we want to pass the testmode by default - * - * @return array - */ - private function getPresetOptions() - { - $options = []; - if ($this->client->usesOAuth()) { - $options["testmode"] = $this->mode === "test" ? true : false; - } - - return $options; - } - - /** - * Apply the preset options. - * - * @param array $options - * @return array - */ - private function withPresetOptions(array $options) - { - return array_merge($this->getPresetOptions(), $options); - } - /** * The total amount that is already captured for this payment. Only available * when this payment supports captures. diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/Session.php b/vendor_manual/mollie/mollie-api-php/src/Resources/Session.php new file mode 100644 index 000000000..44b49c54a --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/Session.php @@ -0,0 +1,175 @@ +status === SessionStatus::STATUS_CREATED; + } + + public function isReadyForProcessing() + { + return $this->status === SessionStatus::STATUS_READY_FOR_PROCESSING; + } + + public function isCompleted() + { + return $this->status === SessionStatus::STATUS_COMPLETED; + } + + public function hasFailed() + { + return $this->status === SessionStatus::STATUS_FAILED; + } + + /** + * Saves the session's updatable properties. + * + * @return \Mollie\Api\Resources\Session + * @throws \Mollie\Api\Exceptions\ApiException + */ + public function update() + { + $body = [ + 'billingAddress' => $this->billingAddress, + 'shippingAddress' => $this->shippingAddress, + ]; + + $result = $this->client->sessions->update($this->id, $this->withPresetOptions($body)); + + return ResourceFactory::createFromApiResult($result, new Session($this->client)); + } + + /** + * Cancels this session. + * + * @return Session + * @throws \Mollie\Api\Exceptions\ApiException + */ + public function cancel() + { + return $this->client->sessions->cancel($this->id, $this->getPresetOptions()); + } + + /** + * @return string|null + */ + public function getRedirectUrl() + { + if (empty($this->_links->redirect)) { + return null; + } + + return $this->_links->redirect->href; + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/SessionCollection.php b/vendor_manual/mollie/mollie-api-php/src/Resources/SessionCollection.php new file mode 100644 index 000000000..b1414c36b --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/SessionCollection.php @@ -0,0 +1,22 @@ +client); + } +} diff --git a/vendor_manual/mollie/mollie-api-php/src/Resources/Settlement.php b/vendor_manual/mollie/mollie-api-php/src/Resources/Settlement.php index 8bdef55ac..54f71cd24 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Resources/Settlement.php +++ b/vendor_manual/mollie/mollie-api-php/src/Resources/Settlement.php @@ -3,7 +3,6 @@ namespace Mollie\Api\Resources; use Mollie\Api\Exceptions\ApiException; -use Mollie\Api\MollieApiClient; use Mollie\Api\Types\SettlementStatus; class Settlement extends BaseResource @@ -92,7 +91,7 @@ public function isPending() } /** - * Is this settlement paidout? + * Is this settlement paid out? * * @return bool */ @@ -102,7 +101,7 @@ public function isPaidout() } /** - * Is this settlement failed? + * Has this settlement failed? * * @return bool */ @@ -112,7 +111,7 @@ public function isFailed() } /** - * Retrieves all payments associated with this settlement + * Retrieve the first page of payments associated with this settlement. * * @param int|null $limit * @param array $parameters @@ -121,72 +120,65 @@ public function isFailed() */ public function payments(int $limit = null, array $parameters = []): PaymentCollection { - return $this->client->settlementPayments->pageForId($this->id, null, $limit, $parameters); + return $this->client->settlementPayments->pageForId( + $this->id, + null, + $limit, + $parameters + ); } /** - * Retrieves all refunds associated with this settlement + * Retrieve the first page of refunds associated with this settlement. * + * @param int|null $limit + * @param array $parameters * @return RefundCollection * @throws ApiException */ - public function refunds() + public function refunds(int $limit = null, array $parameters = []) { - if (! isset($this->_links->refunds->href)) { - return new RefundCollection($this->client, 0, null); - } - - $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->refunds->href); - - return ResourceFactory::createCursorResourceCollection( - $this->client, - $result->_embedded->refunds, - Refund::class, - $result->_links + return $this->client->settlementRefunds->pageForId( + $this->id, + null, + $limit, + $parameters ); } /** - * Retrieves all chargebacks associated with this settlement + * Retrieve the first page of chargebacks associated with this settlement. * + * @param int|null $limit + * @param array $parameters * @return ChargebackCollection * @throws ApiException */ - public function chargebacks() + public function chargebacks(int $limit = null, array $parameters = []) { - if (! isset($this->_links->chargebacks->href)) { - return new ChargebackCollection($this->client, 0, null); - } - - $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->chargebacks->href); - - return ResourceFactory::createCursorResourceCollection( - $this->client, - $result->_embedded->chargebacks, - Chargeback::class, - $result->_links + return $this->client->settlementChargebacks->pageForId( + $this->id, + null, + $limit, + $parameters ); } /** - * Retrieves all captures associated with this settlement + * Retrieve the first page of cap associated with this settlement. * + * @param int|null $limit + * @param array $parameters * @return CaptureCollection * @throws ApiException */ - public function captures() + public function captures(int $limit = null, array $parameters = []) { - if (! isset($this->_links->captures->href)) { - return new CaptureCollection($this->client, 0, null); - } - - $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->captures->href); - - return ResourceFactory::createCursorResourceCollection( - $this->client, - $result->_embedded->captures, - Capture::class, - $result->_links + return $this->client->settlementCaptures->pageForId( + $this->id, + null, + $limit, + $parameters ); } } diff --git a/vendor_manual/mollie/mollie-api-php/src/Types/PaymentMethod.php b/vendor_manual/mollie/mollie-api-php/src/Types/PaymentMethod.php index 7c7436565..e7db376c4 100644 --- a/vendor_manual/mollie/mollie-api-php/src/Types/PaymentMethod.php +++ b/vendor_manual/mollie/mollie-api-php/src/Types/PaymentMethod.php @@ -79,11 +79,13 @@ class PaymentMethod */ public const KBC = "kbc"; + public const KLARNA_ONE = "klarna"; + /** * @link https://www.mollie.com/en/payments/klarna-pay-later */ public const KLARNA_PAY_LATER = "klarnapaylater"; - + /** * @link https://www.mollie.com/en/payments/klarna-pay-now */ @@ -124,7 +126,7 @@ class PaymentMethod * @link https://www.mollie.com/en/payments/sofort */ public const SOFORT = "sofort"; - + /** * @link https://www.mollie.com/en/payments/in3 */ diff --git a/vendor_manual/mollie/mollie-api-php/src/Types/SessionStatus.php b/vendor_manual/mollie/mollie-api-php/src/Types/SessionStatus.php new file mode 100644 index 000000000..8d19b7798 --- /dev/null +++ b/vendor_manual/mollie/mollie-api-php/src/Types/SessionStatus.php @@ -0,0 +1,26 @@ +