Skip to content

Commit e2f90ec

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into L3-PR-2022-04-19
2 parents d20387a + 7d80b87 commit e2f90ec

File tree

13 files changed

+86
-6
lines changed

13 files changed

+86
-6
lines changed

app/code/Magento/Paypal/Block/Adminhtml/System/Config/PayLaterLink.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PayLaterLink extends Field
2929
/**
3030
* @var array.
3131
*/
32-
private const ARRAY_PAYLATER_SUPPORTED_COUNTRIES = ['US','GB','DE','FR','AU'];
32+
private const ARRAY_PAYLATER_SUPPORTED_COUNTRIES = ['US','GB','DE','FR','AU','IT','ES'];
3333

3434
/**
3535
* @var ScopeConfigInterface

app/code/Magento/Paypal/Controller/Express/OnAuthorization.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,19 @@
3333
class OnAuthorization extends AbstractExpress implements HttpPostActionInterface
3434
{
3535
/**
36+
* @var PayPalConfig
3637
* @inheritdoc
3738
*/
3839
protected $_configType = PayPalConfig::class;
3940

4041
/**
42+
* @var PayPalConfig
4143
* @inheritdoc
4244
*/
4345
protected $_configMethod = PayPalConfig::METHOD_WPP_EXPRESS;
4446

4547
/**
48+
* @var PayPalCheckout
4649
* @inheritdoc
4750
*/
4851
protected $_checkoutType = PayPalCheckout::class;
@@ -53,8 +56,6 @@ class OnAuthorization extends AbstractExpress implements HttpPostActionInterface
5356
private $cartRepository;
5457

5558
/**
56-
* Url Builder
57-
*
5859
* @var UrlInterface
5960
*/
6061
private $urlBuilder;
@@ -116,6 +117,7 @@ public function execute(): ResultInterface
116117
$controllerResult = $this->resultFactory->create(ResultFactory::TYPE_JSON);
117118
$payerId = $this->getRequest()->getParam('payerId');
118119
$tokenId = $this->getRequest()->getParam('paymentToken');
120+
$fundingSource = $this->getRequest()->getParam('paypalFundingSource');
119121

120122
try {
121123
$quote = $this->_getQuote();
@@ -127,6 +129,7 @@ public function execute(): ResultInterface
127129

128130
/** Populate checkout object with new data */
129131
$this->_initCheckout($quote);
132+
$quote->getPayment()->setAdditionalInformation(PayPalCheckout::PAYMENT_INFO_FUNDING_SOURCE, $fundingSource);
130133
/** Populate quote with information about billing and shipping addresses*/
131134
$this->_checkout->returnFromPaypal($tokenId, $payerId);
132135
if ($this->_checkout->canSkipOrderReviewStep()) {

app/code/Magento/Paypal/Model/Express/Checkout.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Checkout
4242
public const PAYMENT_INFO_TRANSPORT_PAYER_ID = 'paypal_express_checkout_payer_id';
4343
public const PAYMENT_INFO_TRANSPORT_REDIRECT = 'paypal_express_checkout_redirect_required';
4444
public const PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT = 'paypal_ec_create_ba';
45+
public const PAYMENT_INFO_FUNDING_SOURCE = 'paypal_funding_source';
4546

4647
/**
4748
* Flag which says that was used PayPal Express Checkout button for checkout

app/code/Magento/Paypal/Test/Mftf/Test/AdminRegionalLinkForPayLaterTest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,12 @@
4444
<argument name="enabledOption" value="Yes"/>
4545
<argument name="countryCode" value="us"/>
4646
</actionGroup>
47+
<selectOption selector="{{PaymentsConfigSection.merchantCountry}}" userInput="Italy" stepKey="setMerchantCountry4"/>
48+
<waitForPageLoad stepKey="waitForPageLoa4"/>
49+
<actionGroup ref="AdminPayPalRegionalLinkOtherActionGroup" stepKey="verifyPayPalCommentCommentLink4">
50+
<argument name="payPalConfigType" value="PayPalExpressCheckoutOtherCountryConfigSection"/>
51+
<argument name="enabledOption" value="Yes"/>
52+
<argument name="countryCode" value="it"/>
53+
</actionGroup>
4754
</test>
4855
</tests>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Paypal\ViewModel;
9+
10+
use Magento\Checkout\Model\Session;
11+
use Magento\Framework\View\Element\Block\ArgumentInterface;
12+
use Magento\Paypal\Model\Express\Checkout;
13+
14+
/**
15+
* Provides Paypal funding source data
16+
*
17+
*/
18+
class PaypalFundingSourceDataProvider implements ArgumentInterface
19+
{
20+
/**
21+
* @var Session
22+
*/
23+
private $checkoutSession;
24+
25+
/**
26+
* @param Session $checkoutSession
27+
*/
28+
public function __construct(
29+
Session $checkoutSession
30+
) {
31+
$this->checkoutSession = $checkoutSession;
32+
}
33+
34+
/**
35+
* Return paypal funding source
36+
*
37+
* @return string|null
38+
*/
39+
public function getPaypalFundingSource()
40+
{
41+
$quote = $this->checkoutSession->getQuote();
42+
if ($quote->getPayment()->getAdditionalInformation(Checkout::PAYMENT_INFO_FUNDING_SOURCE)) {
43+
return ucfirst($quote->getPayment()->getAdditionalInformation(
44+
Checkout::PAYMENT_INFO_FUNDING_SOURCE
45+
));
46+
}
47+
return null;
48+
}
49+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<config_path>payment/paypal_express/buyer_country</config_path>
109109
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
110110
<attribute type="shared">1</attribute>
111+
<tooltip>The buyer country determines which funding sources are eligible for a given buyer during testing.</tooltip>
111112
<depends>
112113
<field id="sandbox_flag">1</field>
113114
</depends>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<config_path>payment/payflow_advanced/buyer_country</config_path>
6161
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
6262
<attribute type="shared">1</attribute>
63+
<tooltip>The buyer country determines which funding sources are eligible for a given buyer during testing.</tooltip>
6364
<depends>
6465
<field id="sandbox_flag">1</field>
6566
</depends>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<label>Buyer Country</label>
6161
<config_path>payment/payflow_link/buyer_country</config_path>
6262
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
63+
<tooltip>The buyer country determines which funding sources are eligible for a given buyer during testing.</tooltip>
6364
<attribute type="shared">1</attribute>
6465
<depends>
6566
<field id="sandbox_flag">1</field>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<label>Buyer Country</label>
5656
<config_path>payment/payflowpro/buyer_country</config_path>
5757
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
58+
<tooltip>The buyer country determines which funding sources are eligible for a given buyer during testing.</tooltip>
5859
<attribute type="shared">1</attribute>
5960
<depends>
6061
<field id="sandbox_flag">1</field>

app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
</referenceContainer>
2121
<referenceContainer name="content">
2222
<block class="Magento\Paypal\Block\Express\Review" name="paypal.express.review" template="Magento_Paypal::express/review.phtml">
23+
<arguments>
24+
<argument name="PaypalFundingSourceDataProvider" xsi:type="object">Magento\Paypal\ViewModel\PaypalFundingSourceDataProvider</argument>
25+
</arguments>
2326
<block class="Magento\Paypal\Block\Express\Review" name="express.review.shipping.method" as="shipping_method" template="Magento_Paypal::express/review/shipping/method.phtml"/>
2427
<block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions">
2528
<block class="Magento\Checkout\Block\Cart\Coupon" name="paypal.cart.coupon" as="coupon" template="Magento_Checkout::cart/coupon.phtml"/>

0 commit comments

Comments
 (0)