支持微信支付宝独立支付渠道
This commit is contained in:
@@ -2,15 +2,17 @@ package paymentconfig
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestImportCreateRequestKeepsOnlyOneActiveConfig(t *testing.T) {
|
||||
func TestImportCreateRequestKeepsOneActiveConfigPerPayWay(t *testing.T) {
|
||||
configs := []ConfigDTO{
|
||||
{Provider: "lakala", MerchantID: "M1", Status: "active", IsDefault: true},
|
||||
{Provider: "leshua", MerchantID: "M2", Status: "active", IsDefault: false},
|
||||
{Provider: "lakala", MerchantID: "M1", PayWay: "ZFBZF", Status: "active", IsDefault: true},
|
||||
{Provider: "leshua", MerchantID: "M2", PayWay: "ZFBZF", Status: "active", IsDefault: false},
|
||||
{Provider: "leshua", MerchantID: "M3", PayWay: "WXZF", Status: "active", IsDefault: true},
|
||||
}
|
||||
activeKey := backupActiveKey(configs)
|
||||
activeKeys := backupActiveKeys(configs)
|
||||
|
||||
first := importCreateRequest(configs[0], activeKey)
|
||||
second := importCreateRequest(configs[1], activeKey)
|
||||
first := importCreateRequest(configs[0], activeKeys)
|
||||
second := importCreateRequest(configs[1], activeKeys)
|
||||
third := importCreateRequest(configs[2], activeKeys)
|
||||
|
||||
if first.Status != "active" || !first.IsDefault {
|
||||
t.Fatalf("first config status/default = %s/%v, want active/true", first.Status, first.IsDefault)
|
||||
@@ -18,6 +20,9 @@ func TestImportCreateRequestKeepsOnlyOneActiveConfig(t *testing.T) {
|
||||
if second.Status != "disabled" || second.IsDefault {
|
||||
t.Fatalf("second config status/default = %s/%v, want disabled/false", second.Status, second.IsDefault)
|
||||
}
|
||||
if third.Status != "active" || !third.IsDefault {
|
||||
t.Fatalf("third config status/default = %s/%v, want active/true", third.Status, third.IsDefault)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportCreateRequestPreservesTestingConfig(t *testing.T) {
|
||||
@@ -27,7 +32,7 @@ func TestImportCreateRequestPreservesTestingConfig(t *testing.T) {
|
||||
Status: "testing",
|
||||
}
|
||||
|
||||
req := importCreateRequest(cfg, "")
|
||||
req := importCreateRequest(cfg, nil)
|
||||
|
||||
if req.Status != "testing" || req.IsDefault {
|
||||
t.Fatalf("status/default = %s/%v, want testing/false", req.Status, req.IsDefault)
|
||||
|
||||
Reference in New Issue
Block a user