Skip to content

Commit 53c38b4

Browse files
authored
Include changes from 2.1.2 release (#3)
1 parent 4cc5521 commit 53c38b4

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

Components/MonduApi/Service/MonduClient.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ public function createOrder($order, $returnUrl, $cancelUrl, $declineUrl, $paymen
5454
* @return array|null
5555
* @throws RequestException
5656
*/
57-
public function confirmMonduOrder($orderUid): ?array {
58-
$response = $this->sendRequest('post', 'orders/'. $orderUid . '/confirm', null, 'CONFIRM_ORDER');
57+
public function confirmMonduOrder($orderUid, $orderNumber = null): ?array {
58+
$body = null;
59+
if ($orderNumber) {
60+
$body = [
61+
'external_reference_id' => $orderNumber
62+
];
63+
}
64+
$response = $this->sendRequest('post', 'orders/'. $orderUid . '/confirm', json_encode($body), 'CONFIRM_ORDER');
5965
return $response['order'] ?? null;
6066
}
6167

Controllers/Frontend/Mondu.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ public function returnAction()
111111
}
112112

113113
$orderUid = $this->request->get('order_uuid');
114-
$monduOrder = $this->monduClient->confirmMonduOrder($orderUid);
114+
$orderNumber = $this->saveOrder($orderUid, $orderUid, Status::PAYMENT_STATE_OPEN);
115+
$monduOrder = $this->monduClient->confirmMonduOrder($orderUid, $orderNumber);
115116

116117
if (!$monduOrder || !$this->isMonduOrderSuccessful($monduOrder['state'])) {
117118
$this->handleError('Mondu: Unable to confirm the Order');
@@ -120,24 +121,15 @@ public function returnAction()
120121

121122
switch ($monduOrder['state']) {
122123
case PaymentMethods::MONDU_STATE_CONFIRMED:
123-
$orderNumber = $this->saveOrder(
124-
$orderUid,
125-
$orderUid,
126-
self::PAYMENTSTATUSPAID
127-
);
124+
$this->savePaymentStatus($orderUid, $orderUid, Status::PAYMENT_STATE_COMPLETELY_PAID);
128125
break;
129126
default:
130-
$orderNumber = $this->saveOrder(
131-
$orderUid,
132-
$orderUid,
133-
Status::PAYMENT_STATE_REVIEW_NECESSARY
134-
);
127+
$this->savePaymentStatus($orderUid, $orderUid, Status::PAYMENT_STATE_REVIEW_NECESSARY);
135128
}
136129

137-
130+
$monduOrder = $this->orderHelper->getMonduOrder($orderUid);
138131
$repo = $this->getModelManager()->getRepository(Order::class);
139132
$order = $repo->findOneBy(['number' => $orderNumber]);
140-
$monduOrder = $this->orderHelper->updateExternalInfoOrder($order);
141133

142134
$this->updateShopwareOrder($order,
143135
[

plugin.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<label lang="en">Mondu Payment</label>
66
<label lang="de">Mondu Payment</label>
77

8-
<version>2.1.1</version>
8+
<version>2.1.2</version>
99
<copyright>(c) Mondu GmbH</copyright>
1010
<author>Mondu GmbH</author>
1111
<link>https://mondu.ai</link>
@@ -15,6 +15,11 @@
1515
<description lang="en">This module offers you Mondu as a checkout option</description>
1616
<description lang="de">This module offers you Mondu as a checkout option</description>
1717

18+
<changelog version="2.1.2">
19+
<changes lang="en">Bugfixes and improvements</changes>
20+
<changes lang="de">Bugfixes and improvements</changes>
21+
</changelog>
22+
1823
<changelog version="2.1.1">
1924
<changes lang="en">Bugfixes and improvements</changes>
2025
<changes lang="de">Bugfixes and improvements</changes>

0 commit comments

Comments
 (0)