From d141e9a63d0d3042195367dfe2d8a1818723622d Mon Sep 17 00:00:00 2001 From: Ivana Nestorovic Date: Thu, 22 May 2025 17:51:18 +0200 Subject: [PATCH 1/2] Implement observer for a company type on invoice B2B payment method ISSUE:MAIN-2293 --- .../method-renderer/paylater_invoice_b2b.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/view/frontend/web/js/view/payment/method-renderer/paylater_invoice_b2b.js b/view/frontend/web/js/view/payment/method-renderer/paylater_invoice_b2b.js index ceebffd..3013089 100644 --- a/view/frontend/web/js/view/payment/method-renderer/paylater_invoice_b2b.js +++ b/view/frontend/web/js/view/payment/method-renderer/paylater_invoice_b2b.js @@ -44,6 +44,36 @@ define( }); this.hideFormFields(fieldId); + this.observeCompanyType(fieldId); + + }, + + observeCompanyType: function (fieldId) { + var self = this; + var container = document.getElementById(fieldId); + if (!container) { + return; + } + + var observer = new MutationObserver(function () { + var selectElem = container.querySelector('.unzerCombobox.companyType'); + if (selectElem) { + selectElem.addEventListener('change', function () { + self.hidePrivateFields(fieldId); + }); + observer.disconnect(); + } + }); + + observer.observe(container, { + childList: true, + subtree: true + }); + }, + + hidePrivateFields: function (fieldId) { + var field = $('#' + fieldId); + field.find('.field.firstname, .field.lastname, .field.email').hide(); }, hideFormFields: function (fieldId) { From 63e8c060937af1904ab573d05e71294e74c11562 Mon Sep 17 00:00:00 2001 From: Ivana Nestorovic Date: Mon, 9 Jun 2025 10:29:56 +0200 Subject: [PATCH 2/2] [Release 3.2.9 - 2025-06-09] --- CHANGELOG.md | 4 ++++ composer.json | 2 +- etc/module.xml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 741f3a4..642eda6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [3.2.9](https://github.com/unzerdev/magento2/compare/3.2.8..3.2.9) +### Changed +* Hide first name, last name and email fields for Invoice B2B payment method + ## [3.2.8](https://github.com/unzerdev/magento2/compare/3.2.7..3.2.8) ### Fixed * Rounding issue in case of total amount mismatch diff --git a/composer.json b/composer.json index d2d5133..956ad7c 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "unzerdev/magento2", "description": "This extension for Magento 2 provides a direct integration of the Unzer payment types to your Magento 2 shop via the Unzer Payment API (PAPI).", "type": "magento2-module", - "version": "3.2.8", + "version": "3.2.9", "license": "Apache-2.0", "require": { "php": "~7.4.0|~8.1.0|~8.2.0|~8.3.0", diff --git a/etc/module.xml b/etc/module.xml index 82dcece..eb9c82b 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,7 +1,7 @@ - +