Skip to content

Commit 2517ec4

Browse files
tishonatorTihomir Ivanov
andauthored
release 24.1.0. (#469)
Co-authored-by: Tihomir Ivanov <[email protected]>
1 parent 5906caf commit 2517ec4

File tree

66 files changed

+1863
-157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1863
-157
lines changed

Cartridges.zip

-15.8 MB
Binary file not shown.

Cartridges/int_checkoutcom/cartridge/scripts/hooks.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
{
2424
"name": "dw.extensions.applepay.shippingContactSelected",
2525
"script": "./payment/processor/CHECKOUTCOM_APPLE_PAY"
26+
},
27+
{
28+
"name": "dw.extensions.applepay.getRequest",
29+
"script": "./payment/processor/CHECKOUTCOM_APPLE_PAY"
2630
}
2731
]
2832
}

Cartridges/int_checkoutcom/cartridge/scripts/payment/processor/CHECKOUTCOM_APPLE_PAY.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,11 @@ exports.shippingContactSelected = function(basket, event, response) {
154154

155155
return;
156156
};
157+
158+
exports.getRequest = function(basket, req) {
159+
var currentLocale = ckoHelper.getSiteCurrentCountryCode();
160+
if(currentLocale === 'SA') {
161+
req.supportedNetworks.push('mada');
162+
}
163+
session.custom.applepaysession = 'yes';
164+
};

Cartridges/int_checkoutcom/cartridge/scripts/payment/processor/CHECKOUTCOM_CARD.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
// API Includes
77
var Transaction = require('dw/system/Transaction');
8+
var PaymentMgr = require('dw/order/PaymentMgr');
89

910
// Site controller
1011
var Site = require('dw/system/Site');
@@ -79,6 +80,16 @@ function Handle(args) {
7980
cardType: paymentForm.get('type').value(),
8081
};
8182

83+
var paymentCard = PaymentMgr.getPaymentCard(cardData.cardType);
84+
85+
var creditCardStatus = paymentCard.verify(cardData.month, cardData.year, cardData.number, cardData.cvn);
86+
if (creditCardStatus.error) {
87+
var invalidatePaymentCardFormElements = require('*/cartridge/scripts/checkout/InvalidatePaymentCardFormElements');
88+
invalidatePaymentCardFormElements.invalidatePaymentCardForm(creditCardStatus, session.forms.cardPaymentForm);
89+
90+
return { error: true };
91+
}
92+
8293
// Validate expiration date
8394
if (cardData.year === new Date().getFullYear() && cardData.month < new Date().getMonth() + 1) {
8495
paymentForm.get('expiration.month').invalidateFormElement();

Cartridges/int_checkoutcom/cartridge/static/default/css/card.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
margin-top: 1px;
9393
}
9494

95+
label[for^="dwfrm_cardPaymentForm_number"]~.error-message {
96+
margin-bottom: -20px;
97+
}
98+
9599
.cartes-bancaires-wrapper.selected, .cartes-visa-wrapper.selected, .cartes-mastercard-wrapper.selected {
96100
border-color: #00D26A;
97101
}
@@ -159,6 +163,10 @@
159163
padding: 7px;
160164
}
161165

