Skip to content

Commit 52804d7

Browse files
MC-41598: Add PP PayLater component to Checkout page
- add component in before-place-order section and change name in configuration
1 parent 100f0e3 commit 52804d7

24 files changed

+167
-288
lines changed

app/code/Magento/Paypal/Model/PayLaterCheckoutConfigProvider.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
*/
1313
class PayLaterCheckoutConfigProvider implements ConfigProviderInterface
1414
{
15-
/**
16-
* PayLater checkout page placement
17-
*/
18-
private const PLACEMENT = 'payment';
19-
2015
/**
2116
* @var PayLaterConfig
2217
*/
@@ -42,10 +37,12 @@ public function __construct(PayLaterConfig $payLaterConfig, SdkUrl $sdkUrl)
4237
*/
4338
public function getConfig()
4439
{
45-
$attributes = $this->payLaterConfig->getStyleConfig(self::PLACEMENT);
46-
$attributes['data-pp-placement'] = self::PLACEMENT;
40+
$attributes = $this->payLaterConfig->getStyleConfig(PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT);
41+
$attributes['data-pp-placement'] = PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT;
4742

48-
$config['payment']['paypalPayLater']['enabled'] = $this->payLaterConfig->isEnabled(self::PLACEMENT);
43+
$config['payment']['paypalPayLater']['enabled'] = $this->payLaterConfig->isEnabled(
44+
PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT
45+
);
4946
$config['payment']['paypalPayLater']['config'] = [
5047
'sdkUrl' => $this->sdkUrl->getUrl(),
5148
'attributes' => $attributes

app/code/Magento/Paypal/Model/PayLaterConfig.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
*/
1515
class PayLaterConfig
1616
{
17+
/**
18+
* Checkout payment step placement
19+
*/
20+
const CHECKOUT_PAYMENT_PLACEMENT = 'checkout_payment';
21+
1722
/**
1823
* @var Config
1924
*/
@@ -101,30 +106,33 @@ private function isPPCreditEnabled()
101106
private function getSectionConfig($section, $key)
102107
{
103108
if (!array_key_exists($section, $this->configData)) {
109+
$sectionName = $section === self::CHECKOUT_PAYMENT_PLACEMENT
110+
? self::CHECKOUT_PAYMENT_PLACEMENT : "${section}page";
111+
104112
$this->configData[$section] = [
105-
'display' => (boolean)$this->config->getPayLaterConfigValue("${section}page_display"),
106-
'position' => $this->config->getPayLaterConfigValue("${section}page_position"),
113+
'display' => (boolean)$this->config->getPayLaterConfigValue("${sectionName}_display"),
114+
'position' => $this->config->getPayLaterConfigValue("${sectionName}_position"),
107115
'style' => [
108116
'data-pp-style-layout' => $this->config->getPayLaterConfigValue(
109-
"${section}page_stylelayout"
117+
"${sectionName}_stylelayout"
110118
),
111119
'data-pp-style-logo-type' => $this->config->getPayLaterConfigValue(
112-
"${section}page_logotype"
120+
"${sectionName}_logotype"
113121
),
114122
'data-pp-style-logo-position' => $this->config->getPayLaterConfigValue(
115-
"${section}page_logoposition"
123+
"${sectionName}_logoposition"
116124
),
117125
'data-pp-style-text-color' => $this->config->getPayLaterConfigValue(
118-
"${section}page_textcolor"
126+
"${sectionName}_textcolor"
119127
),
120128
'data-pp-style-text-size' => $this->config->getPayLaterConfigValue(
121-
"${section}page_textsize"
129+
"${sectionName}_textsize"
122130
),
123131
'data-pp-style-color' => $this->config->getPayLaterConfigValue(
124-
"${section}page_color"
132+
"${sectionName}_color"
125133
),
126134
'data-pp-style-ratio' => $this->config->getPayLaterConfigValue(
127-
"${section}page_ratio"
135+
"${sectionName}_ratio"
128136
)
129137
]
130138
];

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

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -413,94 +413,94 @@
413413
</depends>
414414
</field>
415415
</group>
416-
<group id="settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
417-
<label>Checkout Payment Page</label>
416+
<group id="settings_paylater_checkout_payment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
417+
<label>Checkout Payment Step</label>
418418
<depends>
419419
<field id="paylater_enabled">1</field>
420420
</depends>
421-
<field id="paylater_paymentpage_display" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="10">
421+
<field id="paylater_checkout_payment_display" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="10">
422422
<label>Display</label>
423-
<config_path>payment/paypal_paylater/paymentpage_display</config_path>
423+
<config_path>payment/paypal_paylater/checkout_payment_display</config_path>
424424
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
425425
<attribute type="shared">1</attribute>
426426
</field>
427-
<field id="paylater_paymentpage_position" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="20">
427+
<field id="paylater_checkout_payment_position" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="20">
428428
<label>Position</label>
429-
<config_path>payment/paypal_paylater/paymentpage_position</config_path>
429+
<config_path>payment/paypal_paylater/checkout_payment_position</config_path>
430430
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Position::getPositionsCheckout</source_model>
431431
<attribute type="shared">1</attribute>
432432
<depends>
433-
<field id="paylater_paymentpage_display">1</field>
433+
<field id="paylater_checkout_payment_display">1</field>
434434
</depends>
435435
</field>
436-
<field id="paylater_paymentpage_stylelayout" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="30">
436+
<field id="paylater_checkout_payment_stylelayout" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="30">
437437
<label>Style Layout</label>
438-
<config_path>payment/paypal_paylater/paymentpage_stylelayout</config_path>
438+
<config_path>payment/paypal_paylater/checkout_payment_stylelayout</config_path>
439439
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\StyleLayout</source_model>
440440
<attribute type="shared">1</attribute>
441441
<depends>
442-
<field id="paylater_paymentpage_display">1</field>
442+
<field id="paylater_checkout_payment_display">1</field>
443443
</depends>
444444
</field>
445-
<field id="paylater_paymentpage_logotype" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="40">
445+
<field id="paylater_checkout_payment_logotype" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="40">
446446
<label>Logo Type</label>
447-
<config_path>payment/paypal_paylater/paymentpage_logotype</config_path>
447+
<config_path>payment/paypal_paylater/checkout_payment_logotype</config_path>
448448
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoType</source_model>
449449
<attribute type="shared">1</attribute>
450450
<depends>
451-
<field id="paylater_paymentpage_display">1</field>
452-
<field id="paylater_paymentpage_stylelayout">text</field>
451+
<field id="paylater_checkout_payment_display">1</field>
452+
<field id="paylater_checkout_payment_stylelayout">text</field>
453453
</depends>
454454
</field>
455-
<field id="paylater_paymentpage_logoposition" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="50">
455+
<field id="paylater_checkout_payment_logoposition" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="50">
456456
<label>Logo Position</label>
457-
<config_path>payment/paypal_paylater/paymentpage_logoposition</config_path>
457+
<config_path>payment/paypal_paylater/checkout_payment_logoposition</config_path>
458458
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoPosition</source_model>
459459
<attribute type="shared">1</attribute>
460460
<depends>
461-
<field id="paylater_paymentpage_display">1</field>
462-
<field id="paylater_paymentpage_stylelayout">text</field>
463-
<field id="paylater_paymentpage_logotype" separator=",">primary,alternative</field>
461+
<field id="paylater_checkout_payment_display">1</field>
462+
<field id="paylater_checkout_payment_stylelayout">text</field>
463+
<field id="paylater_checkout_payment_logotype" separator=",">primary,alternative</field>
464464
</depends>
465465
</field>
466-
<field id="paylater_paymentpage_textcolor" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="60">
466+
<field id="paylater_checkout_payment_textcolor" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="60">
467467
<label>Text Color</label>
468-
<config_path>payment/paypal_paylater/paymentpage_textcolor</config_path>
468+
<config_path>payment/paypal_paylater/checkout_payment_textcolor</config_path>
469469
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextColor</source_model>
470470
<attribute type="shared">1</attribute>
471471
<depends>
472-
<field id="paylater_paymentpage_display">1</field>
473-
<field id="paylater_paymentpage_stylelayout">text</field>
472+
<field id="paylater_checkout_payment_display">1</field>
473+
<field id="paylater_checkout_payment_stylelayout">text</field>
474474
</depends>
475475
</field>
476-
<field id="paylater_paymentpage_textsize" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="70">
476+
<field id="paylater_checkout_payment_textsize" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="70">
477477
<label>Text Size</label>
478-
<config_path>payment/paypal_paylater/paymentpage_textsize</config_path>
478+
<config_path>payment/paypal_paylater/checkout_payment_textsize</config_path>
479479
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextSize</source_model>
480480
<attribute type="shared">1</attribute>
481481
<depends>
482-
<field id="paylater_paymentpage_display">1</field>
483-
<field id="paylater_paymentpage_stylelayout">text</field>
482+
<field id="paylater_checkout_payment_display">1</field>
483+
<field id="paylater_checkout_payment_stylelayout">text</field>
484484
</depends>
485485
</field>
486-
<field id="paylater_paymentpage_ratio" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="80">
486+
<field id="paylater_checkout_payment_ratio" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="80">
487487
<label>Ratio</label>
488-
<config_path>payment/paypal_paylater/paymentpage_ratio</config_path>
488+
<config_path>payment/paypal_paylater/checkout_payment_ratio</config_path>
489489
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Ratio</source_model>
490490
<attribute type="shared">1</attribute>
491491
<depends>
492-
<field id="paylater_paymentpage_display">1</field>
493-
<field id="paylater_paymentpage_stylelayout">flex</field>
492+
<field id="paylater_checkout_payment_display">1</field>
493+
<field id="paylater_checkout_payment_stylelayout">flex</field>
494494
</depends>
495495
</field>
496-
<field id="paylater_paymentpage_color" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="90">
496+
<field id="paylater_checkout_payment_color" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="90">
497497
<label>Color</label>
498-
<config_path>payment/paypal_paylater/paymentpage_color</config_path>
498+
<config_path>payment/paypal_paylater/checkout_payment_color</config_path>
499499
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Color</source_model>
500500
<attribute type="shared">1</attribute>
501501
<depends>
502-
<field id="paylater_paymentpage_display">1</field>
503-
<field id="paylater_paymentpage_stylelayout">flex</field>
502+
<field id="paylater_checkout_payment_display">1</field>
503+
<field id="paylater_checkout_payment_stylelayout">flex</field>
504504
</depends>
505505
</field>
506506
</group>

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,20 @@
229229
<field id="paylater_productpage_ratio" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_ratio"/>
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>
232-
<group id="advanced_settings_paylater_paymentpage" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
233-
<label>Checkout Payment Page</label>
232+
<group id="advanced_settings_paylater_checkout_payment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
233+
<label>Checkout Payment Step</label>
234234
<depends>
235235
<field id="paylater_enabled">1</field>
236236
</depends>
237-
<field id="paylater_paymentpage_display" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_display"/>
238-
<field id="paylater_paymentpage_position" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_position"/>
239-
<field id="paylater_paymentpage_stylelayout" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_stylelayout"/>
240-
<field id="paylater_paymentpage_logotype" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_logotype"/>
241-
<field id="paylater_paymentpage_logoposition" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_logoposition"/>
242-
<field id="paylater_paymentpage_textcolor" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_textcolor"/>
243-
<field id="paylater_paymentpage_textsize" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_textsize"/>
244-
<field id="paylater_paymentpage_ratio" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_ratio"/>
245-
<field id="paylater_paymentpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_paymentpage/paylater_paymentpage_color"/>
237+
<field id="paylater_checkout_payment_display" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_display"/>
238+
<field id="paylater_checkout_payment_position" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_position"/>
239+
<field id="paylater_checkout_payment_stylelayout" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_stylelayout"/>
240+
<field id="paylater_checkout_payment_logotype" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_logotype"/>
241+
<field id="paylater_checkout_payment_logoposition" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_logoposition"/>
242+
<field id="paylater_checkout_payment_textcolor" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_textcolor"/>
243+
<field id="paylater_checkout_payment_textsize" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_textsize"/>
244+
<field id="paylater_checkout_payment_ratio" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_ratio"/>
245+
<field id="paylater_checkout_payment_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_checkout_payment/paylater_checkout_payment_color"/>
246246
</group>
247247
</group>
248248
</group>

0 commit comments

Comments
 (0)