Passed
Pull Request — master (#723)
by Fedets
09:15
created

getCheckoutPreConditionsForOrderAmendment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

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