Skip to content

Commit

Permalink
Merge pull request #914 from mollie/release/7.5.5
Browse files Browse the repository at this point in the history
Release/7.5.5-beta
  • Loading branch information
mmaymo authored Jun 12, 2024
2 parents 7111a67 + 215b868 commit 2359247
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 20 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-beta.1
* 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
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 2359247

Please sign in to comment.