- Fix inconsistent logging calls across all order logic files - Fix critical gift amount deduction logic bug in renewal process - Fix variable shadowing errors in database transactions - Add comprehensive Go-standard documentation comments - Improve log prefix consistency for better debugging - Remove redundant discount validation code
16 lines
395 B
Go
16 lines
395 B
Go
package order
|
|
|
|
import "github.com/perfect-panel/server/internal/types"
|
|
|
|
func getDiscount(discounts []types.SubscribeDiscount, inputMonths int64) float64 {
|
|
var finalDiscount int64 = 100
|
|
|
|
for _, discount := range discounts {
|
|
if inputMonths >= discount.Quantity && discount.Discount < finalDiscount {
|
|
finalDiscount = discount.Discount
|
|
}
|
|
}
|
|
|
|
return float64(finalDiscount) / float64(100)
|
|
}
|