add contract for order parse

This commit is contained in:
2026-03-05 09:47:22 +08:00
parent 947c868cd4
commit d93fdee203
5 changed files with 49 additions and 92 deletions
+24 -9
View File
@@ -13,16 +13,31 @@ namespace App\Platform;
interface OrderContract
{
/**
* 解析订单子项数据
* 从原始数据格式化订单子项
*
* @param array $orderItems 原始订单子项数组
* @param string $platformOrderId 平台订单 ID
* @param array $raw_data 原始数据数组
* @param array $platform_orders_id_to_local_db_order_id_map 平台订单 ID => 本地数据库订单 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
* 等字段
* - 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;
public function formatOrderItemsFromRaw(array $raw_data, array $platform_orders_id_to_local_db_order_id_map): array;
/**
* 获取本地订单状态 ID
*
* @param string $platform_order_status 平台订单状态字符串
* @return int 本地订单状态 ID
*/
public function getOrderStatusId(string $platform_order_status): int;
/**
* 获取支付方式 ID
*
* @return int 支付方式 ID
*/
public function getPaymentMethodId(): int;
}