Skip to content

Commit

Permalink
Added configuration check around function to reset shipping and amount
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinder van Bochove committed Aug 2, 2019
1 parent ce1c3fa commit ad0b00c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Components/Services/PaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -986,23 +986,23 @@ private function getPaymentsResultForOrder($mollieOrder = null)
* @throws \Exception
*/
private function resetStock(\Shopware\Models\Order\Order $order) {
// Reset shipping and invoice amount
if ($this->config->resetInvoiceAndShipping()) {
$order->setInvoiceShipping(0);
$order->setInvoiceShippingNet(0);
$order->setInvoiceAmount(0);
$order->setInvoiceAmountNet(0);
}

// Cancel failed orders
if ($this->config->autoResetStock()) {
// Cancel failed orders
/** @var \MollieShopware\Components\Services\BasketService $basketService */
$basketService = Shopware()->Container()->get('mollie_shopware.basket_service');

// Reset order quantity
foreach ($order->getDetails() as $orderDetail) {
$basketService->resetOrderDetailQuantity($orderDetail);
}

// Reset shipping and invoice amount
if ($this->config->resetInvoiceAndShipping()) {
$order->setInvoiceShipping(0);
$order->setInvoiceShippingNet(0);
$order->setInvoiceAmount(0);
$order->setInvoiceAmountNet(0);
}
}

// Store order
Expand Down

0 comments on commit ad0b00c

Please sign in to comment.