Passed
Pull Request — master (#664)
by Fedets
05:18
created

getCheckoutOrderSaversForOrderAmendment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

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