refactor payment platform canonicalization and order method consistency
Build docker and publish / build (20.15.1) (push) Failing after 8m1s
Build docker and publish / build (20.15.1) (push) Failing after 8m1s
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package order
|
||||
|
||||
import paymentPlatform "github.com/perfect-panel/server/pkg/payment"
|
||||
|
||||
func canonicalOrderMethod(method string) string {
|
||||
platform := paymentPlatform.ParsePlatform(method)
|
||||
if platform == paymentPlatform.UNSUPPORTED {
|
||||
return method
|
||||
}
|
||||
return platform.String()
|
||||
}
|
||||
@@ -224,7 +224,7 @@ func (l *PurchaseLogic) Purchase(req *types.PurchaseOrderRequest) (resp *types.P
|
||||
Coupon: req.Coupon,
|
||||
CouponDiscount: coupon,
|
||||
PaymentId: payment.Id,
|
||||
Method: payment.Platform,
|
||||
Method: canonicalOrderMethod(payment.Platform),
|
||||
FeeAmount: feeAmount,
|
||||
Status: 1,
|
||||
IsNew: isNew,
|
||||
|
||||
@@ -88,7 +88,7 @@ func (l *RechargeLogic) Recharge(req *types.RechargeOrderRequest) (resp *types.R
|
||||
Amount: totalAmount,
|
||||
FeeAmount: feeAmount,
|
||||
PaymentId: payment.Id,
|
||||
Method: payment.Platform,
|
||||
Method: canonicalOrderMethod(payment.Platform),
|
||||
Status: 1,
|
||||
IsNew: isNew,
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ func (l *RenewalLogic) Renewal(req *types.RenewalOrderRequest) (resp *types.Rene
|
||||
Coupon: req.Coupon,
|
||||
CouponDiscount: coupon,
|
||||
PaymentId: payment.Id,
|
||||
Method: payment.Platform,
|
||||
Method: canonicalOrderMethod(payment.Platform),
|
||||
FeeAmount: feeAmount,
|
||||
Status: 1,
|
||||
SubscribeId: userSubscribe.SubscribeId,
|
||||
|
||||
@@ -90,7 +90,7 @@ func (l *ResetTrafficLogic) ResetTraffic(req *types.ResetTrafficOrderRequest) (r
|
||||
GiftAmount: deductionAmount,
|
||||
FeeAmount: feeAmount,
|
||||
PaymentId: payment.Id,
|
||||
Method: payment.Platform,
|
||||
Method: canonicalOrderMethod(payment.Platform),
|
||||
Status: 1,
|
||||
SubscribeId: userSubscribe.SubscribeId,
|
||||
SubscribeToken: userSubscribe.Token,
|
||||
|
||||
Reference in New Issue
Block a user