优化结构

This commit is contained in:
Yvan
2026-08-28 00:29:40 +08:00
parent 04ff85116c
commit 03a4131f6e
118 changed files with 758 additions and 834 deletions
+9 -7
View File
@@ -1,7 +1,6 @@
package payment
import (
"context"
"fmt"
bizpayment "kra/internal/biz/payment"
"strings"
@@ -9,12 +8,11 @@ import (
// Adapter is the provider boundary used by the payment repository. Provider
// SDK types stay in this package and are normalized to biz/payment results.
type Adapter interface {
Create(context.Context, *bizpayment.PaymentRequest, map[string]any) (*bizpayment.PaymentResult, error)
Query(context.Context, string, map[string]any) (*bizpayment.PaymentResult, error)
Refund(context.Context, *bizpayment.PaymentRefundRequest, map[string]any) (*bizpayment.PaymentResult, error)
Callback(context.Context, *bizpayment.PaymentCallback, map[string]any) (*bizpayment.PaymentResult, error)
}
type Adapter = bizpayment.PaymentAdapter
type Factory struct{}
func NewFactory() *Factory { return &Factory{} }
type adapterFactory func() Adapter
@@ -51,3 +49,7 @@ func New(provider string) (Adapter, error) {
}
return factory(), nil
}
func (*Factory) New(provider string) (bizpayment.PaymentAdapter, error) {
return New(provider)
}