Skip to content

Commit 24dcb1a

Browse files
INTER-4299: V2 Orders not always Initialized as Default API Type (#291)
1 parent ba76c19 commit 24dcb1a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Model/Order/InitOrderFromQuote.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class InitOrderFromQuote
2424
private const INIT_URL = '/checkout/orders/{{shopId}}/init';
2525
private const INIT_SIMPLE_ORDER_URL = '/checkout_sidekick/{{shopId}}/order';
2626
private const FLOW_ID = 'Bold-Magento2';
27-
private const API_TYPE_DEFAULT = 'default';
28-
private const API_TYPE_SIMPLE = 'simple';
27+
public const API_TYPE_DEFAULT = 'default';
28+
public const API_TYPE_SIMPLE = 'simple';
2929

3030
/**
3131
* @var ClientInterface

Model/Quote/SetQuoteExtensionData.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,16 @@ public function execute(int $quoteId, array $data): void
6161
if (!$quoteExtensionData->getId()) {
6262
$quoteExtensionData->setQuoteId($quoteId);
6363
}
64+
$updated = false;
6465
foreach ($data as $key => $value) {
65-
$quoteExtensionData->setData($key, $value);
66+
if ($quoteExtensionData->getData($key) !== $value) {
67+
$quoteExtensionData->setData($key, $value);
68+
$updated = true;
69+
}
70+
}
71+
if ($updated) {
72+
$this->quoteExtensionDataResource->save($quoteExtensionData);
6673
}
67-
$this->quoteExtensionDataResource->save($quoteExtensionData);
6874
} catch (Exception $e) {
6975
$this->logger->error($e->getMessage());
7076
}

0 commit comments

Comments
 (0)