8
8
use Mollie \Api \Types \OrderLineType ;
9
9
use Psr \Log \LoggerInterface ;
10
10
use Shopware \Core \Checkout \Cart \LineItem \LineItem ;
11
- use Shopware \Core \Checkout \Cart \Price \Struct \CalculatedPrice ;
12
11
use Shopware \Core \Checkout \Cart \Price \Struct \CartPrice ;
13
12
use Shopware \Core \Checkout \Cart \Tax \Struct \CalculatedTax ;
14
13
use Shopware \Core \Checkout \Cart \Tax \Struct \CalculatedTaxCollection ;
15
- use Shopware \Core \Checkout \Cart \Tax \TaxCalculator ;
16
14
use Shopware \Core \Checkout \Order \Aggregate \OrderLineItem \OrderLineItemEntity ;
17
15
use Shopware \Core \Checkout \Order \OrderEntity ;
18
16
use Shopware \Core \Checkout \Promotion \Cart \PromotionProcessor ;
19
17
use Shopware \Core \Framework \Context ;
20
- use Shopware \Core \Framework \DataAbstractionLayer \EntityRepository ;
21
18
use Shopware \Core \Framework \DataAbstractionLayer \EntityRepositoryInterface ;
22
19
use Shopware \Core \Framework \DataAbstractionLayer \Search \Criteria ;
23
20
use Shopware \Core \Framework \DataAbstractionLayer \Search \Filter \EqualsFilter ;
@@ -146,19 +143,7 @@ public function getOrderLinesArray(OrderEntity $order): array
146
143
$ sku = $ item ->getProduct ()->getProductNumber ();
147
144
}
148
145
149
- try {
150
- $ molliePreparedApiPrices = $ this ->calculateLineItemPriceData ($ item , $ order ->getTaxStatus (), $ currencyCode );
151
- } catch (MissingPriceLineItemException $ e ) {
152
- $ this ->logger ->critical (
153
- sprintf (
154
- 'The order could not be prepared for mollie api. The LineItem with id (%s), sku (%s) has no prices ' ,
155
- $ item ->getId (),
156
- (string )$ sku
157
- )
158
- );
159
-
160
- throw $ e ;
161
- }
146
+ $ molliePreparedApiPrices = $ this ->calculateLineItemPriceData ($ item , $ order ->getTaxStatus (), $ currencyCode );
162
147
163
148
// Get the image
164
149
$ imageUrl = null ;
@@ -298,6 +283,11 @@ public function calculateLineItemPriceData(OrderLineItemEntity $item, string $or
298
283
$ vatRate = $ itemTax ->getTaxRate ();
299
284
}
300
285
286
+ // Remove VAT if the order is tax free
287
+ if ($ orderTaxType === CartPrice::TAX_STATE_FREE ) {
288
+ $ vatRate = 0.0 ;
289
+ }
290
+
301
291
$ unitPrice = $ price ->getUnitPrice ();
302
292
$ lineItemTotalPrice = $ item ->getTotalPrice ();
303
293
@@ -312,10 +302,6 @@ public function calculateLineItemPriceData(OrderLineItemEntity $item, string $or
312
302
313
303
$ unitPrice = round ($ unitPrice , self ::MOLLIE_PRICE_PRECISION );
314
304
315
- // Remove VAT if the order is tax free
316
- if ($ orderTaxType === CartPrice::TAX_STATE_FREE ) {
317
- $ vatRate = 0.0 ;
318
- }
319
305
320
306
$ roundedLineItemTotalPrice = round ($ lineItemTotalPrice , self ::MOLLIE_PRICE_PRECISION );
321
307
$ roundedVatRate = round ($ vatRate , self ::MOLLIE_PRICE_PRECISION );
0 commit comments