File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
app/code/Magento/Payment/Model Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 6
6
namespace Magento \Payment \Model ;
7
7
8
8
use Magento \Payment \Api \Data \PaymentMethodInterface ;
9
+ use UnexpectedValueException ;
9
10
10
11
/**
11
12
* Payment method list class.
@@ -39,12 +40,29 @@ public function __construct(
39
40
*/
40
41
public function getList ($ storeId )
41
42
{
42
- $ methodsInstances = $ this ->helper ->getStoreMethods ($ storeId );
43
+ $ methodsCodes = array_keys ($ this ->helper ->getPaymentMethods ());
44
+ $ methodsInstances = array_map (
45
+ function ($ code ) {
46
+ try {
47
+ return $ this ->helper ->getMethodInstance ($ code );
48
+ } catch (UnexpectedValueException $ e ) {
49
+ return null ;
50
+ }
51
+ },
52
+ $ methodsCodes
53
+ );
43
54
44
- $ methodsInstances = array_filter ($ methodsInstances , function (MethodInterface $ method ) {
45
- return !($ method instanceof \Magento \Payment \Model \Method \Substitution);
55
+ $ methodsInstances = array_filter ($ methodsInstances , function ($ method ) {
56
+ return $ method && !($ method instanceof \Magento \Payment \Model \Method \Substitution);
46
57
});
47
58
59
+ @uasort (
60
+ $ methodsInstances ,
61
+ function (MethodInterface $ a , MethodInterface $ b ) use ($ storeId ) {
62
+ return (int )$ a ->getConfigData ('sort_order ' , $ storeId ) - (int )$ b ->getConfigData ('sort_order ' , $ storeId );
63
+ }
64
+ );
65
+
48
66
$ methodList = array_map (
49
67
function (MethodInterface $ methodInstance ) use ($ storeId ) {
50
68
You can’t perform that action at this time.
0 commit comments