add contract for order parse
This commit is contained in:
@@ -111,26 +111,6 @@ class OrderConsumer extends ConsumerMessage
|
||||
|
||||
dump("Processing " . count($data_to_upsert) . " order(s) with batch upsert");
|
||||
|
||||
// 检测订单解析器是否实现了 getOrderItems 方法
|
||||
if( !method_exists($parse, 'formatOrderItemsFromRaw')){
|
||||
throw new Exception('formatOrderItemsFromRaw method must be implemented in ' . $parse::class );
|
||||
}
|
||||
|
||||
//@TODO order type 也需要进一步确定 app/Constants/OrderType.php
|
||||
|
||||
// 检测订单解析器是否实现了 getOrderStatusId 方法
|
||||
// 该方法处理了电商平台订单状态到本地订单状态枚举值 \App\Constants\OrderStatus 的映射
|
||||
if( !method_exists($parse, 'getOrderStatusId')){
|
||||
throw new Exception('getOrderStatusId method must be implemented in ' . $parse::class );
|
||||
}
|
||||
|
||||
// 检测订单解析器是否实现了 getPaymentMethodId 方法
|
||||
// 该方法处理了电商平台订单付款方式的枚举值 \App\Constants\PaymentMethod 的映射
|
||||
if( !method_exists($parse, 'getPaymentMethodId')){
|
||||
throw new Exception('getPaymentMethodId method must be implemented in ' . $parse::class );
|
||||
}
|
||||
|
||||
|
||||
// 收集订单数据
|
||||
$orders_data = $data_to_upsert;
|
||||
$raw_data = $data['data'] ?? [];
|
||||
|
||||
Reference in New Issue
Block a user