add order item constraint to order parse

This commit is contained in:
2025-12-15 15:22:22 +08:00
parent 651de05bb5
commit 47b5fe2f8a
5 changed files with 358 additions and 42 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace App\Platform;
/**
* 订单解析器契约接口
*
* 定义所有电商平台订单解析器必须实现的方法
* 适用于:Shopee、Tmall、JD 等所有电商平台
*/
interface OrderContract
{
/**
* 解析订单子项数据
*
* @param array $orderItems 原始订单子项数组
* @param string $platformOrderId 平台订单 ID
* @return array 解析后的订单子项数据数组,每个元素包含:
* - company_id, platform_id, store_id
* - platform_order_id, sub_order_id
* - product_id, platform_product_id
* - unit_price, quantity, discount, total
* 等字段
*/
public function parseOrderItems(array $orderItems, string $platformOrderId): array;
}