@@ -45,21 +45,29 @@ class OrderHelper
45
45
*/
46
46
private CollectionFactory $ collectionFactory ;
47
47
48
+ /**
49
+ * @var SystemConfig
50
+ */
51
+ private SystemConfig $ systemConfig ;
52
+
48
53
/**
49
54
* Constructor
50
55
*
51
56
* @param OrderExtensionFactory $orderExtensionFactory
52
57
* @param FacebookOrderInterfaceFactory $facebookOrderFactory
53
58
* @param CollectionFactory $collectionFactory
59
+ * @param SystemConfig $systemConfig
54
60
*/
55
61
public function __construct (
56
62
OrderExtensionFactory $ orderExtensionFactory ,
57
63
FacebookOrderInterfaceFactory $ facebookOrderFactory ,
58
- CollectionFactory $ collectionFactory
64
+ CollectionFactory $ collectionFactory ,
65
+ SystemConfig $ systemConfig
59
66
) {
60
67
$ this ->orderExtensionFactory = $ orderExtensionFactory ;
61
68
$ this ->facebookOrderFactory = $ facebookOrderFactory ;
62
69
$ this ->collectionFactory = $ collectionFactory ;
70
+ $ this ->systemConfig = $ systemConfig ;
63
71
}
64
72
65
73
/**
@@ -149,4 +157,18 @@ public function getMBEInstalledConfigsByExternalBusinessId(string $externalBusin
149
157
return [];
150
158
}
151
159
}
160
+
161
+ /**
162
+ * Throws an exception if dynamic checkout apis are not enabled
163
+ *
164
+ * @return void
165
+ */
166
+ public function checkDynamicCheckoutConfig (): void
167
+ {
168
+ if (!$ this ->systemConfig ->areDynamicCheckoutApisEnabled ()) {
169
+ throw new LocalizedException (__ (
170
+ "Dynamic Checkout APIs are not enabled "
171
+ ));
172
+ }
173
+ }
152
174
}
0 commit comments