fix(purchase): correct gift amount deduction logic and enhance payment processing comments

This commit is contained in:
Chang lue Tsen
2025-07-07 14:26:53 -04:00
parent 76816ca8ea
commit 9691257bad
7 changed files with 1206 additions and 141 deletions
@@ -93,7 +93,6 @@ func (l *PurchaseLogic) Purchase(req *types.PortalPurchaseRequest) (resp *types.
}
// Calculate the handling fee
amount -= couponAmount
var deductionAmount int64
// find payment method
paymentConfig, err := l.svcCtx.PaymentModel.FindOne(l.ctx, req.Payment)
if err != nil {
@@ -118,7 +117,7 @@ func (l *PurchaseLogic) Purchase(req *types.PortalPurchaseRequest) (resp *types.
Price: price,
Amount: amount,
Discount: discountAmount,
GiftAmount: deductionAmount,
GiftAmount: 0,
Coupon: req.Coupon,
CouponDiscount: couponAmount,
PaymentId: req.Payment,