Passed
Pull Request — master (#608)
by Damir
05:59
created

CheckoutDependencyProvider   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 209
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 10
eloc 101
dl 0
loc 209
rs 10
c 1
b 1
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getCheckoutPostHooksForOrderAmendment() 0 7 1
A getCheckoutOrderSavers() 0 27 1
A getCheckoutPreConditionsForOrderAmendment() 0 25 1
A getCheckoutPostHooksForOrderAmendmentAsync() 0 4 1
A getCheckoutPostHooks() 0 8 1
A getCheckoutOrderSaversForOrderAmendmentAsync() 0 5 1
A getCheckoutPreConditions() 0 24 1
A getCheckoutPreSaveHooksForOrderAmendment() 0 8 1
A getCheckoutOrderSaversForOrderAmendment() 0 17 1
A getCheckoutPreSaveHooks() 0 5 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types = 1);
9
10
namespace Pyz\Zed\Checkout;
11
12
use Spryker\Zed\Availability\Communication\Plugin\ProductsAvailableCheckoutPreConditionPlugin;
13
use Spryker\Zed\CartNote\Communication\Plugin\Checkout\CartNoteSaverPlugin;
14
use Spryker\Zed\CartNote\Communication\Plugin\Checkout\UpdateCartNoteCheckoutDoSaveOrderPlugin;
15
use Spryker\Zed\Checkout\CheckoutDependencyProvider as SprykerCheckoutDependencyProvider;
16
use Spryker\Zed\Customer\Communication\Plugin\Checkout\CustomerOrderSavePlugin;
17
use Spryker\Zed\Customer\Communication\Plugin\CustomerPreConditionCheckerPlugin;
18
use Spryker\Zed\CustomerDiscountConnector\Communication\Plugin\Checkout\CustomerDiscountOrderSavePlugin;
19
use Spryker\Zed\Discount\Communication\Plugin\Checkout\DiscountOrderSavePlugin;
20
use Spryker\Zed\Discount\Communication\Plugin\Checkout\ReleaseUsedCodesCheckoutDoSaveOrderPlugin;
21
use Spryker\Zed\Discount\Communication\Plugin\Checkout\ReplaceSalesOrderDiscountsCheckoutDoSaveOrderPlugin;
22
use Spryker\Zed\Discount\Communication\Plugin\Checkout\VoucherDiscountMaxUsageCheckoutPreConditionPlugin;
23
use Spryker\Zed\DummyPayment\Communication\Plugin\Checkout\DummyPaymentCheckoutPostSavePlugin;
24
use Spryker\Zed\DummyPayment\Communication\Plugin\Checkout\DummyPaymentCheckoutPreConditionPlugin;
25
use Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutPreConditionPlugin;
26
use Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardPaymentCheckoutDoSaveOrderPlugin;
27
use Spryker\Zed\GiftCardMailConnector\Communication\Plugin\Checkout\SendEmailToGiftCardUser;
28
use Spryker\Zed\Kernel\Container;
29
use Spryker\Zed\MerchantProductOption\Communication\Plugin\Checkout\MerchantProductOptionCheckoutPreConditionPlugin;
30
use Spryker\Zed\Nopayment\Communication\Plugin\Checkout\NopaymentCheckoutPreConditionPlugin;
31
use Spryker\Zed\OrderAmendmentExample\Communication\Plugin\Checkout\PaymentToAsyncOrderAmendmentFlowCheckoutPreSavePlugin;
32
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentAuthorizationCheckoutPostSavePlugin;
33
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin;
34
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentMethodValidityCheckoutPreConditionPlugin;
35
use Spryker\Zed\ProductApproval\Communication\Plugin\Checkout\OrderAmendmentProductApprovalCheckoutPreConditionPlugin;
36
use Spryker\Zed\ProductApproval\Communication\Plugin\Checkout\ProductApprovalCheckoutPreConditionPlugin;
37
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\FilterOriginalOrderBundleItemCheckoutPreSavePlugin;
38
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\OrderAmendmentProductBundleAvailabilityCheckoutPreConditionPlugin;
39
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\ProductBundleAvailabilityCheckoutPreConditionPlugin;
40
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\ProductBundleOrderSaverPlugin;
41
use Spryker\Zed\ProductCartConnector\Communication\Plugin\Checkout\OrderAmendmentProductExistsCheckoutPreConditionPlugin;
42
use Spryker\Zed\ProductCartConnector\Communication\Plugin\Checkout\ProductExistsCheckoutPreConditionPlugin;
43
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Checkout\ProductConfigurationCheckoutPreConditionPlugin;
44
use Spryker\Zed\ProductDiscontinued\Communication\Plugin\Checkout\OrderAmendmentProductDiscontinuedCheckoutPreConditionPlugin;
45
use Spryker\Zed\ProductDiscontinued\Communication\Plugin\Checkout\ProductDiscontinuedCheckoutPreConditionPlugin;
46
use Spryker\Zed\ProductOffer\Communication\Plugin\Checkout\OrderAmendmentProductOfferCheckoutPreConditionPlugin;
47
use Spryker\Zed\ProductOffer\Communication\Plugin\Checkout\ProductOfferCheckoutPreConditionPlugin;
48
use Spryker\Zed\ProductOption\Communication\Plugin\Checkout\ProductOptionOrderSaverPlugin;
49
use Spryker\Zed\ProductQuantity\Communication\Plugin\Checkout\ProductQuantityRestrictionCheckoutPreConditionPlugin;
50
use Spryker\Zed\QuoteCheckoutConnector\Communication\Plugin\Checkout\DisallowQuoteCheckoutPreSavePlugin;
51
use Spryker\Zed\Sales\Communication\Plugin\Checkout\DuplicateOrderCheckoutPreConditionPlugin;
52
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderItemsSaverPlugin;
53
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderSaverPlugin;
54
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderTotalsSaverPlugin;
55
use Spryker\Zed\Sales\Communication\Plugin\Checkout\UpdateOrderByQuoteCheckoutDoSaveOrderPlugin;
56
use Spryker\Zed\Sales\Communication\Plugin\SalesOrderExpanderPlugin;
57
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\OriginalOrderQuoteExpanderCheckoutPreSavePlugin;
58
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\QuoteToSaveOrderMapperCheckoutDoSaveOrderPlugin;
59
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin;
60
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin;
61
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\FinishOrderAmendmentCheckoutPostSavePlugin;
62
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\OrderAmendmentCheckoutPreCheckPlugin;
63
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\StartOrderAmendmentDraftCheckoutPostSavePlugin;
64
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\ReplaceSalesOrderThresholdExpensesCheckoutDoSaveOrderPlugin;
65
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\SalesOrderThresholdCheckoutPreConditionPlugin;
66
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\SalesOrderThresholdExpenseSavePlugin;
67
use Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\ReplaceSalesOrderPaymentCheckoutDoSaveOrderPlugin;
68
use Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\SalesPaymentCheckoutDoSaveOrderPlugin;
69
use Spryker\Zed\SalesShipmentType\Communication\Plugin\Checkout\ShipmentTypeCheckoutDoSaveOrderPlugin;
70
use Spryker\Zed\ServicePointCart\Communication\Plugin\Checkout\ServicePointCheckoutPreConditionPlugin;
71
use Spryker\Zed\Shipment\Communication\Plugin\Checkout\ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin;
72
use Spryker\Zed\Shipment\Communication\Plugin\Checkout\SalesOrderShipmentSavePlugin;
73
use Spryker\Zed\ShipmentCheckoutConnector\Communication\Plugin\Checkout\ShipmentCheckoutPreCheckPlugin;
74
use Spryker\Zed\ShipmentTypeCart\Communication\Plugin\Checkout\ShipmentTypeCheckoutPreConditionPlugin;
75
76
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
77
{
78
    /**
79
     * @param \Spryker\Zed\Kernel\Container $container
80
     *
81
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
82
     */
83
    protected function getCheckoutPreConditionsForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
84
    {
85
        return [
86
            new CustomerPreConditionCheckerPlugin(),
87
            new ProductsAvailableCheckoutPreConditionPlugin(),
88
            new GiftCardCheckoutPreConditionPlugin(),
89
            new NopaymentCheckoutPreConditionPlugin(),
90
            new DummyPaymentCheckoutPreConditionPlugin(),
91
            new ShipmentCheckoutPreCheckPlugin(),
92
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
93
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
94
            new ShipmentCheckoutPreCheckPlugin(),
95
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
96
            new DuplicateOrderCheckoutPreConditionPlugin(),
97
            new MerchantProductOptionCheckoutPreConditionPlugin(),
98
            new ProductConfigurationCheckoutPreConditionPlugin(),
99
            new ShipmentTypeCheckoutPreConditionPlugin(),
100
            new ServicePointCheckoutPreConditionPlugin(),
101
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
102
            new OrderAmendmentProductBundleAvailabilityCheckoutPreConditionPlugin(), #Order Amendment Feature
103
            new OrderAmendmentProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
104
            new OrderAmendmentProductOfferCheckoutPreConditionPlugin(),
105
            new OrderAmendmentProductExistsCheckoutPreConditionPlugin(),
106
            new OrderAmendmentProductApprovalCheckoutPreConditionPlugin(),
107
            new OrderAmendmentCheckoutPreCheckPlugin(),
108
        ];
109
    }
110
111
    /**
112
     * @param \Spryker\Zed\Kernel\Container $container
113
     *
114
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
115
     */
116
    protected function getCheckoutOrderSaversForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
117
    {
118
        return [
119
            new CustomerOrderSavePlugin(),
120
            new UpdateOrderByQuoteCheckoutDoSaveOrderPlugin(),
121
            new OrderTotalsSaverPlugin(),
122
            new ReleaseUsedCodesCheckoutDoSaveOrderPlugin(),
123
            new ShipmentTypeCheckoutDoSaveOrderPlugin(),
124
            new UpdateCartNoteCheckoutDoSaveOrderPlugin(),
125
            new ReplaceSalesOrderDiscountsCheckoutDoSaveOrderPlugin(),
126
            new ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin(),
127
            new SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin(),
128
            new SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin(),
129
            new ProductBundleOrderSaverPlugin(),
130
            new ReplaceSalesOrderPaymentCheckoutDoSaveOrderPlugin(),
131
            new GiftCardPaymentCheckoutDoSaveOrderPlugin(),
132
            new ReplaceSalesOrderThresholdExpensesCheckoutDoSaveOrderPlugin(),
133
        ];
134
    }
135
136
    /**
137
     * @param \Spryker\Zed\Kernel\Container $container
138
     *
139
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
140
     */
141
    protected function getCheckoutPreConditions(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
142
    {
143
        return [
144
            new CustomerPreConditionCheckerPlugin(),
145
            new ProductsAvailableCheckoutPreConditionPlugin(),
146
            new ProductBundleAvailabilityCheckoutPreConditionPlugin(),
147
            new GiftCardCheckoutPreConditionPlugin(),
148
            new NopaymentCheckoutPreConditionPlugin(),
149
            new DummyPaymentCheckoutPreConditionPlugin(),
150
            new ShipmentCheckoutPreCheckPlugin(),
151
            new ProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
152
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
153
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
154
            new ShipmentCheckoutPreCheckPlugin(),
155
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
156
            new DuplicateOrderCheckoutPreConditionPlugin(),
157
            new ProductOfferCheckoutPreConditionPlugin(),
158
            new MerchantProductOptionCheckoutPreConditionPlugin(),
159
            new ProductExistsCheckoutPreConditionPlugin(),
160
            new ProductApprovalCheckoutPreConditionPlugin(),
161
            new ProductConfigurationCheckoutPreConditionPlugin(),
162
            new ShipmentTypeCheckoutPreConditionPlugin(),
163
            new ServicePointCheckoutPreConditionPlugin(),
164
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
165
        ];
166
    }
167
168
    /**
169
     * @param \Spryker\Zed\Kernel\Container $container
170
     *
171
     * @return array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface>|array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
172
     */
173
    protected function getCheckoutOrderSavers(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
174
    {
175
        return [
176
            new CustomerOrderSavePlugin(),
177
            /*
178
             * Plugins
179
             * `OrderSaverPlugin`,
180
             * `OrderTotalsSaverPlugin`,
181
             * `SalesOrderShipmentSavePlugin`,
182
             * `ShipmentTypeCheckoutDoSaveOrderPlugin`
183
             * `OrderItemsSaverPlugin`,
184
             * `ProductConfigurationOrderSaverPlugin`
185
             * must be enabled in the strict order.
186
             */
187
            new OrderSaverPlugin(),
188
            new OrderTotalsSaverPlugin(),
189
            new SalesOrderShipmentSavePlugin(),
190
            new ShipmentTypeCheckoutDoSaveOrderPlugin(),
191
            new OrderItemsSaverPlugin(),
192
            new CartNoteSaverPlugin(), #CartNoteFeature
193
            new ProductOptionOrderSaverPlugin(),
0 ignored issues
show
Deprecated Code introduced by
The class Spryker\Zed\ProductOptio...tOptionOrderSaverPlugin has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

193
            /** @scrutinizer ignore-deprecated */ new ProductOptionOrderSaverPlugin(),
Loading history...
194
            new DiscountOrderSavePlugin(),
195
            new ProductBundleOrderSaverPlugin(),
196
            new SalesPaymentCheckoutDoSaveOrderPlugin(),
197
            new GiftCardPaymentCheckoutDoSaveOrderPlugin(),
198
            new SalesOrderThresholdExpenseSavePlugin(), #SalesOrderThresholdFeature
199
            new CustomerDiscountOrderSavePlugin(),
200
        ];
201
    }
202
203
    /**
204
     * @param \Spryker\Zed\Kernel\Container $container
205
     *
206
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
207
     */
208
    protected function getCheckoutPostHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
209
    {
210
        return [
211
            new DummyPaymentCheckoutPostSavePlugin(),
212
            new SendEmailToGiftCardUser(), #GiftCardFeature
213
            new PaymentAuthorizationCheckoutPostSavePlugin(),
214
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
215
            new FinishOrderAmendmentCheckoutPostSavePlugin(),
216
        ];
217
    }
218
219
    /**
220
     * @param \Spryker\Zed\Kernel\Container $container
221
     *
222
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
223
     */
224
    protected function getCheckoutPostHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
225
    {
226
        return [
227
            new DummyPaymentCheckoutPostSavePlugin(),
228
            new SendEmailToGiftCardUser(),
229
            new PaymentAuthorizationCheckoutPostSavePlugin(),
230
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
231
        ];
232
    }
233
234
    /**
235
     * @param \Spryker\Zed\Kernel\Container $container
236
     *
237
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
238
     */
239
    protected function getCheckoutPreSaveHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
240
    {
241
        return [
242
            new DisallowQuoteCheckoutPreSavePlugin(),
243
            new SalesOrderExpanderPlugin(),
244
            new OriginalOrderQuoteExpanderCheckoutPreSavePlugin(),
245
            new FilterOriginalOrderBundleItemCheckoutPreSavePlugin(),
246
            new PaymentToAsyncOrderAmendmentFlowCheckoutPreSavePlugin(), #Order Amendment Feature
247
        ];
248
    }
249
250
    /**
251
     * @param \Spryker\Zed\Kernel\Container $container
252
     *
253
     * @return array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
254
     */
255
    protected function getCheckoutPreSaveHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
256
    {
257
        return [
258
            new DisallowQuoteCheckoutPreSavePlugin(),
259
            new SalesOrderExpanderPlugin(),
260
        ];
261
    }
262
263
    /**
264
     * @param \Spryker\Zed\Kernel\Container $container
265
     *
266
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
267
     */
268
    protected function getCheckoutOrderSaversForOrderAmendmentAsync(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
269
    {
270
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...outDoSaveOrderPlugin()) returns the type array<integer,Spryker\Ze...ckoutDoSaveOrderPlugin> which is incompatible with the documented return type Pyz\Zed\Checkout\list.
Loading history...
271
            new QuoteToSaveOrderMapperCheckoutDoSaveOrderPlugin(), #Order Amendment Feature
272
            new SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin(), #Order Amendment Feature
273
        ];
274
    }
275
276
    /**
277
     * @param \Spryker\Zed\Kernel\Container $container
278
     *
279
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
280
     */
281
    protected function getCheckoutPostHooksForOrderAmendmentAsync(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
282
    {
283
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...eckoutPostSavePlugin()) returns the type array<integer,Spryker\Ze...CheckoutPostSavePlugin> which is incompatible with the documented return type Pyz\Zed\Checkout\list.
Loading history...
284
            new StartOrderAmendmentDraftCheckoutPostSavePlugin(), #Order Amendment Feature
285
        ];
286
    }
287
}
288