166+
.no-click {
167+
pointer-events: none;
168+
}
169+
162170
@media only screen and (max-width: 768px) {
163171
.cartes-bancaires-options {
164172
top: 29%;

Cartridges/int_checkoutcom/cartridge/static/default/js/googlepay.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,13 @@ function launchGooglePay() {
5454
signedMessage: JSON.parse(e.paymentMethodToken.token)
5555
.signedMessage,
5656
};
57-
jQuery('[id="dwfrm_googlePayForm_data"]').val(JSON.stringify(o)),
58-
"" ===
59-
$(
60-
'input[name="dwfrm_billing_googlePayForm_ckoGooglePayData"]'
61-
).val()
62-
? $(".ckoGooglePayButton-invalid-field-message").text(
63-
window.ckoLang.googlePayDataInvalid
64-
)
65-
: $("#dwfrm_billing").submit();
57+
jQuery('[id="dwfrm_googlePayForm_data"]').val(JSON.stringify(o));
58+
if ('' === $('input[name="dwfrm_billing_googlePayForm_ckoGooglePayData"]').val()) {
59+
$('.ckoGooglePayButton-invalid-field-message').text(window.ckoLang.googlePayDataInvalid);
60+
} else {
61+
$('.button-fancy-large').removeClass('no-click disabled');
62+
$('#dwfrm_billing').submit();
63+
}
6664
})(e);
6765
})
6866
.catch(function(e) {
@@ -73,6 +71,13 @@ function launchGooglePay() {
7371
document.addEventListener(
7472
"DOMContentLoaded",
7573
function() {
74+
$('.input-radio').click(function() {
75+
if ($(this).val() === 'CHECKOUTCOM_GOOGLE_PAY') {
76+
$('.button-fancy-large').addClass('no-click disabled');
77+
} else {
78+
$('.button-fancy-large').removeClass('no-click disabled');
79+
}
80+
});
7681
launchGooglePay();
7782
},
7883
!1

Cartridges/int_checkoutcom/cartridge/templates/default/apm/apm.isml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515

1616

1717
<!-- This to include the boleto pay apm form -->
18+
<iscomment>
19+
Boleto has been temporarily removed from the business manager configuration, rendering this payment method currently inactive.
20+
To activate it, include the metadata in the business manager for 'CKO [5] APM Settings' custom preference.
21+
Ticket no. CHECBLD-149
1822
<isif condition="${(dw.system.Site.getCurrent().getCustomPreferenceValue('ckoBoletoEnabled'))}">
1923
<div id="boleto" class="hideApm apmBox">
2024
<isinclude template="apm/includes/boleto.isml"/>
2125
</div>
2226
</isif>
27+
</iscomment>
2328

2429

2530
<!-- This to include the bancontact pay apm form -->
@@ -31,11 +36,16 @@
3136

3237

3338
<!-- This to include the benefit pay apm form -->
39+
<iscomment>
40+
BenefitPay has been temporarily removed from the business manager configuration, rendering this payment method currently inactive.
41+
To activate it, include the metadata in the business manager for 'CKO [5] APM Settings' custom preference.
42+
Ticket no. CHECBLD-149
3443
<isif condition="${(dw.system.Site.getCurrent().getCustomPreferenceValue('ckoBenefitEnabled'))}">
3544
<div id="benefit" class="hideApm apmBox">
3645
<isinclude template="apm/includes/benefitPay.isml"/>
3746
</div>
3847
</isif>
48+
</iscomment>
3949

4050

4151
<!-- This to include the giro pay apm form -->
@@ -103,11 +113,16 @@
103113

104114

105115
<!-- This to include the poli apm form -->
116+
<iscomment>
117+
Poli has been temporarily removed from the business manager configuration, rendering this payment method currently inactive.
118+
To activate it, include the metadata in the business manager for 'CKO [5] APM Settings' custom preference.
119+
Ticket no. CHECBLD-149
106120
<isif condition="${(dw.system.Site.getCurrent().getCustomPreferenceValue('ckoPoliEnabled'))}">
107121
<div id="poli" class="hideApm apmBox">
108122
<isinclude template="apm/includes/poli.isml"/>
109123
</div>
110124
</isif>
125+
</iscomment>
111126

112127

113128
<!-- This to include the p24 apm form -->
@@ -118,19 +133,29 @@
118133
</isif>
119134

120135
<!-- This to include the Oxxo apm form -->
136+
<iscomment>
137+
OXXO has been temporarily removed from the business manager configuration, rendering this payment method currently inactive.
138+
To activate it, include the metadata in the business manager for 'CKO [5] APM Settings' custom preference.
139+
Ticket no. CHECBLD-149
121140
<isif condition="${(dw.system.Site.getCurrent().getCustomPreferenceValue('ckoOxxoEnabled'))}">
122141
<div id="oxxo" class="hideApm apmBox">
123142
<isinclude template="apm/includes/oxxo.isml"/>
124143
</div>
125144
</isif>
145+
</iscomment>
126146

127147

128148
<!-- This to include the Alipay apm form -->
149+
<iscomment>
150+
Alipay has been temporarily removed from the business manager configuration, rendering this payment method currently inactive.
151+
To activate it, include the metadata in the business manager for 'CKO [5] APM Settings' custom preference.
152+
Ticket no. CHECBLD-149
129153
<isif condition="${(dw.system.Site.getCurrent().getCustomPreferenceValue('ckoAlipayEnabled'))}">
130154
<div id="alipay" class="hideApm apmBox">
131155
<isinclude template="apm/includes/alipay.isml"/>
132156
</div>
133157
</isif>
158+
</iscomment>
134159

135160

136161
<!-- This to include the klarna apm form -->
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
'use strict';
2+
3+
var base = require('base/checkout/billing');
4+
5+
/**
6+
* returns the payment method name
7+
* @param {Object} applicablePaymentMethods - applicable payment methods
8+
* @param {Object} selectedPaymentMethod - selected payment method
9+
* @returns {string} paymentMethodName - payment method name
10+
*/
11+
function getPaymentMethodName(applicablePaymentMethods, selectedPaymentMethod) {
12+
var paymentMethodName;
13+
for (var i = 0; i < applicablePaymentMethods.length; i += 1) {
14+
if (applicablePaymentMethods[i].ID === selectedPaymentMethod) {
15+
paymentMethodName = applicablePaymentMethods[i].name;
16+
break;
17+
}
18+
}
19+
return paymentMethodName;
20+
}
21+
22+
23+
/**
24+
* Updates the payment information in checkout, based on the supplied order model
25+
* @param {Object} order - checkout model to use as basis of new truth
26+
*/
27+
base.methods.updatePaymentInformation = function(order) {
28+
// update payment details
29+
var $paymentSummary = $('.payment-details');
30+
var htmlToAppend = '';
31+
var selectedPaymentInstrument;
32+
33+
if (order.billing.payment && order.billing.payment.selectedPaymentInstruments
34+
&& order.billing.payment.selectedPaymentInstruments.length > 0) {
35+
for (var i = 0; i < order.billing.payment.selectedPaymentInstruments.length; i += 1) {
36+
selectedPaymentInstrument = order.billing.payment.selectedPaymentInstruments[i];
37+
}
38+
// CREDIT_CARD
39+
if (selectedPaymentInstrument.paymentMethod === 'CREDIT_CARD') {
40+
htmlToAppend += '<span>' + order.resources.cardType + ' ' + selectedPaymentInstrument.type + '</span><div>' + selectedPaymentInstrument.maskedCreditCardNumber
41+
+ '</div><div><span>' + order.resources.cardEnding + ' ' + selectedPaymentInstrument.expirationMonth + '/' + selectedPaymentInstrument.expirationYear + '</span></div>';
42+
} else {
43+
htmlToAppend += '<div><p>' + getPaymentMethodName(order.billing.payment.applicablePaymentMethods, selectedPaymentInstrument.paymentMethod) + '</p>'
44+
+ '<p>' + order.priceTotal + '</p></div>';
45+
}
46+
}
47+
48+
$paymentSummary.empty().append(htmlToAppend);
49+
};
50+
51+
module.exports = base;

Cartridges/int_checkoutcom_sfra/cartridge/client/default/js/checkout/checkout.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
var customerHelpers = require('base/checkout/customer');
77
var addressHelpers = require('base/checkout/address');
88
var shippingHelpers = require('base/checkout/shipping');
9-
var billingHelpers = require('base/checkout/billing');
9+
var billingHelpers = require('./billing');
1010
var summaryHelpers = require('base/checkout/summary');
1111
var formHelpers = require('base/checkout/formErrors');
1212
var scrollAnimate = require('base/components/scrollAnimate');
13+
var initiPaypalbutton = require('../initPayPalButton');
1314

1415

1516
/**
@@ -191,6 +192,9 @@ var scrollAnimate = require('base/components/scrollAnimate');
191192
// enable the next:Payment button here
192193
$('body').trigger('checkout:enableButton', '.next-step-button button');
193194
shippingHelpers.methods.shippingFormResponse(defer, data);
195+
if (($('.paypal-buttons').length === 0) && ($('.payPal-tab').length > 0)) {
196+
initiPaypalbutton.initPayPalButton();
197+
}
194198
},
195199
error: function(err) {
196200
// enable the next:Payment button here
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
'use strict';
2+
3+
var cart = require('base/cart/cart');
4+
var miniCartExpressPaypal = require('../paypal/minicartExpressPaypal');
5+
6+
var updateMiniCart = true;
7+
8+
module.exports = function () {
9+
cart();
10+
11+
$('.minicart').on('count:update', function (event, count) {
12+
if (count && $.isNumeric(count.quantityTotal)) {
13+
$('.minicart .minicart-quantity').text(count.quantityTotal);
14+
$('.minicart .minicart-link').attr({
15+
'aria-label': count.minicartCountOfItems,
16+
title: count.minicartCountOfItems
17+
});
18+
}
19+
});
20+
21+
$('.minicart').on('mouseenter focusin touchstart', function () {
22+
if ($('.search:visible').length === 0) {
23+
return;
24+
}
25+
var url = $('.minicart').data('action-url');
26+
var count = parseInt($('.minicart .minicart-quantity').text(), 10);
27+
28+
if (count !== 0 && $('.minicart .popover.show').length === 0) {
29+
if (!updateMiniCart) {
30+
$('.minicart .popover').addClass('show');
31+
return;
32+
}
33+
34+
$('.minicart .popover').addClass('show');
35+
$('.minicart .popover').spinner().start();
36+
$.get(url, function (data) {
37+
$('.minicart .popover').empty();
38+
$('.minicart .popover').append(data);
39+
updateMiniCart = false;
40+
miniCartExpressPaypal.miniCartPayPalSDK();
41+
$.spinner().stop();
42+
});
43+
}
44+
});
45+
$('body').on('touchstart click', function (e) {
46+
if ($('.minicart').has(e.target).length <= 0) {
47+
$('.minicart .popover').removeClass('show');
48+
}
49+
});
50+
$('.minicart').on('mouseleave focusout', function (event) {
51+
if ((event.type === 'focusout' && $('.minicart').has(event.target).length > 0)
52+
|| (event.type === 'mouseleave' && $(event.target).is('.minicart .quantity'))
53+
|| $('body').hasClass('modal-open')) {
54+
event.stopPropagation();
55+
return;
56+
}
57+
$('.minicart .popover').removeClass('show');
58+
});
59+
$('body').on('change', '.minicart .quantity', function () {
60+
if ($(this).parents('.bonus-product-line-item').length && $('.cart-page').length) {
61+
location.reload();
62+
}
63+
});
64+
$('body').on('product:afterAddToCart', function () {
65+
updateMiniCart = true;
66+
});
67+
$('body').on('cart:update', function () {
68+
updateMiniCart = true;
69+
});
70+
};

0 commit comments

Comments
 (0)