Completed
Push — master ( 0541e3...1b0cb6 )
by Ilya
55s queued 18s
created

getCheckoutPreConditionsForOrderAmendment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
dl 0
loc 23
rs 9.584
c 1
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\CustomerAddressSalutationCheckoutPreConditionPlugin;
17
use Spryker\Zed\Customer\Communication\Plugin\Checkout\CustomerOrderSavePlugin;
18
use Spryker\Zed\Customer\Communication\Plugin\Checkout\CustomerSalutationCheckoutPreConditionPlugin;
19
use Spryker\Zed\Customer\Communication\Plugin\CustomerPreConditionCheckerPlugin;
20
use Spryker\Zed\CustomerDiscountConnector\Communication\Plugin\Checkout\CustomerDiscountOrderSavePlugin;
21
use Spryker\Zed\Discount\Communication\Plugin\Checkout\DiscountOrderSavePlugin;
22
use Spryker\Zed\Discount\Communication\Plugin\Checkout\ReleaseUsedCodesCheckoutDoSaveOrderPlugin;
23
use Spryker\Zed\Discount\Communication\Plugin\Checkout\ReplaceSalesOrderDiscountsCheckoutDoSaveOrderPlugin;
24
use Spryker\Zed\Discount\Communication\Plugin\Checkout\VoucherDiscountMaxUsageCheckoutPreConditionPlugin;
25
use Spryker\Zed\DummyPayment\Communication\Plugin\Checkout\DummyPaymentCheckoutPostSavePlugin;
26
use Spryker\Zed\DummyPayment\Communication\Plugin\Checkout\DummyPaymentCheckoutPreConditionPlugin;
27
use Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardCheckoutPreConditionPlugin;
28
use Spryker\Zed\GiftCard\Communication\Plugin\Checkout\GiftCardPaymentCheckoutDoSaveOrderPlugin;
29
use Spryker\Zed\GiftCardMailConnector\Communication\Plugin\Checkout\SendEmailToGiftCardUser;
30
use Spryker\Zed\Kernel\Container;
31
use Spryker\Zed\Nopayment\Communication\Plugin\Checkout\NopaymentCheckoutPreConditionPlugin;
32
use Spryker\Zed\OrderAmendmentExample\Communication\Plugin\Checkout\PaymentToAsyncOrderAmendmentFlowCheckoutPreSavePlugin;
33
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentAuthorizationCheckoutPostSavePlugin;
34
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin;
35
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentMethodValidityCheckoutPreConditionPlugin;
36
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\FilterOriginalOrderBundleItemCheckoutPreSavePlugin;
37
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\OrderAmendmentProductBundleAvailabilityCheckoutPreConditionPlugin;
38
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\ProductBundleAvailabilityCheckoutPreConditionPlugin;
39
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\ProductBundleOrderSaverPlugin;
40
use Spryker\Zed\ProductCartConnector\Communication\Plugin\Checkout\OrderAmendmentProductExistsCheckoutPreConditionPlugin;
41
use Spryker\Zed\ProductCartConnector\Communication\Plugin\Checkout\ProductExistsCheckoutPreConditionPlugin;
42
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Checkout\ProductConfigurationCheckoutPreConditionPlugin;
43
use Spryker\Zed\ProductDiscontinued\Communication\Plugin\Checkout\OrderAmendmentProductDiscontinuedCheckoutPreConditionPlugin;
44
use Spryker\Zed\ProductDiscontinued\Communication\Plugin\Checkout\ProductDiscontinuedCheckoutPreConditionPlugin;
45
use Spryker\Zed\ProductQuantity\Communication\Plugin\Checkout\ProductQuantityRestrictionCheckoutPreConditionPlugin;
46
use Spryker\Zed\QuoteCheckoutConnector\Communication\Plugin\Checkout\DisallowedQuoteCheckoutPreConditionPlugin;
47
use Spryker\Zed\QuoteCheckoutConnector\Communication\Plugin\Checkout\DisallowQuoteCheckoutPreSavePlugin;
48
use Spryker\Zed\Sales\Communication\Plugin\Checkout\DuplicateOrderCheckoutPreConditionPlugin;
49
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderItemsSaverPlugin;
50
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderSaverPlugin;
51
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderTotalsSaverPlugin;
52
use Spryker\Zed\Sales\Communication\Plugin\Checkout\UpdateOrderByQuoteCheckoutDoSaveOrderPlugin;
53
use Spryker\Zed\Sales\Communication\Plugin\SalesOrderExpanderPlugin;
54
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\OriginalOrderQuoteExpanderCheckoutPreSavePlugin;
55
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\QuoteToSaveOrderMapperCheckoutDoSaveOrderPlugin;
56
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin;
57
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin;
58
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\FinishOrderAmendmentCheckoutPostSavePlugin;
59
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\OrderAmendmentCheckoutPreCheckPlugin;
60
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\StartOrderAmendmentDraftCheckoutPostSavePlugin;
61
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\ReplaceSalesOrderThresholdExpensesCheckoutDoSaveOrderPlugin;
62
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\SalesOrderThresholdCheckoutPreConditionPlugin;
63
use Spryker\Zed\SalesOrderThreshold\Communication\Plugin\Checkout\SalesOrderThresholdExpenseSavePlugin;
64
use Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\ReplaceSalesOrderPaymentCheckoutDoSaveOrderPlugin;
65
use Spryker\Zed\SalesPayment\Communication\Plugin\Checkout\SalesPaymentCheckoutDoSaveOrderPlugin;
66
use Spryker\Zed\SalesShipmentType\Communication\Plugin\Checkout\ShipmentTypeCheckoutDoSaveOrderPlugin;
67
use Spryker\Zed\Shipment\Communication\Plugin\Checkout\ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin;
68
use Spryker\Zed\Shipment\Communication\Plugin\Checkout\SalesOrderShipmentSavePlugin;
69
use Spryker\Zed\ShipmentCheckoutConnector\Communication\Plugin\Checkout\ShipmentCheckoutPreCheckPlugin;
70
71
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
72
{
73
    /**
74
     * @param \Spryker\Zed\Kernel\Container $container
75
     *
76
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
0 ignored issues
show
Bug introduced by
The type Pyz\Zed\Checkout\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
77
     */
78
    protected function getCheckoutPreConditionsForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
79
    {
80
        return [
81
            new DisallowedQuoteCheckoutPreConditionPlugin(),
82
            new CustomerPreConditionCheckerPlugin(),
83
            new CustomerSalutationCheckoutPreConditionPlugin(),
84
            new CustomerAddressSalutationCheckoutPreConditionPlugin(),
85
            new ProductsAvailableCheckoutPreConditionPlugin(),
86
            new GiftCardCheckoutPreConditionPlugin(),
87
            new NopaymentCheckoutPreConditionPlugin(),
88
            new DummyPaymentCheckoutPreConditionPlugin(),
89
            new ShipmentCheckoutPreCheckPlugin(),
90
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
91
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
92
            new ShipmentCheckoutPreCheckPlugin(),
93
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
94
            new ProductConfigurationCheckoutPreConditionPlugin(),
95
            new DuplicateOrderCheckoutPreConditionPlugin(),
96
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
97
            new OrderAmendmentProductBundleAvailabilityCheckoutPreConditionPlugin(), #Order Amendment Feature
98
            new OrderAmendmentProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
99
            new OrderAmendmentProductExistsCheckoutPreConditionPlugin(),
100
            new OrderAmendmentCheckoutPreCheckPlugin(),
101
        ];
102
    }
103
104
    /**
105
     * @param \Spryker\Zed\Kernel\Container $container
106
     *
107
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
108
     */
109
    protected function getCheckoutOrderSaversForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
110
    {
111
        return [
112
            new CustomerOrderSavePlugin(),
113
            new UpdateOrderByQuoteCheckoutDoSaveOrderPlugin(),
114
            new OrderTotalsSaverPlugin(),
115
            new ReleaseUsedCodesCheckoutDoSaveOrderPlugin(),
116
            new ShipmentTypeCheckoutDoSaveOrderPlugin(),
117
            new UpdateCartNoteCheckoutDoSaveOrderPlugin(),
118
            new ReplaceSalesOrderDiscountsCheckoutDoSaveOrderPlugin(),
119
            new ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin(),
120
            new SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin(),
121
            new ProductBundleOrderSaverPlugin(),
122
            new ReplaceSalesOrderPaymentCheckoutDoSaveOrderPlugin(),
123
            new GiftCardPaymentCheckoutDoSaveOrderPlugin(),
124
            new ReplaceSalesOrderThresholdExpensesCheckoutDoSaveOrderPlugin(),
125
            new SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin(),
126
        ];
127
    }
128
129
    /**
130
     * @param \Spryker\Zed\Kernel\Container $container
131
     *
132
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
133
     */
134
    protected function getCheckoutPreSaveHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
135
    {
136
        return [
137
            new DisallowQuoteCheckoutPreSavePlugin(),
138
            new SalesOrderExpanderPlugin(),
139
            new OriginalOrderQuoteExpanderCheckoutPreSavePlugin(),
140
            new FilterOriginalOrderBundleItemCheckoutPreSavePlugin(),
141
            new PaymentToAsyncOrderAmendmentFlowCheckoutPreSavePlugin(), #Order Amendment Feature
142
        ];
143
    }
144
145
    /**
146
     * @param \Spryker\Zed\Kernel\Container $container
147
     *
148
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
149
     */
150
    protected function getCheckoutPostHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
151
    {
152
        return [
153
            new DummyPaymentCheckoutPostSavePlugin(),
154
            new SendEmailToGiftCardUser(),
155
            new PaymentAuthorizationCheckoutPostSavePlugin(),
156
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
157
        ];
158
    }
159
160
    /**
161
     * @param \Spryker\Zed\Kernel\Container $container
162
     *
163
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
164
     */
165
    protected function getCheckoutPreConditions(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
166
    {
167
        return [
168
            new DisallowedQuoteCheckoutPreConditionPlugin(),
169
            new CustomerPreConditionCheckerPlugin(),
170
            new CustomerSalutationCheckoutPreConditionPlugin(),
171
            new CustomerAddressSalutationCheckoutPreConditionPlugin(),
172
            new ProductsAvailableCheckoutPreConditionPlugin(),
173
            new ProductBundleAvailabilityCheckoutPreConditionPlugin(),
174
            new GiftCardCheckoutPreConditionPlugin(),
175
            new NopaymentCheckoutPreConditionPlugin(),
176
            new DummyPaymentCheckoutPreConditionPlugin(),
177
            new ShipmentCheckoutPreCheckPlugin(),
178
            new ProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
179
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
180
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
181
            new ShipmentCheckoutPreCheckPlugin(),
182
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
183
            new ProductConfigurationCheckoutPreConditionPlugin(),
184
            new DuplicateOrderCheckoutPreConditionPlugin(),
185
            new ProductExistsCheckoutPreConditionPlugin(),
186
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
187
        ];
188
    }
189
190
    /**
191
     * @param \Spryker\Zed\Kernel\Container $container
192
     *
193
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>|array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface>
194
     */
195
    protected function getCheckoutOrderSavers(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
196
    {
197
        return [
198
            new CustomerOrderSavePlugin(),
199
            /*
200
             * Plugins
201
             * `OrderSaverPlugin`,
202
             * `OrderTotalsSaverPlugin`,
203
             * `SalesOrderShipmentSavePlugin`,
204
             * `OrderItemsSaverPlugin`,
205
             * `ProductConfigurationOrderSaverPlugin`
206
             * must be enabled in the strict order.
207
             */
208
            new OrderSaverPlugin(),
209
            new OrderTotalsSaverPlugin(),
210
            new SalesOrderShipmentSavePlugin(),
211
            new OrderItemsSaverPlugin(),
212
            new CartNoteSaverPlugin(), #CartNoteFeature
213
            new DiscountOrderSavePlugin(),
214
            new ProductBundleOrderSaverPlugin(),
215
            new SalesPaymentCheckoutDoSaveOrderPlugin(),
216
            new GiftCardPaymentCheckoutDoSaveOrderPlugin(),
217
            new SalesOrderThresholdExpenseSavePlugin(), #SalesOrderThresholdFeature
218
            new CustomerDiscountOrderSavePlugin(),
219
        ];
220
    }
221
222
    /**
223
     * @param \Spryker\Zed\Kernel\Container $container
224
     *
225
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
226
     */
227
    protected function getCheckoutPostHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
228
    {
229
        return [
230
            new DummyPaymentCheckoutPostSavePlugin(),
231
            new SendEmailToGiftCardUser(), #GiftCardFeature
232
            new PaymentAuthorizationCheckoutPostSavePlugin(),
233
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
234
            new FinishOrderAmendmentCheckoutPostSavePlugin(),
235
        ];
236
    }
237
238
    /**
239
     * @param \Spryker\Zed\Kernel\Container $container
240
     *
241
     * @return array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
242
     */
243
    protected function getCheckoutPreSaveHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
244
    {
245
        return [
246
            new DisallowQuoteCheckoutPreSavePlugin(),
247
            new SalesOrderExpanderPlugin(),
248
        ];
249
    }
250
251
    /**
252
     * @param \Spryker\Zed\Kernel\Container $container
253
     *
254
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
255
     */
256
    protected function getCheckoutOrderSaversForOrderAmendmentAsync(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
257
    {
258
        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...
259
            new QuoteToSaveOrderMapperCheckoutDoSaveOrderPlugin(), #Order Amendment Feature
260
            new SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin(), #Order Amendment Feature
261
        ];
262
    }
263
264
    /**
265
     * @param \Spryker\Zed\Kernel\Container $container
266
     *
267
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
268
     */
269
    protected function getCheckoutPostHooksForOrderAmendmentAsync(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
270
    {
271
        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...
272
            new StartOrderAmendmentDraftCheckoutPostSavePlugin(), #Order Amendment Feature
273
        ];
274
    }
275
}
276