修复代管订单押金赔付待打款金额

This commit is contained in:
yml2213
2026-08-30 20:37:41 +08:00
parent 98f6ee9451
commit 2337395d8f
11 changed files with 238 additions and 111 deletions
+10 -1
View File
@@ -278,7 +278,16 @@ func buildCheckout(order model.RentalOrder, initiatedBy uint64, status string, c
}
func buildCheckoutSettlement(order model.RentalOrder, checkout *model.OrderCheckout) checkoutSettlement {
return calculateCheckoutSettlement(order, checkout.ConsumableAmountCent, checkout.CoinConsumedM, checkout.DepositDeductAmountCent)
return calculateCheckoutSettlement(order, checkout.ConsumableAmountCent, checkout.CoinConsumedM, effectiveCheckoutDepositDeductCent(*checkout))
}
// effectiveCheckoutDepositDeductCent keeps legacy checkouts that only populated
// other_amount_cent from losing their deposit compensation at finalization.
func effectiveCheckoutDepositDeductCent(checkout model.OrderCheckout) int64 {
if checkout.DepositDeductAmountCent > 0 {
return checkout.DepositDeductAmountCent
}
return maxCent(checkout.OtherAmountCent, 0)
}
func calculateCheckoutSettlement(order model.RentalOrder, consumableAmountCent int64, coinConsumedM float64, depositDeductAmountCent int64) checkoutSettlement {