支持后台支付配置管理
This commit is contained in:
@@ -16,8 +16,6 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"hfb_sys/backend/internal/config"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -26,10 +24,22 @@ var (
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
cfg config.LeshuaPaymentConfig
|
||||
cfg Config
|
||||
httpClient *http.Client
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
GatewayURL string
|
||||
MerchantID string
|
||||
SignKey string
|
||||
NotifyKey string
|
||||
NotifyURL string
|
||||
JumpURL string
|
||||
PayWay string
|
||||
JSPayFlag string
|
||||
SignType string
|
||||
}
|
||||
|
||||
type CreatePaymentRequest struct {
|
||||
ThirdOrderID string
|
||||
AmountCent int64
|
||||
@@ -131,7 +141,7 @@ type VerifyNotifyResult struct {
|
||||
ParamKeys []string
|
||||
}
|
||||
|
||||
func NewClient(cfg config.LeshuaPaymentConfig) *Client {
|
||||
func NewClient(cfg Config) *Client {
|
||||
return &Client{
|
||||
cfg: cfg,
|
||||
httpClient: &http.Client{
|
||||
@@ -234,11 +244,11 @@ func (c *Client) CreateRefund(ctx context.Context, req CreateRefundRequest) (*Cr
|
||||
return nil, nil, err
|
||||
}
|
||||
params := map[string]string{
|
||||
"service": "unified_refund",
|
||||
"merchant_id": c.cfg.MerchantID,
|
||||
"service": "unified_refund",
|
||||
"merchant_id": c.cfg.MerchantID,
|
||||
"merchant_refund_id": req.MerchantRefundID,
|
||||
"refund_amount": fmt.Sprintf("%d", req.RefundAmountCent),
|
||||
"nonce_str": Nonce(32),
|
||||
"refund_amount": fmt.Sprintf("%d", req.RefundAmountCent),
|
||||
"nonce_str": Nonce(32),
|
||||
}
|
||||
if req.LeshuaOrderID != "" {
|
||||
params["leshua_order_id"] = req.LeshuaOrderID
|
||||
|
||||
Reference in New Issue
Block a user