Passed
Push — master ( 813c2b...31a484 )
by Ilya
05:35 queued 14s
created

getCheckoutPreConditionsForOrderAmendment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 25
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 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\ProductQuantity\Communication\Plugin\Checkout\ProductQuantityRestrictionCheckoutPreConditionPlugin;
49
use Spryker\Zed\QuoteCheckoutConnector\Communication\Plugin\Checkout\DisallowQuoteCheckoutPreSavePlugin;
50
use Spryker\Zed\Sales\Communication\Plugin\Checkout\DuplicateOrderCheckoutPreConditionPlugin;
51
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderItemsSaverPlugin;
52
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderSaverPlugin;
53
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderTotalsSaverPlugin;
54
use Spryker\Zed\Sales\Communication\Plugin\Checkout\UpdateOrderByQuoteCheckoutDoSaveOrderPlugin;
55
use Spryker\Zed\Sales\Communication\Plugin\SalesOrderExpanderPlugin;
56
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\OriginalOrderQuoteExpanderCheckoutPreSavePlugin;
57
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\QuoteToSaveOrderMapperCheckoutDoSaveOrderPlugin;
58
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin;
59
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin;
60
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\FinishOrderAmendmentCheckoutPostSavePlugin;
61
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\OrderAmendmentCheckoutPreCheckPlugin;
62
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\StartOrderAmendmentDraftCheckoutPostSavePlugin;
63
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\ReplaceSalesOrderThresholdExpensesCheckoutDoSaveOrderPlugin;
64
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\SalesOrderThresholdCheckoutPreConditionPlugin;
65
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\SalesOrderThresholdExpenseSavePlugin;
66
use Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\ReplaceSalesOrderPaymentCheckoutDoSaveOrderPlugin;
67
use Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\SalesPaymentCheckoutDoSaveOrderPlugin;
68
use Spryker\Zed\SalesShipmentType\Communication\Plugin\Checkout\ShipmentTypeCheckoutDoSaveOrderPlugin;
69
use Spryker\Zed\ServicePointCart\Communication\Plugin\Checkout\ServicePointCheckoutPreConditionPlugin;
70
use Spryker\Zed\Shipment\Communication\Plugin\Checkout\ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin;
71
use Spryker\Zed\Shipment\Communication\Plugin\Checkout\SalesOrderShipmentSavePlugin;
72
use Spryker\Zed\ShipmentCheckoutConnector\Communication\Plugin\Checkout\ShipmentCheckoutPreCheckPlugin;
73
use Spryker\Zed\ShipmentTypeCart\Communication\Plugin\Checkout\ShipmentTypeCheckoutPreConditionPlugin;
74
75
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
76
{
77
    /**
78
     * @param \Spryker\Zed\Kernel\Container $container
79
     *
80
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
81
     */
82
    protected function getCheckoutPreConditionsForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
83
    {
84
        return [
85
            new CustomerPreConditionCheckerPlugin(),
86
            new ProductsAvailableCheckoutPreConditionPlugin(),
87
            new GiftCardCheckoutPreConditionPlugin(),
88
            new NopaymentCheckoutPreConditionPlugin(),
89
            new DummyPaymentCheckoutPreConditionPlugin(),
90
            new ShipmentCheckoutPreCheckPlugin(),
91
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
92
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
93
            new ShipmentCheckoutPreCheckPlugin(),
94
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
95
            new DuplicateOrderCheckoutPreConditionPlugin(),
96
            new MerchantProductOptionCheckoutPreConditionPlugin(),
97
            new ProductConfigurationCheckoutPreConditionPlugin(),
98
            new ShipmentTypeCheckoutPreConditionPlugin(),
99
            new ServicePointCheckoutPreConditionPlugin(),
100
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
101
            new OrderAmendmentProductBundleAvailabilityCheckoutPreConditionPlugin(), #Order Amendment Feature
102
            new OrderAmendmentProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
103
            new OrderAmendmentProductOfferCheckoutPreConditionPlugin(),
104
            new OrderAmendmentProductExistsCheckoutPreConditionPlugin(),
105
            new OrderAmendmentProductApprovalCheckoutPreConditionPlugin(),
106
            new OrderAmendmentCheckoutPreCheckPlugin(),
107
        ];
108
    }
109
110
    /**
111
     * @param \Spryker\Zed\Kernel\Container $container
112
     *
113
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
114
     */
115
    protected function getCheckoutOrderSaversForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
116
    {
117
        return [
118
            new CustomerOrderSavePlugin(),
119
            new UpdateOrderByQuoteCheckoutDoSaveOrderPlugin(),
120
            new OrderTotalsSaverPlugin(),
121
            new ReleaseUsedCodesCheckoutDoSaveOrderPlugin(),
122
            new ShipmentTypeCheckoutDoSaveOrderPlugin(),
123
            new UpdateCartNoteCheckoutDoSaveOrderPlugin(),
124
            new ReplaceSalesOrderDiscountsCheckoutDoSaveOrderPlugin(),
125
            new ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin(),
126
            new SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin(),
127
            new SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin(),
128
            new ProductBundleOrderSaverPlugin(),
129
            new ReplaceSalesOrderPaymentCheckoutDoSaveOrderPlugin(),
130
            new GiftCardPaymentCheckoutDoSaveOrderPlugin(),
131
            new ReplaceSalesOrderThresholdExpensesCheckoutDoSaveOrderPlugin(),
132
        ];
133
    }
134
135
    /**
136
     * @param \Spryker\Zed\Kernel\Container $container
137
     *
138
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
139
     */
140
    protected function getCheckoutPreConditions(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
141
    {
142
        return [
143
            new CustomerPreConditionCheckerPlugin(),
144
            new ProductsAvailableCheckoutPreConditionPlugin(),
145
            new ProductBundleAvailabilityCheckoutPreConditionPlugin(),
146
            new GiftCardCheckoutPreConditionPlugin(),
147
            new NopaymentCheckoutPreConditionPlugin(),
148
            new DummyPaymentCheckoutPreConditionPlugin(),
149
            new ShipmentCheckoutPreCheckPlugin(),
150
            new ProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
151
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
152
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
153
            new ShipmentCheckoutPreCheckPlugin(),
154
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
155
            new DuplicateOrderCheckoutPreConditionPlugin(),
156
            new ProductOfferCheckoutPreConditionPlugin(),
157
            new MerchantProductOptionCheckoutPreConditionPlugin(),
158
            new ProductExistsCheckoutPreConditionPlugin(),
159
            new ProductApprovalCheckoutPreConditionPlugin(),
160
            new ProductConfigurationCheckoutPreConditionPlugin(),
161
            new ShipmentTypeCheckoutPreConditionPlugin(),
162
            new ServicePointCheckoutPreConditionPlugin(),
163
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
164
        ];
165
    }
166
167
    /**
168
     * @param \Spryker\Zed\Kernel\Container $container
169
     *
170
     * @return array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface>|array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
171
     */
172
    protected function getCheckoutOrderSavers(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
173
    {
174
        return [
175
            new CustomerOrderSavePlugin(),
176
            /*
177
             * Plugins
178
             * `OrderSaverPlugin`,
179
             * `OrderTotalsSaverPlugin`,
180
             * `SalesOrderShipmentSavePlugin`,
181
             * `ShipmentTypeCheckoutDoSaveOrderPlugin`
182
             * `OrderItemsSaverPlugin`,
183
             * `ProductConfigurationOrderSaverPlugin`
184
             * must be enabled in the strict order.
185
             */
186
            new OrderSaverPlugin(),
187
            new OrderTotalsSaverPlugin(),
188
            new SalesOrderShipmentSavePlugin(),
189
            new ShipmentTypeCheckoutDoSaveOrderPlugin(),
190
            new OrderItemsSaverPlugin(),
191
            new CartNoteSaverPlugin(), #CartNoteFeature
192
            new DiscountOrderSavePlugin(),
193
            new ProductBundleOrderSaverPlugin(),
194
            new SalesPaymentCheckoutDoSaveOrderPlugin(),
195
            new GiftCardPaymentCheckoutDoSaveOrderPlugin(),
196
            new SalesOrderThresholdExpenseSavePlugin(), #SalesOrderThresholdFeature
197
            new CustomerDiscountOrderSavePlugin(),
198
        ];
199
    }
200
201
    /**
202
     * @param \Spryker\Zed\Kernel\Container $container
203
     *
204
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
205
     */
206
    protected function getCheckoutPostHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
207
    {
208
        return [
209
            new DummyPaymentCheckoutPostSavePlugin(),
210
            new SendEmailToGiftCardUser(), #GiftCardFeature
211
            new PaymentAuthorizationCheckoutPostSavePlugin(),
212
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
213
            new FinishOrderAmendmentCheckoutPostSavePlugin(),
214
        ];
215
    }
216
217
    /**
218
     * @param \Spryker\Zed\Kernel\Container $container
219
     *
220
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
221
     */
222
    protected function getCheckoutPostHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
223
    {
224
        return [
225
            new DummyPaymentCheckoutPostSavePlugin(),
226
            new SendEmailToGiftCardUser(),
227
            new PaymentAuthorizationCheckoutPostSavePlugin(),
228
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
229
        ];
230
    }
231
232
    /**
233
     * @param \Spryker\Zed\Kernel\Container $container
234
     *
235
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
236
     */
237
    protected function getCheckoutPreSaveHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
238
    {
239
        return [
240
            new DisallowQuoteCheckoutPreSavePlugin(),
241
            new SalesOrderExpanderPlugin(),
242
            new OriginalOrderQuoteExpanderCheckoutPreSavePlugin(),
243
            new FilterOriginalOrderBundleItemCheckoutPreSavePlugin(),
244
            new PaymentToAsyncOrderAmendmentFlowCheckoutPreSavePlugin(), #Order Amendment Feature
245
        ];
246
    }
247
248
    /**
249
     * @param \Spryker\Zed\Kernel\Container $container
250
     *
251
     * @return array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
252
     */
253
    protected function getCheckoutPreSaveHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
254
    {
255
        return [
256
            new DisallowQuoteCheckoutPreSavePlugin(),
257
            new SalesOrderExpanderPlugin(),
258
        ];
259
    }
260
261
    /**
262
     * @param \Spryker\Zed\Kernel\Container $container
263
     *
264
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
265
     */
266
    protected function getCheckoutOrderSaversForOrderAmendmentAsync(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
267
    {
268
        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...
269
            new QuoteToSaveOrderMapperCheckoutDoSaveOrderPlugin(), #Order Amendment Feature
270
            new SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin(), #Order Amendment Feature
271
        ];
272
    }
273
274
    /**
275
     * @param \Spryker\Zed\Kernel\Container $container
276
     *
277
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
278
     */
279
    protected function getCheckoutPostHooksForOrderAmendmentAsync(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
280
    {
281
        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...
282
            new StartOrderAmendmentDraftCheckoutPostSavePlugin(), #Order Amendment Feature
283
        ];
284
    }
285
}
286