File tree Expand file tree Collapse file tree 3 files changed +52
-2
lines changed Expand file tree Collapse file tree 3 files changed +52
-2
lines changed 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
+ namespace Magento \Payment \Plugin ;
7
+
8
+ use Magento \Framework \App \RequestInterface ;
9
+ use Magento \Sales \Model \AdminOrder \Create ;
10
+
11
+ /**
12
+ * Class PaymentConfigurationProcess
13
+ *
14
+ * Removes inactive payment methods and group from checkout configuration.
15
+ */
16
+ class AdminSetPaymentMethod
17
+ {
18
+ /**
19
+ * @param RequestInterface $request
20
+ */
21
+ public function __construct (
22
+ private readonly RequestInterface $ request
23
+ ) {
24
+ }
25
+
26
+ /**
27
+ * Checkout LayoutProcessor before process plugin.
28
+ *
29
+ * @param Create $subject
30
+ * @param $data
31
+ * @return void
32
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
33
+ */
34
+ public function beforeImportPostData (Create $ subject , $ data )
35
+ {
36
+ if (!isset ($ data ['payment_method ' ]) && !isset ($ this ->request ->getParam ('payment ' )['method ' ])) {
37
+ $ subject ->setPaymentMethod ('' );
38
+ }
39
+ }
40
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
9
+ <type name =" Magento\Sales\Model\AdminOrder\Create" >
10
+ <plugin name =" AdminSetPaymentMethod" type =" Magento\Payment\Plugin\AdminSetPaymentMethod" />
11
+ </type >
12
+ </config >
Original file line number Diff line number Diff line change @@ -1810,8 +1810,6 @@ public function importPostData($data)
1810
1810
1811
1811
if (isset ($ data ['payment_method ' ])) {
1812
1812
$ this ->setPaymentMethod ($ data ['payment_method ' ]);
1813
- } else {
1814
- $ this ->setPaymentMethod ('' );
1815
1813
}
1816
1814
1817
1815
if (isset ($ data ['coupon ' ]['code ' ])) {
You can’t perform that action at this time.
0 commit comments