接入顺成支付并优化配置列表

This commit is contained in:
yml
2026-06-18 21:33:15 +08:00
parent 40ae14d450
commit 6d385478a6
13 changed files with 1763 additions and 40 deletions
@@ -48,6 +48,28 @@ func TestImportCreateRequestPreservesTestingConfig(t *testing.T) {
}
}
func TestValidateCreateRequestRequiresShunchengSecretID(t *testing.T) {
repo := &Repository{}
req := CreateRequest{
Name: "顺成生产商户",
Provider: "shuncheng",
MerchantID: "0000000038",
GatewayURL: "http://jyzxapi.ydxnhb.com",
SignKey: "secret-key",
NotifyKey: "notify-key",
NotifyURL: "https://example.com/api/payments/shuncheng/notify",
PayWay: "ZFBZF",
}
if err := repo.validateCreateRequest(req); err != ErrSecretIDRequired {
t.Fatalf("validateCreateRequest() error = %v, want ErrSecretIDRequired", err)
}
req.ExtraConfig = map[string]any{"secret_id": "SEC-1"}
if err := repo.validateCreateRequest(req); err != nil {
t.Fatalf("validateCreateRequest() error = %v, want nil", err)
}
}
// TestListUsesSuccessfulPaymentStats 验证配置页只统计成功支付,不把打开二维码或取消订单算作成交。
func TestListUsesSuccessfulPaymentStats(t *testing.T) {
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{Logger: logger.Default.LogMode(logger.Silent)})