File tree Expand file tree Collapse file tree 5 files changed +60
-15
lines changed Expand file tree Collapse file tree 5 files changed +60
-15
lines changed Original file line number Diff line number Diff line change 77namespace Magento \Paypal \Block \Express ;
88
99use Magento \Framework \Pricing \PriceCurrencyInterface ;
10- use Magento \Paypal \Model \Express \Checkout ;
1110use Magento \Quote \Model \Quote \Address \Rate ;
1211
1312/**
@@ -307,17 +306,4 @@ protected function _beforeToHtml()
307306
308307 return parent ::_beforeToHtml ();
309308 }
310-
311- /**
312- * Return paypal funding source
313- *
314- * @return string|null
315- */
316- public function getPaypalFundingSource ()
317- {
318- if ($ this ->_quote ->getPayment ()->getAdditionalInformation (Checkout::PAYMENT_INFO_FUNDING_SOURCE )) {
319- return ucfirst ($ this ->_quote ->getPayment ()->getAdditionalInformation (Checkout::PAYMENT_INFO_FUNDING_SOURCE ));
320- }
321- return null ;
322- }
323309}
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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" />
Original file line number Diff line number Diff line change 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 <action method =" setControllerPath" >
2427 <argument name =" prefix" xsi : type =" string" >paypal/payflowexpress</argument >
2528 </action >
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ use Magento\Paypal\Block\Express\Review;
1313 * @var Escaper $escaper
1414 * @var SecureHtmlRenderer $secureRenderer
1515 */
16+
17+ /** @var \Magento\Paypal\ViewModel\PaypalFundingSourceDataProvider $paypalFundingSourceDataProvider */
18+ $ paypalFundingSourceDataProvider = $ block ->getData ('PaypalFundingSourceDataProvider ' );
1619?>
1720<div class="paypal-review view">
1821 <div class="block block-order-details-view">
@@ -101,7 +104,8 @@ use Magento\Paypal\Block\Express\Review;
101104 <div class="box box-order-billing-address">
102105 <strong class="box-title"><span><?= $ escaper ->escapeHtml (__ ('Payment Method ' )) ?> </span></strong>
103106 <div class="box-content">
104- <?= $ escaper ->escapeHtml ($ block ->getPaypalFundingSource () ?? $ block ->getPaymentMethodTitle ()) ?> <br>
107+ <?= $ escaper ->escapeHtml ($ paypalFundingSourceDataProvider ->getPaypalFundingSource ()
108+ ?? $ block ->getPaymentMethodTitle ()) ?> <br>
105109 <?= $ escaper ->escapeHtml ($ block ->getEmail ()) ?> <br>
106110 <img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png"
107111 alt="<?= $ block ->escapeHtml (__ ('Buy now with PayPal ' )) ?> "/>
You can’t perform that action at this time.
0 commit comments