Skip to content

Commit 7213e06

Browse files
MC-41598: Add PP PayLater component to Checkout page
- add banner to other payment methods
1 parent 04ee548 commit 7213e06

File tree

16 files changed

+94
-12
lines changed

16 files changed

+94
-12
lines changed

app/code/Magento/Paypal/etc/adminhtml/system/express_checkout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@
414414
</field>
415415
</group>
416416
<group id="settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
417-
<label>Checkout Page</label>
417+
<label>Checkout Payment Page</label>
418418
<depends>
419419
<field id="paylater_enabled">1</field>
420420
</depends>

app/code/Magento/Paypal/etc/adminhtml/system/payflow_advanced.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
231231
</group>
232232
<group id="advanced_settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
233-
<label>Checkout Page</label>
233+
<label>Checkout Payment Page</label>
234234
<depends>
235235
<field id="paylater_enabled">1</field>
236236
</depends>

app/code/Magento/Paypal/etc/adminhtml/system/payflow_link.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
243243
</group>
244244
<group id="payflow_link_settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
245-
<label>Checkout Page</label>
245+
<label>Checkout Payment Page</label>
246246
<depends>
247247
<field id="paylater_enabled">1</field>
248248
</depends>

app/code/Magento/Paypal/etc/adminhtml/system/payments_pro_hosted_solution.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
169169
</group>
170170
<group id="pphs_settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
171-
<label>Checkout Page</label>
171+
<label>Checkout Payment Page</label>
172172
<depends>
173173
<field id="paylater_enabled">1</field>
174174
</depends>

app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
114114
</group>
115115
<group id="paypal_payflow_settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
116-
<label>Checkout Page</label>
116+
<label>Checkout Payment Page</label>
117117
<depends>
118118
<field id="paylater_enabled">1</field>
119119
</depends>

app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro_with_express_checkout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
164164
</group>
165165
<group id="paypal_payflow_settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
166-
<label>Checkout Page</label>
166+
<label>Checkout Payment Page</label>
167167
<depends>
168168
<field id="paylater_enabled">1</field>
169169
</depends>

app/code/Magento/Paypal/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,3 +761,4 @@ User,User
761761
"Display pay later messaging on your site for offers like Pay in 3, which lets customers pay with 3 interest- free monthly payments. We’ll show messages on your site to promote this feature for you. You may not promote pay later offers with any other content, marketing, or materials.","Display pay later messaging on your site for offers like Pay in 3, which lets customers pay with 3 interest- free monthly payments. We’ll show messages on your site to promote this feature for you. You may not promote pay later offers with any other content, marketing, or materials."
762762
"Monochrome","Monochrome"
763763
"Grayscale","Grayscale"
764+
"Checkout Payment Page", "Checkout Payment Page"

app/code/Magento/Paypal/view/frontend/web/js/view/payment/method-renderer/iframe-methods.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
define([
66
'Magento_Checkout/js/view/payment/default',
77
'Magento_Paypal/js/model/iframe',
8-
'Magento_Checkout/js/model/full-screen-loader'
9-
], function (Component, iframe, fullScreenLoader) {
8+
'Magento_Checkout/js/model/full-screen-loader',
9+
'Magento_Paypal/js/view/paylater-common'
10+
], function (Component, iframe, fullScreenLoader, paypalPayLater) {
1011
'use strict';
1112

1213
return Component.extend({
@@ -16,6 +17,19 @@ define([
1617
},
1718
redirectAfterPlaceOrder: false,
1819
isInAction: iframe.isInAction,
20+
amount: 0,
21+
22+
/** Init observable variables */
23+
initialize: function () {
24+
this._super();
25+
26+
if (window.checkoutConfig) {
27+
const config = window.checkoutConfig.payment.paypalPayLater.config;
28+
paypalPayLater.init(config.sdkUrl, config.attributes);
29+
}
30+
31+
return this;
32+
},
1933

2034
/**
2135
* @return {exports}
@@ -87,6 +101,21 @@ define([
87101
*/
88102
iframeLoaded: function () {
89103
fullScreenLoader.stopLoader();
104+
},
105+
106+
/** Returns payment paylater enabled */
107+
getPayLaterEnabled: function () {
108+
return window.checkoutConfig.payment.paypalPayLater.enabled;
109+
},
110+
111+
/**
112+
* Get PayLater attribute value from configuration
113+
*
114+
* @param {String} attributeName
115+
* @returns {*|null}
116+
*/
117+
getAttribute: function (attributeName) {
118+
return paypalPayLater.getAttribute(attributeName);
90119
}
91120
});
92121
});

app/code/Magento/Paypal/view/frontend/web/js/view/payment/method-renderer/payflowpro-method.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ define([
99
'Magento_Checkout/js/model/payment/additional-validators',
1010
'Magento_Checkout/js/action/set-payment-information',
1111
'Magento_Checkout/js/model/full-screen-loader',
12-
'Magento_Vault/js/view/payment/vault-enabler'
13-
], function ($, Component, additionalValidators, setPaymentInformationAction, fullScreenLoader, VaultEnabler) {
12+
'Magento_Vault/js/view/payment/vault-enabler',
13+
'Magento_Paypal/js/view/paylater-common',
14+
], function ($, Component, additionalValidators, setPaymentInformationAction, fullScreenLoader, VaultEnabler, paypalPayLater) {
1415
'use strict';
1516

1617
return Component.extend({
@@ -19,6 +20,7 @@ define([
1920
},
2021
placeOrderHandler: null,
2122
validateHandler: null,
23+
amount: 0,
2224

2325
/**
2426
* @returns {exports.initialize}
@@ -28,6 +30,11 @@ define([
2830
this.vaultEnabler = new VaultEnabler();
2931
this.vaultEnabler.setPaymentCode(this.getVaultCode());
3032

33+
if (window.checkoutConfig) {
34+
const config = window.checkoutConfig.payment.paypalPayLater.config;
35+
paypalPayLater.init(config.sdkUrl, config.attributes);
36+
}
37+
3138
return this;
3239
},
3340

@@ -135,6 +142,21 @@ define([
135142
*/
136143
getVaultCode: function () {
137144
return 'payflowpro_cc_vault';
138-
}
145+
},
146+
147+
/** Returns payment paylater enabled */
148+
getPayLaterEnabled: function () {
149+
return window.checkoutConfig.payment.paypalPayLater.enabled;
150+
},
151+
152+
/**
153+
* Get PayLater attribute value from configuration
154+
*
155+
* @param {String} attributeName
156+
* @returns {*|null}
157+
*/
158+
getAttribute: function (attributeName) {
159+
return paypalPayLater.getAttribute(attributeName);
160+
},
139161
});
140162
});

app/code/Magento/Paypal/view/frontend/web/template/payment/iframe-methods.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,10 @@
5353
</iframe>
5454
<!-- /ko -->
5555
</div>
56+
<!-- ko if: getPayLaterEnabled() -->
57+
<div style="padding-top: 10px">
58+
<!-- ko template: 'Magento_Paypal/paylater' --><!-- /ko -->
59+
</div>
60+
<!-- /ko -->
5661
</div>
5762
</div>

0 commit comments

Comments
 (0)