fix(order): update commission calculation to actual payment amount minus gateway handling fee

This commit is contained in:
Chang lue Tsen 2025-09-06 11:41:17 -04:00
parent 0872099e98
commit 47446ef410

View File

@ -374,7 +374,8 @@ func (l *ActivateOrderLogic) handleCommission(ctx context.Context, userInfo *use
referralPercentage = uint8(l.svc.Config.Invite.ReferralPercentage)
}
amount := l.calculateCommission(orderInfo.Price, referralPercentage)
// Order commission calculation (Order Amount - Order Fee) * Referral Percentage
amount := l.calculateCommission(orderInfo.Amount-orderInfo.FeeAmount, referralPercentage)
// Use transaction for commission updates
err = l.svc.DB.Transaction(func(tx *gorm.DB) error {