Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Release/7.5.0 #877

Merged
merged 40 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0aba342
Implement In3 fields using PHP
inpsyde-maticluznar Aug 31, 2023
4b00f5b
Esc output.
inpsyde-maticluznar Aug 31, 2023
c68b40d
Add transaction ID to the authorized order
inpsyde-maticluznar Nov 2, 2023
b323b67
Code style
inpsyde-maticluznar Nov 2, 2023
93896bd
Set automatic capture when subscription product is in the cart
inpsyde-maticluznar Nov 7, 2023
c27045f
Add after no payment action hook.
inpsyde-maticluznar Nov 16, 2023
5bcf8f6
Fix capture payment badge, when captured from Mollie dasboard
inpsyde-maticluznar Nov 16, 2023
dba1e1b
Merge branch 'fix/PIWOO-368' into fix/PIWOO-361
inpsyde-maticluznar Nov 16, 2023
001dee4
Add HPOS filters for order colums
inpsyde-maticluznar Nov 17, 2023
6f58195
Add check in case is a payment not order
mmaymo Nov 21, 2023
141374e
Code style
inpsyde-maticluznar Nov 22, 2023
8348ba1
Cancel payment if cancel triggered from Mollie dashboard
inpsyde-maticluznar Nov 22, 2023
ac6bf18
Fix block checkout php error for in3 fields
inpsyde-maticluznar Nov 23, 2023
606a579
Add Twint method
mmaymo Dec 18, 2023
7f0e332
Use methods/all to retrieve active
mmaymo Dec 18, 2023
6b23cbe
Fix CS and tests
mmaymo Dec 18, 2023
6d69990
Send only issuers on allAvailable call
mmaymo Dec 19, 2023
5070249
Refactor all to camel case
mmaymo Dec 19, 2023
6677c49
Change strings void into cancel
inpsyde-maticluznar Dec 20, 2023
4df6fbf
Merge remote-tracking branch 'origin/develop' into fix/PIWOO-386
inpsyde-maticluznar Jan 8, 2024
fde6a3a
Merge remote-tracking branch 'origin/develop' into fix/PIWOO-284
inpsyde-maticluznar Jan 9, 2024
158b145
Add birthdate check on the pay for order page for in3 payment method
inpsyde-maticluznar Jan 11, 2024
9ff37e4
Prevent birth field check for other payment methods
inpsyde-maticluznar Jan 11, 2024
9b74dc7
Unify error messages for required fields
inpsyde-maticluznar Jan 11, 2024
3898ddf
Merge branch 'develop' into fix/PIWOO-376
mmaymo Jan 11, 2024
2c54aaf
Fix CS
mmaymo Jan 11, 2024
00ca2e2
Merge branch 'feature/PIWOO-350-twint-method' into feature/PIWOO-384-…
mmaymo Jan 18, 2024
4799db3
Add Blik payment method
mmaymo Jan 18, 2024
5314834
Merge remote-tracking branch 'origin/fix/PIWOO-361' into release/7.4.…
mmaymo Jan 18, 2024
d33d2d7
Merge remote-tracking branch 'origin/fix/PIWOO-362' into release/7.4.…
mmaymo Jan 18, 2024
1b604ea
Merge remote-tracking branch 'origin/fix/PIWOO-376' into release/7.4.…
mmaymo Jan 18, 2024
cb321ce
Merge remote-tracking branch 'origin/feature/PIWOO-384-blik' into rel…
mmaymo Jan 18, 2024
1839e2b
Fix CS
mmaymo Jan 18, 2024
1b3d30f
Merge remote-tracking branch 'origin/fix/PIWOO-367' into release/7.4.…
mmaymo Jan 25, 2024
8acc682
Enable merchant capture by default PIWOO-369
mmaymo Jan 25, 2024
f5c8c04
Enable klarna one by default PIWOO-370
mmaymo Jan 25, 2024
a0d391a
Change version number
mmaymo Jan 25, 2024
043bb67
Merge remote-tracking branch 'origin/fix/PIWOO-386' into release/7.4.…
mmaymo Jan 29, 2024
14ce783
Update version number
mmaymo Jan 29, 2024
8bf8da1
Merge pull request #876 from mollie/release/7.4.2-beta-1-flags
mmaymo Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mollie-payments-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.1
* Version: 7.5.0-beta1
* Author: Mollie
* Author URI: https://www.mollie.com
* Requires at least: 5.0
Expand Down
1 change: 1 addition & 0 deletions public/images/blik.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions public/images/twint.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 0 additions & 44 deletions resources/js/mollieIn3.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/Assets/AssetsModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,6 @@ protected function registerFrontendScripts(string $pluginUrl, string $pluginPath
(string) filemtime($this->getPluginPath($pluginPath, '/public/js/mollieBillie.min.js')),
true
);
wp_register_script(
'mollie-in3-classic-handles',
$this->getPluginUrl($pluginUrl, '/public/js/mollieIn3.min.js'),
['underscore', 'jquery'],
(string) filemtime($this->getPluginPath($pluginPath, '/public/js/mollieIn3.min.js')),
true
);
}

