Skip to content

Commit 4324275

Browse files
committed
Merge branch 'refs/heads/develop'
2 parents 2756123 + a02dfdc commit 4324275

28 files changed

+704
-94
lines changed

inc/utils.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,13 @@ function transformPhoneToNLFormat($phone)
236236
}
237237
return $phone;
238238
}
239+
240+
function isMollieBirthValid($billing_birthdate)
241+
{
242+
$today = new DateTime();
243+
$birthdate = DateTime::createFromFormat('Y-m-d', $billing_birthdate);
244+
if ($birthdate >= $today) {
245+
return false;
246+
}
247+
return true;
248+
}

inc/woocommerce.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ function is_order_received_page()
3636
*/
3737
function untrailingslashit($string)
3838
{
39+
if ($string === null) {
40+
return '';
41+
}
3942
return rtrim($string, '/');
4043
}
4144
}

mollie-payments-for-woocommerce.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
* Plugin Name: Mollie Payments for WooCommerce
44
* Plugin URI: https://www.mollie.com
55
* Description: Accept payments in WooCommerce with the official Mollie plugin
6-
* Version: 7.6.0
6+
* Version: 7.7.0
77
* Author: Mollie
88
* Author URI: https://www.mollie.com
99
* Requires at least: 5.0
10-
* Tested up to: 6.5
10+
* Tested up to: 6.6
1111
* Text Domain: mollie-payments-for-woocommerce
1212
* Domain Path: /languages
1313
* License: GPLv2 or later
1414
* WC requires at least: 3.9
15-
* WC tested up to: 9.0
15+
* WC tested up to: 9.1
1616
* Requires PHP: 7.2
1717
* Requires Plugins: woocommerce
1818
*/

public/images/payconiq.svg

Lines changed: 1 addition & 0 deletions
Loading

public/images/riverty.svg

Lines changed: 4 additions & 0 deletions
Loading

readme.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Contributors: daanvm, danielhuesken, davdebcom, dinamiko, syde, l.vangunst, ndijkstra, robin-mollie, wido, carmen222, inpsyde-maticluznar
33
Tags: mollie, payments, payment gateway, woocommerce, credit card, apple pay, ideal, bancontact, klarna, sofort, giropay, woocommerce subscriptions
44
Requires at least: 3.8
5-
Tested up to: 6.5
6-
Stable tag: 7.5.5
5+
Tested up to: 6.6
6+
Stable tag: 7.7.0
77
Requires PHP: 7.2
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -221,6 +221,20 @@ Automatic updates should work like a charm; as always though, ensure you backup
221221

222222
== Changelog ==
223223

224+
= 7.7.0 - 12-08-2024 =
225+
226+
* Added - Payconiq payment method
227+
* Added - Riverty payment method
228+
* Fix - Declaring compatibility in WP Editor
229+
* Security - Enhanced object reference security
230+
231+
= 7.6.0 - 10-07-2024 =
232+
233+
* Added - Trustly payment method
234+
* Deprecated - Giropay payment method (iropay Depreciation FAQ](https://help.mollie.com/hc/en-gb/articles/19745480480786-Giropay-Depreciation-FAQ))
235+
* Fixed - Mollie hooks into unrelated orders
236+
* Fixed - Notices and type errors after 7.5.5 update
237+
* Fixed - Rounding issues with products including tax
224238
= 7.5.5 - 18-06-2024 =
225239

226240
* Feature Flag - Enable Bancomat Pay & Alma feature flag by default (official launch 2024-07-01)

resources/js/blocks/molliePaymentMethod.js

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,17 @@ const MollieComponent = (props) => {
197197
}, [activePaymentMethod, onCheckoutValidation, billing.billingData, shippingData.shippingAddress, item, phoneString, inputBirthdate, inputPhone]);
198198

