Skip to content

Commit 72f58b8

Browse files
committed
Merge branch 'MC-41598' into paypal-paylater-2
2 parents 38bc075 + 5b004c6 commit 72f58b8

14 files changed

+379
-149
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Paypal\Model;
7+
8+
use Magento\Checkout\Model\ConfigProviderInterface;
9+
10+
/**
11+
* Provides configuration values for PayPal PayLater on the checkout page
12+
*/
13+
class PayLaterCheckoutConfigProvider implements ConfigProviderInterface
14+
{
15+
/**
16+
* Checkout payment page placement
17+
*/
18+
private const PLACEMENT = 'payment';
19+
20+
/**
21+
* @var PayLaterConfig
22+
*/
23+
private $payLaterConfig;
24+
25+
/**
26+
* @var SdkUrl
27+
*/
28+
private $sdkUrl;
29+
30+
/**
31+
* @param PayLaterConfig $payLaterConfig
32+
* @param SdkUrl $sdkUrl
33+
*/
34+
public function __construct(PayLaterConfig $payLaterConfig, SdkUrl $sdkUrl)
35+
{
36+
$this->payLaterConfig = $payLaterConfig;
37+
$this->sdkUrl = $sdkUrl;
38+
}
39+
40+
/**
41+
* @inheritdoc
42+
*/
43+
public function getConfig()
44+
{
45+
$attributes = $this->payLaterConfig->getStyleConfig(PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT);
46+
$attributes['data-pp-placement'] = self::PLACEMENT;
47+
48+
$config['payment']['paypalPayLater']['enabled'] = $this->payLaterConfig->isEnabled(
49+
PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT
50+
);
51+
$config['payment']['paypalPayLater']['config'] = [
52+
'sdkUrl' => $this->sdkUrl->getUrl(),
53+
'attributes' => $attributes
54+
];
55+
56+
return $config;
57+
}
58+
}

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

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,97 @@
523523
</depends>
524524
</field>
525525
</group>
526+
<group id="settings_paylater_checkout_payment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
527+
<label>Checkout Payment Step</label>
528+
<depends>
529+
<field id="paylater_enabled">1</field>
530+
</depends>
531+
<field id="paylater_checkout_payment_display" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="10">
532+
<label>Display</label>
533+
<config_path>payment/paypal_paylater/checkout_payment_display</config_path>
534+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
535+
<attribute type="shared">1</attribute>
536+
</field>
537+
<field id="paylater_checkout_payment_position" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="20">
538+
<label>Position</label>
539+
<config_path>payment/paypal_paylater/checkout_payment_position</config_path>
540+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Position::getPositionsCheckout</source_model>
541+
<attribute type="shared">1</attribute>
542+
<depends>
543+
<field id="paylater_checkout_payment_display">1</field>
544+
</depends>
545+
</field>
546+
<field id="paylater_checkout_payment_stylelayout" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="30">
547+
<label>Style Layout</label>
548+
<config_path>payment/paypal_paylater/checkout_payment_stylelayout</config_path>
549+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\StyleLayout</source_model>
550+
<attribute type="shared">1</attribute>
551+
<depends>
552+
<field id="paylater_checkout_payment_display">1</field>
553+
</depends>
554+
</field>
555+
<field id="paylater_checkout_payment_logotype" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="40">
556+
<label>Logo Type</label>
557+
<config_path>payment/paypal_paylater/checkout_payment_logotype</config_path>
558+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoType</source_model>
559+
<attribute type="shared">1</attribute>
560+
<depends>
561+
<field id="paylater_checkout_payment_display">1</field>
562+
<field id="paylater_checkout_payment_stylelayout">text</field>
563+
</depends>
564+
</field>
565+
<field id="paylater_checkout_payment_logoposition" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="50">
566+
<label>Logo Position</label>
567+
<config_path>payment/paypal_paylater/checkout_payment_logoposition</config_path>
568+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\LogoPosition</source_model>
569+
<attribute type="shared">1</attribute>
570+
<depends>
571+
<field id="paylater_checkout_payment_display">1</field>
572+
<field id="paylater_checkout_payment_stylelayout">text</field>
573+
<field id="paylater_checkout_payment_logotype" separator=",">primary,alternative</field>
574+
</depends>
575+
</field>
576+
<field id="paylater_checkout_payment_textcolor" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="60">
577+
<label>Text Color</label>
578+
<config_path>payment/paypal_paylater/checkout_payment_textcolor</config_path>
579+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextColor</source_model>
580+
<attribute type="shared">1</attribute>
581+
<depends>
582+
<field id="paylater_checkout_payment_display">1</field>
583+
<field id="paylater_checkout_payment_stylelayout">text</field>
584+
</depends>
585+
</field>
586+
<field id="paylater_checkout_payment_textsize" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="70">
587+
<label>Text Size</label>
588+
<config_path>payment/paypal_paylater/checkout_payment_textsize</config_path>
589+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\TextSize</source_model>
590+
<attribute type="shared">1</attribute>
591+
<depends>
592+
<field id="paylater_checkout_payment_display">1</field>
593+
<field id="paylater_checkout_payment_stylelayout">text</field>
594+
</depends>
595+
</field>
596+
<field id="paylater_checkout_payment_ratio" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="80">
597+
<label>Ratio</label>
598+
<config_path>payment/paypal_paylater/checkout_payment_ratio</config_path>
599+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Ratio</source_model>
600+
<attribute type="shared">1</attribute>
601+
<depends>
602+
<field id="paylater_checkout_payment_display">1</field>
603+
<field id="paylater_checkout_payment_stylelayout">flex</field>
604+
</depends>
605+
</field>
606+
<field id="paylater_checkout_payment_color" translate="label" type="select" showInDefault="1" showInWebsite="1" sortOrder="90">
607+
<label>Color</label>
608+
<config_path>payment/paypal_paylater/checkout_payment_color</config_path>
609+
<source_model>Magento\Paypal\Model\System\Config\Source\PayLater\Color</source_model>
610+
<attribute type="shared">1</attribute>
611+
<depends>
612+
<field id="paylater_checkout_payment_display">1</field>
613+
<field id="paylater_checkout_payment_stylelayout">flex</field>
614+
</depends>
615+
</field>
616+
</group>
526617
</group>
527618
</group>
528619
<group id="settings_ec" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="20">

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,21 @@
252252
<field id="paylater_productpage_ratio" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_ratio"/>
253253
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
254254
</group>
255+
<group id="advanced_settings_paylater_checkout_payment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
256+
<label>Checkout Payment Step</label>
257+
<depends>
258+
<field id="paylater_enabled">1</field>
259+
</depends>
260+
<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"/>
261+
<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"/>
262+
<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"/>
263+
<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"/>
264+
<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"/>
265+
<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"/>
266+
<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"/>
267+
<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"/>
268+
<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"/>
269+
</group>
255270
</group>
256271
</group>
257272
<group id="settings_payments_advanced" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="20">

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,21 @@
261261
<field id="paylater_productpage_ratio" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_ratio"/>
262262
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
263263
</group>
264+
<group id="payflow_link_settings_paylater_checkout_payment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
265+
<label>Checkout Payment Step</label>
266+
<depends>
267+
<field id="paylater_enabled">1</field>
268+
</depends>
269+
<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"/>
270+
<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"/>
271+
<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"/>
272+
<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"/>
273+
<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"/>
274+
<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"/>
275+
<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"/>
276+
<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"/>
277+
<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"/>
278+
</group>
264279
</group>
265280
</group>
266281
<group id="settings_payflow_link" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="20">

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@
189189
<field id="paylater_productpage_ratio" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_ratio"/>
190190
<field id="paylater_productpage_color" translate="label" extends="payment_all_paypal/express_checkout/express_checkout_required/advertise_paylater/settings_paylater_productpage/paylater_productpage_color"/>
191191
</group>
192+
<group id="pphs_settings_paylater_checkout_payment" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
193+
<label>Checkout Payment Step</label>
194+
<depends>
195+
<field id="paylater_enabled">1</field>
196+
</depends>
197+
<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"/>
198+
<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"/>
199+
<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"/>
200+
<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"/>
201+
<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"/>
202+
<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"/>
203+
<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"/>
204+
<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"/>
205+
<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"/>
206+
</group>
192207
</group>
193208
</group>
194209
<group id="pphs_settings" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="20">

0 commit comments

Comments
 (0)