feat(payment): 支付插件 - 合并 PR #546 易支付适配

Merge pull request #546 from qiuliw. Preserve the original author and current main behavior.
This commit is contained in:
qiuliw
2026-09-20 04:56:42 +08:00
committed by ddCat
21 changed files with 995 additions and 2 deletions

View File

@@ -9,10 +9,12 @@ const (
PaymentPluginAlipayPage = "official-payment-alipay-page"
PaymentPluginXunHuPay = "official-payment-xunhupay"
PaymentPluginZhiFuFM = "official-payment-zhifufm"
PaymentPluginEpay = "official-payment-epay"
PaymentProviderWeChat = "wechat-native"
PaymentProviderAlipay = "alipay-page-pay"
PaymentProviderXunHuPay = "xunhupay-aggregate"
PaymentProviderZhiFuFM = "zhifufm-pay"
PaymentProviderEpay = "epay"
)
func bundledPaymentPluginManifests() []protocol.Manifest {

View File

@@ -186,3 +186,38 @@ func TestZhiFuFMOfficialPackageIsPaymentPlugin(t *testing.T) {
t.Fatalf("zhifufm provider type = %T", provider)
}
}
func TestEpayOfficialPackageIsPaymentPlugin(t *testing.T) {
center, err := newPluginRuntime(t.TempDir())
if err != nil {
t.Fatal(err)
}
var plugin PluginView
for _, item := range center.list() {
if item.Manifest.ID == "official-payment-epay" {
plugin = item
plugin.Management = pluginManagementFromView(item)
break
}
}
if plugin.Manifest.ID == "" {
t.Fatal("official-payment-epay is missing")
}
if plugin.Management.Kind != PluginKindPayment || plugin.Source != PluginOriginOfficial {
t.Fatalf("epay plugin = %#v", plugin)
}
if len(plugin.Manifest.Contributes.PaymentProviders) != 1 || plugin.Manifest.Contributes.PaymentProviders[0].ID != "epay" {
t.Fatalf("epay contributions = %#v", plugin.Manifest.Contributes.PaymentProviders)
}
registry := center.paymentRegistrySnapshot()
if registry == nil {
t.Fatal("payment registry is nil")
}
provider, ok := registry.Get("epay")
if !ok {
t.Fatal("epay provider is missing")
}
if _, ok := provider.(*payment.RPCProvider); !ok {
t.Fatalf("epay provider type = %T", provider)
}
}

View File

@@ -17,6 +17,7 @@ var officialPaymentPackageIDs = []string{
"official-payment-alipay-page",
"official-payment-xunhupay",
"official-payment-zhifufm",
"official-payment-epay",
}
var officialPaymentTaggedArtifacts = []string{