199199
onSubmitLocal = onSubmit
200-
const updateIssuer = ( changeEvent ) => {
201-
selectIssuer( changeEvent.target.value )
202-
};
203-
const updateCompany = ( changeEvent ) => {
204-
selectCompany( changeEvent.target.value )
205-
};
206-
const updatePhone = ( changeEvent ) => {
207-
selectPhone( changeEvent.target.value )
208-
}
209-
const updateBirthdate = ( changeEvent ) => {
210-
selectBirthdate( changeEvent.target.value )
200+
const updateIssuer = (e) => selectIssuer(e.target.value);
201+
const updateCompany = (e) => selectCompany(e.target.value);
202+
const updatePhone = (e) => selectPhone(e.target.value);
203+
const updateBirthdate = (e) => selectBirthdate( e.target.value );
204+
205+
function fieldMarkup(id, fieldType, label, action, value, placeholder = null) {
206+
const className = "wc-block-components-text-input wc-block-components-address-form__" + id;
207+
return <div class="custom-input">
208+
<label htmlFor={id} dangerouslySetInnerHTML={{__html: label}}></label>
209+
<input type={fieldType} name={id} id={id} value={value} onChange={action} placeholder={placeholder}></input>
210+
</div>
211211
}
212212

213213
if (item.issuers && item.name !== "mollie_wc_gateway_creditcard"){
@@ -218,38 +218,59 @@ const MollieComponent = (props) => {
218218
return <div dangerouslySetInnerHTML={ {__html: item.content} }></div>;
219219
}
220220

221-
function fieldMarkup(id, fieldType, label, action, value) {
222-
const className = "wc-block-components-text-input wc-block-components-address-form__" + id;
223-
return <div class="custom-input">
224-
<label htmlFor={id} dangerouslySetInnerHTML={{__html: label}}></label>
225-
<input type={fieldType} name={id} id={id} value={value} onChange={action}></input>
226-
</div>
227-
}
228-
229221
if (item.name === "mollie_wc_gateway_billie") {
230222
if (isCompanyFieldVisible) {
231223
return;
232224
}
233225
const companyField = item.companyPlaceholder ? item.companyPlaceholder : "Company name";
234-
return fieldMarkup("billing-company","text", companyField, updateCompany, inputCompany);
226+
return (
227+
<>
228+
<div><p>{item.content}</p></div>
229+
{fieldMarkup("billing-company","text", companyField, updateCompany, inputCompany)}
230+
</>
231+
);
235232
}
236233

237-
if (item.name === "mollie_wc_gateway_in3"){
238-
let fields = [];
239-
const birthdateField = item.birthdatePlaceholder ? item.birthdatePlaceholder : "Birthdate";
240-
fields.push(fieldMarkup("billing-birthdate", "date", birthdateField, updateBirthdate, inputBirthdate));
241-
if (isPhoneFieldVisible === false) {
242-
const phoneField = item.phonePlaceholder ? item.phonePlaceholder : "Phone";
243-
fields.push(fieldMarkup("billing-phone-in3", "tel", phoneField, updatePhone, inputPhone));
244-
}
234+
useEffect(() => {
235+
const countryCodes = {
236+
BE: '+32xxxxxxxxx',
237+
NL: '+316xxxxxxxx',
238+
DE: '+49xxxxxxxxx',
239+
AT: '+43xxxxxxxxx',
240+
};
241+
const country = billing.billingData.country;
242+
item.phonePlaceholder = countryCodes[country] || countryCodes['NL'];
243+
}, [billing.billingData.country]);
244+
245+
if (item.name === "mollie_wc_gateway_in3") {
246+
const birthdateField = item.birthdatePlaceholder || "Birthdate";
247+
const phoneField = item.phonePlaceholder || "+316xxxxxxxx";
248+
const phoneLabel = item.phoneLabel || "Phone";
249+
return (
250+
<>
251+
<div><p>{item.content}</p></div>
252+
{fieldMarkup("billing-birthdate", "date", birthdateField, updateBirthdate, inputBirthdate)}
253+
{!isPhoneFieldVisible && fieldMarkup("billing-phone-in3", "tel", phoneLabel, updatePhone, inputPhone, phoneField)}
254+
</>
255+
);
256+
}
245257

246-
return <>{fields}</>;
258+
if (item.name === "mollie_wc_gateway_riverty") {
259+
const birthdateField = item.birthdatePlaceholder || "Birthdate";
260+
const phoneField = item.phonePlaceholder || "+316xxxxxxxx";
261+
const phoneLabel = item.phoneLabel || "Phone";
262+
return (
263+
<>
264+
<div><p>{item.content}</p></div>
265+
{fieldMarkup("billing-birthdate", "date", birthdateField, updateBirthdate, inputBirthdate)}
266+
{!isPhoneFieldVisible && fieldMarkup("billing-phone-riverty", "tel", phoneLabel, updatePhone, inputPhone, phoneField)}
267+
</>
268+
);
247269
}
248270

249271
return <div><p>{item.content}</p></div>
250272
}
251273

252-
253274
const molliePaymentMethod = (useEffect, ajaxUrl, filters, gatewayData, availableGateways, item, jQuery, requiredFields, isCompanyFieldVisible, isPhoneFieldVisible) =>{
254275
let billingCountry = filters.billingCountry
255276
let cartTotal = filters.cartTotal

resources/js/mollieBlockIndex.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ import molliePaymentMethod from './blocks/molliePaymentMethod'
88
window.onload = (event) => {
99
const { registerPaymentMethod } = wc.wcBlocksRegistry;
1010
const { checkoutData, defaultFields } = wc.wcSettings.allSettings;
11-
const { billing_address, shipping_address } = checkoutData;
11+
let billing_address, shipping_address;
12+
13+
if (checkoutData) {
14+
({ billing_address, shipping_address } = checkoutData);
15+
} else {
16+
billing_address = {};
17+
shipping_address = {};
18+
}
1219
const { ajaxUrl, filters, gatewayData, availableGateways } = mollieBlockData.gatewayData;
1320
const {useEffect} = wp.element;
1421
const isAppleSession = typeof window.ApplePaySession === "function"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(
2+
function ({jQuery}) {
3+
jQuery(function ($) {
4+
$('body').on('change', '#billing_country', function () {
5+
if ($('input[name="payment_method"]:checked').val() === 'mollie_wc_gateway_riverty') {
6+
$('body').trigger('update_checkout');
7+
}
8+
});
9+
});
10+
})(window)
11+
12+
13+

src/Assets/AssetsModule.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ protected function registerFrontendScripts(string $pluginUrl, string $pluginPath
277277
(string) filemtime($this->getPluginPath($pluginPath, '/public/js/gatewaySurcharge.min.js')),
278278
true
279279
);
280+
wp_register_script(
281+
'mollie-riverty-classic-handles',
282+
$this->getPluginUrl($pluginUrl, '/public/js/rivertyCountryPlaceholder.min.js'),
283+
['jquery'],
284+
(string) filemtime($this->getPluginPath($pluginPath, '/public/js/rivertyCountryPlaceholder.min.js')),
285+
true
286+
);
280287
}
281288

282289
public function registerBlockScripts(string $pluginUrl, string $pluginPath): void
@@ -310,11 +317,11 @@ public function enqueueFrontendScripts($container)
310317
return;
311318
}
312319
wp_enqueue_style('mollie-gateway-icons');
313-
$isBillieEnabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_billie_settings', 'enabled');
314320
$allMethodsEnabledAtMollie = $container->get('gateway.paymentMethodsEnabledAtMollie');
315-
$isBillieEnabledAtMollie = in_array('billie', $allMethodsEnabledAtMollie, true);
316-
if ($isBillieEnabled && $isBillieEnabledAtMollie) {
317-
wp_enqueue_script('mollie-billie-classic-handles');
321+
$isRivertyEnabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_riverty_settings', 'enabled');
322+
$isRivertyEnabledAtMollie = in_array('riverty', $allMethodsEnabledAtMollie, true);
323+
if ($isRivertyEnabled && $isRivertyEnabledAtMollie) {
324+
wp_enqueue_script('mollie-riverty-classic-handles');
318325
}
319326

320327
$applePayGatewayEnabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_applepay_settings', 'enabled');

0 commit comments

Comments
 (0)