Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Unzer_PAPI" setup_version="3.2.8">
<module name="Unzer_PAPI" setup_version="3.2.9">
<sequence>
<module name="Magento_Checkout"/>
<module name="Magento_Config" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down