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 @@ - + 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) {