优化结构
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user