Skip to content

Commit

Permalink
[PT-1842] Handle transitionOrderState and transitionDeliveryState err…
Browse files Browse the repository at this point in the history
…ors gracefully.
  • Loading branch information
tikohov20 committed Sep 27, 2024
1 parent 9e9ff8e commit 081b493
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mondu/shopware6-payment",
"description": "Mondu payment for Shopware 6",
"version": "1.4.1",
"version": "1.4.2",
"type": "shopware-platform-plugin",
"license": "proprietary",
"authors": [
Expand Down
12 changes: 4 additions & 8 deletions src/Components/Webhooks/Service/WebhookService.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function handleDeclinedOrCanceled($params, $context): array
}
}

protected function transitionOrderState($externalReferenceId, $state, $context, $monduId = null): StateMachineStateCollection
protected function transitionOrderState($externalReferenceId, $state, $context, $monduId = null): ?StateMachineStateCollection
{
try {
return $this->stateMachineRegistry->transition(new Transition(
Expand All @@ -177,15 +177,13 @@ protected function transitionOrderState($externalReferenceId, $state, $context,
$state,
'stateId'
), $context);
} catch (MonduException $e) {
throw $e;
} catch (\Exception $e) {
$this->log('transitionOrderState Failed', [$externalReferenceId, $state], $e);
throw new MonduException($e->getMessage());
return null;
}
}

protected function transitionDeliveryState($externalReferenceId, $state, $context, $monduId = null): StateMachineStateCollection
protected function transitionDeliveryState($externalReferenceId, $state, $context, $monduId = null): ?StateMachineStateCollection
{
try {
$criteria = new Criteria([$this->getOrderUuid($externalReferenceId, $context, $monduId)]);
Expand All @@ -201,11 +199,9 @@ protected function transitionDeliveryState($externalReferenceId, $state, $contex
$state,
'stateId'
), $context);
} catch (MonduException $e) {
throw $e;
} catch (\Exception $e) {
$this->log('transitionDeliveryState Failed', [$externalReferenceId, $state], $e);
throw new MonduException($e->getMessage());
return null;
}
}

Expand Down

0 comments on commit 081b493

Please sign in to comment.