This commit is contained in:
2026-04-08 23:22:48 +02:00
parent c5b2885b44
commit 633da52880
16 changed files with 765 additions and 95 deletions

View File

@@ -122,13 +122,13 @@ final class OrderImportRepository
integration_id, source, source_order_id, external_order_id, external_platform_id, external_platform_account_id,
external_status_id, external_payment_type_id, payment_status, external_carrier_id, external_carrier_account_id,
customer_login, is_invoice, is_encrypted, is_canceled_by_buyer, currency,
total_without_tax, total_with_tax, total_paid, send_date_min, send_date_max, ordered_at,
total_without_tax, total_with_tax, total_paid, delivery_price, send_date_min, send_date_max, ordered_at,
source_created_at, source_updated_at, preferences_json, payload_json, fetched_at
) VALUES (
:integration_id, :source, :source_order_id, :external_order_id, :external_platform_id, :external_platform_account_id,
:external_status_id, :external_payment_type_id, :payment_status, :external_carrier_id, :external_carrier_account_id,
:customer_login, :is_invoice, :is_encrypted, :is_canceled_by_buyer, :currency,
:total_without_tax, :total_with_tax, :total_paid, :send_date_min, :send_date_max, :ordered_at,
:total_without_tax, :total_with_tax, :total_paid, :delivery_price, :send_date_min, :send_date_max, :ordered_at,
:source_created_at, :source_updated_at, :preferences_json, :payload_json, :fetched_at
)'
);
@@ -168,6 +168,7 @@ final class OrderImportRepository
total_without_tax = :total_without_tax,
total_with_tax = :total_with_tax,
total_paid = :total_paid,
delivery_price = :delivery_price,
send_date_min = :send_date_min,
send_date_max = :send_date_max,
ordered_at = :ordered_at,
@@ -213,6 +214,7 @@ final class OrderImportRepository
'total_without_tax' => $orderData['total_without_tax'] ?? null,
'total_with_tax' => $orderData['total_with_tax'] ?? null,
'total_paid' => $orderData['total_paid'] ?? null,
'delivery_price' => $orderData['delivery_price'] ?? null,
'send_date_min' => $orderData['send_date_min'] ?? null,
'send_date_max' => $orderData['send_date_max'] ?? null,
'ordered_at' => $orderData['ordered_at'] ?? null,

View File

@@ -232,6 +232,7 @@ final class AllegroOrderImportService
'delivery_cost' => $delivery['cost'] ?? null,
'delivery_time' => $deliveryTime,
],
'delivery_price' => $this->resolveDeliveryCost($delivery),
'payload_json' => $payload,
'fetched_at' => $fetchedAt,
];
@@ -733,6 +734,21 @@ final class AllegroOrderImportService
return (float) $value;
}
/**
* @param array<string, mixed> $delivery
*/
private function resolveDeliveryCost(array $delivery): ?float
{
$cost = $delivery['cost'] ?? null;
if (is_array($cost)) {
return $this->amountToFloat($cost);
}
if (is_numeric($cost)) {
return (float) $cost;
}
return null;
}
/**
* @param array<string, mixed> $address
*/

View File

@@ -152,6 +152,7 @@ final class ShopproOrderMapper
'total_without_tax' => $totalNet,
'total_with_tax' => $totalGross,
'total_paid' => $totalPaid,
'delivery_price' => $transportCost,
'send_date_min' => null,
'send_date_max' => null,
'ordered_at' => $sourceCreatedAt,