fix(billing): 分次退款累计达到全额应推进为已退款

This commit is contained in:
萝卜
2026-03-11 03:57:14 +00:00
parent e9b559436f
commit bf5f83df6c
2 changed files with 92 additions and 2 deletions

View File

@@ -549,8 +549,10 @@ class PlatformOrderController extends Controller
'last_channel' => (string) (data_get($latestRefund, 'channel') ?? ''),
]);
// 可治理辅助:自动推进退款标记(仅当订单本身已支付,且退款金额>0 时)
if ($order->payment_status === 'paid' && (float) $data['amount'] > 0) {
// 可治理辅助:自动推进退款标记(仅当退款金额>0 时)
// 注意:允许从 paid / partially_refunded 推进到 partially_refunded / refunded
// 且不会把已 refunded 的订单降级。
if ((float) $data['amount'] > 0 && in_array($order->payment_status, ['paid', 'partially_refunded'], true)) {
$paidAmount = (float) ($order->paid_amount ?? 0);
// 退款总额 >= 已付金额 => 视为已退款;否则视为部分退款