update
This commit is contained in:
@@ -44,10 +44,13 @@ final class OrderImportRepository
|
||||
|
||||
$this->replaceAddresses($orderId, $addresses);
|
||||
$this->replaceItems($orderId, $items);
|
||||
$this->replacePayments($orderId, $payments);
|
||||
$this->replaceShipments($orderId, $shipments);
|
||||
$this->replaceNotes($orderId, $notes);
|
||||
$this->replaceStatusHistory($orderId, $statusHistory);
|
||||
|
||||
if ($created) {
|
||||
$this->replacePayments($orderId, $payments);
|
||||
$this->replaceShipments($orderId, $shipments);
|
||||
$this->replaceStatusHistory($orderId, $statusHistory);
|
||||
}
|
||||
|
||||
$this->pdo->commit();
|
||||
} catch (Throwable $exception) {
|
||||
|
||||
@@ -236,14 +236,30 @@ final class ShopproOrdersSyncService
|
||||
} else {
|
||||
$result['imported_updated'] = (int) $result['imported_updated'] + 1;
|
||||
}
|
||||
$this->orders->recordActivity(
|
||||
(int) ($save['order_id'] ?? 0),
|
||||
'import',
|
||||
'Import zamowienia z shopPRO',
|
||||
['integration_id' => $integrationId, 'source_order_id' => $sourceOrderId],
|
||||
'import',
|
||||
'shopPRO'
|
||||
);
|
||||
$wasCreated = !empty($save['created']);
|
||||
$savedOrderId = (int) ($save['order_id'] ?? 0);
|
||||
$summary = $wasCreated
|
||||
? 'Import zamowienia z shopPRO'
|
||||
: 'Zaktualizowano zamowienie z shopPRO (re-import)';
|
||||
$details = [
|
||||
'integration_id' => $integrationId,
|
||||
'source_order_id' => $sourceOrderId,
|
||||
'source_updated_at' => $sourceUpdatedAt,
|
||||
'created' => $wasCreated,
|
||||
'trigger' => 'orders_sync',
|
||||
'trigger_label' => 'Synchronizacja zamowien',
|
||||
];
|
||||
|
||||
if (!$this->orders->shouldSkipDuplicateImportActivity($savedOrderId, $details)) {
|
||||
$this->orders->recordActivity(
|
||||
$savedOrderId,
|
||||
'import',
|
||||
$summary,
|
||||
$details,
|
||||
'import',
|
||||
'shopPRO'
|
||||
);
|
||||
}
|
||||
} catch (Throwable $exception) {
|
||||
$result['failed'] = (int) $result['failed'] + 1;
|
||||
$errors = is_array($result['errors']) ? $result['errors'] : [];
|
||||
|
||||
Reference in New Issue
Block a user