Passed
Push — master ( 73bf48...047dc7 )
by Ilya
05:56 queued 16s
created

getCheckoutPreConditionsForOrderAmendment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 28
rs 9.504
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\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\DummyPaymentCheckoutPreConditionPlugin;
26
use Spryker\Zed\Kernel\Container;
27
use Spryker\Zed\Merchant\Communication\Plugin\Checkout\MerchantCheckoutPreConditionPlugin;
28
use Spryker\Zed\MerchantProductOption\Communication\Plugin\Checkout\MerchantProductOptionCheckoutPreConditionPlugin;
29
use Spryker\Zed\Nopayment\Communication\Plugin\Checkout\NopaymentCheckoutPreConditionPlugin;
30
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentAuthorizationCheckoutPostSavePlugin;
31
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin;
32
use Spryker\Zed\Payment\Communication\Plugin\Checkout\PaymentMethodValidityCheckoutPreConditionPlugin;
33
use Spryker\Zed\ProductApproval\Communication\Plugin\Checkout\OrderAmendmentProductApprovalCheckoutPreConditionPlugin;
34
use Spryker\Zed\ProductApproval\Communication\Plugin\Checkout\ProductApprovalCheckoutPreConditionPlugin;
35
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\FilterOriginalOrderBundleItemCheckoutPreSavePlugin;
36
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\OrderAmendmentProductBundleAvailabilityCheckoutPreConditionPlugin;
37
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\ProductBundleAvailabilityCheckoutPreConditionPlugin;
38
use Spryker\Zed\ProductBundle\Communication\Plugin\Checkout\ProductBundleOrderSaverPlugin;
39
use Spryker\Zed\ProductCartConnector\Communication\Plugin\Checkout\OrderAmendmentProductExistsCheckoutPreConditionPlugin;
40
use Spryker\Zed\ProductCartConnector\Communication\Plugin\Checkout\ProductExistsCheckoutPreConditionPlugin;
41
use Spryker\Zed\ProductConfigurationCart\Communication\Plugin\Checkout\ProductConfigurationCheckoutPreConditionPlugin;
42
use Spryker\Zed\ProductDiscontinued\Communication\Plugin\Checkout\OrderAmendmentProductDiscontinuedCheckoutPreConditionPlugin;
43
use Spryker\Zed\ProductDiscontinued\Communication\Plugin\Checkout\ProductDiscontinuedCheckoutPreConditionPlugin;
44
use Spryker\Zed\ProductOffer\Communication\Plugin\Checkout\OrderAmendmentProductOfferCheckoutPreConditionPlugin;
45
use Spryker\Zed\ProductOffer\Communication\Plugin\Checkout\ProductOfferCheckoutPreConditionPlugin;
46
use Spryker\Zed\ProductPackagingUnit\Communication\Plugin\Checkout\AmountAvailabilityCheckoutPreConditionPlugin;
47
use Spryker\Zed\ProductQuantity\Communication\Plugin\Checkout\ProductQuantityRestrictionCheckoutPreConditionPlugin;
48
use Spryker\Zed\QuoteApproval\Communication\Plugin\Checkout\QuoteApprovalCheckoutPreConditionPlugin;
49
use Spryker\Zed\QuoteCheckoutConnector\Communication\Plugin\Checkout\DisallowedQuoteCheckoutPreConditionPlugin;
50
use Spryker\Zed\QuoteCheckoutConnector\Communication\Plugin\Checkout\DisallowQuoteCheckoutPreSavePlugin;
51
use Spryker\Zed\QuoteRequest\Communication\Plugin\Checkout\CloseQuoteRequestCheckoutPostSaveHookPlugin;
52
use Spryker\Zed\QuoteRequest\Communication\Plugin\Checkout\QuoteRequestPreCheckPlugin;
53
use Spryker\Zed\Sales\Communication\Plugin\Checkout\DuplicateOrderCheckoutPreConditionPlugin;
54
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderItemsSaverPlugin;
55
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderSaverPlugin;
56
use Spryker\Zed\Sales\Communication\Plugin\Checkout\OrderTotalsSaverPlugin;
57
use Spryker\Zed\Sales\Communication\Plugin\Checkout\UpdateOrderByQuoteCheckoutDoSaveOrderPlugin;
58
use Spryker\Zed\Sales\Communication\Plugin\SalesOrderExpanderPlugin;
59
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\OriginalOrderQuoteExpanderCheckoutPreSavePlugin;
60
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin;
61
use Spryker\Zed\SalesOrderAmendment\Communication\Plugin\Checkout\SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin;
62
use Spryker\Zed\SalesOrderAmendmentOms\Communication\Plugin\Checkout\OrderAmendmentCheckoutPreCheckPlugin;
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\Shipment\Communication\Plugin\Checkout\ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin;
70
use Spryker\Zed\Shipment\Communication\Plugin\Checkout\SalesOrderShipmentSavePlugin;
71
use Spryker\Zed\ShipmentCheckoutConnector\Communication\Plugin\Checkout\ShipmentCheckoutPreCheckPlugin;
72
73
class CheckoutDependencyProvider extends SprykerCheckoutDependencyProvider
74
{
75
    /**
76
     * @param \Spryker\Zed\Kernel\Container $container
77
     *
78
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
79
     */
80
    protected function getCheckoutPreConditions(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
81
    {
82
        return [
83
            new DisallowedQuoteCheckoutPreConditionPlugin(),
84
            new CustomerPreConditionCheckerPlugin(),
85
            new ProductsAvailableCheckoutPreConditionPlugin(),
86
            new ProductBundleAvailabilityCheckoutPreConditionPlugin(),
87
            new ShipmentCheckoutPreCheckPlugin(),
88
            new ProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
89
            new AmountAvailabilityCheckoutPreConditionPlugin(),
90
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
91
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
92
            new QuoteRequestPreCheckPlugin(),
93
            new QuoteApprovalCheckoutPreConditionPlugin(),
94
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
95
            new DuplicateOrderCheckoutPreConditionPlugin(),
96
            new ProductExistsCheckoutPreConditionPlugin(),
97
            new ProductOfferCheckoutPreConditionPlugin(),
98
            new MerchantProductOptionCheckoutPreConditionPlugin(),
99
            new ProductApprovalCheckoutPreConditionPlugin(),
100
            new ProductConfigurationCheckoutPreConditionPlugin(),
101
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
102
        ];
103
    }
104
105
    /**
106
     * @param \Spryker\Zed\Kernel\Container $container
107
     *
108
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreConditionPluginInterface>
109
     */
110
    protected function getCheckoutPreConditionsForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
111
    {
112
        return [
113
            new DisallowedQuoteCheckoutPreConditionPlugin(),
114
            new CustomerPreConditionCheckerPlugin(),
115
            new CustomerSalutationCheckoutPreConditionPlugin(),
116
            new CustomerAddressSalutationCheckoutPreConditionPlugin(),
117
            new ProductsAvailableCheckoutPreConditionPlugin(),
118
            new NopaymentCheckoutPreConditionPlugin(),
119
            new DummyPaymentCheckoutPreConditionPlugin(),
120
            new ShipmentCheckoutPreCheckPlugin(),
121
            new AmountAvailabilityCheckoutPreConditionPlugin(),
122
            new SalesOrderThresholdCheckoutPreConditionPlugin(), #SalesOrderThresholdFeature
123
            new VoucherDiscountMaxUsageCheckoutPreConditionPlugin(),
124
            new QuoteRequestPreCheckPlugin(),
125
            new QuoteApprovalCheckoutPreConditionPlugin(),
126
            new MerchantCheckoutPreConditionPlugin(),
127
            new PaymentMethodValidityCheckoutPreConditionPlugin(),
128
            new ProductConfigurationCheckoutPreConditionPlugin(),
129
            new DuplicateOrderCheckoutPreConditionPlugin(),
130
            new MerchantProductOptionCheckoutPreConditionPlugin(),
131
            new ProductQuantityRestrictionCheckoutPreConditionPlugin(),
132
            new OrderAmendmentProductBundleAvailabilityCheckoutPreConditionPlugin(), #Order Amendment Feature
133
            new OrderAmendmentProductDiscontinuedCheckoutPreConditionPlugin(), #ProductDiscontinuedFeature
134
            new OrderAmendmentProductOfferCheckoutPreConditionPlugin(),
135
            new OrderAmendmentProductExistsCheckoutPreConditionPlugin(),
136
            new OrderAmendmentProductApprovalCheckoutPreConditionPlugin(),
137
            new OrderAmendmentCheckoutPreCheckPlugin(),
138
        ];
139
    }
140
141
    /**
142
     * @param \Spryker\Zed\Kernel\Container $container
143
     *
144
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>|array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface>
145
     */
146
    protected function getCheckoutOrderSavers(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
147
    {
148
        return [
149
            new CustomerOrderSavePlugin(),
150
            /*
151
             * Plugins
152
             * `OrderSaverPlugin`,
153
             * `OrderTotalsSaverPlugin`,
154
             * `SalesOrderShipmentSavePlugin`,
155
             * `OrderItemsSaverPlugin`,
156
             * `ProductConfigurationOrderSaverPlugin`
157
             * must be enabled in the strict order.
158
             */
159
            new OrderSaverPlugin(),
160
            new OrderTotalsSaverPlugin(),
161
            new SalesOrderShipmentSavePlugin(),
162
            new OrderItemsSaverPlugin(),
163
            new CartNoteSaverPlugin(), #CartNoteFeature
164
            new DiscountOrderSavePlugin(),
165
            new ProductBundleOrderSaverPlugin(),
166
            new SalesPaymentCheckoutDoSaveOrderPlugin(),
167
            new SalesOrderThresholdExpenseSavePlugin(), #SalesOrderThresholdFeature
168
            new CustomerDiscountOrderSavePlugin(),
169
        ];
170
    }
171
172
    /**
173
     * @param \Spryker\Zed\Kernel\Container $container
174
     *
175
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutSaveOrderInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutDoSaveOrderInterface>
176
     */
177
    protected function getCheckoutOrderSaversForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
178
    {
179
        return [
180
            new CustomerOrderSavePlugin(),
181
            /*
182
             * Plugins
183
             * `UpdateOrderByQuoteCheckoutDoSaveOrderPlugin`,
184
             * `OrderTotalsSaverPlugin`,
185
             * `ShipmentTypeCheckoutDoSaveOrderPlugin`
186
             * `ReplaceSalesOrderDiscountsCheckoutDoSaveOrderPlugin`
187
             * `ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin`,
188
             * `SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin`,
189
             * must be enabled in the strict order.
190
             */
191
            new UpdateOrderByQuoteCheckoutDoSaveOrderPlugin(),
192
            new OrderTotalsSaverPlugin(),
193
            new ReleaseUsedCodesCheckoutDoSaveOrderPlugin(),
194
            new ShipmentTypeCheckoutDoSaveOrderPlugin(),
195
            new UpdateCartNoteCheckoutDoSaveOrderPlugin(), #CartNoteFeature
196
            new ReplaceSalesOrderDiscountsCheckoutDoSaveOrderPlugin(),
197
            new ReplaceSalesOrderShipmentCheckoutDoSaveOrderPlugin(),
198
            new SalesOrderAmendmentQuoteCheckoutDoSaveOrderPlugin(),
199
            new SalesOrderAmendmentItemsCheckoutDoSaveOrderPlugin(),
200
            new ProductBundleOrderSaverPlugin(),
201
            new ReplaceSalesOrderPaymentCheckoutDoSaveOrderPlugin(),
202
            new ReplaceSalesOrderThresholdExpensesCheckoutDoSaveOrderPlugin(), #SalesOrderThresholdFeature
203
        ];
204
    }
205
206
    /**
207
     * @param \Spryker\Zed\Kernel\Container $container
208
     *
209
     * @return array<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
210
     */
211
    protected function getCheckoutPostHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
212
    {
213
        return [
214
            new CloseQuoteRequestCheckoutPostSaveHookPlugin(),
215
            new PaymentAuthorizationCheckoutPostSavePlugin(),
216
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
217
        ];
218
    }
219
220
    /**
221
     * @param \Spryker\Zed\Kernel\Container $container
222
     *
223
     * @return list<\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPostSaveInterface>
224
     */
225
    protected function getCheckoutPostHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
226
    {
227
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...eckoutPostSavePlugin()) returns the type array<integer,Spryker\Ze...koutPostSaveHookPlugin> which is incompatible with the documented return type Pyz\Zed\Checkout\list.
Loading history...
228
            new CloseQuoteRequestCheckoutPostSaveHookPlugin(),
229
            new PaymentAuthorizationCheckoutPostSavePlugin(),
230
            new PaymentConfirmPreOrderPaymentCheckoutPostSavePlugin(),
231
        ];
232
    }
233
234
    /**
235
     * @param \Spryker\Zed\Kernel\Container $container
236
     *
237
     * @return array<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
238
     */
239
    protected function getCheckoutPreSaveHooks(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
240
    {
241
        return [
242
            new DisallowQuoteCheckoutPreSavePlugin(),
243
            new SalesOrderExpanderPlugin(),
244
        ];
245
    }
246
247
    /**
248
     * @param \Spryker\Zed\Kernel\Container $container
249
     *
250
     * @return list<\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveHookInterface|\Spryker\Zed\Checkout\Dependency\Plugin\CheckoutPreSaveInterface|\Spryker\Zed\CheckoutExtension\Dependency\Plugin\CheckoutPreSavePluginInterface>
251
     */
252
    protected function getCheckoutPreSaveHooksForOrderAmendment(Container $container): array // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
253
    {
254
        return [
255
            new DisallowQuoteCheckoutPreSavePlugin(),
256
            new SalesOrderExpanderPlugin(),
257
            new OriginalOrderQuoteExpanderCheckoutPreSavePlugin(),
258
            new FilterOriginalOrderBundleItemCheckoutPreSavePlugin(), #Order Amendment Feature
259
        ];
260
    }
261
}
262