优化结构
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package payment
|
||||
|
||||
import (
|
||||
"kra/internal/biz/system"
|
||||
bizpayment "kra/internal/biz/payment"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestWechatV2ResponseRequiresBusinessSuccessCode(t *testing.T) {
|
||||
|
||||
func TestPopulateDouyinPaymentAmountUsesSignedFieldPresence(t *testing.T) {
|
||||
amount := &douyin.AmountInfo{Total: 100, PayerTotal: 0, Currency: "CNY", PayerCurrency: "CNY"}
|
||||
result := &system.PaymentResult{}
|
||||
result := &bizpayment.PaymentResult{}
|
||||
if err := populateDouyinPaymentAmount(result, amount, []byte(`{"amount":{"total":100,"payer_total":0,"currency":"CNY","payer_currency":"CNY"}}`)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -36,7 +36,7 @@ func TestPopulateDouyinPaymentAmountUsesSignedFieldPresence(t *testing.T) {
|
||||
t.Fatalf("explicit zero payer_total was not preserved: %+v", result)
|
||||
}
|
||||
|
||||
result = &system.PaymentResult{}
|
||||
result = &bizpayment.PaymentResult{}
|
||||
if err := populateDouyinPaymentAmount(result, amount, []byte(`{"amount":{"total":100,"currency":"CNY"}}`)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func TestPopulateDouyinPaymentAmountUsesSignedFieldPresence(t *testing.T) {
|
||||
t.Fatalf("missing payer_total was treated as authoritative: %+v", result)
|
||||
}
|
||||
|
||||
if err := populateDouyinPaymentAmount(&system.PaymentResult{}, &douyin.AmountInfo{Total: 100, PayerTotal: 101}, []byte(`{"amount":{"total":100,"payer_total":101}}`)); err == nil {
|
||||
if err := populateDouyinPaymentAmount(&bizpayment.PaymentResult{}, &douyin.AmountInfo{Total: 100, PayerTotal: 101}, []byte(`{"amount":{"total":100,"payer_total":101}}`)); err == nil {
|
||||
t.Fatal("accepted payer_total greater than total")
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func TestValidateDouyinMerchantIdentity(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAlipayRefundResultValidatesIdentityAndAmount(t *testing.T) {
|
||||
req := &system.PaymentRefundRequest{
|
||||
req := &bizpayment.PaymentRefundRequest{
|
||||
TradeNo: "T-ALIPAY", ProviderTradeNo: "P-ALIPAY", RefundNo: "R-ALIPAY",
|
||||
Amount: 123, Currency: "CNY",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user