Skip to content

Commit

Permalink
Release 4.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrowanwallee committed Aug 18, 2021
1 parent ed1a5b4 commit 576822b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 4.0.6
- Fix for delivery state change error

# 4.0.5
- Fixed plugin uninstall action

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 4.0.6
- Fehler beim Ändern des Lieferstatus behoben

# 4.0.5
- Deinstallation Aktion des Plugins behoben

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tail -f var/log/wallee_payment*.log

## Documentation

[Documentation](https://plugin-documentation.wallee.com/wallee-payment/shopware-6/4.0.5/docs/en/documentation.html)
[Documentation](https://plugin-documentation.wallee.com/wallee-payment/shopware-6/4.0.6/docs/en/documentation.html)

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
"wallee/sdk": "3.0.1"
},
"type": "shopware-platform-plugin",
"version": "4.0.5"
"version": "4.0.6"
}
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/wallee-payment/shopware-6/releases/tag/4.0.5/">
<a href="https://github.com/wallee-payment/shopware-6/releases/tag/4.0.6/">
Source
</a>
</li>
Expand Down
25 changes: 20 additions & 5 deletions src/Core/Api/WebHooks/Controller/WebHookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Psr\Log\LoggerInterface;
use Shopware\Core\{
Checkout\Cart\Exception\OrderNotFoundException,
Checkout\Order\Aggregate\OrderDelivery\OrderDeliveryEntity,
Checkout\Order\Aggregate\OrderTransaction\OrderTransactionEntity,
Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStateHandler,
Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStates,
Expand Down Expand Up @@ -531,6 +532,7 @@ public function updateTransactionInvoice(WebHookRequest $callBackData, Context $
case TransactionInvoiceState::NOT_APPLICABLE:
case TransactionInvoiceState::PAID:
$this->orderTransactionStateHandler->paid($orderTransactionId, $context);
$this->unholdDelivery($orderTransactionId, $context);
break;
default:
break;
Expand Down Expand Up @@ -564,9 +566,16 @@ private function unholdDelivery(string $orderId, Context $context): void
/**
* @var OrderDeliveryStateHandler $orderDeliveryStateHandler
*/
$order = $this->getOrderEntity($orderId, $context);
$order = $this->getOrderEntity($orderId, $context);
/**
* @var OrderDeliveryEntity $orderDelivery
*/
$orderDelivery = $order->getDeliveries()->last();
if ($orderDelivery->getStateMachineState()->getTechnicalName() !== OrderDeliveryStateHandler::STATE_HOLD){
return;
}
$orderDeliveryStateHandler = $this->container->get(OrderDeliveryStateHandler::class);
$orderDeliveryStateHandler->unhold($order->getDeliveries()->last()->getId(), $context);
$orderDeliveryStateHandler->unhold($orderDelivery->getId(), $context);
} catch (\Exception $exception) {
$this->logger->info($exception->getMessage(), $exception->getTrace());
}
Expand Down Expand Up @@ -597,12 +606,18 @@ private function unholdAndCancelDelivery(string $orderId, Context $context): voi
* @var OrderDeliveryStateHandler $orderDeliveryStateHandler
*/
$orderDeliveryStateHandler = $this->container->get(OrderDeliveryStateHandler::class);
$orderDeliveryId = $order->getDeliveries()->last()->getId();
/**
* @var OrderDeliveryEntity $orderDelivery
*/
$orderDelivery = $order->getDeliveries()->last();
if ($orderDelivery->getStateMachineState()->getTechnicalName() !== OrderDeliveryStateHandler::STATE_HOLD){
return;
}
$orderDeliveryId = $orderDelivery->getId();
$orderDeliveryStateHandler->unhold($orderDeliveryId, $context);
$orderDeliveryStateHandler->cancel($orderDeliveryId, $context);
} catch (\Exception $exception) {
$this->logger->info($exception->getMessage(), $exception->getTrace());
}
}

}
}

0 comments on commit 576822b

Please sign in to comment.