@@ -55,6 +55,13 @@ class SdkUrl
55
55
*/
56
56
private $ unsupportedPaymentMethods ;
57
57
58
+ /**
59
+ * These payment methods will be added as parameters to the SDK url to enable them.
60
+ *
61
+ * @var array
62
+ */
63
+ private $ supportedPaymentMethods ;
64
+
58
65
/**
59
66
* @var ResolverInterface
60
67
*/
@@ -74,14 +81,16 @@ class SdkUrl
74
81
* @param StoreManagerInterface $storeManager
75
82
* @param array $disallowedFundingMap
76
83
* @param array $unsupportedPaymentMethods
84
+ * @param array $supportedPaymentMethods
77
85
*/
78
86
public function __construct (
79
87
ResolverInterface $ localeResolver ,
80
88
ConfigFactory $ configFactory ,
81
89
ScopeConfigInterface $ scopeConfig ,
82
90
StoreManagerInterface $ storeManager ,
83
91
$ disallowedFundingMap = [],
84
- $ unsupportedPaymentMethods = []
92
+ $ unsupportedPaymentMethods = [],
93
+ $ supportedPaymentMethods = []
85
94
) {
86
95
$ this ->localeResolver = $ localeResolver ;
87
96
$ this ->config = $ configFactory ->create ();
@@ -90,6 +99,7 @@ public function __construct(
90
99
$ this ->storeManager = $ storeManager ;
91
100
$ this ->disallowedFundingMap = $ disallowedFundingMap ;
92
101
$ this ->unsupportedPaymentMethods = $ unsupportedPaymentMethods ;
102
+ $ this ->supportedPaymentMethods = $ supportedPaymentMethods ;
93
103
}
94
104
95
105
/**
@@ -116,6 +126,7 @@ public function getUrl(): string
116
126
$ params ['intent ' ] = $ this ->getIntent ();
117
127
$ params ['merchant-id ' ] = $ this ->config ->getValue ('merchant_id ' );
118
128
$ params ['disable-funding ' ] = $ this ->getDisallowedFunding ();
129
+ $ params ['enable-funding ' ] = $ this ->getAllowedFunding ();
119
130
$ params = array_replace ($ params , $ this ->queryParams );
120
131
}
121
132
$ params ['components ' ] = implode (', ' , $ components );
@@ -198,6 +209,16 @@ private function getDisallowedFunding()
198
209
return implode (', ' , $ result );
199
210
}
200
211
212
+ /**
213
+ * Returns allowed funding from configuration
214
+ *
215
+ * @return string
216
+ */
217
+ private function getAllowedFunding ()
218
+ {
219
+ return implode (', ' , $ this ->supportedPaymentMethods );
220
+ }
221
+
201
222
/**
202
223
* Returns if is allowed PayPal Guest Checkout.
203
224
*
0 commit comments