Skip to content

Commit 346ae41

Browse files
authored
[PT-1842] Handle transitionOrderState and transitionDeliveryState errors gracefully (#75)
1 parent 9e9ff8e commit 346ae41

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mondu/shopware6-payment",
33
"description": "Mondu payment for Shopware 6",
4-
"version": "1.4.1",
4+
"version": "1.4.2",
55
"type": "shopware-platform-plugin",
66
"license": "proprietary",
77
"authors": [

src/Components/Webhooks/Service/WebhookService.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function handleDeclinedOrCanceled($params, $context): array
168168
}
169169
}
170170

171-
protected function transitionOrderState($externalReferenceId, $state, $context, $monduId = null): StateMachineStateCollection
171+
protected function transitionOrderState($externalReferenceId, $state, $context, $monduId = null): ?StateMachineStateCollection
172172
{
173173
try {
174174
return $this->stateMachineRegistry->transition(new Transition(
@@ -177,15 +177,13 @@ protected function transitionOrderState($externalReferenceId, $state, $context,
177177
$state,
178178
'stateId'
179179
), $context);
180-
} catch (MonduException $e) {
181-
throw $e;
182180
} catch (\Exception $e) {
183181
$this->log('transitionOrderState Failed', [$externalReferenceId, $state], $e);
184-
throw new MonduException($e->getMessage());
182+
return null;
185183
}
186184
}
187185

188-
protected function transitionDeliveryState($externalReferenceId, $state, $context, $monduId = null): StateMachineStateCollection
186+
protected function transitionDeliveryState($externalReferenceId, $state, $context, $monduId = null): ?StateMachineStateCollection
189187
{
190188
try {
191189
$criteria = new Criteria([$this->getOrderUuid($externalReferenceId, $context, $monduId)]);
@@ -201,11 +199,9 @@ protected function transitionDeliveryState($externalReferenceId, $state, $contex
201199
$state,
202200
'stateId'
203201
), $context);
204-
} catch (MonduException $e) {
205-
throw $e;
206202
} catch (\Exception $e) {
207203
$this->log('transitionDeliveryState Failed', [$externalReferenceId, $state], $e);
208-
throw new MonduException($e->getMessage());
204+
return null;
209205
}
210206
}
211207

0 commit comments

Comments
 (0)