Skip to content

Commit

Permalink
Merge branch 'refs/heads/release/7.5.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaymo committed Jun 18, 2024
2 parents ecb0f9d + 37a494f commit d5d6190
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 90 deletions.
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.5.4
* Version: 7.5.5
* Author: Mollie
* Author URI: https://www.mollie.com
* Requires at least: 5.0
Expand Down
2 changes: 1 addition & 1 deletion resources/js/blocks/molliePaymentMethod.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const MollieComponent = (props) => {
return <>{fields}</>;
}

return <div><p></p></div>
return <div><p>{item.content}</p></div>
}


Expand Down
2 changes: 1 addition & 1 deletion src/Activation/ActivationModule.php

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/Gateway/GatewayModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,19 @@ public function services(): array
$availablePaymentMethods = $container->get('gateway.listAllMethodsAvailable');
$klarnaOneFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.klarna_one_enabled', true);
if (!$klarnaOneFlag) {
return array_filter($availablePaymentMethods, static function ($method) {
$availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::KLARNA;
});
}
$bancomatpayFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.bancomatpay_enabled', true);
if (!$bancomatpayFlag) {
return array_filter($availablePaymentMethods, static function ($method) {
$availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::BANCOMATPAY;
});
}
$almaFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.alma_enabled', false);
$almaFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.alma_enabled', true);
if (!$almaFlag) {
return array_filter($availablePaymentMethods, static function ($method) {
$availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) {
return $method['id'] !== Constants::ALMA;
});
}
Expand Down Expand Up @@ -808,8 +808,8 @@ public function addPhoneWhenRest($arrayContext)
{
$context = $arrayContext;
$phoneMandatoryGateways = ['mollie_wc_gateway_in3'];
$paymentMethod = $context->payment_data['payment_method'];
if (in_array($paymentMethod, $phoneMandatoryGateways)) {
$paymentMethod = $context->payment_data['payment_method'] ?? null;
if ($paymentMethod && in_array($paymentMethod, $phoneMandatoryGateways)) {
$billingPhone = $context->order->get_billing_phone();
if (!empty($billingPhone) && $this->isPhoneValid($billingPhone)) {
return;
Expand All @@ -819,7 +819,7 @@ public function addPhoneWhenRest($arrayContext)
$context->order->save();
return;
}
$billingPhone = $context->payment_data['billing_phone'];
$billingPhone = $context->payment_data['billing_phone'] ?? null;
if ($billingPhone && $this->isPhoneValid($billingPhone)) {
$context->order->set_billing_phone($billingPhone);
$context->order->save();
Expand All @@ -831,9 +831,9 @@ public function addBirthdateWhenRest($arrayContext)
{
$context = $arrayContext;
$birthMandatoryGateways = ['mollie_wc_gateway_in3'];
$paymentMethod = $context->payment_data['payment_method'];
if (in_array($paymentMethod, $birthMandatoryGateways)) {
$billingBirthdate = $context->payment_data['billing_birthdate'];
$paymentMethod = $context->payment_data['payment_method'] ?? null;
if ($paymentMethod && in_array($paymentMethod, $birthMandatoryGateways)) {
$billingBirthdate = $context->payment_data['billing_birthdate'] ?? null;
if ($billingBirthdate && $this->isBirthValid($billingBirthdate)) {
$context->order->update_meta_data('billing_birthdate', $billingBirthdate);
$context->order->save();
Expand Down
9 changes: 5 additions & 4 deletions src/Gateway/Surcharge.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function buildDescriptionWithSurcharge($description, PaymentMethodI $paym
*/
public function buildDescriptionWithSurchargeForBlock(PaymentMethodI $paymentMethod)
{
$defaultDescription = $paymentMethod->getProperty('description') ?: '';
$defaultDescription = $paymentMethod->getProperty('description') ?: ($paymentMethod->getProperty('defaultDescription') ?: '');
$surchargeType = $paymentMethod->getProperty('payment_surcharge');

if (
Expand All @@ -76,9 +76,10 @@ public function buildDescriptionWithSurchargeForBlock(PaymentMethodI $paymentMet
return $defaultDescription;
}
$feeText = $this->feeTextByType($surchargeType, $paymentMethod);
$feeText = is_string($feeText) ? html_entity_decode($feeText) : false;
$feeText = is_string($feeText) ? $defaultDescription . ' ' . html_entity_decode($feeText) : false;
$defaultFeeText = $defaultDescription . ' ' . __('A surchage fee might apply');

return $feeText ?: __('A surchage fee might apply');
return $feeText ?: $defaultFeeText;
}

/**
Expand Down Expand Up @@ -336,7 +337,7 @@ protected function feeTextByType($surchargeType, PaymentMethodI $paymentMethod)
protected function maybeAddTaxString(string $feeText): string
{
if (wc_tax_enabled()) {
$feeText .= __(' (incl. VAT)', 'mollie-payments-for-woocommerce');
$feeText .= __(' (excl. VAT)', 'mollie-payments-for-woocommerce');
}
return $feeText;
}
Expand Down
39 changes: 3 additions & 36 deletions src/PaymentMethods/Ideal.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function getConfig(): array
'id' => 'ideal',
'defaultTitle' => __('iDEAL', 'mollie-payments-for-woocommerce'),
'settingsDescription' => '',
'defaultDescription' => __('Select your bank', 'mollie-payments-for-woocommerce'),
'paymentFields' => true,
'defaultDescription' => '',
'paymentFields' => false,
'instructions' => true,
'supports' => [
'products',
Expand All @@ -29,39 +29,6 @@ public function getConfig(): array

public function getFormFields($generalFormFields): array
{
$searchKey = 'advanced';
$keys = array_keys($generalFormFields);
$index = array_search($searchKey, $keys);
$before = array_slice($generalFormFields, 0, $index + 1, true);
$after = array_slice($generalFormFields, $index + 1, null, true);
$paymentMethodFormFieds = [
'issuers_dropdown_shown' => [
'title' => __('Show iDEAL banks dropdown', 'mollie-payments-for-woocommerce'),
'type' => 'checkbox',
'description' => sprintf(
__(
'If you disable this, a dropdown with various iDEAL banks will not be shown in the WooCommerce checkout, so users will select a iDEAL bank on the Mollie payment page after checkout.',
'mollie-payments-for-woocommerce'
),
$this->getConfig()['defaultTitle']
),
'default' => self::DEFAULT_ISSUERS_DROPDOWN,
],
'issuers_empty_option' => [
'title' => __('Issuers empty option', 'mollie-payments-for-woocommerce'),
'type' => 'text',
'description' => sprintf(
__(
"This text will be displayed as the first option in the iDEAL issuers drop down, if nothing is entered, 'Select your bank' will be shown. Only if the above 'Show iDEAL banks dropdown' is enabled.",
'mollie-payments-for-woocommerce'
),
$this->getConfig()['defaultTitle']
),
'default' => __('Select your bank', 'mollie-payments-for-woocommerce'),
],
];
$before = array_merge($before, $paymentMethodFormFieds);
$formFields = array_merge($before, $after);
return $formFields;
return $generalFormFields;
}
}
34 changes: 0 additions & 34 deletions src/PaymentMethods/PaymentFieldsStrategies/IdealFieldsStrategy.php

This file was deleted.

12 changes: 9 additions & 3 deletions src/Shared/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,20 @@ public function getMethodIssuers($apiKey, $testMode = false, $methodId = null)
public function getMethodWithIssuersById($methodId, $apiKey)
{
$method = $this->getCachedMethodById($methodId);
if ($method) {
if ($method === false) {
$method = [];
}
if (!empty($method['issuers'])) {
return $method;
}
if (!$apiKey) {
return false;
}
return $this->api_helper->getApiClient($apiKey)->methods->get(sprintf('%s', $methodId), [ "include" => "issuers" ]);
$methodWithIssuers = $this->api_helper->getApiClient($apiKey)->methods->get(sprintf('%s', $methodId), [ "include" => "issuers" ]);
if (!empty($methodWithIssuers->issuers)) {
$method['issuers'] = $methodWithIssuers->issuers;
}
return $method;
}

/**
Expand Down Expand Up @@ -695,7 +702,6 @@ public function getAllAvailablePaymentMethods($useCache = true)
$locale = $this->getPaymentLocale();
$filters_key = [];
$filters_key['locale'] = $locale;
$filters_key['include'] = 'issuers';
$transient_id = $this->getTransientId(md5(http_build_query($filters_key)));
try {
if ($useCache) {
Expand Down
12 changes: 12 additions & 0 deletions src/Shared/SharedDataDictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ class SharedDataDictionary
'mollie-plugin-version',
'mollie-new-install',
'mollie_wc_is_phone_required_flag',
'_transient_mollie-wc-ideal_issuers_live',
'_transient_mollie-wc-ideal_issuers_test',
'_transient_timeout_mollie-wc-ideal_issuers_live',
'_transient_timeout_mollie-wc-ideal_issuers_test',
'_transient_timeout_mollie-wc-kbc_issuers_live',
'_transient_timeout_mollie-wc-kbc_issuers_test',
'_transient_mollie-wc-kbc_issuers_live',
'_transient_mollie-wc-kbc_issuers_test',
'_transient_timeout_mollie-wc-giftcard_issuers_test',
'_transient_mollie-wc-giftcard_issuers_test',
'_transient_timeout_mollie-wc-giftcard_issuers_live',
'_transient_mollie-wc-giftcard_issuers_live',
];
public const DB_VERSION_PARAM_NAME = 'mollie-db-version';
public const PLUGIN_VERSION_PARAM_NAME = 'mollie-plugin-version';
Expand Down

0 comments on commit d5d6190

Please sign in to comment.