public function registerBlockScripts(string $pluginUrl, string $pluginPath): void
Expand Down Expand Up @@ -322,11 +315,6 @@ public function enqueueFrontendScripts($container)
if ($isBillieEnabled && $isBillieEnabledAtMollie) {
wp_enqueue_script('mollie-billie-classic-handles');
}
$isIn3Enabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_in3_settings', 'enabled');
$isIn3EnabledAtMollie = in_array('in3', $allMethodsEnabledAtMollie, true);
if ($isIn3Enabled && $isIn3EnabledAtMollie) {
wp_enqueue_script('mollie-in3-classic-handles');
}

$applePayGatewayEnabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_applepay_settings', 'enabled');
$isAppleEnabledAtMollie = in_array('applepay', $allMethodsEnabledAtMollie, true);
Expand Down
74 changes: 46 additions & 28 deletions src/Gateway/GatewayModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Mollie\WooCommerce\Gateway;

use Automattic\WooCommerce\Admin\Overrides\Order;
use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
use Mollie\WooCommerce\Vendor\Inpsyde\Modularity\Module\ExecutableModule;
use Mollie\WooCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
Expand Down Expand Up @@ -58,6 +59,9 @@ class GatewayModule implements ServiceModule, ExecutableModule
*/
protected $pluginId;

const FIELD_IN3_BIRTHDATE = 'billing_birthdate';
const GATEWAY_NAME_IN3 = "mollie_wc_gateway_in3";

public function services(): array
{
return [
Expand Down Expand Up @@ -101,7 +105,7 @@ public function services(): array
},
'gateway.getKlarnaPaymentMethodsAfterFeatureFlag' => static function (ContainerInterface $container): array {
$availablePaymentMethods = $container->get('gateway.listAllMethodsAvailable');
$klarnaOneFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.klarna_one_enabled', getenv('MOL_KLARNA_ENABLED') === '1');
$klarnaOneFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.klarna_one_enabled', true);
if (!$klarnaOneFlag) {
return array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::KLARNA;
Expand Down Expand Up @@ -255,6 +259,11 @@ static function () {
11,
2
);
add_action(
'woocommerce_before_pay_action',
[$this, 'in3FieldsMandatoryPayForOrder'],
11
);
}
// Set order to paid and processed when eventually completed without Mollie
add_action('woocommerce_payment_complete', [$this, 'setOrderPaidByOtherGateway'], 10, 1);
Expand Down Expand Up @@ -614,18 +623,44 @@ public function BillieFieldsMandatory($fields, $errors)
{
$gatewayName = "mollie_wc_gateway_billie";
$field = 'billing_company';
$paymentMethodName = 'Billie';
return $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $field, $errors, $paymentMethodName);
$companyLabel = __('Company', 'mollie-payments-for-woocommerce');
return $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $field, $companyLabel, $errors);
}

