29 lines
844 B
PHP
29 lines
844 B
PHP
|
|
<?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;
|
||
|
|
}
|