优化结构
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"kra/internal/biz/system"
|
||||
bizpayment "kra/internal/biz/payment"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
@@ -51,8 +51,8 @@ func TestWechatV3CodePayUsesGoPaySDK(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
result, err := (&wechatV3Adapter{}).Create(context.Background(), &system.PaymentRequest{
|
||||
Provider: system.PaymentWechatV3,
|
||||
result, err := (&wechatV3Adapter{}).Create(context.Background(), &bizpayment.PaymentRequest{
|
||||
Provider: bizpayment.PaymentWechatV3,
|
||||
TradeNo: "T-WECHAT-CODEPAY",
|
||||
Subject: "subject",
|
||||
Amount: 123,
|
||||
@@ -85,7 +85,7 @@ func TestWechatV3CodePayUsesGoPaySDK(t *testing.T) {
|
||||
if amount["total"] != float64(123) || amount["currency"] != "CNY" {
|
||||
t.Fatalf("request amount = %#v", amount)
|
||||
}
|
||||
if result.Provider != system.PaymentWechatV3 || result.Status != "success" || result.TradeNo != "T-WECHAT-CODEPAY" || result.ProviderTradeNo != "WX-CODEPAY-1" || result.QueryID != "" {
|
||||
if result.Provider != bizpayment.PaymentWechatV3 || result.Status != "success" || result.TradeNo != "T-WECHAT-CODEPAY" || result.ProviderTradeNo != "WX-CODEPAY-1" || result.QueryID != "" {
|
||||
t.Fatalf("result identity = %+v", result)
|
||||
}
|
||||
if result.Amount != 123 || result.Currency != "CNY" || result.PayerCurrency != "CNY" || !result.AmountBreakdownKnown || result.PayerPaidAmount != 100 || result.CashPaidAmount != 100 || result.DiscountAmount != 23 {
|
||||
@@ -108,7 +108,7 @@ func TestWechatV3CodePayAliasesRequireAuthCode(t *testing.T) {
|
||||
|
||||
for _, method := range []string{"micropay", "micro_pay", "micro-pay", "codepay", "code_pay", "code-pay", "barcode", "barcode_pay", "facepay", "face_pay"} {
|
||||
t.Run(method, func(t *testing.T) {
|
||||
_, err := (&wechatV3Adapter{}).Create(context.Background(), &system.PaymentRequest{
|
||||
_, err := (&wechatV3Adapter{}).Create(context.Background(), &bizpayment.PaymentRequest{
|
||||
TradeNo: "T-WECHAT-CODEPAY", Subject: "subject", Amount: 1, Currency: "CNY",
|
||||
Extra: map[string]any{"method": method},
|
||||
}, config)
|
||||
|
||||
Reference in New Issue
Block a user