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 7
7
namespace Magento \Paypal \Block \Express ;
8
8
9
9
use Magento \Framework \Pricing \PriceCurrencyInterface ;
10
- use Magento \Paypal \Model \Express \Checkout ;
11
10
use Magento \Quote \Model \Quote \Address \Rate ;
12
11
13
12
/**
@@ -307,17 +306,4 @@ protected function _beforeToHtml()
307
306
308
307
return parent ::_beforeToHtml ();
309
308
}
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
- }
323
309
}
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 20
20
</referenceContainer >
21
21
<referenceContainer name =" content" >
22
22
<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 >
23
26
<block class =" Magento\Paypal\Block\Express\Review" name =" express.review.shipping.method" as =" shipping_method" template =" Magento_Paypal::express/review/shipping/method.phtml" />
24
27
<block class =" Magento\Framework\View\Element\Text\ListText" name =" paypal.additional.actions" >
25
28
<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 20
20
</referenceContainer >
21
21
<referenceContainer name =" content" >
22
22
<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 >
23
26
<action method =" setControllerPath" >
24
27
<argument name =" prefix" xsi : type =" string" >paypal/payflowexpress</argument >
25
28
</action >
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ use Magento\Paypal\Block\Express\Review;
13
13
* @var Escaper $escaper
14
14
* @var SecureHtmlRenderer $secureRenderer
15
15
*/
16
+
17
+ /** @var \Magento\Paypal\ViewModel\PaypalFundingSourceDataProvider $paypalFundingSourceDataProvider */
18
+ $ paypalFundingSourceDataProvider = $ block ->getData ('PaypalFundingSourceDataProvider ' );
16
19
?>
17
20
<div class="paypal-review view">
18
21
<div class="block block-order-details-view">
@@ -101,7 +104,8 @@ use Magento\Paypal\Block\Express\Review;
101
104
<div class="box box-order-billing-address">
102
105
<strong class="box-title"><span><?= $ escaper ->escapeHtml (__ ('Payment Method ' )) ?> </span></strong>
103
106
<div class="box-content">
104
- <?= $ escaper ->escapeHtml ($ block ->getPaypalFundingSource () ?? $ block ->getPaymentMethodTitle ()) ?> <br>
107
+ <?= $ escaper ->escapeHtml ($ paypalFundingSourceDataProvider ->getPaypalFundingSource ()
108
+ ?? $ block ->getPaymentMethodTitle ()) ?> <br>
105
109
<?= $ escaper ->escapeHtml ($ block ->getEmail ()) ?> <br>
106
110
<img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png"
107
111
alt="<?= $ block ->escapeHtml (__ ('Buy now with PayPal ' )) ?> "/>
You can’t perform that action at this time.
0 commit comments