Skip to content

Commit

Permalink
Merge branch 'release/v6.1.1' into 'master'
Browse files Browse the repository at this point in the history
release/v6.1.1 into master

See merge request agence-dnd/marketplace/magento-2/external/module-checkout-magento2-plugin!207
  • Loading branch information
DnD-Behou committed May 16, 2024
2 parents d68e7be + 493d4e8 commit be4c7c0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"magento/framework": ">=100.0.1"
},
"type": "magento2-module",
"version": "6.1.0",
"version": "6.1.1",
"autoload": {
"files": [
"registration.php"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ define(
return Customer.isLoggedIn();
},

/**
* @return {void}
*/
initEvents: function () {
var self = this;

Expand All @@ -141,9 +138,6 @@ define(
});
},

/**
* @return {void}
*/
handleFormState: function () {
if (Utilities.methodIsSelected(METHOD_ID)) {
this.getCkoPaymentForm();
Expand All @@ -152,8 +146,6 @@ define(

/**
* Gets the payment form styles
*
* @return {void}
*/
getFormStyles: function () {
var formStyles = this.getValue('payment_form_styles');
Expand All @@ -175,26 +167,20 @@ define(

/**
* Gets the payment form layout
*
* @return {void}
*/
getFormLayout: function () {
return this.getValue('payment_form_layout');
},

/**
* Gets the module images path
*
* @return {void}
*/
getImagesPath: function () {
return window.checkoutConfig.payment.checkoutcom_magento2.checkoutcom_data.images_path;
},

/**
* Gets the payment form
*
* @return {void}
*/
getCkoPaymentForm: function () {
// Prepare the needed variables
Expand Down Expand Up @@ -231,7 +217,6 @@ define(

/**
* Loads a Frames component.
* @return {void}
*/
addFramesComponent: function (framesInstance) {
if (this.getFormLayout() == 'multi') {
Expand All @@ -245,8 +230,6 @@ define(

/**
* Removes the payment form
*
* @return {void}
*/
removeCkoPaymentForm: function () {
// Remove the events
Expand All @@ -265,7 +248,6 @@ define(

/**
* Add events to Frames.
* @return {void}
*/
addFramesEvents: function () {
var self = this;
Expand All @@ -274,11 +256,12 @@ define(
Frames.addEventHandler(
Frames.Events.READY,
function() {
var valid = Utilities.getBillingAddress() != null;
const billingAddress = Utilities.getBillingAddress();
self.checkBillingAdressCustomerName(billingAddress);

if(valid) {
cardholderName = Utilities.getCustomerName();
}
Quote.billingAddress.subscribe(function (newBillingAddress){
self.checkBillingAdressCustomerName(newBillingAddress);
});
}
)

Expand All @@ -289,8 +272,9 @@ define(
const valid = Frames.isCardValid()
if (valid) {
if(cardholderName.length === 0) {
if(Utilities.getBillingAddress()) {
cardholderName = Utilities.getCustomerName();
const billingAddress = Utilities.getBillingAddress();
if (billingAddress) {
cardholderName = Utilities.getCustomerNameByBillingAddress(billingAddress);
}
}

Expand Down Expand Up @@ -329,9 +313,6 @@ define(
);
},

/**
* @return {void}
*/
placeOrder: function () {
if (Utilities.methodIsSelected(METHOD_ID)) {
// Validate the order placement
Expand Down Expand Up @@ -360,11 +341,29 @@ define(
}
},

/**
* @return {void}
*/
toggleTooltip: function () {
this.tooltipVisible(!this.tooltipVisible());
},

/**
* @param {object} billingAddress
*/
checkBillingAdressCustomerName: function (billingAddress) {
const valid = billingAddress !== null;

if (valid) {
cardholderName = Utilities.getCustomerNameByBillingAddress(billingAddress);
this.setCardHolderName(cardholderName);
}
},

/**
* @param {string} cardholderName
*/
setCardHolderName: function (cardholderName) {
Frames.cardholder = {
name: cardholderName
};
}
}
);
Expand Down
7 changes: 3 additions & 4 deletions view/frontend/web/js/view/payment/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,10 @@ define(
/**
* Customer name.
*
* @param {bool} return in object format.
* @return {mixed} The billing address.
* @param {object} billingAddress
* @return {string}
*/
getCustomerName: function () {
var billingAddress = this.getBillingAddress();
getCustomerNameByBillingAddress: function (billingAddress) {
var customerName = '';
if (billingAddress && billingAddress.firstname && billingAddress.lastname) {
customerName += billingAddress.firstname;
Expand Down

0 comments on commit be4c7c0

Please sign in to comment.