From 3d8d5c637b43291359448084ddd8335afd78f51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Mei=C3=9Felbach?= Date: Tue, 15 Feb 2022 16:48:22 +0100 Subject: [PATCH 01/24] Fix empty arrays not being treated as valid cache results --- src/Shared/Data.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Shared/Data.php b/src/Shared/Data.php index 80fd32131..309b89e45 100644 --- a/src/Shared/Data.php +++ b/src/Shared/Data.php @@ -367,9 +367,9 @@ public function getApiPaymentMethods($use_cache = true, $filters = []) $filters_key = $filters; $filters_key['mode'] = ( $test_mode ? 'test' : 'live' ); $filters_key['api'] = 'methods'; + $transient_id = $this->getTransientId(md5(http_build_query($filters_key))); try { - $transient_id = $this->getTransientId(md5(http_build_query($filters_key))); if ($use_cache) { // When no cache exists $methods will be `false` @@ -377,7 +377,7 @@ public function getApiPaymentMethods($use_cache = true, $filters = []) } // No cache exists, call the API and cache the result - if (!$methods) { + if ($methods === false) { $filters['resource'] = 'orders'; $filters['includeWallets'] = 'applepay'; if(!$apiKey) { @@ -403,6 +403,13 @@ public function getApiPaymentMethods($use_cache = true, $filters = []) return $methods; } catch (\Mollie\Api\Exceptions\ApiException $e) { + /** + * Cache the result for a short period + * to prevent hammering the API with requests that are likely to fail again + */ + if ($use_cache) { + set_transient($transient_id, [], 60 * 5); + } $this->logger->log(LogLevel::DEBUG, __FUNCTION__ . ": Could not load Mollie methods (" . ( $test_mode ? 'test' : 'live' ) . "): " . $e->getMessage() . ' (' . get_class($e) . ')'); return []; From 8e1e360b952353a84a3b55e5b79cf64470e9a0ec Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Wed, 16 Feb 2022 16:00:04 +0100 Subject: [PATCH 02/24] MOL-683 Instantiate gateways only if enabled at Mollie --- src/Gateway/GatewayModule.php | 47 +++++++++++++++++++++++----- src/Gateway/MolliePaymentGateway.php | 9 +++--- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index 1ba8419a1..a96d1e2d4 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -16,6 +16,7 @@ use Mollie\WooCommerce\Buttons\PayPalButton\DataToPayPal; use Mollie\WooCommerce\Buttons\PayPalButton\PayPalAjaxRequests; use Mollie\WooCommerce\Buttons\PayPalButton\PayPalButtonHandler; +use Mollie\WooCommerce\Gateway\Voucher\MaybeDisableGateway; use Mollie\WooCommerce\Notice\AdminNotice; use Mollie\WooCommerce\Notice\NoticeInterface; use Mollie\WooCommerce\Payment\MollieObject; @@ -29,10 +30,10 @@ use Mollie\WooCommerce\PaymentMethods\IconFactory; use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Settings\Settings; +use Mollie\WooCommerce\Shared\Data; +use Mollie\WooCommerce\Shared\GatewaySurchargeHandler; use Mollie\WooCommerce\Subscription\MollieSepaRecurringGateway; use Mollie\WooCommerce\Subscription\MollieSubscriptionGateway; -use Mollie\WooCommerce\Shared\GatewaySurchargeHandler; -use Mollie\WooCommerce\Gateway\Voucher\MaybeDisableGateway; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface as Logger; @@ -105,6 +106,19 @@ public function services(): array 'Voucher', ]; }, + 'gateway.paymentMethodsEnabledAtMollie' => static function (ContainerInterface $container): array { + /* @var Data $dataHelper */ + $dataHelper = $container->get('settings.data_helper'); + /* @var Settings $settings */ + $settings = $container->get('settings.settings_helper'); + $apiKey = $settings->getApiKey(); + $methods = $apiKey? $dataHelper->getAllPaymentMethods($apiKey):[]; + foreach ($methods as $key => $method){ + $methods[$method['id']] = $method; + unset($methods[$key]); + } + return $methods; + }, IconFactory::class => static function (ContainerInterface $container): IconFactory { $pluginUrl = $container->get('shared.plugin_url'); $pluginPath = $container->get('shared.plugin_path'); @@ -198,17 +212,23 @@ static function () { // Set order to paid and processed when eventually completed without Mollie add_action('woocommerce_payment_complete', [$this, 'setOrderPaidByOtherGateway'], 10, 1); + $appleGateway = isset($container->get('gateway.instances')['mollie_wc_gateway_applepay'])? $container->get('gateway.instances')['mollie_wc_gateway_applepay']:false; + $notice = $container->get(AdminNotice::class); $logger = $container->get(Logger::class); $pluginUrl = $container->get('shared.plugin_url'); $apiHelper = $container->get('SDK.api_helper'); $settingsHelper = $container->get('settings.settings_helper'); - $appleGateway = $container->get('gateway.instances')['mollie_wc_gateway_applepay']; $this->gatewaySurchargeHandling($container->get(Surcharge::class)); - $this->mollieApplePayDirectHandling($notice, $logger, $apiHelper, $settingsHelper, $appleGateway); - $gatewayInstances = $container->get('gateway.instances'); - $paypalGateway = $gatewayInstances['mollie_wc_gateway_paypal']; - $this->molliePayPalButtonHandling($paypalGateway, $notice, $logger, $pluginUrl); + if($appleGateway){ + $this->mollieApplePayDirectHandling($notice, $logger, $apiHelper, $settingsHelper, $appleGateway); + } + + $paypalGateway = isset($container->get('gateway.instances')['mollie_wc_gateway_paypal'])? $container->get('gateway.instances')['mollie_wc_gateway_paypal']:false; + if ($paypalGateway){ + $this->molliePayPalButtonHandling($paypalGateway, $notice, $logger, $pluginUrl); + } + $checkoutBlockHandler = new CheckoutBlockService($container->get('settings.data_helper')); $checkoutBlockHandler->bootstrapAjaxRequest(); add_action( 'woocommerce_rest_checkout_process_payment_with_context', function($paymentContext){ @@ -436,9 +456,16 @@ public function instantiatePaymentMethodGateways(ContainerInterface $container): $mollieObject = $container->get(MollieObject::class); $paymentFactory = $container->get(PaymentFactory::class); $pluginId = $container->get('shared.plugin_id'); + $methodsEnabledAtMollie = $container->get('gateway.paymentMethodsEnabledAtMollie'); $gateways = []; + if(empty($methodsEnabledAtMollie)){ + return $gateways; + } foreach ($paymentMethods as $paymentMethodName) { + if(!$this->paymentMethodEnabledAtMollie($paymentMethodName, $methodsEnabledAtMollie)){ + continue; + } $paymentMethodName = 'Mollie\\WooCommerce\\PaymentMethods\\' . $paymentMethodName; $paymentMethod = new $paymentMethodName( $iconFactory, @@ -449,7 +476,6 @@ public function instantiatePaymentMethodGateways(ContainerInterface $container): $isSepa = $paymentMethod->getProperty('SEPA'); $paymentMethodId = $paymentMethod->getProperty('id'); $key = 'mollie_wc_gateway_' . $paymentMethodId; - //si lo saco de aquí y devuelve solo uno gatewayFactory(type) if ($isSepa) { $directDebit = new Directdebit( $iconFactory, @@ -507,4 +533,9 @@ public function instantiatePaymentMethodGateways(ContainerInterface $container): } return $gateways; } + + private function paymentMethodEnabledAtMollie($paymentMethodName, $methodsEnabledAtMollie) + { + return array_key_exists(strtolower($paymentMethodName), $methodsEnabledAtMollie); + } } diff --git a/src/Gateway/MolliePaymentGateway.php b/src/Gateway/MolliePaymentGateway.php index 842e79945..5601f07b8 100644 --- a/src/Gateway/MolliePaymentGateway.php +++ b/src/Gateway/MolliePaymentGateway.php @@ -197,10 +197,11 @@ public function __construct( $this->has_fields = false; } - if (!$this->isValidForUse()) { - // Disable gateway if it's not valid for use - $this->enabled = false; - } + $isEnabledAtWoo = $this->paymentMethod->getProperty('enabled') ? + $this->paymentMethod->getProperty('enabled')==='yes' : + true; + $this->enabled = $isEnabledAtWoo; + if ($this->paymentMethod->getProperty('filtersOnBuild')) { $this->paymentMethod->filtersOnBuild(); } From b4b434391510b3425cae72e140594ee375cfb3bc Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Wed, 16 Feb 2022 16:19:08 +0100 Subject: [PATCH 03/24] MOL-683 hide apple menu if disabled at Mollie --- src/Settings/Page/MollieSettingsPage.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Settings/Page/MollieSettingsPage.php b/src/Settings/Page/MollieSettingsPage.php index e8990af4a..308a11105 100644 --- a/src/Settings/Page/MollieSettingsPage.php +++ b/src/Settings/Page/MollieSettingsPage.php @@ -665,18 +665,21 @@ protected function validateApiKeyOrRemove($pattern, $value, $keyName) */ public function get_sections() { + $isAppleEnabled =array_key_exists('mollie_wc_gateway_applepay', $this->registeredGateways); $sections = [ '' => __('General', 'mollie-payments-for-woocommerce'), 'mollie_components' => __( 'Mollie Components', 'mollie-payments-for-woocommerce' ), - 'applepay_button' => __( - 'Apple Pay Button', - 'mollie-payments-for-woocommerce' - ), 'advanced' => __('Advanced', 'mollie-payments-for-woocommerce'), ]; + if($isAppleEnabled){ + $sections['applepay_button'] = __( + 'Apple Pay Button', + 'mollie-payments-for-woocommerce' + ); + } return apply_filters( 'woocommerce_get_sections_' . $this->id, From bdd795c9c40a19693c57ce330761112b8cc86f12 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 17 Feb 2022 11:47:48 +0100 Subject: [PATCH 04/24] MOL-683 list of methods initialized as false If we don't use cache we want to hit the API, if methods would be an empty array we would skip that step to avoid the infinite loop when no methods are available. --- src/Shared/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shared/Data.php b/src/Shared/Data.php index 309b89e45..60c806acd 100644 --- a/src/Shared/Data.php +++ b/src/Shared/Data.php @@ -362,7 +362,7 @@ public function getApiPaymentMethods($use_cache = true, $filters = []) $test_mode = $this->isTestModeEnabled(); $apiKey = $this->settingsHelper->getApiKey(); - $methods = []; + $methods = false; $filters_key = $filters; $filters_key['mode'] = ( $test_mode ? 'test' : 'live' ); From 2a8ce0b7b9ed0d2311940f1f563b0c52b3033a40 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 17 Feb 2022 11:48:18 +0100 Subject: [PATCH 05/24] MOL-683 gateway enabled expects 'yes' not true --- src/Gateway/MolliePaymentGateway.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gateway/MolliePaymentGateway.php b/src/Gateway/MolliePaymentGateway.php index 5601f07b8..afc9b0aeb 100644 --- a/src/Gateway/MolliePaymentGateway.php +++ b/src/Gateway/MolliePaymentGateway.php @@ -198,8 +198,8 @@ public function __construct( } $isEnabledAtWoo = $this->paymentMethod->getProperty('enabled') ? - $this->paymentMethod->getProperty('enabled')==='yes' : - true; + $this->paymentMethod->getProperty('enabled') : + 'yes'; $this->enabled = $isEnabledAtWoo; if ($this->paymentMethod->getProperty('filtersOnBuild')) { From 492bee05fce1ced443e88c47538b584b215bbc49 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Fri, 18 Feb 2022 09:31:49 +0100 Subject: [PATCH 06/24] MOL-684 send api key instead of test mode --- src/Payment/PaymentModule.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Payment/PaymentModule.php b/src/Payment/PaymentModule.php index f182c4057..ac66ce84c 100644 --- a/src/Payment/PaymentModule.php +++ b/src/Payment/PaymentModule.php @@ -329,12 +329,10 @@ public function shipAndCaptureOrderAtMollie($order_id) return; } - // Is test mode enabled? - $test_mode = $this->settingsHelper->isTestModeEnabled(); - + $apiKey = $this->settingsHelper->getApiKey(); try { // Get the order from the Mollie API - $mollie_order = $this->apiHelper->getApiClient($test_mode)->orders->get($mollie_order_id); + $mollie_order = $this->apiHelper->getApiClient($apiKey)->orders->get($mollie_order_id); // Check that order is Paid or Authorized and can be captured if ($mollie_order->isCanceled()) { @@ -352,7 +350,7 @@ public function shipAndCaptureOrderAtMollie($order_id) } if ($mollie_order->isPaid() || $mollie_order->isAuthorized()) { - $this->apiHelper->getApiClient($test_mode)->orders->get($mollie_order_id)->shipAll(); + $this->apiHelper->getApiClient($apiKey)->orders->get($mollie_order_id)->shipAll(); $order->add_order_note('Order successfully updated to shipped at Mollie, capture of funds underway.'); $this->logger->log(LogLevel::DEBUG, __METHOD__ . ' - ' . $order_id . ' - Order successfully updated to shipped at Mollie, capture of funds underway.'); @@ -398,12 +396,10 @@ public function cancelOrderAtMollie($order_id) return; } - // Is test mode enabled? - $test_mode = $this->settingsHelper->isTestModeEnabled(); - + $apiKey = $this->settingsHelper->getApiKey(); try { // Get the order from the Mollie API - $mollie_order = $this->apiHelper->getApiClient($test_mode)->orders->get($mollie_order_id); + $mollie_order = $this->apiHelper->getApiClient($apiKey)->orders->get($mollie_order_id); // Check that order is not already canceled at Mollie if ($mollie_order->isCanceled()) { @@ -415,7 +411,7 @@ public function cancelOrderAtMollie($order_id) // Check that order has the correct status to be canceled if ($mollie_order->isCreated() || $mollie_order->isAuthorized() || $mollie_order->isShipping()) { - $this->apiHelper->getApiClient($test_mode)->orders->get($mollie_order_id)->cancel(); + $this->apiHelper->getApiClient($apiKey)->orders->get($mollie_order_id)->cancel(); $order->add_order_note('Order also cancelled at Mollie.'); $this->logger->log(LogLevel::DEBUG, __METHOD__ . ' - ' . $order_id . ' - Order cancelled in WooCommerce, also cancelled at Mollie.'); From 975a789d2d1f482d49278fe53823c4cf7ba12ff9 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Fri, 18 Feb 2022 13:40:51 +0100 Subject: [PATCH 07/24] MOL-683 show all payment methods in settings --- src/Gateway/GatewayModule.php | 99 +++++++++++++----------- src/Settings/Page/MollieSettingsPage.php | 39 +++++++--- src/Settings/SettingsModule.php | 4 +- 3 files changed, 86 insertions(+), 56 deletions(-) diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index a96d1e2d4..ab96c6970 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -26,7 +26,6 @@ use Mollie\WooCommerce\Payment\PaymentFactory; use Mollie\WooCommerce\Payment\PaymentFieldsService; use Mollie\WooCommerce\Payment\PaymentService; -use Mollie\WooCommerce\PaymentMethods\Directdebit; use Mollie\WooCommerce\PaymentMethods\IconFactory; use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Settings\Settings; @@ -82,29 +81,8 @@ public function services(): array 'gateway.instances' => function (ContainerInterface $container): array { return $this->instantiatePaymentMethodGateways($container); }, - 'gateway.paymentMethods' => static function (): array { - return [ - 'Banktransfer', - 'Belfius', - 'Creditcard', - 'DirectDebit', - 'Eps', - 'Giropay', - 'Ideal', - 'Kbc', - 'Klarnapaylater', - 'Klarnapaynow', - 'Klarnasliceit', - 'Bancontact', - 'Paypal', - 'Paysafecard', - 'Przelewy24', - 'Sofort', - 'Giftcard', - 'Applepay', - 'Mybank', - 'Voucher', - ]; + 'gateway.paymentMethods' => static function (ContainerInterface $container): array { + return (new self)->instantiatePaymentMethods($container); }, 'gateway.paymentMethodsEnabledAtMollie' => static function (ContainerInterface $container): array { /* @var Data $dataHelper */ @@ -439,12 +417,9 @@ public function molliePayPalButtonHandling( public function instantiatePaymentMethodGateways(ContainerInterface $container): array { - $logger = $container->get(Logger::class); $notice = $container->get(AdminNotice::class); - $iconFactory = $container->get(IconFactory::class); $paymentService = $container->get(PaymentService::class); - $surchargeService = $container->get(Surcharge::class); $mollieOrderService = $container->get(MollieOrderService::class); $HttpResponseService = $container->get('SDK.HttpResponse'); $settingsHelper = $container->get('settings.settings_helper'); @@ -452,7 +427,6 @@ public function instantiatePaymentMethodGateways(ContainerInterface $container): $paymentMethods = $container->get('gateway.paymentMethods'); $data = $container->get('settings.data_helper'); $orderInstructionsService = new OrderInstructionsService(); - $paymentFieldsService = $container->get(PaymentFieldsService::class); $mollieObject = $container->get(MollieObject::class); $paymentFactory = $container->get(PaymentFactory::class); $pluginId = $container->get('shared.plugin_id'); @@ -462,27 +436,16 @@ public function instantiatePaymentMethodGateways(ContainerInterface $container): return $gateways; } - foreach ($paymentMethods as $paymentMethodName) { - if(!$this->paymentMethodEnabledAtMollie($paymentMethodName, $methodsEnabledAtMollie)){ + foreach ($paymentMethods as $paymentMethod) { + $paymentMethodId = $paymentMethod->getProperty('id'); + if(!$this->paymentMethodEnabledAtMollie($paymentMethodId, $methodsEnabledAtMollie)){ continue; } - $paymentMethodName = 'Mollie\\WooCommerce\\PaymentMethods\\' . $paymentMethodName; - $paymentMethod = new $paymentMethodName( - $iconFactory, - $settingsHelper, - $paymentFieldsService, - $surchargeService - ); + $isSepa = $paymentMethod->getProperty('SEPA'); - $paymentMethodId = $paymentMethod->getProperty('id'); $key = 'mollie_wc_gateway_' . $paymentMethodId; if ($isSepa) { - $directDebit = new Directdebit( - $iconFactory, - $settingsHelper, - $paymentFieldsService, - $surchargeService - ); + $directDebit = $paymentMethods['directdebit']; $gateways[$key] = new MollieSepaRecurringGateway( $directDebit, $paymentMethod, @@ -538,4 +501,52 @@ private function paymentMethodEnabledAtMollie($paymentMethodName, $methodsEnable { return array_key_exists(strtolower($paymentMethodName), $methodsEnabledAtMollie); } + + /** + * @param $container + * @return array + */ + protected function instantiatePaymentMethods($container): array + { + $paymentMethods = []; + $paymentMethodsNames = [ + 'Banktransfer', + 'Belfius', + 'Creditcard', + 'DirectDebit', + 'Eps', + 'Giropay', + 'Ideal', + 'Kbc', + 'Klarnapaylater', + 'Klarnapaynow', + 'Klarnasliceit', + 'Bancontact', + 'Paypal', + 'Paysafecard', + 'Przelewy24', + 'Sofort', + 'Giftcard', + 'Applepay', + 'Mybank', + 'Voucher', + ]; + $iconFactory = $container->get(IconFactory::class); + $settingsHelper = $container->get('settings.settings_helper'); + $surchargeService = $container->get(Surcharge::class); + $paymentFieldsService = $container->get(PaymentFieldsService::class); + foreach ($paymentMethodsNames as $paymentMethodName) { + $paymentMethodClassName = 'Mollie\\WooCommerce\\PaymentMethods\\' . $paymentMethodName; + $paymentMethod = new $paymentMethodClassName( + $iconFactory, + $settingsHelper, + $paymentFieldsService, + $surchargeService + ); + $paymentMethodId = $paymentMethod->getProperty('id'); + $paymentMethods[$paymentMethodId] = $paymentMethod; + } + + return $paymentMethods; + } } diff --git a/src/Settings/Page/MollieSettingsPage.php b/src/Settings/Page/MollieSettingsPage.php index 308a11105..5a7355d75 100644 --- a/src/Settings/Page/MollieSettingsPage.php +++ b/src/Settings/Page/MollieSettingsPage.php @@ -4,7 +4,6 @@ namespace Mollie\WooCommerce\Settings\Page; -use Mollie\WooCommerce\Gateway\MolliePaymentGateway; use Mollie\WooCommerce\Settings\Settings; use Mollie\WooCommerce\Shared\Data; use WC_Admin_Settings; @@ -32,11 +31,16 @@ class MollieSettingsPage extends WC_Settings_Page * @var Data */ protected $dataHelper; + /** + * @var array + */ + protected $paymentMethods; public function __construct( Settings $settingsHelper, string $pluginPath, array $gateways, + array $paymentMethods, bool $isTestModeEnabled, Data $dataHelper ) { @@ -48,7 +52,7 @@ public function __construct( $this->registeredGateways = $gateways; $this->isTestModeEnabled = $isTestModeEnabled; $this->dataHelper = $dataHelper; - + $this->paymentMethods = $paymentMethods; add_action( 'woocommerce_sections_' . $this->id, [$this, 'output_sections'] @@ -309,25 +313,38 @@ public function getMollieMethods() $content .= '
    '; - $mollieGateways = $this->registeredGateways; - foreach ($mollieGateways as $gateway) { - if ($gateway instanceof MolliePaymentGateway) { - $content .= '
  • '; - $content .= $gateway->paymentMethod->getIconUrl(); - $content .= ' ' . esc_html($gateway->paymentMethod->getProperty('defaultTitle')); - - if ($gateway->is_available()) { + $mollieGateways = $this->registeredGateways;//this are the gateways enabled + $paymentMethods = $this->paymentMethods; + foreach ($paymentMethods as $paymentMethod) { + $paymentMethodId = $paymentMethod->getProperty('id'); + $gatewayKey = 'mollie_wc_gateway_' . $paymentMethodId; + $paymentMethodEnabledAtMollie = array_key_exists($gatewayKey , $mollieGateways); + $content .= '
  • '; + $content .= $paymentMethod->getIconUrl(); + $content .= ' ' . esc_html($paymentMethod->getProperty('defaultTitle')); + if ($paymentMethodEnabledAtMollie) { + $isEnabledAtWoo = $paymentMethod->getProperty('enabled') ? + $paymentMethod->getProperty('enabled') : + 'yes'; + if ($isEnabledAtWoo === 'yes') { $content .= $iconAvailable; } else { $content .= $iconNoAvailable; } - $content .= ' ' . strtolower( + $content .= ' ' . strtolower( __('Edit', 'mollie-payments-for-woocommerce') ) . ''; $content .= '
  • '; + continue; } + $content .= $iconNoAvailable; + $content .= ' ' . strtolower( + __('Activate', 'mollie-payments-for-woocommerce') + ) . ''; + + $content .= ''; } $content .= '
'; diff --git a/src/Settings/SettingsModule.php b/src/Settings/SettingsModule.php index 30e37ca5e..4e6067ae8 100644 --- a/src/Settings/SettingsModule.php +++ b/src/Settings/SettingsModule.php @@ -76,6 +76,7 @@ public function run(ContainerInterface $container): bool $this->dataHelper = $container->get('settings.data_helper'); $pluginPath = $container->get('shared.plugin_path'); $gateways = $container->get('gateway.instances'); + $paymentMethods = $container->get('gateway.paymentMethods'); // Add settings link to plugins page add_filter('plugin_action_links_' . $this->plugin_basename, [$this, 'addPluginActionLinks']); @@ -84,11 +85,12 @@ public function run(ContainerInterface $container): bool }); add_filter( 'woocommerce_get_settings_pages', - function ($settings) use ($pluginPath, $gateways) { + function ($settings) use ($pluginPath, $gateways, $paymentMethods) { $settings[] = new MollieSettingsPage( $this->settingsHelper, $pluginPath, $gateways, + $paymentMethods, $this->isTestModeEnabled, $this->dataHelper ); From 67929b6c8fe5c9fcc65efe32722104f318b49f99 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Fri, 18 Feb 2022 13:42:59 +0100 Subject: [PATCH 08/24] MOL-680 call surcharge handler on init --- src/Shared/GatewaySurchargeHandler.php | 28 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Shared/GatewaySurchargeHandler.php b/src/Shared/GatewaySurchargeHandler.php index 67904a333..3838c4113 100644 --- a/src/Shared/GatewaySurchargeHandler.php +++ b/src/Shared/GatewaySurchargeHandler.php @@ -23,7 +23,15 @@ public function __construct(Surcharge $surcharge) __(Surcharge::DEFAULT_FEE_LABEL, 'mollie-payments-for-woocommerce') ); + add_action( + 'init', + [$this, 'surchargeActions'] + ); + + } + public function surchargeActions() + { add_filter('woocommerce_cart_calculate_fees', function ($cart) { return $this->add_engraving_fees($cart); @@ -44,20 +52,18 @@ function () { } ); add_action( - 'wp_ajax_mollie_checkout_blocks_surchage', - function () { - return $this->updateSurchargeCheckoutBlock(); - } + 'wp_ajax_mollie_checkout_blocks_surchage', + function () { + return $this->updateSurchargeCheckoutBlock(); + } ); add_action( - 'wp_ajax_nopriv_mollie_checkout_blocks_surchage', - function () { - return $this->updateSurchargeCheckoutBlock(); - } + 'wp_ajax_nopriv_mollie_checkout_blocks_surchage', + function () { + return $this->updateSurchargeCheckoutBlock(); + } ); - add_action('woocommerce_order_item_meta_end', function ($item_id, $item, $order, $bool) { - return $this->setHiddenOrderId($item_id, $item, $order, $bool); - }, 10, 4); + add_action( 'woocommerce_order_item_meta_end',[$this, 'setHiddenOrderId'], 10, 4); } public function setHiddenOrderId($item_id, $item, $order, $bool = false) From aa72eb0cabfa0373092707954e179f71c0e5f937 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 21 Feb 2022 10:43:26 +0100 Subject: [PATCH 09/24] MOL-683 fix class name --- src/Gateway/GatewayModule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index ab96c6970..18170a66a 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -513,7 +513,7 @@ protected function instantiatePaymentMethods($container): array 'Banktransfer', 'Belfius', 'Creditcard', - 'DirectDebit', + 'Directdebit', 'Eps', 'Giropay', 'Ideal', From 43d18e5b27bd439f4a6d073eaec788cb363cf7f1 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 21 Feb 2022 10:58:55 +0100 Subject: [PATCH 10/24] MOL-683 show enabled at Mollie, disregard Woo --- src/Settings/Page/MollieSettingsPage.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Settings/Page/MollieSettingsPage.php b/src/Settings/Page/MollieSettingsPage.php index 5a7355d75..cbebd1f15 100644 --- a/src/Settings/Page/MollieSettingsPage.php +++ b/src/Settings/Page/MollieSettingsPage.php @@ -323,15 +323,7 @@ public function getMollieMethods() $content .= $paymentMethod->getIconUrl(); $content .= ' ' . esc_html($paymentMethod->getProperty('defaultTitle')); if ($paymentMethodEnabledAtMollie) { - $isEnabledAtWoo = $paymentMethod->getProperty('enabled') ? - $paymentMethod->getProperty('enabled') : - 'yes'; - if ($isEnabledAtWoo === 'yes') { - $content .= $iconAvailable; - } else { - $content .= $iconNoAvailable; - } - + $content .= $iconAvailable; $content .= ' ' . strtolower( __('Edit', 'mollie-payments-for-woocommerce') ) . ''; From fd53e1aed99f90d810e3bc60211f5991ff35316d Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Wed, 23 Feb 2022 15:31:38 +0100 Subject: [PATCH 11/24] MOL-695 Update SDK and add wp http adapter --- composer.json | 2 +- composer.lock | 420 +++++++++++++++---------------- src/SDK/Api.php | 4 +- src/SDK/WordPressHttpAdapter.php | 127 ++++++++++ 4 files changed, 338 insertions(+), 215 deletions(-) create mode 100644 src/SDK/WordPressHttpAdapter.php diff --git a/composer.json b/composer.json index 4768f5c14..3dff8bd89 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,7 @@ "php": "^7.2", "ext-intl": "*", "ext-json": "*", + "mollie/mollie-api-php": "^v2.40", "inpsyde/modularity": "^1.3.0" }, "require-dev": { @@ -27,7 +28,6 @@ "johnpbloch/wordpress-core": "^5.0", "woocommerce/woocommerce": "^3.0 || ^4.0", "fzaninotto/faker": "^1.9@dev", - "mollie/mollie-api-php": "^2.21", "inpsyde/php-coding-standards": "^1.0.0", "vimeo/psalm": "^4.8" }, diff --git a/composer.lock b/composer.lock index 99ef0d325..99f8249d1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,85 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "41cdf9b79a3525cc68e7b232a6f79dbc", + "content-hash": "30be4fb2467d33afac71d083f8d46109", "packages": [ + { + "name": "composer/ca-bundle", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", + "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.55", + "psr/log": "^1.0", + "symfony/phpunit-bridge": "^4.2 || ^5", + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/ca-bundle/issues", + "source": "https://github.com/composer/ca-bundle/tree/1.3.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-10-28T20:44:15+00:00" + }, { "name": "inpsyde/modularity", "version": "dev-master", @@ -80,6 +157,97 @@ }, "time": "2022-01-24T14:27:58+00:00" }, + { + "name": "mollie/mollie-api-php", + "version": "v2.40.2", + "source": { + "type": "git", + "url": "https://github.com/mollie/mollie-api-php.git", + "reference": "ac3e079bbc86e95dc77d4f33965a62e9e6b95ed8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/ac3e079bbc86e95dc77d4f33965a62e9e6b95ed8", + "reference": "ac3e079bbc86e95dc77d4f33965a62e9e6b95ed8", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.2", + "ext-curl": "*", + "ext-json": "*", + "ext-openssl": "*", + "php": ">=5.6" + }, + "require-dev": { + "eloquent/liberator": "^2.0", + "friendsofphp/php-cs-fixer": "^3.0", + "guzzlehttp/guzzle": "^6.3 || ^7.0", + "phpunit/phpunit": "^5.7 || ^6.5 || ^7.1 || ^8.5 || ^9.5" + }, + "suggest": { + "mollie/oauth2-mollie-php": "Use OAuth to authenticate with the Mollie API. This is needed for some endpoints. Visit https://docs.mollie.com/ for more information." + }, + "type": "library", + "autoload": { + "psr-4": { + "Mollie\\Api\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Mollie B.V.", + "email": "info@mollie.com" + } + ], + "description": "Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.", + "homepage": "https://www.mollie.com/en/developers", + "keywords": [ + "Apple Pay", + "CBC", + "Przelewy24", + "api", + "bancontact", + "banktransfer", + "belfius", + "belfius direct net", + "charges", + "creditcard", + "direct debit", + "fashioncheque", + "gateway", + "gift cards", + "ideal", + "inghomepay", + "intersolve", + "kbc", + "klarna", + "mistercash", + "mollie", + "paylater", + "payment", + "payments", + "paypal", + "paysafecard", + "podiumcadeaukaart", + "recurring", + "refunds", + "sepa", + "service", + "sliceit", + "sofort", + "sofortbanking", + "subscriptions" + ], + "support": { + "issues": "https://github.com/mollie/mollie-api-php/issues", + "source": "https://github.com/mollie/mollie-api-php/tree/v2.40.2" + }, + "time": "2022-02-08T08:53:18+00:00" + }, { "name": "psr/container", "version": "1.0.0", @@ -141,12 +309,12 @@ "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "591e06ec427c2d2e5018172552b9354c208419e7" + "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/591e06ec427c2d2e5018172552b9354c208419e7", - "reference": "591e06ec427c2d2e5018172552b9354c208419e7", + "url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", + "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", "shasum": "" }, "require": { @@ -169,13 +337,13 @@ } }, "autoload": { - "psr-4": { - "Amp\\": "lib" - }, "files": [ "lib/functions.php", "lib/Internal/functions.php" - ] + ], + "psr-4": { + "Amp\\": "lib" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -215,7 +383,7 @@ "support": { "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/master" + "source": "https://github.com/amphp/amp/tree/v2.6.2" }, "funding": [ { @@ -223,7 +391,7 @@ "type": "github" } ], - "time": "2021-12-03T13:45:05+00:00" + "time": "2022-02-20T17:52:18+00:00" }, { "name": "amphp/byte-stream", @@ -596,83 +764,6 @@ }, "time": "2021-11-11T15:53:55+00:00" }, - { - "name": "composer/ca-bundle", - "version": "dev-main", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", - "reference": "4c679186f2aca4ab6a0f1b0b9cf9252decb44d0b", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.55", - "psr/log": "^1.0", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" - }, - "default-branch": true, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.1" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-10-28T20:44:15+00:00" - }, { "name": "composer/installers", "version": "1.x-dev", @@ -900,7 +991,7 @@ }, { "name": "composer/pcre", - "version": "dev-main", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", @@ -920,7 +1011,6 @@ "phpstan/phpstan-strict-rules": "^1.1", "symfony/phpunit-bridge": "^4.2 || ^5" }, - "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -1583,12 +1673,12 @@ "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "d5f3b8dfadf381c70b2f313a9fdb7c2ef795689b" + "reference": "2e2368da8dffca20962a592fc69e327d532d3fe8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/d5f3b8dfadf381c70b2f313a9fdb7c2ef795689b", - "reference": "d5f3b8dfadf381c70b2f313a9fdb7c2ef795689b", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/2e2368da8dffca20962a592fc69e327d532d3fe8", + "reference": "2e2368da8dffca20962a592fc69e327d532d3fe8", "shasum": "" }, "require": { @@ -1623,7 +1713,7 @@ "source": "https://core.trac.wordpress.org/browser", "wiki": "https://codex.wordpress.org/" }, - "time": "2022-02-07T15:15:53+00:00" + "time": "2022-02-22T16:15:52+00:00" }, { "name": "maxmind-db/reader", @@ -1758,121 +1848,27 @@ }, "time": "2021-09-13T15:33:03+00:00" }, - { - "name": "mollie/mollie-api-php", - "version": "v2.40.2", - "source": { - "type": "git", - "url": "https://github.com/mollie/mollie-api-php.git", - "reference": "ac3e079bbc86e95dc77d4f33965a62e9e6b95ed8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/ac3e079bbc86e95dc77d4f33965a62e9e6b95ed8", - "reference": "ac3e079bbc86e95dc77d4f33965a62e9e6b95ed8", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.2", - "ext-curl": "*", - "ext-json": "*", - "ext-openssl": "*", - "php": ">=5.6" - }, - "require-dev": { - "eloquent/liberator": "^2.0", - "friendsofphp/php-cs-fixer": "^3.0", - "guzzlehttp/guzzle": "^6.3 || ^7.0", - "phpunit/phpunit": "^5.7 || ^6.5 || ^7.1 || ^8.5 || ^9.5" - }, - "suggest": { - "mollie/oauth2-mollie-php": "Use OAuth to authenticate with the Mollie API. This is needed for some endpoints. Visit https://docs.mollie.com/ for more information." - }, - "type": "library", - "autoload": { - "psr-4": { - "Mollie\\Api\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Mollie B.V.", - "email": "info@mollie.com" - } - ], - "description": "Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.", - "homepage": "https://www.mollie.com/en/developers", - "keywords": [ - "Apple Pay", - "CBC", - "Przelewy24", - "api", - "bancontact", - "banktransfer", - "belfius", - "belfius direct net", - "charges", - "creditcard", - "direct debit", - "fashioncheque", - "gateway", - "gift cards", - "ideal", - "inghomepay", - "intersolve", - "kbc", - "klarna", - "mistercash", - "mollie", - "paylater", - "payment", - "payments", - "paypal", - "paysafecard", - "podiumcadeaukaart", - "recurring", - "refunds", - "sepa", - "service", - "sliceit", - "sofort", - "sofortbanking", - "subscriptions" - ], - "support": { - "issues": "https://github.com/mollie/mollie-api-php/issues", - "source": "https://github.com/mollie/mollie-api-php/tree/v2.40.2" - }, - "time": "2022-02-08T08:53:18+00:00" - }, { "name": "myclabs/deep-copy", "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "8263fc30b63ea463b22e7f264ed77f2ceb022cdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8263fc30b63ea463b22e7f264ed77f2ceb022cdc", + "reference": "8263fc30b63ea463b22e7f264ed77f2ceb022cdc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6", + "doctrine/common": "^2.13", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5" }, "default-branch": true, "type": "library", @@ -1898,7 +1894,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.x" }, "funding": [ { @@ -1906,7 +1902,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-02-17T17:54:39+00:00" }, { "name": "netresearch/jsonmapper", @@ -3684,12 +3680,12 @@ "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "0c25aa925ee40a693b70f085a74701754238da5d" + "reference": "c921498b474212fe4552928bbeb68d70250ce5e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/0c25aa925ee40a693b70f085a74701754238da5d", - "reference": "0c25aa925ee40a693b70f085a74701754238da5d", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/c921498b474212fe4552928bbeb68d70250ce5e8", + "reference": "c921498b474212fe4552928bbeb68d70250ce5e8", "shasum": "" }, "require": { @@ -3730,7 +3726,7 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2021-09-27T22:26:41+00:00" + "time": "2022-02-21T17:01:13+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -3794,12 +3790,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "468f17e0875fb182bb3f8e51ed43d9be31e68dc2" + "reference": "5caf5d80363b2a46d2cd1b24d08c5ab259b53487" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/468f17e0875fb182bb3f8e51ed43d9be31e68dc2", - "reference": "468f17e0875fb182bb3f8e51ed43d9be31e68dc2", + "url": "https://api.github.com/repos/symfony/console/zipball/5caf5d80363b2a46d2cd1b24d08c5ab259b53487", + "reference": "5caf5d80363b2a46d2cd1b24d08c5ab259b53487", "shasum": "" }, "require": { @@ -3886,7 +3882,7 @@ "type": "tidelift" } ], - "time": "2022-01-31T16:08:03+00:00" + "time": "2022-02-09T15:52:21+00:00" }, { "name": "symfony/css-selector", @@ -4303,12 +4299,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4736,12 +4732,12 @@ "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b06fb932d486eb7165bbea6625583506e4b2cfd1" + "reference": "3a85f49268f8db12d35cc6c991218ddeea72ed02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b06fb932d486eb7165bbea6625583506e4b2cfd1", - "reference": "b06fb932d486eb7165bbea6625583506e4b2cfd1", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/3a85f49268f8db12d35cc6c991218ddeea72ed02", + "reference": "3a85f49268f8db12d35cc6c991218ddeea72ed02", "shasum": "" }, "require": { @@ -4835,7 +4831,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm/tree/4.x" }, - "time": "2022-02-04T19:36:20+00:00" + "time": "2022-02-23T12:45:57+00:00" }, { "name": "webmozart/assert", @@ -5229,5 +5225,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/src/SDK/Api.php b/src/SDK/Api.php index 1ff7bbe67..c9d24826e 100644 --- a/src/SDK/Api.php +++ b/src/SDK/Api.php @@ -50,10 +50,10 @@ public function getApiClient($apiKey, $needToUpdateApiKey = false) } if (empty(self::$api_client) || $needToUpdateApiKey) { - $client = new MollieApiClient(); + $httpClient = new WordPressHttpAdapter(); + $client = new MollieApiClient($httpClient); $client->setApiKey($apiKey); $client->setApiEndpoint($this->getApiEndpoint()); - $client->addVersionString('WordPress/' . ( isset($wp_version) ? $wp_version : 'Unknown' )); $client->addVersionString('WooCommerce/' . get_option('woocommerce_version', 'Unknown')); $client->addVersionString('WooCommerceSubscriptions/' . get_option('woocommerce_subscriptions_active_version', 'Unknown')); $client->addVersionString('MollieWoo/' . $this->pluginVersion); diff --git a/src/SDK/WordPressHttpAdapter.php b/src/SDK/WordPressHttpAdapter.php new file mode 100644 index 000000000..11ead8d78 --- /dev/null +++ b/src/SDK/WordPressHttpAdapter.php @@ -0,0 +1,127 @@ +attemptRequest($httpMethod, $httpBody, $headers, $url); + } catch (ApiException $e) { + // Nothing + } + } + + throw new CurlConnectTimeoutException( + "Unable to connect to Mollie. Maximum number of retries (" . self::MAX_RETRIES . ") reached." + ); + } + + public function versionString() + { + global $wp_version; + return 'WordPress/'. $wp_version; + } + + /** + * @param $response + */ + protected function parseResponse($response) + { + $statusCode = wp_remote_retrieve_response_code($response); + $httpBody = wp_remote_retrieve_body($response); + if (empty($httpBody)) { + if ($statusCode === self::HTTP_NO_CONTENT) { + return null; + } + + throw new ApiException("No response body found."); + } + + $body = @json_decode($httpBody); + + // GUARDS + if (json_last_error() !== JSON_ERROR_NONE) { + throw new ApiException("Unable to decode Mollie response: '{$response}'."); + } + + if (isset($body->error)) { + throw new ApiException($body->error->message); + } + + if ($statusCode >= 400) { + $message = "Error executing API call ({$body->status}: {$body->title}): {$body->detail}"; + + $field = null; + + if (! empty($body->field)) { + $field = $body->field; + } + + if (isset($body->_links, $body->_links->documentation)) { + $message .= ". Documentation: {$body->_links->documentation->href}"; + } + + if ($httpBody) { + $message .= ". Request body: {$httpBody}"; + } + + throw new ApiException($message, $statusCode, $field); + } + + return $body; + } + + /** + * @param string $httpMethod + * @param $httpBody + * @param array $headers + * @param string $url + * @return array|\WP_Error + */ + protected function attemptRequest(string $httpMethod, $httpBody, array $headers, string $url) + { + $args = [ + 'method' => $httpMethod, + 'body' => $httpBody, + 'headers' => $headers + ]; + $response = wp_remote_request($url, $args); + if(is_wp_error($response)){ + throw new ApiException($response->get_error_message()); + } + + return $this->parseResponse($response); + } +} From ed39a7b5f92a4fcc87c0ce009c0b3f441d56c6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=BCsken?= Date: Thu, 24 Feb 2022 09:03:10 +0100 Subject: [PATCH 12/24] remove retry and add some args to request --- src/SDK/WordPressHttpAdapter.php | 60 +++++++++++--------------------- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/src/SDK/WordPressHttpAdapter.php b/src/SDK/WordPressHttpAdapter.php index 11ead8d78..3ad05d840 100644 --- a/src/SDK/WordPressHttpAdapter.php +++ b/src/SDK/WordPressHttpAdapter.php @@ -11,17 +11,13 @@ class WordPressHttpAdapter implements MollieHttpAdapterInterface { /** - * HTTP status code for an empty ok response. - */ - const HTTP_NO_CONTENT = 204; - /** - * The maximum number of retries + * Default response timeout (in seconds). */ - const MAX_RETRIES = 5; + const DEFAULT_TIMEOUT = 10; /** - * The amount of milliseconds the delay is being increased with on each retry. + * HTTP status code for an empty ok response. */ - const DELAY_INCREASE_MS = 1000; + const HTTP_NO_CONTENT = 204; /** * @param string $httpMethod @@ -29,23 +25,27 @@ class WordPressHttpAdapter implements MollieHttpAdapterInterface * @param array $headers * @param $httpBody * - * @throws \Mollie\Api\Exceptions\CurlConnectTimeoutException + * @throws ApiException */ public function send($httpMethod, $url, $headers, $httpBody) { - for ($i = 0; $i <= self::MAX_RETRIES; $i++) { - usleep($i * self::DELAY_INCREASE_MS); + $headers['Content-Type'] = 'application/json'; - try { - return $this->attemptRequest($httpMethod, $httpBody, $headers, $url); - } catch (ApiException $e) { - // Nothing - } + $args = [ + 'method' => $httpMethod, + 'body' => $httpBody, + 'headers' => $headers, + 'user-agent' => $headers['User-Agent'], + 'sslverify' => true, + 'timeout' => self::DEFAULT_TIMEOUT + ]; + $response = wp_remote_request($url, $args); + + if(is_wp_error($response)){ + throw new ApiException($response->get_error_message(), $response->get_error_code()); } - throw new CurlConnectTimeoutException( - "Unable to connect to Mollie. Maximum number of retries (" . self::MAX_RETRIES . ") reached." - ); + return $this->parseResponse($response); } public function versionString() @@ -56,6 +56,7 @@ public function versionString() /** * @param $response + * @throws ApiException */ protected function parseResponse($response) { @@ -103,25 +104,4 @@ protected function parseResponse($response) return $body; } - /** - * @param string $httpMethod - * @param $httpBody - * @param array $headers - * @param string $url - * @return array|\WP_Error - */ - protected function attemptRequest(string $httpMethod, $httpBody, array $headers, string $url) - { - $args = [ - 'method' => $httpMethod, - 'body' => $httpBody, - 'headers' => $headers - ]; - $response = wp_remote_request($url, $args); - if(is_wp_error($response)){ - throw new ApiException($response->get_error_message()); - } - - return $this->parseResponse($response); - } } From 4ba6cf236907c87b7c4176080522f1e171fd41bb Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 24 Feb 2022 10:51:12 +0100 Subject: [PATCH 13/24] MOL-683 Check gateway exists before using --- src/Gateway/Voucher/VoucherModule.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Gateway/Voucher/VoucherModule.php b/src/Gateway/Voucher/VoucherModule.php index 35c3c22a7..24944caca 100644 --- a/src/Gateway/Voucher/VoucherModule.php +++ b/src/Gateway/Voucher/VoucherModule.php @@ -38,8 +38,9 @@ class VoucherModule implements ExecutableModule */ public function run(ContainerInterface $container): bool { - $voucherGateway = $container->get('gateway.instances')['mollie_wc_gateway_voucher']; - $voucher = $voucherGateway->enabled === 'yes'; + $gatewayInstances = $container->get('gateway.instances'); + $voucherGateway = isset($gatewayInstances['mollie_wc_gateway_voucher'])?$gatewayInstances['mollie_wc_gateway_voucher']:false; + $voucher = $voucherGateway? $voucherGateway->enabled === 'yes': false; if($voucher){ $this->voucherEnabledHooks(); From 078f6079e9ff9fdd28b8e411fc2d688bf682a5a8 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 24 Feb 2022 10:52:19 +0100 Subject: [PATCH 14/24] MOL-683 Check gateway exists before using --- src/Settings/Page/MollieSettingsPage.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Settings/Page/MollieSettingsPage.php b/src/Settings/Page/MollieSettingsPage.php index cbebd1f15..90e4ea3f9 100644 --- a/src/Settings/Page/MollieSettingsPage.php +++ b/src/Settings/Page/MollieSettingsPage.php @@ -375,10 +375,10 @@ protected function getGatewaySettingsUrl($gateway_class_name): string */ protected function checkDirectDebitStatus($content): string { - $ideal_gateway = $this->registeredGateways["mollie_wc_gateway_ideal"]; - $sepa_gateway = $this->registeredGateways["mollie_wc_gateway_directdebit"]; + $idealGateway = !empty($this->registeredGateways["mollie_wc_gateway_ideal"]) && $this->registeredGateways["mollie_wc_gateway_ideal"]->enabled === 'yes'; + $sepaGateway = !empty($this->registeredGateways["mollie_wc_gateway_directdebit"]) && $this->registeredGateways["mollie_wc_gateway_directdebit"]->enabled === 'yes'; - if ((class_exists('WC_Subscription')) && ($ideal_gateway->is_available()) && (!$sepa_gateway->is_available())) { + if ((class_exists('WC_Subscription')) && $idealGateway && !$sepaGateway) { $warning_message = __( 'You have WooCommerce Subscriptions activated, but not SEPA Direct Debit. Enable SEPA Direct Debit if you want to allow customers to pay subscriptions with iDEAL and/or other "first" payment methods.', 'mollie-payments-for-woocommerce' @@ -424,13 +424,12 @@ protected function checkMollieBankTransferNotBACS($content) */ protected function warnAboutRequiredCheckoutFieldForKlarna($content) { - $woocommerce_klarnapaylater_gateway = isset($this->registeredGateways["mollie_wc_gateway_klarnapaylater"]) ? $this->registeredGateways["mollie_wc_gateway_klarnapaylater"] : false; - $woocommerce_klarnasliceit_gateway = isset($this->registeredGateways["mollie_wc_gateway_klarnasliceit"]) ? $this->registeredGateways["mollie_wc_gateway_klarnasliceit"] : false; - $woocommerce_klarnapaynow_gateway = isset($this->registeredGateways["mollie_wc_gateway_klarnapaynow"]) ? $this->registeredGateways["mollie_wc_gateway_klarnapaynow"] : false; + $woocommerceKlarnapaylaterGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnapaylater"]) && $this->registeredGateways["mollie_wc_gateway_klarnapaylater"]->enabled === 'yes'; + $woocommerceKlarnasliceitGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnasliceit"]) && $this->registeredGateways["mollie_wc_gateway_klarnasliceit"]->enabled === 'yes'; + $woocommerceKlarnapaynowGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnapaynow"]) && $this->registeredGateways["mollie_wc_gateway_klarnapaynow"]->enabled === 'yes'; if ( - $woocommerce_klarnapaylater_gateway && $woocommerce_klarnapaylater_gateway->is_available( - ) || $woocommerce_klarnasliceit_gateway && $woocommerce_klarnasliceit_gateway->is_available() + $woocommerceKlarnapaylaterGateway || $woocommerceKlarnasliceitGateway || $woocommerceKlarnapaynowGateway ) { $content .= '

'; $content .= sprintf( From 9cc8fe1a9a84c3dd3c2e84c37b4eba5646b41714 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 24 Feb 2022 10:52:36 +0100 Subject: [PATCH 15/24] MOL-683 Reorder modules --- mollie-payments-for-woocommerce.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mollie-payments-for-woocommerce.php b/mollie-payments-for-woocommerce.php index 9dc3f40c6..ce4d3bc09 100644 --- a/mollie-payments-for-woocommerce.php +++ b/mollie-payments-for-woocommerce.php @@ -181,11 +181,9 @@ function initialize() new SharedModule(), new SDKModule(), new SettingsModule(), - new VoucherModule(), - new AssetsModule(), new GatewayModule(), - + new VoucherModule(), new PaymentModule() ); } catch (Throwable $throwable) { From 56e1c8a197411c101f39f3043c9d94b267e78944 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 24 Feb 2022 10:53:22 +0100 Subject: [PATCH 16/24] MOL-683 extract formatCurrencyValue to function --- inc/utils.php | 7 +++++++ src/Shared/Data.php | 11 +++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/inc/utils.php b/inc/utils.php index bb583cb87..b06caf364 100644 --- a/inc/utils.php +++ b/inc/utils.php @@ -185,3 +185,10 @@ function mollieWooCommercIsExpiryDateEnabled() } return $expiryDateEnabled; } + +function mollieWooCommerceFormatCurrencyValue($value, $currency) +{ + // Only the Japanese Yen has no decimals in the currency + + return $currency === "JPY" ? number_format($value, 0, '.', '') : number_format($value, 2, '.', ''); +} diff --git a/src/Shared/Data.php b/src/Shared/Data.php index 60c806acd..d15ec1db0 100644 --- a/src/Shared/Data.php +++ b/src/Shared/Data.php @@ -374,6 +374,8 @@ public function getApiPaymentMethods($use_cache = true, $filters = []) if ($use_cache) { // When no cache exists $methods will be `false` $methods = get_transient($transient_id); + } else { + delete_transient($transient_id); } // No cache exists, call the API and cache the result @@ -653,16 +655,13 @@ public function getOrderCurrency($order) /** * Format currency value into Mollie API v2 format * - * @param float $value + * @param float|string $value * - * @return float $value + * @return string */ public function formatCurrencyValue($value, $currency) { - // Only the Japanese Yen has no decimals in the currency - $value = (float) $value; - - return $currency === "JPY" ? number_format($value, 0, '.', '') : number_format($value, 2, '.', ''); + return mollieWooCommerceFormatCurrencyValue($value, $currency); } /** From 23d207ad712db42c0453f8df14e89b4e309294ed Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 24 Feb 2022 10:54:20 +0100 Subject: [PATCH 17/24] MOL-683 Reload active methods on refresh --- src/Settings/Page/MollieSettingsPage.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Settings/Page/MollieSettingsPage.php b/src/Settings/Page/MollieSettingsPage.php index 90e4ea3f9..115b0fc15 100644 --- a/src/Settings/Page/MollieSettingsPage.php +++ b/src/Settings/Page/MollieSettingsPage.php @@ -272,7 +272,12 @@ public function getMollieMethods() ) ) { /* Reload active Mollie methods */ - $dataHelper->getAllPaymentMethods($apiKey, $testMode, $use_cache = false); + $methods = $dataHelper->getAllPaymentMethods($apiKey, $testMode, false); + foreach ($methods as $key => $method){ + $methods['mollie_wc_gateway_'.$method['id']] = $method; + unset($methods[$key]); + } + $this->registeredGateways = $methods; } $iconAvailable = ' registeredGateways["mollie_wc_gateway_ideal"]->enabled === 'yes'; - $sepaGateway = !empty($this->registeredGateways["mollie_wc_gateway_directdebit"]) && $this->registeredGateways["mollie_wc_gateway_directdebit"]->enabled === 'yes'; + $idealGateway = !empty($this->registeredGateways["mollie_wc_gateway_ideal"]) && $this->paymentMethods["ideal"]->getProperty('enabled') === 'yes'; + $sepaGateway = !empty($this->registeredGateways["mollie_wc_gateway_directdebit"]) && $this->paymentMethods["directdebit"]->getProperty('enabled') === 'yes'; if ((class_exists('WC_Subscription')) && $idealGateway && !$sepaGateway) { $warning_message = __( @@ -429,9 +429,9 @@ protected function checkMollieBankTransferNotBACS($content) */ protected function warnAboutRequiredCheckoutFieldForKlarna($content) { - $woocommerceKlarnapaylaterGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnapaylater"]) && $this->registeredGateways["mollie_wc_gateway_klarnapaylater"]->enabled === 'yes'; - $woocommerceKlarnasliceitGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnasliceit"]) && $this->registeredGateways["mollie_wc_gateway_klarnasliceit"]->enabled === 'yes'; - $woocommerceKlarnapaynowGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnapaynow"]) && $this->registeredGateways["mollie_wc_gateway_klarnapaynow"]->enabled === 'yes'; + $woocommerceKlarnapaylaterGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnapaylater"]) && $this->paymentMethods["klarnapaylater"]->getProperty('enabled') === 'yes'; + $woocommerceKlarnasliceitGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnasliceit"]) && $this->paymentMethods["klarnasliceit"]->getProperty('enabled') === 'yes'; + $woocommerceKlarnapaynowGateway = !empty($this->registeredGateways["mollie_wc_gateway_klarnapaynow"]) && $this->paymentMethods["klarnapaynow"]->getProperty('enabled') === 'yes'; if ( $woocommerceKlarnapaylaterGateway || $woocommerceKlarnasliceitGateway || $woocommerceKlarnapaynowGateway From b0c00bd5376ee1815bf1b121f20a2337903828c9 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Thu, 24 Feb 2022 16:43:29 +0100 Subject: [PATCH 19/24] MOL-683 call for recurring methods only if subscription plugin is active --- src/Shared/Data.php | 53 +++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/src/Shared/Data.php b/src/Shared/Data.php index d15ec1db0..8110b4769 100644 --- a/src/Shared/Data.php +++ b/src/Shared/Data.php @@ -65,6 +65,12 @@ public function isBlockPluginActive(): bool return is_plugin_active('woo-gutenberg-products-block/woocommerce-gutenberg-products-block.php'); } + public function isSubscriptionPluginActive(): bool + { + $subscriptionPlugin = is_plugin_active('woocommerce-subscriptions/woocommerce-subscriptions.php'); + return apply_filters('mollie_wc_subscription_plugin_active', $subscriptionPlugin); + } + /** * @return bool */ @@ -214,26 +220,13 @@ public function getPayment($payment_id, $apiKey, $use_cache = true) public function getAllPaymentMethods($apiKey, $test_mode = false, $use_cache = true) { $result = $this->getRegularPaymentMethods($apiKey, $test_mode, $use_cache); - $recurringPaymentMethods = $this->getRecurringPaymentMethods($apiKey, $test_mode, $use_cache); - if (!is_array($result)) { $result = unserialize($result); } - if (!is_array($recurringPaymentMethods)) { - $recurringPaymentMethods = unserialize($recurringPaymentMethods); - } - foreach ($recurringPaymentMethods as $recurringItem) { - $notFound = true; - foreach ($result as $item) { - if ($item['id'] === $recurringItem['id']) { - $notFound = false; - break; - } - } - if ($notFound) { - $result[] = $recurringItem; - } + $isSubscriptionPluginActive = $this->isSubscriptionPluginActive(); + if($isSubscriptionPluginActive){ + $result = $this->addRecurringPaymentMethods($apiKey, $test_mode, $use_cache, $result); } return $result; @@ -694,4 +687,32 @@ public function isSubscription($orderId) $isSubscription = false; return apply_filters($this->pluginId . '_is_subscription_payment', $isSubscription, $orderId); } + + /** + * @param $apiKey + * @param bool $test_mode + * @param bool $use_cache + * @param $result + * @return mixed + */ + protected function addRecurringPaymentMethods($apiKey, bool $test_mode, bool $use_cache, $result) + { + $recurringPaymentMethods = $this->getRecurringPaymentMethods($apiKey, $test_mode, $use_cache); + if (!is_array($recurringPaymentMethods)) { + $recurringPaymentMethods = unserialize($recurringPaymentMethods); + } + foreach ($recurringPaymentMethods as $recurringItem) { + $notFound = true; + foreach ($result as $item) { + if ($item['id'] === $recurringItem['id']) { + $notFound = false; + break; + } + } + if ($notFound) { + $result[] = $recurringItem; + } + } + return $result; + } } From 40dca310667d82499bbf8c0af84a26d9c883a3d3 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 28 Feb 2022 10:26:26 +0100 Subject: [PATCH 20/24] MOL-683 fix tests --- composer.json | 6 +- .../ApplePayButton/ResponsesToApple.php | 3 +- src/PaymentMethods/PaymentMethodsIconUrl.php | 2 +- src/Shared/GatewaySurchargeHandler.php | 18 ++- .../ApplePayButton/AjaxRequestsTest.php | 2 +- .../ApplePayButton/ApplePayDataObjectTest.php | 2 +- .../DataToAppleButtonScriptsTest.php | 2 +- .../ApplePayButton/ResponsesToAppleTest.php | 2 +- tests/php/Functional/HelperMocks.php | 45 +++--- .../PayPalButton/AjaxRequestsTest.php | 2 +- .../DataToPayPalButtonScriptsTest.php | 2 +- .../PayPalButton/PayPalDataObjectTest.php | 2 +- .../Payment/OrderItemsRefunderTest.php | 3 +- .../Functional/Payment/PaymentServiceTest.php | 77 ++++++++++- .../Payment/RefundLineItemsBuilderTest.php | 2 +- .../Shared/SurchargeHandlerTest.php | 28 ++-- .../Subscription/MollieSubscriptionTest.php | 129 +++++++++++++----- tests/php/Stubs/woocommerce.php | 18 ++- tests/php/TestCase.php | 5 +- 19 files changed, 256 insertions(+), 94 deletions(-) diff --git a/composer.json b/composer.json index 3dff8bd89..ce53fa952 100644 --- a/composer.json +++ b/composer.json @@ -15,18 +15,17 @@ } ], "require": { - "php": "^7.2", + "php": ">=7.2", "ext-intl": "*", "ext-json": "*", "mollie/mollie-api-php": "^v2.40", "inpsyde/modularity": "^1.3.0" }, "require-dev": { - "phpunit/phpunit": "^7.1", + "phpunit/phpunit": "^8", "brain/monkey": "^2.3", "ptrofimov/xpmock": "^1", "johnpbloch/wordpress-core": "^5.0", - "woocommerce/woocommerce": "^3.0 || ^4.0", "fzaninotto/faker": "^1.9@dev", "inpsyde/php-coding-standards": "^1.0.0", "vimeo/psalm": "^4.8" @@ -40,6 +39,7 @@ "autoload-dev": { "psr-4": { "Mollie\\WooCommerceTests\\": "tests/php", + "Mollie\\WooCommerceTests\\Unit\\": "tests/php/Unit", "Mollie\\WooCommerceTests\\Functional\\": "tests/php/Functional" } }, diff --git a/src/Buttons/ApplePayButton/ResponsesToApple.php b/src/Buttons/ApplePayButton/ResponsesToApple.php index 4a6c1572e..ba0d20116 100644 --- a/src/Buttons/ApplePayButton/ResponsesToApple.php +++ b/src/Buttons/ApplePayButton/ResponsesToApple.php @@ -193,7 +193,8 @@ protected function appleNewLineItemsResponse(array $paymentDetails) $type ); } - if ($paymentDetails['fee']['amount']) { + $issetFeeAmount = isset($paymentDetails['fee']) && isset($paymentDetails['fee']['amount']); + if ( $issetFeeAmount ) { $response[] = $this->appleItemFormat( $paymentDetails['fee']['label'] ?: '', diff --git a/src/PaymentMethods/PaymentMethodsIconUrl.php b/src/PaymentMethods/PaymentMethodsIconUrl.php index 3c2155553..ffa2720ce 100644 --- a/src/PaymentMethods/PaymentMethodsIconUrl.php +++ b/src/PaymentMethods/PaymentMethodsIconUrl.php @@ -156,7 +156,7 @@ protected function enabledCreditcards(): array $creditcardSettings = get_option('mollie_wc_gateway_creditcard_settings', []); foreach ($creditcardsAvailable as $card) { - if (mollieWooCommerceStringToBoolOption($creditcardSettings[$optionLexem . $card])) { + if (isset($creditcardSettings[$optionLexem . $card]) && mollieWooCommerceStringToBoolOption($creditcardSettings[$optionLexem . $card])) { $enabledCreditcards[] = $card . $svgFileName; } } diff --git a/src/Shared/GatewaySurchargeHandler.php b/src/Shared/GatewaySurchargeHandler.php index 3838c4113..38d3a572b 100644 --- a/src/Shared/GatewaySurchargeHandler.php +++ b/src/Shared/GatewaySurchargeHandler.php @@ -18,10 +18,7 @@ class GatewaySurchargeHandler public function __construct(Surcharge $surcharge) { $this->surcharge = $surcharge; - $this->gatewayFeeLabel = get_option( - 'mollie-payments-for-woocommerce_gatewayFeeLabel', - __(Surcharge::DEFAULT_FEE_LABEL, 'mollie-payments-for-woocommerce') - ); + $this->gatewayFeeLabel = $this->surchargeFeeOption(); add_action( 'init', @@ -134,7 +131,7 @@ public function updateSurchargeOrderPay() } $amount = $this->surcharge->calculateFeeAmountOrder($order, $gatewaySettings); - $surchargeName = $this->surcharge->buildFeeName($gatewayName); + $surchargeName = $this->surcharge->buildFeeName($this->gatewayFeeLabel); if ($amount > 0) { $this->orderAddFee($order, $amount, $surchargeName); @@ -233,8 +230,11 @@ public function add_engraving_fees($cart) if ($this->surcharge->aboveMaxLimit($cartAmount, $gatewaySettings)) { return; } + $amount = $this->surcharge->calculateFeeAmount($cart, $gatewaySettings); + $surchargeName = $this->surcharge->buildFeeName($this->gatewayFeeLabel); + $cart->add_fee($surchargeName, $amount); } @@ -323,5 +323,13 @@ protected function canProcessGateway() } return $gateway; } + + protected function surchargeFeeOption() + { + return get_option( + 'mollie-payments-for-woocommerce_gatewayFeeLabel', + __(Surcharge::DEFAULT_FEE_LABEL, 'mollie-payments-for-woocommerce') + ); + } } diff --git a/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php b/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php index 27bd8c239..ae25a7d07 100644 --- a/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php +++ b/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php @@ -471,7 +471,7 @@ private function wcOrder() /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/ApplePayButton/ApplePayDataObjectTest.php b/tests/php/Functional/ApplePayButton/ApplePayDataObjectTest.php index 7e9568cb9..c4d4d617d 100644 --- a/tests/php/Functional/ApplePayButton/ApplePayDataObjectTest.php +++ b/tests/php/Functional/ApplePayButton/ApplePayDataObjectTest.php @@ -192,7 +192,7 @@ public function testDataObjectError() /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/ApplePayButton/DataToAppleButtonScriptsTest.php b/tests/php/Functional/ApplePayButton/DataToAppleButtonScriptsTest.php index bba8b218e..86ffc1ecc 100644 --- a/tests/php/Functional/ApplePayButton/DataToAppleButtonScriptsTest.php +++ b/tests/php/Functional/ApplePayButton/DataToAppleButtonScriptsTest.php @@ -259,7 +259,7 @@ private function wcSession() /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/ApplePayButton/ResponsesToAppleTest.php b/tests/php/Functional/ApplePayButton/ResponsesToAppleTest.php index f26ac46c8..7334d838d 100644 --- a/tests/php/Functional/ApplePayButton/ResponsesToAppleTest.php +++ b/tests/php/Functional/ApplePayButton/ResponsesToAppleTest.php @@ -151,7 +151,7 @@ public function testAppleFormattedResponseWithShippingMethod() /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/HelperMocks.php b/tests/php/Functional/HelperMocks.php index 024c9b0a8..26381620f 100644 --- a/tests/php/Functional/HelperMocks.php +++ b/tests/php/Functional/HelperMocks.php @@ -5,7 +5,6 @@ use Mollie\Api\MollieApiClient; -use Mollie\WooCommerce\Gateway\MolliePaymentGateway; use Mollie\WooCommerce\Notice\AdminNotice; use Mollie\WooCommerce\Payment\MollieOrderService; use Mollie\WooCommerce\Payment\OrderInstructionsService; @@ -15,7 +14,6 @@ use Mollie\WooCommerce\SDK\Api; use Mollie\WooCommerce\Settings\Settings; use Mollie\WooCommerce\Shared\Data; -use Mollie\WooCommerceTests\Functional\Payment\PaymentServiceTest; use Mollie\WooCommerceTests\Stubs\Status; use Mollie\WooCommerceTests\TestCase; use Psr\Log\LoggerInterface; @@ -100,7 +98,7 @@ public function settingsHelper() return $this->createConfiguredMock( Settings::class, [ - 'isTestModeEnabled' => 'true', + 'isTestModeEnabled' => true, 'getApiKey' => 'test_NtHd7vSyPSpEyuTEwhjsxdjsgVG4SV', 'getPaymentLocale' => 'en_US', 'shouldStoreCustomer' => false, @@ -161,27 +159,26 @@ public function gatewayMockedOptions(string $paymentMethodId, $isSepa = false, $ public function paymentMethodSettings($testParams = []){ return [ - 'enabled' => $testParams['enabled'] ?: 'yes', - 'title' => $testParams['title'] ?: 'default title', - 'description' => $testParams['description'] ?: 'default description', - 'display_logo' => $testParams['display_logo'] ?: 'yes', - 'iconFileUrl' => $testParams['iconFileUrl'] ?: '', - 'iconFilePath' => $testParams['iconFilePath'] ?: '', - 'allowed_countries' => $testParams['allowed_countries'] ?: [], - 'enable_custom_logo' => $testParams['enable_custom_logo'] ?: false, - 'payment_surcharge' => $testParams['payment_surcharge'] ?: 'no_fee', - 'fixed_fee' => $testParams['fixed_fee'] ?: '0.00', - 'percentage' => $testParams['percentage'] ?: '0.00', - 'surcharge_limit' => $testParams['surcharge_limit'] ?: '0.00', - 'maximum_limit' => $testParams['maximum_limit'] ?: '0.00', - 'activate_expiry_days_setting' => $testParams['activate_expiry_days_setting'] ?: 'no', - 'order_dueDate' => $testParams['order_dueDate'] ?: '0', - 'issuers_dropdown_shown' => $testParams['issuers_dropdown_shown'] ?: 'yes', - 'issuers_empty_option' => $testParams['issuers_empty_option'] ?: 'Select your bank', - 'initial_order_status' => $testParams['initial_order_status'] ?: 'on-hold', - 'mollie_creditcard_icons_enabler' => $testParams['mollie_creditcard_icons_enabler'] ?: false, - 'mollie_creditcard_icons_amex' => $testParams['mollie_creditcard_icons_amex'], - + 'enabled' => isset($testParams['enabled']) ? $testParams['enabled'] : 'yes', + 'title' => isset($testParams['title']) ? $testParams['title'] : 'default title', + 'description' => isset($testParams['description']) ? $testParams['description'] : 'default description', + 'display_logo' => isset($testParams['display_logo']) ? $testParams['display_logo'] : 'yes', + 'iconFileUrl' => isset($testParams['iconFileUrl']) ? $testParams['iconFileUrl'] : '', + 'iconFilePath' => isset($testParams['iconFilePath']) ? $testParams['iconFilePath'] : '', + 'allowed_countries' => isset($testParams['allowed_countries']) ? $testParams['allowed_countries'] : [], + 'enable_custom_logo' => isset($testParams['enable_custom_logo']) ? $testParams['enable_custom_logo'] : false, + 'payment_surcharge' => isset($testParams['payment_surcharge']) ? $testParams['payment_surcharge'] : 'no_fee', + 'fixed_fee' => isset($testParams['fixed_fee']) ? $testParams['fixed_fee'] : '0.00', + 'percentage' => isset($testParams['percentage']) ? $testParams['percentage'] : '0.00', + 'surcharge_limit' => isset($testParams['surcharge_limit']) ? $testParams['surcharge_limit'] : '0.00', + 'maximum_limit' => isset($testParams['maximum_limit']) ? $testParams['maximum_limit'] : '0.00', + 'activate_expiry_days_setting' => isset($testParams['activate_expiry_days_setting']) ? $testParams['activate_expiry_days_setting'] : 'no', + 'order_dueDate' => isset($testParams['order_dueDate']) ? $testParams['order_dueDate'] : '0', + 'issuers_dropdown_shown' => isset($testParams['issuers_dropdown_shown']) ? $testParams['issuers_dropdown_shown'] : 'yes', + 'issuers_empty_option' => isset($testParams['issuers_empty_option']) ? $testParams['issuers_empty_option'] : 'Select your bank', + 'initial_order_status' => isset($testParams['initial_order_status']) ? $testParams['initial_order_status'] : 'on-hold', + 'mollie_creditcard_icons_enabler' => isset($testParams['mollie_creditcard_icons_enabler']) ? $testParams['mollie_creditcard_icons_enabler'] : false, + 'mollie_creditcard_icons_amex' => isset($testParams['mollie_creditcard_icons_amex']) ? $testParams['mollie_creditcard_icons_amex'] : '', ]; } diff --git a/tests/php/Functional/PayPalButton/AjaxRequestsTest.php b/tests/php/Functional/PayPalButton/AjaxRequestsTest.php index 1c533e006..560853def 100644 --- a/tests/php/Functional/PayPalButton/AjaxRequestsTest.php +++ b/tests/php/Functional/PayPalButton/AjaxRequestsTest.php @@ -165,7 +165,7 @@ private function wcOrder() /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php b/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php index d9a89045c..5736826b4 100644 --- a/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php +++ b/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php @@ -257,7 +257,7 @@ private function wcSession() /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/PayPalButton/PayPalDataObjectTest.php b/tests/php/Functional/PayPalButton/PayPalDataObjectTest.php index c794ad2a7..5a068c5eb 100644 --- a/tests/php/Functional/PayPalButton/PayPalDataObjectTest.php +++ b/tests/php/Functional/PayPalButton/PayPalDataObjectTest.php @@ -59,7 +59,7 @@ public function testDataObjectSuccess() /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/Payment/OrderItemsRefunderTest.php b/tests/php/Functional/Payment/OrderItemsRefunderTest.php index 5f58b1b04..f6f18e894 100644 --- a/tests/php/Functional/Payment/OrderItemsRefunderTest.php +++ b/tests/php/Functional/Payment/OrderItemsRefunderTest.php @@ -12,6 +12,7 @@ use Mollie\WooCommerce\Payment\RefundLineItemsBuilder; use Mollie\WooCommerce\Shared\Data; + use WC_Order_Item; use Mollie\WooCommerceTests\TestCase; @@ -378,7 +379,7 @@ private function buildLineItems($refundReason) /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/Payment/PaymentServiceTest.php b/tests/php/Functional/Payment/PaymentServiceTest.php index 7e36ac855..418362fbb 100644 --- a/tests/php/Functional/Payment/PaymentServiceTest.php +++ b/tests/php/Functional/Payment/PaymentServiceTest.php @@ -49,9 +49,84 @@ public function __construct($name = null, array $data = [], $dataName = '') * * @test */ + public function processPayment_Order_success(){ + $paymentMethodId = 'Ideal'; + $isSepa = true; + $wcOrderId = 1; + $wcOrderKey = 'wc_order_hxZniP1zDcnM8'; + $wcOrder = $this->wcOrder($wcOrderId, $wcOrderKey); + $mollieOrderId = 'wvndyu';//ord_wvndyu + $processPaymentRedirect = 'https://www.mollie.com/payscreen/order/checkout/'. $mollieOrderId; + + $paymentMethod = $this->helperMocks->paymentMethodBuilder($paymentMethodId); + $orderEndpoints = $this->createConfiguredMock( + OrderEndpoint::class, + [ + 'create' => new MollieOrderResponse(), + ] + ); + $apiClientMock = $this->createConfiguredMock( + MollieApiClient::class, + [] + ); + $apiClientMock->orders = $orderEndpoints; + $testee = new PaymentService( + $this->helperMocks->noticeMock(), + $this->helperMocks->loggerMock(), + $this->helperMocks->paymentFactory($apiClientMock), + $this->helperMocks->dataHelper($apiClientMock), + $this->helperMocks->apiHelper($apiClientMock), + $this->helperMocks->settingsHelper(), + $this->helperMocks->pluginId(), + $this->paymentCheckoutService($apiClientMock) + ); + $testee->setGateway($this->createMock(MolliePaymentGateway::class)); + stubs( + [ + 'admin_url' => 'http://admin.com', + 'wc_get_order' => $wcOrder, + 'wc_get_product' => $this->wcProduct(), + 'wc_get_payment_gateway_by_order' => $this->mollieGateway($paymentMethodId, $testee), + 'add_query_arg' => 'https://webshop.example.org/wc-api/mollie_return?order_id=1&key=wc_order_hxZniP1zDcnM8', + 'WC' => $this->wooCommerce() + ] + ); + $expectedRequestToMollie = $this->expectedRequestData($wcOrder); + $orderEndpoints->method('create')->with($expectedRequestToMollie); + + /* + * Expectations + */ + expect('is_plugin_active') + ->andReturn(false); + expect('get_option') + ->with('mollie-payments-for-woocommerce_api_switch') + ->andReturn(false); + expect('get_transient')->andReturn(['ideal'=>['id'=>'ideal']]); + + /* + * Execute Test + */ + $expectedResult = array ( + 'result' => 'success', + 'redirect' => $processPaymentRedirect, + ); + $arrayResult = $testee->processPayment(1, $wcOrder, $paymentMethod, $processPaymentRedirect); + self::assertEquals($expectedResult, $arrayResult); + + /* + * Execute Test + */ + $expectedResult = array ( + 'result' => 'success', + 'redirect' => $processPaymentRedirect, + ); + $arrayResult = $testee->processPayment(1, $wcOrder, $paymentMethod, $processPaymentRedirect); + self::assertEquals($expectedResult, $arrayResult); + } - protected function setUp() + protected function setUp(): void { $_POST = []; parent::setUp(); diff --git a/tests/php/Functional/Payment/RefundLineItemsBuilderTest.php b/tests/php/Functional/Payment/RefundLineItemsBuilderTest.php index 5d1fb16f0..f31c91ef0 100644 --- a/tests/php/Functional/Payment/RefundLineItemsBuilderTest.php +++ b/tests/php/Functional/Payment/RefundLineItemsBuilderTest.php @@ -413,7 +413,7 @@ private function orderLineItem($id, $status, array $price, array $discountAmount /** * @inheritDoc */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Functional/Shared/SurchargeHandlerTest.php b/tests/php/Functional/Shared/SurchargeHandlerTest.php index 0aec0f7b2..87b6af171 100644 --- a/tests/php/Functional/Shared/SurchargeHandlerTest.php +++ b/tests/php/Functional/Shared/SurchargeHandlerTest.php @@ -35,7 +35,7 @@ public function __construct($name = null, array $data = [], $dataName = '') * * @test */ - /*public function addsSurchargeFeesInCheckout(){ + public function addsSurchargeFeesInCheckout(){ $cart = $this->cartMock(); $paymentSurcharge = Surcharge::FIXED_FEE; $fixedFee = 10.00; @@ -43,12 +43,13 @@ public function __construct($name = null, array $data = [], $dataName = '') $feeLimit = 1; $expectedLabel = 'custom label'; $expectedAmount = 10.00; - $testee = $this->createPartialMock( + $testee = $this->buildTesteeMock( GatewaySurchargeHandler::class, - [] - ); - $testee->gatewayFeeLabel = 'custom label'; + [new Surcharge()], + ['surchargeFeeOption'] + )->getMock(); + $testee->gatewayFeeLabel = 'custom label'; expect('mollieWooCommerceIsCheckoutContext')->andReturn(true); expect('WC')->andReturn($this->wooCommerce()); expect('get_option')->andReturn( @@ -64,7 +65,7 @@ public function __construct($name = null, array $data = [], $dataName = '') $cart->expects(self::once())->method('add_fee')->with($expectedLabel, $expectedAmount); $testee->add_engraving_fees($cart); - }*/ + } /** * @@ -74,14 +75,14 @@ public function __construct($name = null, array $data = [], $dataName = '') * * @test */ - /*public function addsSurchargeFeesInOrderPayPage() + public function addsSurchargeFeesInOrderPayPage() { $paymentSurcharge = Surcharge::FIXED_FEE; $fixedFee = 10.00; $percentage = 0; $feeLimit = 1; $expectedLabel = 'custom label'; - $expectedAmount = 10.00; + $expectedAmount = 10.00; $newTotal = 20.00; $expectedData = [ 'amount' => $expectedAmount, @@ -89,10 +90,11 @@ public function __construct($name = null, array $data = [], $dataName = '') 'currency' => 'EUR', 'newTotal' => $newTotal, ]; - $testee = $this->createPartialMock( + $testee = $this->buildTesteeMock( GatewaySurchargeHandler::class, - ['canProcessOrder', 'canProcessGateway', 'orderRemoveFee', 'orderAddFee'] - ); + [new Surcharge()], + ['canProcessOrder', 'canProcessGateway', 'orderRemoveFee', 'orderAddFee', 'surchargeFeeOption'] + )->getMock(); $testee->gatewayFeeLabel = 'custom label'; $testee->expects($this->once()) @@ -122,7 +124,7 @@ public function __construct($name = null, array $data = [], $dataName = '') expect('wp_send_json_success')->with($expectedData); $testee->updateSurchargeOrderPay(); - }*/ + } protected function cartMock() { @@ -162,7 +164,7 @@ private function wcOrder($id, $orderKey) [ 'get_id' => $id, 'get_order_key' => $orderKey, - 'get_total' => '20.00', + 'get_total' => 20.00, 'get_items' => [], 'get_billing_first_name' => 'billingggivenName', 'get_billing_last_name' => 'billingfamilyName', diff --git a/tests/php/Functional/Subscription/MollieSubscriptionTest.php b/tests/php/Functional/Subscription/MollieSubscriptionTest.php index 634ed997f..f01afa851 100644 --- a/tests/php/Functional/Subscription/MollieSubscriptionTest.php +++ b/tests/php/Functional/Subscription/MollieSubscriptionTest.php @@ -2,17 +2,20 @@ namespace Mollie\WooCommerceTests\Functional\Subscription; +use Mollie\Api\Endpoints\CustomerEndpoint; +use Mollie\Api\Endpoints\PaymentEndpoint; +use Mollie\Api\Resources\Customer; +use Mollie\Api\Resources\Mandate; +use Mollie\Api\Resources\MandateCollection; +use Mollie\Api\Resources\Payment; +use Mollie\WooCommerce\Payment\MollieObject; +use Mollie\WooCommerce\SDK\HttpResponse; use Mollie\WooCommerce\Subscription\MollieSubscriptionGateway; use Mollie\WooCommerceTests\Functional\HelperMocks; use Mollie\WooCommerceTests\TestCase; - - -use stdClass; - use function Brain\Monkey\Functions\expect; -use function Brain\Monkey\Functions\stubs; -use function Brain\Monkey\Functions\when; + /** * Class Mollie_WC_Plugin_Test @@ -35,19 +38,33 @@ public function __construct($name = null, array $data = [], $dataName = '') * THEN THE ORDER NOTES ARE CREATED * @test */ - /*public function renewSubcriptionPaymentTest() + public function renewSubcriptionPaymentTest() { - $wcSubscription = $this->wcOrder(); - + $gatewayName = 'mollie_wc_gateway_ideal'; + $renewalOrder = $this->wcOrder(); + $subscription = $this->wcOrder(2, $gatewayName, $renewalOrder, 'active' ); + + $testee = $this->buildTestee(); + $testee->expects($this->once())->method( + 'isTestModeEnabledForRenewalOrder' + )->with($renewalOrder)->willReturn(true); + expect('wcs_get_subscriptions_for_renewal_order')->andReturn( + [$subscription] + ); + $testee->expects($this->once())->method( + 'restore_mollie_customer_id_and_mandate' + )->willReturn(false); + expect('wc_get_payment_gateway_by_order')->andReturn($gatewayName); + $renewalOrder->expects($this->once())->method( + 'set_payment_method' + )->with($gatewayName); + expect('get_post_meta')->with(1, '_payment_method', true); + expect('wc_get_order')->with(1)->andReturn($renewalOrder); + expect('wcs_order_contains_renewal')->with(1)->andReturn($renewalOrder); + expect('wcs_get_subscription')->andReturn($subscription); - $testee = $this->buildTesteeMock( - MollieSubscriptionGateway::class, - [], - [] - )->getMock(); - var_dump($testee); $expectedResult = ['result' => 'success']; - $result = $testee->scheduled_subscription_payment(1.02, $wcSubscription); + $result = $testee->scheduled_subscription_payment(1.02, $renewalOrder); $this->assertEquals($expectedResult, $result); } @@ -59,30 +76,71 @@ private function buildTestee(){ $data = $this->helperMocks->dataHelper(); $logger = $this->helperMocks->loggerMock(); $notice = $this->helperMocks->noticeMock(); - - return new MollieSubscriptionGateway( - $paymentMethod, - $paymentService, - $orderInstructionsService, - $mollieOrderService, - $data, - $logger, - $notice, - $HttpResponseService, - $settingsHelper, - $mollieObject, - $paymentFactory, - $pluginId, - $apiHelper + $HttpResponseService = new HttpResponse(); + $settingsHelper = $this->helperMocks->settingsHelper(); + $mollieObject = $this->createMock(MollieObject::class); + $apiClientMock = $this->helperMocks->apiClient(); + $mandate = $this->createMock(Mandate::class); + $mandate->status = 'valid'; + $mandate->method = 'mollie_wc_gateway_ideal'; + $customer = $this->createConfiguredMock( + Customer::class, + [ + 'mandates'=> [$mandate] + ] ); - }*/ + $apiClientMock->customers = $this->createConfiguredMock( + CustomerEndpoint::class, + [ + 'get'=> $customer + ] + ); + $paymentResponse = $this->createMock(Payment::class); + $paymentResponse->method = 'ideal'; + $paymentResponse->mandateId = 'mandateId'; + $paymentResponse->resource = 'payment'; + $apiClientMock->payments = $this->createConfiguredMock( + PaymentEndpoint::class, + [ + 'create'=> $paymentResponse + ] + ); + $paymentFactory = $this->helperMocks->paymentFactory($apiClientMock); + $pluginId = $this->helperMocks->pluginId(); + $apiHelper = $this->helperMocks->apiHelper($apiClientMock); + return $this->buildTesteeMock( + MollieSubscriptionGateway::class, + [ + $paymentMethod, + $paymentService, + $orderInstructionsService, + $mollieOrderService, + $data, + $logger, + $notice, + $HttpResponseService, + $settingsHelper, + $mollieObject, + $paymentFactory, + $pluginId, + $apiHelper + ], + [ + 'init_form_fields', + 'initDescription', + 'initIcon', + 'isTestModeEnabledForRenewalOrder', + 'restore_mollie_customer_id_and_mandate' + ] + )->getMock(); + } - private function wcOrder() + private function wcOrder($id = 1, $meta = false, $parentOrder = false, $status = 'processing') { $item = $this->createConfiguredMock( 'WC_Order', [ - 'get_id' => 1, + 'get_id' => $id, 'get_order_key' => 'wc_order_hxZniP1zDcnM8', 'get_total' => '20', 'get_items' => [$this->wcOrderItem()], @@ -107,6 +165,9 @@ private function wcOrder() 'get_order_number' => 1, 'get_payment_method' => 'mollie_wc_gateway_ideal', 'get_currency' => 'EUR', + 'get_meta' => $meta, + 'get_parent' => $parentOrder, + 'update_status'=>$status ] ); diff --git a/tests/php/Stubs/woocommerce.php b/tests/php/Stubs/woocommerce.php index ea8bb9105..236e977db 100644 --- a/tests/php/Stubs/woocommerce.php +++ b/tests/php/Stubs/woocommerce.php @@ -154,7 +154,23 @@ public function get_checkout_payment_url() public function get_meta() { } - public function get_currency(){} + + public function get_currency() + { + } + + public function get_parent() + { + } + + public function set_payment_method() + { + } + + public function update_status() + { + + } } class WC_Cart { diff --git a/tests/php/TestCase.php b/tests/php/TestCase.php index 94a0b8faa..9b4834d24 100644 --- a/tests/php/TestCase.php +++ b/tests/php/TestCase.php @@ -32,8 +32,9 @@ class TestCase extends PhpUnitTestCase * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ - protected function setUp() + protected function setUp(): void { + parent::setUp(); setUp(); $this->setupFaker(); @@ -57,7 +58,7 @@ protected function setupFaker() * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Mockery::close(); From 0271731022b580a03741c1dbb282fbfaa1142636 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 28 Feb 2022 13:41:03 +0100 Subject: [PATCH 21/24] MOL-683 add is_available gateway tests --- src/Gateway/MolliePaymentGateway.php | 1 + .../ApplePayButton/AjaxRequestsTest.php | 109 ++--------- .../Functional/Gateway/MollieGatewayTest.php | 173 +++++++++++++++++ tests/php/Stubs/WooCommerceMocks.php | 182 ++++++++++++++++++ 4 files changed, 368 insertions(+), 97 deletions(-) create mode 100644 tests/php/Functional/Gateway/MollieGatewayTest.php create mode 100644 tests/php/Stubs/WooCommerceMocks.php diff --git a/src/Gateway/MolliePaymentGateway.php b/src/Gateway/MolliePaymentGateway.php index afc9b0aeb..09bdf7fdc 100644 --- a/src/Gateway/MolliePaymentGateway.php +++ b/src/Gateway/MolliePaymentGateway.php @@ -454,6 +454,7 @@ public function is_available(): bool } $billing_country = WC()->customer ? WC()->customer->get_billing_country() : wc_get_base_location()['country']; + $billing_country = apply_filters( $this->pluginId . '_is_available_billing_country_for_payment_gateways', diff --git a/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php b/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php index ae25a7d07..30be00e42 100644 --- a/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php +++ b/tests/php/Functional/ApplePayButton/AjaxRequestsTest.php @@ -13,6 +13,7 @@ use Mollie\WooCommerce\Subscription\MollieSubscriptionGateway; use Mollie\WooCommerceTests\Functional\HelperMocks; use Mollie\WooCommerceTests\Stubs\postDTOTestsStubs; +use Mollie\WooCommerceTests\Stubs\WooCommerceMocks; use Mollie\WooCommerceTests\TestCase; use PHPUnit_Framework_Exception; use WC_Countries; @@ -41,11 +42,14 @@ class AjaxRequestsTest extends TestCase private $ordersApiClient; /** @var HelperMocks */ private $helperMocks; + /** @var WooCommerceMocks */ + private $wooCommerceMocks; public function __construct($name = null, array $data = [], $dataName = '') { parent::__construct($name, $data, $dataName); $this->helperMocks = new HelperMocks(); + $this->wooCommerceMocks = new WooCommerceMocks(); } public function testValidateMerchant() @@ -285,10 +289,6 @@ public function testUpdateShippingContactErrorMissingData() $testee->updateShippingContact(); } - - - - public function mollieGateway($paymentMethodName, $isSepa = false, $isSubscription = false){ $gateway = $this->createConfiguredMock( MollieSubscriptionGateway::class, @@ -311,18 +311,7 @@ private function wooCommerce( $total = 0, $tax = 0 ) { - $item = $this->createConfiguredMock( - 'WooCommerce', - [ - - ] - ); - $item->cart = $this->wcCart($subtotal, $shippingTotal, $total, $tax); - $item->customer = $this->wcCustomer(); - $item->shipping = $this->wcShipping(); - $item->session = $this->wcSession(); - - return $item; + return $this->wooCommerceMocks->wooCommerce($subtotal, $shippingTotal, $total, $tax); } /** @@ -332,22 +321,7 @@ private function wooCommerce( */ private function wcCart($subtotal, $shippingTotal, $total, $tax) { - $item = $this->createConfiguredMock( - 'WC_Cart', - [ - 'needs_shipping' => true, - 'get_subtotal' => $subtotal, - 'is_empty' => true, - 'get_shipping_total' => $shippingTotal, - 'add_to_cart' => '88888', - 'get_total_tax' => $tax, - 'get_total' => $total, - 'calculate_shipping' => null - - ] - ); - - return $item; + return $this->wooCommerceMocks->wcCart($subtotal, $shippingTotal, $total, $tax); } /** @@ -357,15 +331,7 @@ private function wcCart($subtotal, $shippingTotal, $total, $tax) */ private function wcCustomer() { - $item = $this->createConfiguredMock( - 'WC_Customer', - [ - 'get_shipping_country' => 'IT' - - ] - ); - - return $item; + return $this->wooCommerceMocks->wcCustomer(); } /** @@ -375,15 +341,7 @@ private function wcCustomer() */ private function wcCountries() { - $item = $this->createConfiguredMock( - WC_Countries::class, - [ - 'get_allowed_countries' => ['IT' => 'Italy'], - 'get_shipping_countries' => ['IT' => 'Italy'], - ] - ); - - return $item; + return $this->wooCommerceMocks->wcCountries(); } /** @@ -393,29 +351,7 @@ private function wcCountries() */ private function wcShipping() { - $item = $this->createConfiguredMock( - 'WC_Shipping', - [ - 'calculate_shipping' => [ - 0 => [ - 'rates' => [ - $this->wcShippingRate( - 'flat_rate:1', - 'Flat1', - '1.00' - ), - $this->wcShippingRate( - 'flat_rate:4', - 'Flat4', - '4.00' - ) - ] - ] - ] - ] - ); - - return $item; + return $this->wooCommerceMocks->wcShipping(); } /** @@ -425,17 +361,7 @@ private function wcShipping() */ private function wcShippingRate($id, $label, $cost) { - $item = $this->createConfiguredMock( - 'WC_Shipping_Rate', - [ - 'get_id' => $id, - 'get_label' => $label, - 'get_cost' => $cost - - ] - ); - - return $item; + return $this->wooCommerceMocks->wcShippingRate($id, $label, $cost); } /** @@ -445,13 +371,7 @@ private function wcShippingRate($id, $label, $cost) */ private function wcSession() { - return $this->createConfiguredMock( - 'WC_Session', - [ - 'set' => null - - ] - ); + return $this->wooCommerceMocks->wcSession(); } /** @@ -460,12 +380,7 @@ private function wcSession() */ private function wcOrder() { - return $this->createConfiguredMock( - 'Mollie\WooCommerceTests\Stubs\WC_Order', - [ - 'get_id' => 11, - ] - ); + return $this->wooCommerceMocks->wcOrder(); } /** diff --git a/tests/php/Functional/Gateway/MollieGatewayTest.php b/tests/php/Functional/Gateway/MollieGatewayTest.php new file mode 100644 index 000000000..158a0ac48 --- /dev/null +++ b/tests/php/Functional/Gateway/MollieGatewayTest.php @@ -0,0 +1,173 @@ +helperMocks = new HelperMocks(); + $this->wooCommerceMocks = new WooCommerceMocks(); + } + + /** + * WHEN gateway setting 'enabled' !== 'yes' + * THEN is_available returns false + * @test + */ + public function gatewayNOTEnabledIsNOTAvailable() + { + $testee = $this->buildTestee(['enabled'=>'no']); + + $expectedResult = false; + $result = $testee->is_available(); + $this->assertEquals($expectedResult, $result); + } + + /** + * WHEN gateway setting 'enabled' !== 'yes' + * THEN is_available returns false + * @test + */ + public function gatewayEnabledIsAvailable() + { + $testee = $this->buildTestee(['enabled'=>'yes']); + $total = 10.00; + $WC = $this->wooCommerceMocks->wooCommerce(10.00, 0, $total, 0); + expect('WC')->andReturn($WC); + $testee->expects($this->atLeast(2))->method('get_order_total')->willReturn($total); + expect('get_woocommerce_currency')->andReturn('EUR'); + expect('get_transient')->andReturn([['id'=>'ideal']]); + + $expectedResult = true; + $result = $testee->is_available(); + $this->assertEquals($expectedResult, $result); + } + + private function buildTestee($settings){ + $paymentMethod = $this->helperMocks->paymentMethodBuilder('Ideal', false, false, $settings); + $paymentService = $this->helperMocks->paymentService(); + $orderInstructionsService = $this->helperMocks->orderInstructionsService(); + $mollieOrderService = $this->helperMocks->mollieOrderService(); + $data = $this->helperMocks->dataHelper(); + $logger = $this->helperMocks->loggerMock(); + $notice = $this->helperMocks->noticeMock(); + $HttpResponseService = new HttpResponse(); + $mollieObject = $this->createMock(MollieObject::class); + $apiClientMock = $this->helperMocks->apiClient(); + + $paymentFactory = $this->helperMocks->paymentFactory($apiClientMock); + $pluginId = $this->helperMocks->pluginId(); + + return $this->buildTesteeMock( + MolliePaymentGateway::class, + [ + $paymentMethod, + $paymentService, + $orderInstructionsService, + $mollieOrderService, + $data, + $logger, + $notice, + $HttpResponseService, + $mollieObject, + $paymentFactory, + $pluginId + ], + [ + 'init_form_fields', + 'initDescription', + 'initIcon', + 'get_order_total' + ] + )->getMock(); + } + + private function wcOrder($id = 1, $meta = false, $parentOrder = false, $status = 'processing') + { + $item = $this->createConfiguredMock( + 'WC_Order', + [ + 'get_id' => $id, + 'get_order_key' => 'wc_order_hxZniP1zDcnM8', + 'get_total' => '20', + 'get_items' => [$this->wcOrderItem()], + 'get_billing_first_name' => 'billingggivenName', + 'get_billing_last_name' => 'billingfamilyName', + 'get_billing_email' => 'billingemail', + 'get_shipping_first_name' => 'shippinggivenName', + 'get_shipping_last_name' => 'shippingfamilyName', + 'get_billing_address_1' => 'shippingstreetAndNumber', + 'get_billing_address_2' => 'billingstreetAdditional', + 'get_billing_postcode' => 'billingpostalCode', + 'get_billing_city' => 'billingcity', + 'get_billing_state' => 'billingregion', + 'get_billing_country' => 'billingcountry', + 'get_shipping_address_1' => 'shippingstreetAndNumber', + 'get_shipping_address_2' => 'shippingstreetAdditional', + 'get_shipping_postcode' => 'shippingpostalCode', + 'get_shipping_city' => 'shippingcity', + 'get_shipping_state' => 'shippingregion', + 'get_shipping_country' => 'shippingcountry', + 'get_shipping_methods' => false, + 'get_order_number' => 1, + 'get_payment_method' => 'mollie_wc_gateway_ideal', + 'get_currency' => 'EUR', + 'get_meta' => $meta, + 'get_parent' => $parentOrder, + 'update_status'=>$status + ] + ); + + return $item; + } + private function wcOrderItem() + { + $item = new \WC_Order_Item_Product(); + + $item['quantity'] = 1; + $item['variation_id'] = null; + $item['product_id'] = 1; + $item['line_subtotal_tax']= 0; + $item['line_total']= 20; + $item['line_subtotal']= 20; + $item['line_tax']= 0; + $item['tax_status']= ''; + $item['total']= 20; + $item['name']= 'productName'; + + return $item; + } + +} + + + diff --git a/tests/php/Stubs/WooCommerceMocks.php b/tests/php/Stubs/WooCommerceMocks.php new file mode 100644 index 000000000..16d6eb4f4 --- /dev/null +++ b/tests/php/Stubs/WooCommerceMocks.php @@ -0,0 +1,182 @@ +createConfiguredMock( + WC_Countries::class, + [ + 'get_allowed_countries' => ['IT' => 'Italy'], + 'get_shipping_countries' => ['IT' => 'Italy'], + ] + ); + + return $item; + } + + /** + * + * @return PHPUnit_Framework_MockObject_MockObject + * @throws PHPUnit_Framework_Exception + */ + public function wcCustomer() + { + $item = $this->createConfiguredMock( + 'WC_Customer', + [ + 'get_shipping_country' => 'IT', + 'get_billing_country' => 'IT' + + ] + ); + + return $item; + } + + /** + * + * @return PHPUnit_Framework_MockObject_MockObject + * @throws PHPUnit_Framework_Exception + */ + public function wooCommerce( + $subtotal = 0, + $shippingTotal = 0, + $total = 0, + $tax = 0 + ) { + $item = $this->createConfiguredMock( + 'WooCommerce', + [ + + ] + ); + $item->cart = $this->wcCart($subtotal, $shippingTotal, $total, $tax); + $item->customer = $this->wcCustomer(); + $item->shipping = $this->wcShipping(); + $item->session = $this->wcSession(); + + return $item; + } + + /** + * + * @return PHPUnit_Framework_MockObject_MockObject + * @throws PHPUnit_Framework_Exception + */ + public function wcCart($subtotal, $shippingTotal, $total, $tax) + { + $item = $this->createConfiguredMock( + 'WC_Cart', + [ + 'needs_shipping' => true, + 'get_subtotal' => $subtotal, + 'is_empty' => true, + 'get_shipping_total' => $shippingTotal, + 'add_to_cart' => '88888', + 'get_total_tax' => $tax, + 'get_total' => $total, + 'calculate_shipping' => null + + ] + ); + + return $item; + } + + /** + * + * @throws PHPUnit_Framework_Exception + */ + public function wcOrder() + { + return $this->createConfiguredMock( + 'Mollie\WooCommerceTests\Stubs\WC_Order', + [ + 'get_id' => 11, + ] + ); + } + + /** + * + * @return PHPUnit_Framework_MockObject_MockObject + * @throws PHPUnit_Framework_Exception + */ + public function wcShipping() + { + $item = $this->createConfiguredMock( + 'WC_Shipping', + [ + 'calculate_shipping' => [ + 0 => [ + 'rates' => [ + $this->wcShippingRate( + 'flat_rate:1', + 'Flat1', + '1.00' + ), + $this->wcShippingRate( + 'flat_rate:4', + 'Flat4', + '4.00' + ) + ] + ] + ] + ] + ); + + return $item; + } + + /** + * + * @return PHPUnit_Framework_MockObject_MockObject + * @throws PHPUnit_Framework_Exception + */ + public function wcSession() + { + return $this->createConfiguredMock( + 'WC_Session', + [ + 'set' => null + + ] + ); + } + + /** + * + * @return PHPUnit_Framework_MockObject_MockObject + * @throws PHPUnit_Framework_Exception + */ + public function wcShippingRate($id, $label, $cost) + { + $item = $this->createConfiguredMock( + 'WC_Shipping_Rate', + [ + 'get_id' => $id, + 'get_label' => $label, + 'get_cost' => $cost + + ] + ); + + return $item; + } +} From addb7b9fb7c676f486fb10dae37a723777f677a7 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 28 Feb 2022 14:38:47 +0100 Subject: [PATCH 22/24] MOL-670 update customer country when updating country in blocks --- src/BlockService/CheckoutBlockService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BlockService/CheckoutBlockService.php b/src/BlockService/CheckoutBlockService.php index de66b24aa..c38b9d925 100644 --- a/src/BlockService/CheckoutBlockService.php +++ b/src/BlockService/CheckoutBlockService.php @@ -66,6 +66,7 @@ public function availableGateways() $filters = false; } if ($filters) { + WC()->customer->set_billing_country($billingCountry); $availableGateways = WC()->payment_gateways()->get_available_payment_gateways(); foreach ($availableGateways as $key => $gateway){ if(strpos($key, 'mollie_wc_gateway_') === false){ From 5f8aadc6e91b394d83fbfc2b1bf4c5f23cebf933 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 28 Feb 2022 15:03:23 +0100 Subject: [PATCH 23/24] MOL-683 composer update --- composer.lock | 998 +++++++++++--------------------------------------- 1 file changed, 217 insertions(+), 781 deletions(-) diff --git a/composer.lock b/composer.lock index 99f8249d1..4a4d7432c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "30be4fb2467d33afac71d083f8d46109", + "content-hash": "32e99abefd5d85458bf7ac2dd564210c", "packages": [ { "name": "composer/ca-bundle", @@ -250,27 +250,22 @@ }, { "name": "psr/container", - "version": "1.0.0", + "version": "1.1.x-dev", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.2.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -283,7 +278,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -297,9 +292,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" + "source": "https://github.com/php-fig/container/tree/1.1.x" }, - "time": "2017-02-14T16:28:37+00:00" + "time": "2021-03-05T17:36:06+00:00" } ], "packages-dev": [ @@ -519,82 +514,6 @@ }, "time": "2022-02-07T07:28:34+00:00" }, - { - "name": "automattic/jetpack-autoloader", - "version": "v2.7.1", - "source": { - "type": "git", - "url": "https://github.com/Automattic/jetpack-autoloader.git", - "reference": "5437697a56aefbdf707849b9833e1b36093d7a73" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-autoloader/zipball/5437697a56aefbdf707849b9833e1b36093d7a73", - "reference": "5437697a56aefbdf707849b9833e1b36093d7a73", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1 || ^2.0" - }, - "require-dev": { - "yoast/phpunit-polyfills": "0.2.0" - }, - "type": "composer-plugin", - "extra": { - "class": "Automattic\\Jetpack\\Autoloader\\CustomAutoloaderPlugin" - }, - "autoload": { - "psr-4": { - "Automattic\\Jetpack\\Autoloader\\": "src" - }, - "classmap": [ - "src/AutoloadGenerator.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "description": "Creates a custom autoloader for a plugin or theme.", - "support": { - "source": "https://github.com/Automattic/jetpack-autoloader/tree/v2.7.1" - }, - "time": "2020-12-18T22:33:59+00:00" - }, - { - "name": "automattic/jetpack-constants", - "version": "v1.5.1", - "source": { - "type": "git", - "url": "https://github.com/Automattic/jetpack-constants.git", - "reference": "18f772daddc8be5df76c9f4a92e017a3c2569a5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/18f772daddc8be5df76c9f4a92e017a3c2569a5b", - "reference": "18f772daddc8be5df76c9f4a92e017a3c2569a5b", - "shasum": "" - }, - "require-dev": { - "php-mock/php-mock": "^2.1", - "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "description": "A wrapper for defining constants in a more testable way.", - "support": { - "source": "https://github.com/Automattic/jetpack-constants/tree/v1.5.1" - }, - "time": "2020-10-28T19:00:31+00:00" - }, { "name": "automattic/phpcs-neutron-standard", "version": "v1.7.0", @@ -764,157 +683,6 @@ }, "time": "2021-11-11T15:53:55+00:00" }, - { - "name": "composer/installers", - "version": "1.x-dev", - "source": { - "type": "git", - "url": "https://github.com/composer/installers.git", - "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", - "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0 || ^2.0" - }, - "replace": { - "roundcube/plugin-installer": "*", - "shama/baton": "*" - }, - "require-dev": { - "composer/composer": "1.6.* || ^2.0", - "composer/semver": "^1 || ^3", - "phpstan/phpstan": "^0.12.55", - "phpstan/phpstan-phpunit": "^0.12.16", - "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.3" - }, - "type": "composer-plugin", - "extra": { - "class": "Composer\\Installers\\Plugin", - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Installers\\": "src/Composer/Installers" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kyle Robinson Young", - "email": "kyle@dontkry.com", - "homepage": "https://github.com/shama" - } - ], - "description": "A multi-framework Composer library installer", - "homepage": "https://composer.github.io/installers/", - "keywords": [ - "Craft", - "Dolibarr", - "Eliasis", - "Hurad", - "ImageCMS", - "Kanboard", - "Lan Management System", - "MODX Evo", - "MantisBT", - "Mautic", - "Maya", - "OXID", - "Plentymarkets", - "Porto", - "RadPHP", - "SMF", - "Starbug", - "Thelia", - "Whmcs", - "WolfCMS", - "agl", - "aimeos", - "annotatecms", - "attogram", - "bitrix", - "cakephp", - "chef", - "cockpit", - "codeigniter", - "concrete5", - "croogo", - "dokuwiki", - "drupal", - "eZ Platform", - "elgg", - "expressionengine", - "fuelphp", - "grav", - "installer", - "itop", - "joomla", - "known", - "kohana", - "laravel", - "lavalite", - "lithium", - "magento", - "majima", - "mako", - "mediawiki", - "miaoxing", - "modulework", - "modx", - "moodle", - "osclass", - "pantheon", - "phpbb", - "piwik", - "ppi", - "processwire", - "puppet", - "pxcms", - "reindex", - "roundcube", - "shopware", - "silverstripe", - "sydes", - "sylius", - "symfony", - "tastyigniter", - "typo3", - "wordpress", - "yawik", - "zend", - "zikula" - ], - "support": { - "issues": "https://github.com/composer/installers/issues", - "source": "https://github.com/composer/installers/tree/v1.12.0" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-09-13T08:19:44+00:00" - }, { "name": "composer/package-versions-deprecated", "version": "dev-master", @@ -991,30 +759,30 @@ }, { "name": "composer/pcre", - "version": "1.x-dev", + "version": "2.x-dev", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "437d09fdc9fbce60cb9defb28473e864b33c2d28" + "reference": "66930996df48eb8dcd5346eee236a35c3853a8b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/437d09fdc9fbce60cb9defb28473e864b33c2d28", - "reference": "437d09fdc9fbce60cb9defb28473e864b33c2d28", + "url": "https://api.github.com/repos/composer/pcre/zipball/66930996df48eb8dcd5346eee236a35c3853a8b0", + "reference": "66930996df48eb8dcd5346eee236a35c3853a8b0", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5" + "symfony/phpunit-bridge": "^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -1042,7 +810,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/main" + "source": "https://github.com/composer/pcre/tree/2.x" }, "funding": [ { @@ -1058,7 +826,7 @@ "type": "tidelift" } ], - "time": "2022-01-21T20:27:39+00:00" + "time": "2022-02-26T13:13:56+00:00" }, { "name": "composer/semver", @@ -1144,20 +912,20 @@ }, { "name": "composer/xdebug-handler", - "version": "3.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "12f1b79476638a5615ed00ea6adbb269cec96fd8" + "reference": "ced299686f41dce890debac69273b47ffe98a40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/12f1b79476638a5615ed00ea6adbb269cec96fd8", - "reference": "12f1b79476638a5615ed00ea6adbb269cec96fd8", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", "shasum": "" }, "require": { - "composer/pcre": "^1", + "composer/pcre": "^1 || ^2 || ^3", "php": "^7.2.5 || ^8.0", "psr/log": "^1 || ^2 || ^3" }, @@ -1190,7 +958,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.1" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" }, "funding": [ { @@ -1206,7 +974,7 @@ "type": "tidelift" } ], - "time": "2022-01-04T18:29:42+00:00" + "time": "2022-02-25T21:32:43+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -1605,12 +1373,12 @@ "source": { "type": "git", "url": "https://github.com/inpsyde/php-coding-standards.git", - "reference": "8f6929b35b627fefbd865829cd8422954f73c6bd" + "reference": "bab7e00068c2b7a601e3cdce6b0bf6a0ccfe8355" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/inpsyde/php-coding-standards/zipball/8f6929b35b627fefbd865829cd8422954f73c6bd", - "reference": "8f6929b35b627fefbd865829cd8422954f73c6bd", + "url": "https://api.github.com/repos/inpsyde/php-coding-standards/zipball/bab7e00068c2b7a601e3cdce6b0bf6a0ccfe8355", + "reference": "bab7e00068c2b7a601e3cdce6b0bf6a0ccfe8355", "shasum": "" }, "require": { @@ -1663,9 +1431,9 @@ ], "support": { "issues": "https://github.com/inpsyde/php-coding-standards/issues", - "source": "https://github.com/inpsyde/php-coding-standards/tree/master" + "source": "https://github.com/inpsyde/php-coding-standards/tree/1.0.0" }, - "time": "2022-01-29T18:41:21+00:00" + "time": "2022-02-28T11:55:53+00:00" }, { "name": "johnpbloch/wordpress-core", @@ -1673,12 +1441,12 @@ "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "2e2368da8dffca20962a592fc69e327d532d3fe8" + "reference": "84e6d84e98cf31e5df02dc15493c7fedce69ad15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/2e2368da8dffca20962a592fc69e327d532d3fe8", - "reference": "2e2368da8dffca20962a592fc69e327d532d3fe8", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/84e6d84e98cf31e5df02dc15493c7fedce69ad15", + "reference": "84e6d84e98cf31e5df02dc15493c7fedce69ad15", "shasum": "" }, "require": { @@ -1713,71 +1481,7 @@ "source": "https://core.trac.wordpress.org/browser", "wiki": "https://codex.wordpress.org/" }, - "time": "2022-02-22T16:15:52+00:00" - }, - { - "name": "maxmind-db/reader", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git", - "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/febd4920bf17c1da84cef58e56a8227dfb37fbe4", - "reference": "febd4920bf17c1da84cef58e56a8227dfb37fbe4", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "conflict": { - "ext-maxminddb": "<1.6.0,>=2.0.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "2.*", - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpcov": "^3.0", - "phpunit/phpunit": "5.*", - "squizlabs/php_codesniffer": "3.*" - }, - "suggest": { - "ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", - "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", - "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups" - }, - "type": "library", - "autoload": { - "psr-4": { - "MaxMind\\Db\\": "src/MaxMind/Db" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Gregory J. Oschwald", - "email": "goschwald@maxmind.com", - "homepage": "https://www.maxmind.com/" - } - ], - "description": "MaxMind DB Reader API", - "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php", - "keywords": [ - "database", - "geoip", - "geoip2", - "geolocation", - "maxmind" - ], - "support": { - "issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues", - "source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.6.0" - }, - "time": "2019-12-19T22:59:03+00:00" + "time": "2022-02-26T08:32:07+00:00" }, { "name": "mockery/mockery", @@ -2064,108 +1768,33 @@ }, "time": "2019-03-29T20:06:56+00:00" }, - { - "name": "pelago/emogrifier", - "version": "v3.1.0", - "source": { - "type": "git", - "url": "https://github.com/MyIntervals/emogrifier.git", - "reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MyIntervals/emogrifier/zipball/f6a5c7d44612d86c3901c93f1592f5440e6b2cd8", - "reference": "f6a5c7d44612d86c3901c93f1592f5440e6b2cd8", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4", - "symfony/css-selector": "^2.8 || ^3.0 || ^4.0 || ^5.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.15.3", - "phpmd/phpmd": "^2.7.0", - "phpunit/phpunit": "^5.7.27", - "squizlabs/php_codesniffer": "^3.5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Pelago\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Oliver Klee", - "email": "github@oliverklee.de" - }, - { - "name": "Zoli Szabó", - "email": "zoli.szabo+github@gmail.com" - }, - { - "name": "John Reeve", - "email": "jreeve@pelagodesign.com" - }, - { - "name": "Jake Hotson", - "email": "jake@qzdesign.co.uk" - }, - { - "name": "Cameron Brooks" - }, - { - "name": "Jaime Prado" - } - ], - "description": "Converts CSS styles into inline style attributes in your HTML code", - "homepage": "https://www.myintervals.com/emogrifier.php", - "keywords": [ - "css", - "email", - "pre-processing" - ], - "support": { - "issues": "https://github.com/MyIntervals/emogrifier/issues", - "source": "https://github.com/MyIntervals/emogrifier" - }, - "time": "2019-12-26T19:37:31+00:00" - }, { "name": "phar-io/manifest", - "version": "1.0.3", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "reference": "36d8a21e851a9512db2b086dc5ac2c61308f0138" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/36d8a21e851a9512db2b086dc5ac2c61308f0138", + "reference": "36d8a21e851a9512db2b086dc5ac2c61308f0138", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -2199,24 +1828,30 @@ "issues": "https://github.com/phar-io/manifest/issues", "source": "https://github.com/phar-io/manifest/tree/master" }, - "time": "2018-07-08T19:23:20+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2022-02-21T19:55:33+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -2248,9 +1883,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/master" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2018-07-08T19:19:57+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -2546,40 +2181,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "819f92bba8b001d4363065928088de22f25a3a48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -2607,9 +2242,15 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0" }, - "time": "2018-10-31T16:06:48+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-26T12:20:09+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2837,53 +2478,52 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "8.5.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "e93feeab376fef7dc81cbaa48273f61df991849f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e93feeab376fef7dc81cbaa48273f61df991849f", + "reference": "e93feeab376fef7dc81cbaa48273f61df991849f", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.0", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.2", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.4", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.2", + "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -2891,7 +2531,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -2919,9 +2559,19 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5" }, - "time": "2020-01-08T08:45:45+00:00" + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-23T15:51:03+00:00" }, { "name": "psr/log", @@ -3347,23 +2997,26 @@ }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -3371,7 +3024,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3396,9 +3049,15 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0" }, - "time": "2017-04-27T15:39:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-10T06:55:38+00:00" }, { "name": "sebastian/object-enumerator", @@ -3627,6 +3286,62 @@ ], "time": "2020-11-30T07:30:19+00:00" }, + { + "name": "sebastian/type", + "version": "1.1.x-dev", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:25:11+00:00" + }, { "name": "sebastian/version", "version": "2.0.1", @@ -3790,12 +3505,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5caf5d80363b2a46d2cd1b24d08c5ab259b53487" + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5caf5d80363b2a46d2cd1b24d08c5ab259b53487", - "reference": "5caf5d80363b2a46d2cd1b24d08c5ab259b53487", + "url": "https://api.github.com/repos/symfony/console/zipball/d8111acc99876953f52fe16d4c50eb60940d49ad", + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad", "shasum": "" }, "require": { @@ -3866,7 +3581,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/5.4" + "source": "https://github.com/symfony/console/tree/v5.4.5" }, "funding": [ { @@ -3882,74 +3597,7 @@ "type": "tidelift" } ], - "time": "2022-02-09T15:52:21+00:00" - }, - { - "name": "symfony/css-selector", - "version": "5.4.x-dev", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b0a190285cd95cb019237851205b8140ef6e368e", - "reference": "b0a190285cd95cb019237851205b8140ef6e368e", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" - }, - "default-branch": true, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Converts CSS selectors to XPath expressions", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.4.3" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-02-24T12:45:35+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4052,12 +3700,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4512,21 +4160,25 @@ }, { "name": "symfony/service-contracts", - "version": "2.3.x-dev", + "version": "2.5.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "313e7dfe608b6e378c7b473a8ff410e74c1e3216" + "reference": "034c73d5dd4c05c71a27f05b3c43c0f2fcc8985a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/313e7dfe608b6e378c7b473a8ff410e74c1e3216", - "reference": "313e7dfe608b6e378c7b473a8ff410e74c1e3216", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/034c73d5dd4c05c71a27f05b3c43c0f2fcc8985a", + "reference": "034c73d5dd4c05c71a27f05b3c43c0f2fcc8985a", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.0" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -4534,7 +4186,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.3-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -4571,7 +4223,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/2.3" + "source": "https://github.com/symfony/service-contracts/tree/2.5" }, "funding": [ { @@ -4587,7 +4239,7 @@ "type": "tidelift" } ], - "time": "2021-07-13T09:34:55+00:00" + "time": "2021-11-23T10:19:22+00:00" }, { "name": "symfony/string", @@ -4623,12 +4275,12 @@ "default-branch": true, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -4732,12 +4384,12 @@ "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "3a85f49268f8db12d35cc6c991218ddeea72ed02" + "reference": "fc2c6ab4d5fa5d644d8617089f012f3bb84b8703" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/3a85f49268f8db12d35cc6c991218ddeea72ed02", - "reference": "3a85f49268f8db12d35cc6c991218ddeea72ed02", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/fc2c6ab4d5fa5d644d8617089f012f3bb84b8703", + "reference": "fc2c6ab4d5fa5d644d8617089f012f3bb84b8703", "shasum": "" }, "require": { @@ -4829,9 +4481,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.x" + "source": "https://github.com/vimeo/psalm/tree/4.22.0" }, - "time": "2022-02-23T12:45:57+00:00" + "time": "2022-02-24T20:34:05+00:00" }, { "name": "webmozart/assert", @@ -4944,222 +4596,6 @@ "abandoned": "symfony/filesystem", "time": "2021-11-08T08:17:20+00:00" }, - { - "name": "woocommerce/action-scheduler", - "version": "3.1.6", - "source": { - "type": "git", - "url": "https://github.com/woocommerce/action-scheduler.git", - "reference": "275d0ba54b1c263dfc62688de2fa9a25a373edf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/275d0ba54b1c263dfc62688de2fa9a25a373edf8", - "reference": "275d0ba54b1c263dfc62688de2fa9a25a373edf8", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "^5.6", - "woocommerce/woocommerce-sniffs": "0.0.8", - "wp-cli/wp-cli": "~1.5.1" - }, - "type": "wordpress-plugin", - "extra": { - "scripts-description": { - "test": "Run unit tests", - "phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer", - "phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-or-later" - ], - "description": "Action Scheduler for WordPress and WooCommerce", - "homepage": "https://actionscheduler.org/", - "support": { - "issues": "https://github.com/woocommerce/action-scheduler/issues", - "source": "https://github.com/woocommerce/action-scheduler/tree/master" - }, - "time": "2020-05-12T16:22:33+00:00" - }, - { - "name": "woocommerce/woocommerce", - "version": "4.9.4", - "source": { - "type": "git", - "url": "https://github.com/woocommerce/woocommerce.git", - "reference": "3ff803152015ca2da50afa9d51d78f9035f08ab9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce/zipball/3ff803152015ca2da50afa9d51d78f9035f08ab9", - "reference": "3ff803152015ca2da50afa9d51d78f9035f08ab9", - "shasum": "" - }, - "require": { - "automattic/jetpack-autoloader": "2.7.1", - "automattic/jetpack-constants": "1.5.1", - "composer/installers": "~1.7", - "maxmind-db/reader": "1.6.0", - "pelago/emogrifier": "3.1.0", - "php": ">=7.0", - "psr/container": "1.0.0", - "woocommerce/action-scheduler": "3.1.6", - "woocommerce/woocommerce-admin": "1.8.3", - "woocommerce/woocommerce-blocks": "4.0.1" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4" - }, - "type": "wordpress-plugin", - "extra": { - "installer-paths": { - "packages/{$name}": [ - "woocommerce/action-scheduler", - "woocommerce/woocommerce-blocks", - "woocommerce/woocommerce-admin" - ] - }, - "scripts-description": { - "test": "Run unit tests", - "phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer", - "phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier", - "makepot-audit": "Generate i18n/languages/woocommerce.pot file and run audit", - "makepot": "Generate i18n/languages/woocommerce.pot file" - }, - "bamarni-bin": { - "target-directory": "bin/composer" - } - }, - "autoload": { - "psr-0": { - "Automattic\\WooCommerce\\Vendor\\": "lib/packages/" - }, - "psr-4": { - "Automattic\\WooCommerce\\": "src/", - "Automattic\\WooCommerce\\Vendor\\": "lib/packages/" - }, - "classmap": [ - "includes/rest-api" - ], - "exclude-from-classmap": [ - "includes/legacy", - "includes/libraries" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-or-later" - ], - "description": "An eCommerce toolkit that helps you sell anything. Beautifully.", - "homepage": "https://woocommerce.com/", - "support": { - "issues": "https://github.com/woocommerce/woocommerce/issues", - "source": "https://github.com/woocommerce/woocommerce/tree/4.9.4" - }, - "time": "2021-09-24T00:15:19+00:00" - }, - { - "name": "woocommerce/woocommerce-admin", - "version": "1.8.3", - "source": { - "type": "git", - "url": "https://github.com/woocommerce/woocommerce-admin.git", - "reference": "534442980c34369f711efdb8e85fdcb1363be712" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/534442980c34369f711efdb8e85fdcb1363be712", - "reference": "534442980c34369f711efdb8e85fdcb1363be712", - "shasum": "" - }, - "require": { - "automattic/jetpack-autoloader": "^2.2.0", - "composer/installers": "^1.9.0", - "php": ">=5.6|>=7.0" - }, - "require-dev": { - "phpunit/phpunit": "7.5.20", - "suin/phpcs-psr4-sniff": "^2.2", - "woocommerce/woocommerce-sniffs": "0.1.0" - }, - "type": "wordpress-plugin", - "extra": { - "scripts-description": { - "test": "Run unit tests", - "phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer", - "phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier" - } - }, - "autoload": { - "psr-4": { - "Automattic\\WooCommerce\\Admin\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-or-later" - ], - "description": "A modern, javascript-driven WooCommerce Admin experience.", - "homepage": "https://github.com/woocommerce/woocommerce-admin", - "support": { - "issues": "https://github.com/woocommerce/woocommerce-admin/issues", - "source": "https://github.com/woocommerce/woocommerce-admin/tree/v1.8.3" - }, - "time": "2021-01-06T00:00:42+00:00" - }, - { - "name": "woocommerce/woocommerce-blocks", - "version": "v4.0.1", - "source": { - "type": "git", - "url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git", - "reference": "d7232c7c9fb7294ddbdcc1429752ffcbaf9dc148" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/d7232c7c9fb7294ddbdcc1429752ffcbaf9dc148", - "reference": "d7232c7c9fb7294ddbdcc1429752ffcbaf9dc148", - "shasum": "" - }, - "require": { - "automattic/jetpack-autoloader": "^2.0.0", - "composer/installers": "^1.7.0" - }, - "require-dev": { - "phpunit/phpunit": "6.5.14", - "woocommerce/woocommerce-sniffs": "0.1.0" - }, - "type": "wordpress-plugin", - "extra": { - "scripts-description": { - "phpcs": "Analyze code against the WordPress coding standards with PHP_CodeSniffer", - "phpcbf": "Fix coding standards warnings/errors automatically with PHP Code Beautifier" - } - }, - "autoload": { - "psr-4": { - "Automattic\\WooCommerce\\Blocks\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-or-later" - ], - "description": "WooCommerce blocks for the Gutenberg editor.", - "homepage": "https://woocommerce.com/", - "keywords": [ - "blocks", - "gutenberg", - "woocommerce" - ], - "support": { - "issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues", - "source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v4.0.1" - }, - "time": "2021-07-15T15:57:26+00:00" - }, { "name": "wp-coding-standards/wpcs", "version": "2.3.0", @@ -5220,7 +4656,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.2", + "php": ">=7.2", "ext-intl": "*", "ext-json": "*" }, From b8841a220a8b5d84f7285044054cd8bd8fc8e87c Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Tue, 1 Mar 2022 08:12:27 +0100 Subject: [PATCH 24/24] MOL-699 Release 7.0.3-beta1 update version number --- mollie-payments-for-woocommerce.php | 2 +- src/Shared/SharedModule.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mollie-payments-for-woocommerce.php b/mollie-payments-for-woocommerce.php index ce4d3bc09..bc8b9d87a 100644 --- a/mollie-payments-for-woocommerce.php +++ b/mollie-payments-for-woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: Mollie Payments for WooCommerce * Plugin URI: https://www.mollie.com * Description: Accept payments in WooCommerce with the official Mollie plugin - * Version: 7.0.1 + * Version: 7.0.3-beta1 * Author: Mollie * Author URI: https://www.mollie.com * Requires at least: 5.0 diff --git a/src/Shared/SharedModule.php b/src/Shared/SharedModule.php index db0fcd281..e83996876 100644 --- a/src/Shared/SharedModule.php +++ b/src/Shared/SharedModule.php @@ -29,7 +29,7 @@ public function services(): array }, 'shared.plugin_version' => static function (): string { //Get plugin version - return '7.0.1'; + return '7.0.3-beta1'; }, 'shared.plugin_title' => static function (): string { //Get plugin version