支持后台支付配置管理

This commit is contained in:
yml
2026-06-06 17:49:22 +08:00
parent 13543b3dcb
commit 4d40883da6
29 changed files with 3173 additions and 198 deletions
@@ -3,8 +3,6 @@ package leshua
import (
"strings"
"testing"
"hfb_sys/backend/internal/config"
)
func TestSignUsesASCIISortedNonEmptyParams(t *testing.T) {
@@ -32,7 +30,7 @@ func TestSignUsesASCIISortedNonEmptyParams(t *testing.T) {
}
func TestVerifyNotifyIncludesEmptyAndExcludesErrorCode(t *testing.T) {
client := NewClient(config.LeshuaPaymentConfig{NotifyKey: "notify-secret"})
client := NewClient(Config{NotifyKey: "notify-secret"})
params := map[string]string{
"merchant_id": "1234567890",
"third_order_id": "NO1",
@@ -59,7 +57,7 @@ func TestVerifyNotifyIncludesEmptyAndExcludesErrorCode(t *testing.T) {
}
func TestVerifyNotifyDoesNotFallBackToSignKey(t *testing.T) {
client := NewClient(config.LeshuaPaymentConfig{
client := NewClient(Config{
NotifyKey: "wrong-notify-secret",
SignKey: "sign-secret",
})
@@ -85,7 +83,7 @@ func TestVerifyNotifyDoesNotFallBackToSignKey(t *testing.T) {
}
func TestVerifyNotifyUsesDocumentedNotifySignature(t *testing.T) {
client := NewClient(config.LeshuaPaymentConfig{NotifyKey: "notify-secret"})
client := NewClient(Config{NotifyKey: "notify-secret"})
params := map[string]string{
"merchant_id": "1234567890",
"third_order_id": "NO1",
@@ -109,7 +107,7 @@ func TestVerifyNotifyUsesDocumentedNotifySignature(t *testing.T) {
}
func TestVerifyNotifyKeepsEmptyXMLFieldsInSignature(t *testing.T) {
client := NewClient(config.LeshuaPaymentConfig{NotifyKey: "notify-secret"})
client := NewClient(Config{NotifyKey: "notify-secret"})
params, err := ParsePayload([]byte(`<leshua>
<amount>100</amount>
<goods_tag></goods_tag>
@@ -190,7 +188,7 @@ func TestSignRefundUsesSameAlgorithm(t *testing.T) {
}
func TestVerifyRefundNotify(t *testing.T) {
client := NewClient(config.LeshuaPaymentConfig{NotifyKey: "notify-secret"})
client := NewClient(Config{NotifyKey: "notify-secret"})
params := map[string]string{
"merchant_id": "1234567890",
"third_order_id": "NO1",