feat(payment): 接入扫呗普通支付2.0
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package paymentconfig
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestValidateCreateRequestSaobeiRequiresTerminalID(t *testing.T) {
|
||||
repo := &Repository{}
|
||||
req := CreateRequest{
|
||||
Name: "扫呗测试",
|
||||
Provider: "saobei",
|
||||
MerchantID: "839305812000286",
|
||||
GatewayURL: "https://pay.example",
|
||||
SignKey: "access-token",
|
||||
NotifyURL: "https://example.com/api/payments/saobei/notify",
|
||||
ExtraConfig: map[string]any{
|
||||
"terminal_id": "",
|
||||
},
|
||||
}
|
||||
if err := repo.validateCreateRequest(req); !errors.Is(err, ErrTerminalIDRequired) {
|
||||
t.Fatalf("validateCreateRequest() error = %v, want %v", err, ErrTerminalIDRequired)
|
||||
}
|
||||
req.ExtraConfig["terminal_id"] = "30616969"
|
||||
if err := repo.validateCreateRequest(req); err != nil {
|
||||
t.Fatalf("validateCreateRequest() error = %v, want nil", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user