public function in3FieldsMandatory($fields, $errors)
{
$gatewayName = "mollie_wc_gateway_in3";
$phoneField = 'billing_phone';
$birthdateField = 'billing_birthdate';
$paymentMethodName = 'in3';
$fields = $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $phoneField, $errors, $paymentMethodName);
return $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $birthdateField, $errors, $paymentMethodName);
$birthdateField = self::FIELD_IN3_BIRTHDATE;
$phoneLabel = __('Phone', 'mollie-payments-for-woocommerce');
$birthDateLabel = __('Birthdate', 'mollie-payments-for-woocommerce');
$fields = $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $phoneField, $phoneLabel, $errors);
return $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $birthdateField, $birthDateLabel, $errors);
}

/**
* @param Order $order
*/
public function in3FieldsMandatoryPayForOrder(Order $order)
{
$paymentMethod = filter_input(INPUT_POST, 'payment_method', FILTER_SANITIZE_SPECIAL_CHARS) ?? false;

if ($paymentMethod !== self::GATEWAY_NAME_IN3) {
return;
}

$birthdateValue = filter_input(INPUT_POST, self::FIELD_IN3_BIRTHDATE, FILTER_SANITIZE_SPECIAL_CHARS) ?? false;
$birthDateLabel = __('Birthdate', 'mollie-payments-for-woocommerce');

if (!$birthdateValue) {
wc_add_notice(
sprintf(
__('%s is a required field.', 'woocommerce'),
"<strong>$birthDateLabel</strong>"
),
'error'
);
}
}

/**
Expand Down Expand Up @@ -664,10 +699,9 @@ public function buildPaymentMethod(
* @param string $gatewayName
* @param string $field
* @param $errors
* @param string $paymentMethodName
* @return mixed
*/
public function addPaymentMethodMandatoryFields($fields, string $gatewayName, string $field, $errors, string $paymentMethodName)
public function addPaymentMethodMandatoryFields($fields, string $gatewayName, string $field, string $fieldLabel, $errors)
{
if ($fields['payment_method'] !== $gatewayName) {
return $fields;
Expand All @@ -680,29 +714,13 @@ public function addPaymentMethodMandatoryFields($fields, string $gatewayName, st
$errors->add(
'validation',
sprintf(
__(
'Error processing %1$s payment, the %2$s field is required.',
'mollie-payments-for-woocommerce'
),
$paymentMethodName,
$field
__('%s is a required field.', 'woocommerce'),
"<strong>$fieldLabel</strong>"
)
);
}
}
if ($fields[$field] === '') {
$errors->add(
'validation',
sprintf(
__(
'Please enter your %1$s, this is required for %2$s payments',
'mollie-payments-for-woocommerce'
),
$field,
$paymentMethodName
)
);
}

return $fields;
}
}
2 changes: 1 addition & 1 deletion src/MerchantCapture/Capture/Action/VoidPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __invoke()
$this->logger->error($exception->getMessage());
$this->order->add_order_note(
__(
'Payment Void Failed. We encountered an issue while canceling the pre-authorized payment.',
'Payment cancelation failed. We encountered an issue while canceling the pre-authorized payment.',
'mollie-payments-for-woocommerce'
)
);
Expand Down
5 changes: 4 additions & 1 deletion src/MerchantCapture/Capture/Type/ManualCapture.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public function enableOrderCaptureButton(array $actions, \WC_Order $order): arra

public function sendManualCaptureMode(array $paymentData): array
{
if ($this->container->get('merchant.manual_capture.enabled')) {
if (
$this->container->get('merchant.manual_capture.enabled') &&
$this->container->get('merchant.manual_capture.cart_can_be_captured')
) {
$paymentData['captureMode'] = 'manual';
}
return $paymentData;
Expand Down
9 changes: 9 additions & 0 deletions src/MerchantCapture/Capture/Type/StateChangeCapture.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ class StateChangeCapture
public function __construct(ContainerInterface $container)
{
$this->container = $container;
$pluginId = $container->get('shared.plugin_id');

add_action('woocommerce_order_status_changed', [$this, "orderStatusChange"], 10, 3);

/** When the webhook process is activated we don't need automatic status change. Status change is handled
* by the webhook logic.
*/
add_action($pluginId . '_before_webhook_payment_action', function () {
remove_action('woocommerce_order_status_changed', [$this, "orderStatusChange"]);
});
}

public function orderStatusChange(int $orderId, string $oldStatus, string $newStatus)
Expand Down
Loading
Loading