Skip to content

Commit

Permalink
INTER-4299: V2 Orders not always Initialized as Default API Type (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-bystritskyi authored Jul 19, 2024
1 parent ba76c19 commit 24dcb1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Model/Order/InitOrderFromQuote.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class InitOrderFromQuote
private const INIT_URL = '/checkout/orders/{{shopId}}/init';
private const INIT_SIMPLE_ORDER_URL = '/checkout_sidekick/{{shopId}}/order';
private const FLOW_ID = 'Bold-Magento2';
private const API_TYPE_DEFAULT = 'default';
private const API_TYPE_SIMPLE = 'simple';
public const API_TYPE_DEFAULT = 'default';
public const API_TYPE_SIMPLE = 'simple';

/**
* @var ClientInterface
Expand Down
10 changes: 8 additions & 2 deletions Model/Quote/SetQuoteExtensionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,16 @@ public function execute(int $quoteId, array $data): void
if (!$quoteExtensionData->getId()) {
$quoteExtensionData->setQuoteId($quoteId);
}
$updated = false;
foreach ($data as $key => $value) {
$quoteExtensionData->setData($key, $value);
if ($quoteExtensionData->getData($key) !== $value) {
$quoteExtensionData->setData($key, $value);
$updated = true;
}
}
if ($updated) {
$this->quoteExtensionDataResource->save($quoteExtensionData);
}
$this->quoteExtensionDataResource->save($quoteExtensionData);
} catch (Exception $e) {
$this->logger->error($e->getMessage());
}
Expand Down

0 comments on commit 24dcb1a

Please sign in to comment.